even even more progress

This commit is contained in:
Spottedleaf 2021-06-11 23:02:49 -07:00 committed by MiniDigger | Martin
parent 8599f95b4f
commit 42458fbca4
15 changed files with 88 additions and 99 deletions

View File

@ -7,6 +7,9 @@ Vanilla will double add Spider Jockeys to the world, so ignore already added.
Also add debug if something else tries to, and abort before world gets bad state
In 1.17 the entire entity state manager was rewritten. no longer applies, needs
further information on new state manager
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0a613f94d1c796267636e1a343aeee65a49ffed5..335928d60dbfc07644ffeab366900c5e77e99d56 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java

View File

@ -7,6 +7,8 @@ World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is tr
Keep them consistent
No longer relevant in 1.17
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 335928d60dbfc07644ffeab366900c5e77e99d56..20650bfd10abfa010e71cfeede06c461d50d19a3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Remove invalid mob spawner tile entities
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 485cb87e83dd4b4b052905fb7f5f83d3c26f542f..ee2df7de72c75e4fbf8a681ff254260554969b66 100644
index 485cb87e83dd4b4b052905fb7f5f83d3c26f542f..89d280ec732b2d023f9c7ba06b1c3e5be3ef86f5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -46,10 +46,12 @@ import net.minecraft.world.level.TickList;
@ -27,7 +27,7 @@ index 485cb87e83dd4b4b052905fb7f5f83d3c26f542f..ee2df7de72c75e4fbf8a681ff2542605
// CraftBukkit start
+ // Paper start - Remove invalid mob spawner tile entities
+ } else if (blockEntity instanceof SpawnerBlockEntity && !(getBlockState(blockposition).getBlock() instanceof SpawnerBlock)) {
+ this.blockEntities.remove(blockposition);
+ this.removeBlockEntity(blockEntity.getBlockPos());
+ // Paper end
} else {
System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()

View File

@ -155,7 +155,7 @@ index b4a7776ba9486bbca42ffb596c8a8bcdf6471ce3..59fae60116167baf989e85596334824e
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index a6e8a8de17acc6c7c0bdeea01544a334797b69b6..9939c4c39549771afe971a6433dfd57e36050dd8 100644
index cbc2a9a3e9943c20cae645fbb18f0aa29415bd63..b36a893ded952d1a5ed1a55eae9c3c406848e1f3 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1,6 +1,7 @@
@ -167,7 +167,7 @@ index a6e8a8de17acc6c7c0bdeea01544a334797b69b6..9939c4c39549771afe971a6433dfd57e
import com.google.common.collect.Sets;
import com.google.common.collect.UnmodifiableIterator;
@@ -615,10 +616,15 @@ public class LevelChunk implements ChunkAccess {
this.blockEntities.remove(blockposition);
this.removeBlockEntity(blockEntity.getBlockPos());
// Paper end
} else {
- System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()

View File

@ -9,10 +9,10 @@ Subject: [PATCH] Fix Old Sign Conversion
This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 13115d1b28dfa2d87b45a50bd0feaa7f57769122..d08ed44884726ca2ba4578226b8aa6244778f4c7 100644
index d6a4a2a59f1be0cc2e373dc326287b60db5559d2..9d777fce673c8f6b3ee2d69f5a6360a8a5ad8e84 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -34,6 +34,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
@@ -30,6 +30,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
public CraftPersistentDataContainer persistentDataContainer;
// CraftBukkit end
private static final Logger LOGGER = LogManager.getLogger();
@ -21,38 +21,28 @@ index 13115d1b28dfa2d87b45a50bd0feaa7f57769122..d08ed44884726ca2ba4578226b8aa624
@Nullable
protected Level level;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index e747f729326fb3bacfb3f983ac7701c0fb0f0e6a..e4eab82855649fec654c60b2e94ba7b71c2ac5a2 100644
index dbb59775422b80fb4b60a8cfd2c0bd81c1646e88..589fbdd5c86655244aa92a42e5f45747b5c5026e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -78,13 +78,14 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@@ -95,7 +95,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
s = "\"\"";
}
try {
- MutableComponent ichatmutablecomponent = Component.Serializer.fromJson(s.isEmpty() ? "\"\"" : s);
+ //IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - move down - the old format might throw a json error
- if (oldSign) {
+ if (oldSign && !isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted
messages[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
continue;
}
// CraftBukkit end
+ MutableComponent ichatmutablecomponent = Component.Serializer.fromJson(s.isEmpty() ? "\"\"" : s); // Paper - after old sign
if (this.level instanceof ServerLevel) {
try {
- if (oldSign) {
+ if (oldSign && !this.isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted
this.messages[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
continue;
}
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
index 8da00ee410e3f8f09b8ac273095a3d22d6c4d92b..d4cf5d3bdbe629081f6ec9d4ea94004560c93ebc 100644
index e396c3aede9ca22ec98e1bd25c7da35ed6406f4f..80d3787d9c07f8dd740c2e5979e1cc14891b8829 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
@@ -278,9 +278,11 @@ public class StructureTemplate {
@@ -283,7 +283,9 @@ public class StructureTemplate {
definedstructure_blockinfo.nbt.putLong("LootTableSeed", random.nextLong());
}
+ tileentity.isLoadingStructure = true; // Paper
tileentity.load(definedstructure_blockinfo.state, definedstructure_blockinfo.nbt);
tileentity.mirror(placementData.getMirror());
tileentity.rotate(placementData.getRotation());
tileentity.load(definedstructure_blockinfo.nbt);
+ tileentity.isLoadingStructure = false; // Paper
}
}

View File

@ -5,15 +5,15 @@ Subject: [PATCH] Don't lookup game profiles that have no UUID and no name
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 9342fa6b28e805743b8e3a13007605934244d6cd..f3e05fac1b5248ca4ee2cac03263e96c166ed343 100644
index 95682f63c7ae1460b069e13f11295f72c1f262a8..b2bd204879badfe1cab6bea9db2d6c412505a9ce 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -92,7 +92,7 @@ public class GameProfileCache {
@@ -100,7 +100,7 @@ public class GameProfileCache {
repository.findProfilesByNames(new String[]{name}, Agent.MINECRAFT, profilelookupcallback);
GameProfile gameprofile = (GameProfile) atomicreference.get();
- if (!usesAuthentication() && gameprofile == null) {
+ if (!usesAuthentication() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(name)) { // Paper - Don't lookup a profile with a blank name
- if (!GameProfileCache.usesAuthentication() && gameprofile == null) {
+ if (!GameProfileCache.usesAuthentication() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(name)) { // Paper - Don't lookup a profile with a blank name
UUID uuid = Player.createPlayerUUID(new GameProfile((UUID) null, name));
gameprofile = new GameProfile(uuid, name);

View File

@ -32,10 +32,10 @@ index 1b8e5671c9dc8c15ce33d351c1bb20f28919b9a2..c52dc0346f93527965ef29a0ccdc4bf3
+ }
}
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index f3e05fac1b5248ca4ee2cac03263e96c166ed343..e8af352f813a5015d216fc590190ae8fdb03f77d 100644
index b2bd204879badfe1cab6bea9db2d6c412505a9ce..73dbc4db56bbafefd07ad550d006a437b1ed1b95 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -89,6 +89,7 @@ public class GameProfileCache {
@@ -97,6 +97,7 @@ public class GameProfileCache {
}
};
@ -43,7 +43,7 @@ index f3e05fac1b5248ca4ee2cac03263e96c166ed343..e8af352f813a5015d216fc590190ae8f
repository.findProfilesByNames(new String[]{name}, Agent.MINECRAFT, profilelookupcallback);
GameProfile gameprofile = (GameProfile) atomicreference.get();
@@ -106,7 +107,7 @@ public class GameProfileCache {
@@ -114,7 +115,7 @@ public class GameProfileCache {
}
private static boolean usesAuthentication() {
@ -51,12 +51,12 @@ index f3e05fac1b5248ca4ee2cac03263e96c166ed343..e8af352f813a5015d216fc590190ae8f
+ return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper
}
public synchronized void add(GameProfile gameprofile) { // Paper - synchronize
public synchronized void add(GameProfile profile) { // Paper - synchronize
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
index 09c5fa2dbcbed05da51ef2d63e6d6112d22d7877..e6a26c274616947329a6164e4648486452819b0c 100644
index da515ac94aa3c294855f28e6deb9094cc7187dd9..b61a3217c70f3f5c4c06131b3c4978534d7d935a 100644
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
@@ -63,7 +63,8 @@ public class OldUsersConverter {
@@ -65,7 +65,8 @@ public class OldUsersConverter {
return new String[i];
});
@ -67,16 +67,15 @@ index 09c5fa2dbcbed05da51ef2d63e6d6112d22d7877..e6a26c274616947329a6164e46484864
} else {
String[] astring1 = astring;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2828936fe294d9d6750a8838da49ec8398835214..bbe0978f56d23b7defce765d381d4a7c20acd75c 100644
index 95689d11668e37a894b70517270849c2c4e162aa..91002473f54fd0ac95489b9448fe91072565881d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1515,7 +1515,8 @@ public final class CraftServer implements Server {
@@ -1515,7 +1515,7 @@ public final class CraftServer implements Server {
// Spigot Start
GameProfile profile = null;
// Only fetch an online UUID in online mode
- if ( getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
+ if ( getOnlineMode()
+ || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() ) // Paper - Handle via setting
- if ( this.getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
+ if ( this.getOnlineMode() || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() ) // Paper - Handle via setting
{
profile = console.getProfileCache().get( name );
profile = this.console.getProfileCache().getProfile( name );
}

View File

@ -9,7 +9,7 @@ object identity checks safely.
Use a simpler optimized hashcode
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java
index c5af36a0279d1e1c951e6f9b34857b0aa934f940..62f11a02e3f5c07e838f425cffb0a28b6d2bc138 100644
index 6cdb0716f2a4b29f7a5ecd109bf3c4700ebd22ad..ff1a0d125edd2ea10c870cbb62ae9aa23644b6dc 100644
--- a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java
@@ -30,8 +30,7 @@ public class BooleanProperty extends Property<Boolean> {
@ -23,11 +23,11 @@ index c5af36a0279d1e1c951e6f9b34857b0aa934f940..62f11a02e3f5c07e838f425cffb0a28b
return true;
} else if (object instanceof BooleanProperty && super.equals(object)) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
index b5817645727f2af2785e0987ba824f431d4e9e32..2fdfd7d2470ee9f1a96eda7418b104c960df8460 100644
index e76591dec764d92e1a760c5208714f3c80ea8fc7..bcf8b24e9f9e9870c1a1d27c721a6a433305d55a 100644
--- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
@@ -50,8 +50,7 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope
return ((StringRepresentable) value).getSerializedName();
@@ -48,8 +48,7 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope
return value.getSerializedName();
}
- @Override
@ -51,34 +51,22 @@ index c3ec7f91794d802e5b9ddac3fffccce378dace68..72f508321ebffcca31240fbdd068b4d1
return true;
} else if (object instanceof IntegerProperty && super.equals(object)) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
index 8cc07c70fde81e44679f3ea7d9a4c6b2447885d4..80f8966ac56e8af4a6c7aa86b2d8dd0f319c7b5d 100644
index 0dc91cfaef2bc6004270c380e673da1728287433..81b43e0b0146729a8a1c6ade82634c86cde67857 100644
--- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
@@ -60,23 +60,17 @@ public abstract class Property<T extends Comparable<T>> {
}
@@ -66,14 +66,7 @@ public abstract class Property<T extends Comparable<T>> {
@Override
public boolean equals(Object object) {
- if (this == object) {
- return true;
- } else if (!(object instanceof Property)) {
- return false;
- } else {
- Property<?> iblockstate = (Property) object;
-
- return this.clazz.equals(iblockstate.clazz) && this.name.equals(iblockstate.name);
- Property<?> property = (Property)object;
- return this.clazz.equals(property.clazz) && this.name.equals(property.name);
- }
+ return this == object; // Paper - only one instance per configuration
+ return this == object;
}
+ private static final java.util.concurrent.atomic.AtomicInteger hashId = new java.util.concurrent.atomic.AtomicInteger(1); // Paper - only one instance per configuration
+ private final int hashCode = 92821 * hashId.getAndIncrement(); // Paper - only one instance per configuration
public final int hashCode() {
if (this.hashCode == null) {
this.hashCode = this.generateHashCode();
}
- return this.hashCode;
+ return this.hashCode; // Paper - only one instance per configuration
}
public int generateHashCode() {
@Override

View File

@ -23,23 +23,23 @@ index c52dc0346f93527965ef29a0ccdc4bf3debe302e..64d7c9058ee757a6d3cf3b648596092a
+ }
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e2bfe8e916c9e59af81627ea0ee449970527034d..d6f4ccf06c919410e13409433bdfc3aa88a21c30 100644
index 6cd0fd57503723a58b30a7c33b1c863afc2401e2..37a25af3697e06a7f8aeaf462fbf50f8bc250dd3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1463,13 +1463,14 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -1495,13 +1495,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Spigot start - limit place/interactions
private int limitedPackets;
private long lastLimitedPacket = -1;
+ private static final int THRESHOLD = com.destroystokyo.paper.PaperConfig.packetInSpamThreshold; // Paper - Configurable threshold
private boolean checkLimit(long timestamp) {
- if (lastLimitedPacket != -1 && timestamp - lastLimitedPacket < 30 && limitedPackets++ >= 4) {
+ if (lastLimitedPacket != -1 && timestamp - lastLimitedPacket < THRESHOLD && limitedPackets++ >= 8) { // Paper - Use threshold, raise packet limit to 8
- if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < 30 && this.limitedPackets++ >= 4) {
+ if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < THRESHOLD && this.limitedPackets++ >= 8) { // Paper - Use threshold, raise packet limit to 8
return false;
}
- if (lastLimitedPacket == -1 || timestamp - lastLimitedPacket >= 30) {
+ if (lastLimitedPacket == -1 || timestamp - lastLimitedPacket >= THRESHOLD) { // Paper
lastLimitedPacket = timestamp;
limitedPackets = 0;
- if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= 30) {
+ if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= THRESHOLD) { // Paper
this.lastLimitedPacket = timestamp;
this.limitedPackets = 0;
return true;

View File

@ -21,10 +21,10 @@ index 64d7c9058ee757a6d3cf3b648596092a810e105c..4e2f243faa209925dcb7c3ef89df3ed8
+ }
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d6f4ccf06c919410e13409433bdfc3aa88a21c30..1b92c669bbe69bcc07a554b7b43ee99bfebc1af4 100644
index 37a25af3697e06a7f8aeaf462fbf50f8bc250dd3..b33ef48a4372dd8ac4a86bdd386a5a7d42583c72 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -305,7 +305,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -302,7 +302,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientIsFloating && !this.player.isSleeping()) {
if (++this.aboveGroundTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
@ -33,7 +33,7 @@ index d6f4ccf06c919410e13409433bdfc3aa88a21c30..1b92c669bbe69bcc07a554b7b43ee99b
return;
}
} else {
@@ -324,7 +324,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -321,7 +321,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());

View File

@ -3,14 +3,15 @@ From: Aikar <aikar@aikar.co>
Date: Thu, 16 Jun 2016 00:17:23 -0400
Subject: [PATCH] Remove FishingHook reference on Craft Entity removal
TODO 1.17 isn't this supposed to be applied to when the fish hook is removed _in general_? Not just in Bukkit api calls?
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
index 5668facc5bf5c56581c3ebd268f832d77ce5c05b..50322cfc07a7d93c32461faeb5e22e35ceead323 100644
index 6bfa984781a483d048ef4318761203c701d8a632..3c18712040da8d6ece24fd817b7846836b8353c1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
@@ -119,4 +119,14 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
public HookState getState() {
return HookState.values()[getHandle().currentState.ordinal()];
return HookState.values()[this.getHandle().currentState.ordinal()];
}
+
+ // Paper start

View File

@ -6,14 +6,14 @@ Subject: [PATCH] Auto fix bad Y levels on player login
Bring down to a saner Y level if super high, as this can cause the server to crash
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index bd3d9182dfb2c0ae1d8c3b9aa360f94c33252592..3a2356b3e00098d100a179a05316f402390d4e9b 100644
index f48d7205242fc38c00e496c88090e0e98e394b39..c60d42c835ed9a1bcc938aa1647c5266b87a05c5 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -337,6 +337,7 @@ public class ServerPlayer extends Player implements ContainerListener {
@@ -401,6 +401,7 @@ public class ServerPlayer extends Player {
@Override
public void readAdditionalSaveData(CompoundTag tag) {
super.readAdditionalSaveData(tag);
public void readAdditionalSaveData(CompoundTag nbt) {
super.readAdditionalSaveData(nbt);
+ if (this.getY() > 300) this.setPosRaw(getX(), 257, getZ()); // Paper - bring down to a saner Y level if out of world
if (tag.contains("playerGameType", 99)) {
if (this.getServer().getForceGameType()) {
this.gameMode.setGameModeForPlayer(this.getServer().getDefaultGameType(), GameType.NOT_SET);
if (nbt.contains("enteredNetherPosition", 10)) {
CompoundTag nbttagcompound1 = nbt.getCompound("enteredNetherPosition");

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Option to remove corrupt tile entities
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6eca3f300020006f02dd36253b522db442e3cc33..622affa0dc3cc1eadaed400511f2ca2cde3fca2a 100644
index 9b2e9a02ff31c3cb37b67135d0a03441f247d8e2..96247356d7888d5681bff60567add1188aedb18b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -300,4 +300,9 @@ public class PaperWorldConfig {
@@ -301,4 +301,9 @@ public class PaperWorldConfig {
preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
}
@ -19,15 +19,15 @@ index 6eca3f300020006f02dd36253b522db442e3cc33..622affa0dc3cc1eadaed400511f2ca2c
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 70f5b025c2b803df3de8a51cbcfafbe915866f42..d69ccb1f31f31ebeee477df20ce1410f9e485eb7 100644
index eed2ef73c33b76222de0f4fd91525cc03eef19b0..521f199e495f3bec232cc9ca36e51e0392afe737 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -678,6 +678,12 @@ public class LevelChunk implements ChunkAccess {
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
@@ -640,6 +640,12 @@ public class LevelChunk implements ChunkAccess {
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
e.printStackTrace();
ServerInternalException.reportInternalException(e);
+
+ if (this.world.paperConfig.removeCorruptTEs) {
+ if (this.level.paperConfig.removeCorruptTEs) {
+ this.removeBlockEntity(blockEntity.getBlockPos());
+ this.markUnsaved();
+ org.bukkit.Bukkit.getLogger().info("Removing corrupt tile entity");

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityZapEvent
diff --git a/src/main/java/net/minecraft/world/entity/animal/Pig.java b/src/main/java/net/minecraft/world/entity/animal/Pig.java
index 6ecf7afe5fd7c4c95a17eaed1445d034aa2d5f18..e512a38ccbba93266f0234e3b2fcf7f62693039b 100644
index d414b111386e18dec8992b510b93c19ece8d60dd..2c95b6eddfe46e5d2ad495bfc86ccc24ae75e704 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Pig.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Pig.java
@@ -254,6 +254,11 @@ public class Pig extends Animal implements ItemSteerable, Saddleable {
@ -21,11 +21,15 @@ index 6ecf7afe5fd7c4c95a17eaed1445d034aa2d5f18..e512a38ccbba93266f0234e3b2fcf7f6
if (CraftEventFactory.callPigZapEvent(this, lightning, entitypigzombie).isCancelled()) {
return;
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 2f99bdaabe1c1a6a4e1a7e2bd533a63b12818be1..5648a4a4d8511ac8c46c61245a7ff83753a3e51f 100644
index df8c953fffcc6063abd1929b8d3a07943da86e21..731aea63eedb8cb37291bb2238ff8ab2e3a5f6eb 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -786,6 +786,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning);
@@ -826,9 +826,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@Override
public void thunderHit(ServerLevel world, LightningBolt lightning) {
if (world.getDifficulty() != Difficulty.PEACEFUL) {
- Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning);
+ // Paper - move log down, event can cancel
Witch entitywitch = (Witch) EntityType.WITCH.create((Level) world);
+ // Paper start
@ -34,14 +38,16 @@ index 2f99bdaabe1c1a6a4e1a7e2bd533a63b12818be1..5648a4a4d8511ac8c46c61245a7ff837
+ }
+ // Paper end
+
entitywitch.moveTo(this.getX(), this.getY(), this.getZ(), this.yRot, this.xRot);
+ Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); // Paper - move log down, event can cancel
+
entitywitch.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null, (CompoundTag) null);
entitywitch.setNoAi(this.isNoAi());
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 7fde1bb7587e567270e3f936381c6d361870211f..81af3e2e0964b6e179f92a342efdae943be18b75 100644
index fdb97878a6e73b729dbf09292d214e42c57d720a..cb3f1f71cc5c5a18c0af818679b72583a7edec7c 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1086,6 +1086,14 @@ public class CraftEventFactory {
@@ -1082,6 +1082,14 @@ public class CraftEventFactory {
return event;
}