even more work

This commit is contained in:
Spottedleaf 2020-06-25 05:04:34 -07:00
parent 8269101af0
commit 2bf5db6cc9
34 changed files with 349 additions and 368 deletions

View file

@ -8,40 +8,8 @@ object identity checks safely.
Use a simpler optimized hashcode
diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java/net/minecraft/server/IBlockState.java
index 0ce77d9230f3d1c53df7c5b72a380a2fa0c6d882..00e67b567f00824b25b45e5ff5ecd62c87ea0309 100644
--- a/src/main/java/net/minecraft/server/IBlockState.java
+++ b/src/main/java/net/minecraft/server/IBlockState.java
@@ -28,23 +28,13 @@ public abstract class IBlockState<T extends Comparable<T>>
}
public boolean equals(Object object) {
- if (this == object) {
- return true;
- } else if (!(object instanceof IBlockState)) {
- return false;
- } else {
- IBlockState<?> blockstate = (IBlockState) object;
-
- return this.a.equals(blockstate.a) && this.b.equals(blockstate.b);
- }
+ return this == object; // Paper - only one instance per configuration
}
+ 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.c == null) {
- this.c = this.c();
- }
-
- return this.c;
+ return this.hashCode; // Paper - only one instance per configuration
}
public int c() {
diff --git a/src/main/java/net/minecraft/server/BlockStateBoolean.java b/src/main/java/net/minecraft/server/BlockStateBoolean.java
index d8738447d794f6967307daa1271473903b76a632..7ca302b522df081755120c597a08d589193c57a6 100644
index 8df150f4cabb3dd98cb66c9d1af7fae035a6a6fe..4ca8db630434915de4eaeac6c4ecd60714d7f5d9 100644
--- a/src/main/java/net/minecraft/server/BlockStateBoolean.java
+++ b/src/main/java/net/minecraft/server/BlockStateBoolean.java
@@ -30,8 +30,7 @@ public class BlockStateBoolean extends IBlockState<Boolean> {
@ -55,7 +23,7 @@ index d8738447d794f6967307daa1271473903b76a632..7ca302b522df081755120c597a08d589
return true;
} else if (object instanceof BlockStateBoolean && super.equals(object)) {
diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java
index 1486d460c8ec3d117b4dc3d28b2c3f1b632e187b..7cdadc6b6abd069f9a1bc000a8f116f73b90e029 100644
index 8162c11d14b8e88c2b572f9ddf6b7a15977047f8..8dc620b22bb904aa6a82e2127aa9da861986525c 100644
--- a/src/main/java/net/minecraft/server/BlockStateEnum.java
+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java
@@ -49,8 +49,7 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends IBlockState<T>
@ -69,7 +37,7 @@ index 1486d460c8ec3d117b4dc3d28b2c3f1b632e187b..7cdadc6b6abd069f9a1bc000a8f116f7
return true;
} else if (object instanceof BlockStateEnum && super.equals(object)) {
diff --git a/src/main/java/net/minecraft/server/BlockStateInteger.java b/src/main/java/net/minecraft/server/BlockStateInteger.java
index 6f35c365f9086a2289e17b4d8e73757ad2c7f87b..0499a71705f3bdac6c94a8dc340cc15e96d9586e 100644
index 5bd7a236b948666ca31e53cb3a8aa0dc147e274b..36b84446e96faefad3b783f73df74e0f3bce8255 100644
--- a/src/main/java/net/minecraft/server/BlockStateInteger.java
+++ b/src/main/java/net/minecraft/server/BlockStateInteger.java
@@ -38,8 +38,7 @@ public class BlockStateInteger extends IBlockState<Integer> {
@ -82,3 +50,44 @@ index 6f35c365f9086a2289e17b4d8e73757ad2c7f87b..0499a71705f3bdac6c94a8dc340cc15e
if (this == object) {
return true;
} else if (object instanceof BlockStateInteger && super.equals(object)) {
diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java/net/minecraft/server/IBlockState.java
index 88f1f201240ef0479c4f0f93f4caca454bbe7e9e..4eea3a4fca4cea96109e54473335fd3660e2f6d6 100644
--- a/src/main/java/net/minecraft/server/IBlockState.java
+++ b/src/main/java/net/minecraft/server/IBlockState.java
@@ -21,7 +21,7 @@ public abstract class IBlockState<T extends Comparable<T>> {
return DataResult.error("Unable to read property: " + this + " with value: " + s1);
});
}, this::a);
- this.e = this.d.xmap(this::b, IBlockState.a::b);
+ this.e = this.d.xmap(this::b, (IBlockState.a<T> param) -> { return param.b(); }); // Paper - decompile fix
this.a = oclass;
this.b = s;
}
@@ -61,23 +61,17 @@ public abstract class IBlockState<T extends Comparable<T>> {
}
public boolean equals(Object object) {
- if (this == object) {
- return true;
- } else if (!(object instanceof IBlockState)) {
- return false;
- } else {
- IBlockState<?> iblockstate = (IBlockState) object;
-
- return this.a.equals(iblockstate.a) && this.b.equals(iblockstate.b);
- }
+ return this == object; // Paper - only one instance per configuration
}
+ 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.c == null) {
this.c = this.b();
}
- return this.c;
+ return this.hashCode; // Paper - only one instance per configuration
}
public int b() {

View file

@ -23,10 +23,10 @@ index 53f96a1576582fce83999a1f7e9a2624506ed51f..010b17d2e7a27ace6ff8b15edff577c4
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index c00ada6c10529fd50b0d7fbb1763b6e09287a1fc..6a6739bba0ad9a5fadac7a49e698c2435200c1fc 100644
index 6fe5f581934647b6f3a51dd63080e720a574de4d..98bd46adf77a7f9c3cf82d85ce1646fc75066a08 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1204,13 +1204,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1240,13 +1240,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
// Spigot start - limit place/interactions
private int limitedPackets;
private long lastLimitedPacket = -1;

View file

@ -21,14 +21,14 @@ index 010b17d2e7a27ace6ff8b15edff577c4164d2e81..5a83fc21cb6801d597a01fb4a83d3048
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 6a6739bba0ad9a5fadac7a49e698c2435200c1fc..7ed21a99e9025837bc5c38efa542df85dc2eb248 100644
index 98bd46adf77a7f9c3cf82d85ce1646fc75066a08..4c59b6beb0db3fd9d42e2f53519c40f211ef8bfb 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -147,7 +147,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
if (this.B) {
if (this.B && !this.player.isSleeping()) {
if (++this.C > 80) {
PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getDisplayName().getString());
- this.disconnect(new ChatMessage("multiplayer.disconnect.flying", new Object[0]));
- this.disconnect(new ChatMessage("multiplayer.disconnect.flying"));
+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message
return;
}
@ -37,7 +37,7 @@ index 6a6739bba0ad9a5fadac7a49e698c2435200c1fc..7ed21a99e9025837bc5c38efa542df85
if (this.D && this.player.getRootVehicle().getRidingPassenger() == this.player) {
if (++this.E > 80) {
PlayerConnection.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getDisplayName().getString());
- this.disconnect(new ChatMessage("multiplayer.disconnect.flying", new Object[0]));
- this.disconnect(new ChatMessage("multiplayer.disconnect.flying"));
+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message
return;
}

View file

@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 22:54:28 -0400
Subject: [PATCH] Chunk registration fixes
World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is treated
Keep them consistent
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 43b588709da17ae779e97d297955edd3425c2a68..6d5bb1c5183c0e7fc83e197f3a6840b2dcb1ad02 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -729,7 +729,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
if (entity.ck()) {
this.getMethodProfiler().enter("chunkCheck");
int i = MathHelper.floor(entity.locX() / 16.0D);
- int j = MathHelper.floor(entity.locY() / 16.0D);
+ int j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior
int k = MathHelper.floor(entity.locZ() / 16.0D);
if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {

View file

@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 22:54:28 -0400
Subject: [PATCH] Chunk registration fixes
World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is treated
Keep them consistent
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index aae3d51288a257f42e773cde052bee52fc1ca238..e428b3cb8c8ca5a662a0e867bf74d08775f1bacd 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -696,7 +696,7 @@ public class WorldServer extends World {
public void chunkCheck(Entity entity) {
this.getMethodProfiler().enter("chunkCheck");
int i = MathHelper.floor(entity.locX() / 16.0D);
- int j = MathHelper.floor(entity.locY() / 16.0D);
+ int j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior;
int k = MathHelper.floor(entity.locZ() / 16.0D);
if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Remove FishingHook reference on Craft Entity removal
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
index 257ce11664e7388ec004f8fad62ad2fce2aeb791..d45bba0c97961eff6b5107ade63f897263eeff47 100644
index 591650712199f904af2c66b0d7e36ce31d87e1a3..f7b5320fc6c8a9dec40c69907c020d96fd3bfa00 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
@@ -66,4 +66,15 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
@@ -48,4 +48,15 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
Validate.isTrue(chance >= 0 && chance <= 1, "The bite chance must be between 0 and 1.");
this.biteChance = chance;
}

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/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index aca885db36a8c93e32b3a2e40c407e4fdd5c97e4..83ffee35fb2f7de14dbaf06f62d2019eaf68814c 100644
index 75757e00edfd11a4a7dc793d5d13355ea713dc01..a5c921f9e1c07fd1eb969063727019a6d8bce5b6 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -197,6 +197,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -206,6 +206,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@Override
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
public void loadData(NBTTagCompound nbttagcompound) {
super.loadData(nbttagcompound);
+ if (this.locY() > 300) this.setPositionRaw(locX(), 257, locZ()); // Paper - bring down to a saner Y level if out of world
if (nbttagcompound.hasKeyOfType("playerGameType", 99)) {
if (this.getMinecraftServer().getForceGamemode()) {
this.playerInteractManager.setGameMode(this.getMinecraftServer().getGamemode());
this.playerInteractManager.a(this.getMinecraftServer().getGamemode(), EnumGamemode.NOT_SET);

View file

@ -19,10 +19,10 @@ index 8cf3076f4e0d8d7e81158881c763f89ebda7e678..721eceeffc843da8b9da1ccc2d07f3bc
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 2c1570c89026a5dbbe76ab00c6a89919e566a5f6..87e94693f6db07d1273854ad55e5f263f2f2239e 100644
index c0b5d25f63741947c0d8ee32f317eb7fd3db4b65..fdc02b512f2d4bc968977564d520bc7ec7189c69 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -636,6 +636,12 @@ public class Chunk implements IChunkAccess {
@@ -637,6 +637,12 @@ public class Chunk implements IChunkAccess {
"Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
e.printStackTrace();
ServerInternalException.reportInternalException(e);

View file

@ -5,44 +5,43 @@ Subject: [PATCH] Add EntityZapEvent
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index 5c24e22c7d0eb1f10b45fc782151f1d7606d5383..8d277566e9df010b6f86385bc8f018e4c8c2d3bf 100644
index 1d580d9cbdca9ceafccd35e20f6f075a582a0ac6..cd0a94794e8969937f7f8408e0fb46c1684abc00 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -164,6 +164,12 @@ public class EntityPig extends EntityAnimal {
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible());
}
@@ -208,6 +208,11 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
}
+ // Paper start
+ if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
+ return;
+ }
+ // Paper end
+
// CraftBukkit start
if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
return;
entitypigzombie.setPersistent();
+ // Paper start
+ if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
+ return;
+ }
+ // Paper end
// CraftBukkit start
if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
return;
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index f72347050302e4cb99d4c9b71b7e8acab545ea59..5e3835851d8c5e804542c256a54187e4ed05bace 100644
index f7f76bca254dc7bc5792e449feeaa113a96c93e4..d0b04707e830fbaf3a6bfe92637e4432172fd9c7 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -681,6 +681,12 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
public void onLightningStrike(EntityLightning entitylightning) {
EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a(this.world);
@@ -714,6 +714,12 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
EntityVillager.LOGGER.info("Villager {} was struck by lightning {}.", this, entitylightning);
EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a(this.world);
+ // Paper start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) {
+ return;
+ }
+ // Paper end
+ // Paper start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) {
+ return;
+ }
+ // Paper end
+
entitywitch.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch);
entitywitch.prepare(this.world, this.world.getDamageScaler(new BlockPosition(entitywitch)), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null);
entitywitch.setNoAI(this.isNoAI());
entitywitch.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch);
entitywitch.prepare(this.world, this.world.getDamageScaler(entitywitch.getChunkCoordinates()), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) 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 37b0776ed580995024008e81254b8a8516641e3f..26e29e0f37b9d4f23b4928c5aeef1da184efe3fc 100644
index 1952e6dadbf3b26de98263279e0188c806d8ff52..f3385622b57a17eadcb0882cd7e138cf36640ae5 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1053,6 +1053,14 @@ public class CraftEventFactory {
@@ -1051,6 +1051,14 @@ public class CraftEventFactory {
return event;
}

View file

@ -30,14 +30,13 @@ index 721eceeffc843da8b9da1ccc2d07f3bcc901db76..bff2e9d26dc8057c3950d1b57ee2e746
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index e64722f63bab6bc1ce97ca63d4fde7599f6c1296..6683f7c5f31b88187961335c5f708b8a4f77b5af 100644
index 7c308e0912fb60f8dcdfb36c8a8c8718231858bc..40ab0a1e5b8e31f1ef3b2444366784a65f034341 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -233,6 +233,15 @@ public class EntityFallingBlock extends Entity {
@@ -233,6 +233,13 @@ public class EntityFallingBlock extends Entity {
@Override
protected void a(NBTTagCompound nbttagcompound) {
this.block = GameProfileSerializer.d(nbttagcompound.getCompound("BlockState"));
+
protected void loadData(NBTTagCompound nbttagcompound) {
this.block = GameProfileSerializer.c(nbttagcompound.getCompound("BlockState"));
+ // Paper start - Block FallingBlocks with Command Blocks
+ // Check mappings on update - dc = "repeating_command_block" - dd = "chain_command_block"
+ final Block b = this.block.getBlock();
@ -45,7 +44,6 @@ index e64722f63bab6bc1ce97ca63d4fde7599f6c1296..6683f7c5f31b88187961335c5f708b8a
+ this.block = Blocks.STONE.getBlockData();
+ }
+ // Paper end
+
this.ticksLived = nbttagcompound.getInt("Time");
if (nbttagcompound.hasKeyOfType("HurtEntities", 99)) {
this.hurtEntities = nbttagcompound.getBoolean("HurtEntities");

View file

@ -5,13 +5,13 @@ Subject: [PATCH] Cache user authenticator threads
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 83ffee35fb2f7de14dbaf06f62d2019eaf68814c..482d7b7cb6b89d79b2ce54338130481f9f1c8c24 100644
index a5c921f9e1c07fd1eb969063727019a6d8bce5b6..8ff3f34cc09e369d423370b9d713424b27b2dfcf 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -4,7 +4,9 @@ import com.google.common.collect.Lists;
import com.mojang.authlib.GameProfile;
import com.mojang.datafixers.util.Either;
import io.netty.util.concurrent.Future;
import com.mojang.serialization.DataResult;
+import java.util.ArrayDeque; // Paper
import java.util.Collection;
+import java.util.Deque; // Paper
@ -27,7 +27,7 @@ index 83ffee35fb2f7de14dbaf06f62d2019eaf68814c..482d7b7cb6b89d79b2ce54338130481f
private final AdvancementDataPlayer advancementDataPlayer;
private final ServerStatisticManager serverStatisticManager;
private float lastHealthScored = Float.MIN_VALUE;
@@ -371,13 +373,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -414,13 +416,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
while (!this.removeQueue.isEmpty()) {
int i = Math.min(this.removeQueue.size(), Integer.MAX_VALUE);
int[] aint = new int[i];
@ -50,7 +50,7 @@ index 83ffee35fb2f7de14dbaf06f62d2019eaf68814c..482d7b7cb6b89d79b2ce54338130481f
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(aint));
}
@@ -1327,7 +1336,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1434,7 +1443,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
// this.recipeBook.a((RecipeBook) entityplayer.recipeBook); // CraftBukkit
@ -63,6 +63,6 @@ index 83ffee35fb2f7de14dbaf06f62d2019eaf68814c..482d7b7cb6b89d79b2ce54338130481f
+ this.removeQueue.addAll(entityplayer.removeQueue);
+ }
+ // Paper end
this.cm = entityplayer.cm;
this.cr = entityplayer.cr;
this.ck = entityplayer.ck;
this.cp = entityplayer.cp;
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Optimise removeQueue
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index c6fd50daa842aae7558ae14196483b544c377c29..19e72da6d9a8bf43d1d25c1be3aa23c75dd6e5d7 100644
index 01e981209ec832b3da368091ed109f42464c1c33..7c016afc904d6d6958abf73fd0d87a25c9fa41ad 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -97,6 +97,12 @@ public class LoginListener implements PacketLoginInListener {
@@ -96,6 +96,12 @@ public class LoginListener implements PacketLoginInListener {
}
@ -21,7 +21,7 @@ index c6fd50daa842aae7558ae14196483b544c377c29..19e72da6d9a8bf43d1d25c1be3aa23c7
// Spigot start
public void initUUID()
{
@@ -175,8 +181,8 @@ public class LoginListener implements PacketLoginInListener {
@@ -174,8 +180,8 @@ public class LoginListener implements PacketLoginInListener {
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic(), this.e));
} else {
// Spigot start
@ -32,7 +32,7 @@ index c6fd50daa842aae7558ae14196483b544c377c29..19e72da6d9a8bf43d1d25c1be3aa23c7
@Override
public void run() {
try {
@@ -187,7 +193,8 @@ public class LoginListener implements PacketLoginInListener {
@@ -186,7 +192,8 @@ public class LoginListener implements PacketLoginInListener {
server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
}
}
@ -42,7 +42,7 @@ index c6fd50daa842aae7558ae14196483b544c377c29..19e72da6d9a8bf43d1d25c1be3aa23c7
// Spigot end
}
@@ -204,7 +211,8 @@ public class LoginListener implements PacketLoginInListener {
@@ -203,7 +210,8 @@ public class LoginListener implements PacketLoginInListener {
this.loginKey = packetlogininencryptionbegin.a(privatekey);
this.g = LoginListener.EnumProtocolState.AUTHENTICATING;
this.networkManager.a(this.loginKey);
@ -52,9 +52,9 @@ index c6fd50daa842aae7558ae14196483b544c377c29..19e72da6d9a8bf43d1d25c1be3aa23c7
public void run() {
GameProfile gameprofile = LoginListener.this.i;
@@ -251,10 +259,8 @@ public class LoginListener implements PacketLoginInListener {
@@ -250,10 +258,8 @@ public class LoginListener implements PacketLoginInListener {
return LoginListener.this.server.Y() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
return LoginListener.this.server.U() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
}
- };
-

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a27783dcf3f7575b8527aefc60a15621520cbf19..3cb57c3b8ca8f29437bea52e9cf3512985f56eb5 100644
index 28b3c800683dd42b88d630c9ae83996b7b4f65df..a0d1e57ff34dfb36913ff937575bb3c1ad444f54 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2118,5 +2118,24 @@ public final class CraftServer implements Server {
@@ -2169,5 +2169,24 @@ public final class CraftServer implements Server {
DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions();
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add source to PlayerExpChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index f72bb0c13806c3fadcbbf345f3533c115a200a7f..0447800d9dc341af647a928abd8b79938eddbd6f 100644
index 2e25aba27993608ed7ee1cfb7ae8ee60bc74feda..c13a47382d0a7456fa5035a64f42a6ed5e9f1c8e 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -193,7 +193,7 @@ public class EntityExperienceOrb extends Entity {
@@ -188,7 +188,7 @@ public class EntityExperienceOrb extends Entity {
}
if (this.value > 0) {
@ -18,10 +18,10 @@ index f72bb0c13806c3fadcbbf345f3533c115a200a7f..0447800d9dc341af647a928abd8b7993
this.die();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 26e29e0f37b9d4f23b4928c5aeef1da184efe3fc..d9997278d335901138ff8bd29faaf88d4e0f36cf 100644
index f3385622b57a17eadcb0882cd7e138cf36640ae5..b4da37eb1566c4f92d4e3dc6310cd1cc8ccbca7a 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -117,6 +117,7 @@ import org.bukkit.entity.ThrownPotion;
@@ -115,6 +115,7 @@ import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.Vehicle;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Villager.Profession;
@ -29,7 +29,7 @@ index 26e29e0f37b9d4f23b4928c5aeef1da184efe3fc..d9997278d335901138ff8bd29faaf88d
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Result;
@@ -1012,6 +1013,17 @@ public class CraftEventFactory {
@@ -1010,6 +1011,17 @@ public class CraftEventFactory {
return event;
}

View file

@ -5,26 +5,26 @@ Subject: [PATCH] Don't let fishinghooks use portals
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3f1dbca881ce19a633fc7c20d26d1a25b550edf7..8a2093ac5a6d47c795523a1aab87e46f10b1699e 100644
index 2175ce0830701568024ed4d45164ba8ae0ec8548..33262be7f883afeca6a8662ffcb5c44a4800e657 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -161,7 +161,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -163,7 +163,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public boolean ac;
public boolean impulse;
public int portalCooldown;
- protected boolean af;
+ protected boolean af; public final boolean inPortal() { return this.af; } // Paper - OBFHELPER
protected int ag;
public DimensionManager dimension;
protected BlockPosition ai;
- protected boolean inPortal;
+ protected boolean inPortal; public final boolean inPortal() { return this.inPortal; } // Paper - OBFHELPER
protected int portalTicks;
protected BlockPosition ah;
protected Vec3D ai;
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 40bdcf4e75bb36385e82ba8b8f2471760072705a..39e3bd37956d7e0a4d5f784a581e17a77b71f78b 100644
index ab8f67c11419cc788fc3cb814d2224e65217dd08..13b46c59b9a017bfa985ad74f80eca77608d1891 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -160,6 +160,12 @@ public class EntityFishingHook extends Entity {
@@ -191,6 +191,12 @@ public class EntityFishingHook extends IProjectile {
this.setMot(this.getMot().a(0.92D));
this.Z();
this.ac();
+
+ // Paper start - These shouldn't be going through portals
+ if (this.inPortal()) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add ProjectileCollideEvent
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 2b14b2c3fa21e67ebd8f344a6ee066d67bf53044..634e2bd3049d65bbef4ef12e2264049a6980fd71 100644
index 44e23fa452c5f39ad7ff678064f5474813f7cea8..c552962a9a2c8dac6794ef6698943c7d91ea45c4 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -187,6 +187,17 @@ public abstract class EntityArrow extends Entity implements IProjectile {
@@ -160,6 +160,17 @@ public abstract class EntityArrow extends IProjectile {
}
}
@ -27,12 +27,12 @@ index 2b14b2c3fa21e67ebd8f344a6ee066d67bf53044..634e2bd3049d65bbef4ef12e2264049a
this.a((MovingObjectPosition) object);
this.impulse = true;
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
index 078cc252313faca997e3a716fed5c5d2261c086c..6756c79b31aa04a110eeedd3c44b11abc34f4b5f 100644
index 17ab9401dbd6c67488a79abeeed24e37c126b729..5c737d605219bcb0c509f10e62550981f7cdb03f 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -67,7 +67,16 @@ public abstract class EntityFireball extends Entity {
++this.g;
MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, true, this.g >= 25, this.shooter, RayTrace.BlockCollisionOption.COLLIDER);
@@ -57,7 +57,16 @@ public abstract class EntityFireball extends IProjectile {
MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, this::a, RayTrace.BlockCollisionOption.COLLIDER);
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
+ // Paper start - Call ProjectileCollideEvent
@ -48,55 +48,38 @@ index 078cc252313faca997e3a716fed5c5d2261c086c..6756c79b31aa04a110eeedd3c44b11ab
this.a(movingobjectposition);
// CraftBukkit start - Fire ProjectileHitEvent
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 39e3bd37956d7e0a4d5f784a581e17a77b71f78b..807ec3394db7bef29bf92f2c200fd76f96df03ab 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -214,7 +214,16 @@ public class EntityFishingHook extends Entity {
return !entity.isSpectator() && (entity.isInteractable() || entity instanceof EntityItem) && (entity != this.owner || this.g >= 5);
}, RayTrace.BlockCollisionOption.COLLIDER, true);
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
+ // Paper start - Call ProjectileCollideEvent
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
+ if (event.isCancelled()) {
+ movingobjectposition = null;
+ }
+ }
+ // Paper end
+
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // CraftBukkit - Call event
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
this.hooked = ((MovingObjectPositionEntity) movingobjectposition).getEntity();
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 2e4c9d42677d3e48a8f8ad559a723fc4eeec07e3..724b78b5d2d7f4ce8de31c763d2d95b986c1b7f6 100644
index 9ca6b747050bf9db9b787a5190c3f4fd138beabc..2283307676e5f89a8d49be40b7ccae55f7881cf6 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -99,7 +99,16 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.ap = null;
@@ -41,12 +41,22 @@ public abstract class EntityProjectile extends IProjectile {
}
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
+ // Paper start - Call ProjectileCollideEvent
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
+ if (event.isCancelled()) {
+ movingobjectposition = null;
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && !flag) {
+ // Paper start - Call ProjectileCollideEvent
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
+ if (event.isCancelled()) {
+ movingobjectposition = null;
+ }
+ }
+ }
+ // Paper end
+
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition()).getBlock() == Blocks.NETHER_PORTAL) {
this.c(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition());
} else {
+ if (movingobjectposition != null) {
+ // Paper end
this.a(movingobjectposition);
// CraftBukkit start
if (this.dead) {
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
}
// CraftBukkit end
+ } // Paper
}
Vec3D vec3d = this.getMot();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index d9997278d335901138ff8bd29faaf88d4e0f36cf..f1a4de57282f3553f34245122bf15130420f558b 100644
index b4da37eb1566c4f92d4e3dc6310cd1cc8ccbca7a..dc4fc5b300bb319be3d483aa7206bb0134343068 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1157,6 +1157,16 @@ public class CraftEventFactory {
@@ -1155,6 +1155,16 @@ public class CraftEventFactory {
return CraftItemStack.asNMSCopy(bitem);
}

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Prevent Pathfinding out of World Border
This prevents Entities from trying to run outside of the World Border
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 39a0c45bb0e3d2fcfbcc07192f9e1e61570c922e..bdd092e49da13960cd8a65e989a351d65cb620f7 100644
index 9330e65cbdf2f826528e3c891197fac7860306ec..b06c76a369f1dc9de8d782272c3ff0573af89361 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -123,7 +123,7 @@ public abstract class NavigationAbstract {
@@ -126,7 +126,7 @@ public abstract class NavigationAbstract {
// Paper start - Pathfind event
boolean copiedSet = false;
for (BlockPosition possibleTarget : set) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 5dd504ea0b0d0ca7e7cd8c33473177f95c54bd8c..203c4173ff2467a027da059b2d473ec1a90bb88b 100644
index 3e6dc44ede30846b8c612b043c1bd625576980e8..cfd03f29e6c46c66bf3ad9253c88e27b30f313c1 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -225,6 +225,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -285,6 +285,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return chunk == null ? null : chunk.getFluid(blockposition);
}

View file

@ -11,23 +11,23 @@ that is outside happens to be closer, but unreachable, yet another reachable
one is in border that would of been missed.
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index 0f248b6de3b822642389eba2ce3569a6538bdece..e8ce2ecf23e58d82febf6b9441e0004e69cdc858 100644
index 68510457b527e61bf60bf1e7dfd664578172c00a..3880559505af742f1ab36f7959dc7fbd1e5da1b3 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -108,6 +108,7 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
@@ -138,6 +138,7 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
int i2 = l + k * k1;
int j2 = i1 + k * l1;
ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2);
+ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS);
StructureStart<?> structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess);
if (flag1 || flag2) {
ChunkCoordIntPair chunkcoordintpair = this.a(chunkgenerator, seededrandom, j, k, i1, j1);
+ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
StructureStart structurestart = world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS).a(this.b());
if (structurestart != null && structurestart.e()) {
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
index 73730fe25c84a867b8d95525c9d76d60a5797396..4c20db5a3f9e159997a9851691aca421241d6d95 100644
index d5c0d394feaf8bb991245dbdcc6252cf45eac13d..0ef92a320d132b443e76276b2c34a4626cf187db 100644
--- a/src/main/java/net/minecraft/server/WorldBorder.java
+++ b/src/main/java/net/minecraft/server/WorldBorder.java
@@ -24,6 +24,18 @@ public class WorldBorder {
return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f();
@@ -26,6 +26,18 @@ public class WorldBorder {
return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h();
}
+ // Paper start
@ -43,5 +43,5 @@ index 73730fe25c84a867b8d95525c9d76d60a5797396..4c20db5a3f9e159997a9851691aca421
+ // Paper end
+
public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) {
return (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e() && (double) chunkcoordintpair.g() > this.d() && (double) chunkcoordintpair.e() < this.f();
return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h();
}

View file

@ -28,13 +28,13 @@ index bff2e9d26dc8057c3950d1b57ee2e7469e7f943c..f164844f339793860e773c499443ce16
+ }
}
diff --git a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java
index 5fe0da76bd172c2c552b2dd210e89be214c4385c..f7220f057e313ad137fe01397e43c4a42afbccc1 100644
index 32a98e758b9df48005ddc5283eacdc5123a32c39..30f21e3ff7eed3c7291e01b94cc0f66fd48756d0 100644
--- a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java
+++ b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java
@@ -42,6 +42,15 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional
@@ -48,6 +48,15 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional
if (blockposition != null) {
WorldServer worldserver = loottableinfo.c();
WorldServer worldserver = loottableinfo.getWorld();
+ // Paper start
+ if (!worldserver.paperConfig.enableTreasureMaps) {
+ /*
@ -44,20 +44,20 @@ index 5fe0da76bd172c2c552b2dd210e89be214c4385c..f7220f057e313ad137fe01397e43c4a4
+ return itemstack;
+ }
+ // Paper end
BlockPosition blockposition1 = worldserver.a(this.d, blockposition, this.g, this.h);
BlockPosition blockposition1 = worldserver.a(this.e, blockposition, this.h, this.i);
if (blockposition1 != null) {
diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java
index 3bcf0b385d1f707176dae9c3ee49370e2e6dd481..4764ffef77bf0a73018017a07103186a9ce55b8f 100644
index 532460e7549192dfe6170e2bf489edb46b8b5737..d0c2ec4050458e26d1bd85cc09b1a3fdca8488c6 100644
--- a/src/main/java/net/minecraft/server/VillagerTrades.java
+++ b/src/main/java/net/minecraft/server/VillagerTrades.java
@@ -92,7 +92,8 @@ public class VillagerTrades {
@@ -91,7 +91,8 @@ public class VillagerTrades {
return null;
} else {
WorldServer worldserver = (WorldServer) entity.world;
- BlockPosition blockposition = worldserver.a(this.b, new BlockPosition(entity), 100, true);
+ if (!worldserver.paperConfig.enableTreasureMaps) return null; //Paper
+ BlockPosition blockposition = worldserver.a(this.b, new BlockPosition(entity), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); //Paper
- BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, true);
+ if (!worldserver.paperConfig.enableTreasureMaps) return null; // Paper
+ BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); // Paper
if (blockposition != null) {
ItemStack itemstack = ItemWorldMap.createFilledMapView(worldserver, blockposition.getX(), blockposition.getZ(), (byte) 2, true, true);

View file

@ -6,15 +6,15 @@ Subject: [PATCH] Optimize ItemStack.isEmpty()
Remove hashMap lookup every check, simplify code to remove ternary
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index db11c8ec692aaf37fc68fd39b95fcadacf5eda38..854cffe6c98956cbafa2ead9b831e39209a76c8d 100644
index a360711ea14983e8df34caa5edda80a015e6db23..c4d034c6a6ff176bc954c00c328512bdf67455a6 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -150,7 +150,7 @@ public final class ItemStack {
@@ -154,7 +154,7 @@ public final class ItemStack {
}
public boolean isEmpty() {
- return this == ItemStack.a ? true : (this.getItem() != null && this.getItem() != Items.AIR ? this.count <= 0 : true);
+ return this == ItemStack.a || this.item == null || this.item == Items.AIR || this.count <= 0; // Paper
- return this == ItemStack.b ? true : (this.getItem() != null && this.getItem() != Items.AIR ? this.count <= 0 : true);
+ return this == ItemStack.NULL_ITEM || this.item == null || this.item == Items.AIR || this.count <= 0; // Paper
}
public ItemStack cloneAndSubtract(int i) {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add API methods to control if armour stands can move
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index ed6092f65a57b696d1343b5b6c061422bd1220b1..176af6c889fa29d5df7c822f888cdc26f81110e6 100644
index 073c3e17eee996f2a9b620bbc13c59d6e342fd6c..3571ef9ac1299702ad274aad43070abf959bf9d9 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -43,6 +43,7 @@ public class EntityArmorStand extends EntityLiving {
@ -18,7 +18,7 @@ index ed6092f65a57b696d1343b5b6c061422bd1220b1..176af6c889fa29d5df7c822f888cdc26
super(entitytypes, world);
@@ -817,4 +818,13 @@ public class EntityArmorStand extends EntityLiving {
return this.getEntityType().k().a(f);
return this.getEntityType().l().a(f);
}
+
+ // Paper start

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Properly fix item duplication bug
Credit to prplz for figuring out the real issue
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 482d7b7cb6b89d79b2ce54338130481f9f1c8c24..bf32997c422d478699c32ce0539a65c35fbf0d12 100644
index 8ff3f34cc09e369d423370b9d713424b27b2dfcf..f4275e2ba2659d3087395105da9446225d3a904c 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1795,7 +1795,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1933,7 +1933,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@Override
protected boolean isFrozen() {
@ -19,10 +19,10 @@ index 482d7b7cb6b89d79b2ce54338130481f9f1c8c24..bf32997c422d478699c32ce0539a65c3
@Override
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 7ed21a99e9025837bc5c38efa542df85dc2eb248..d6f5f176d4b5a39ddea4a9dc31a2322cc7d9d2d0 100644
index 4c59b6beb0db3fd9d42e2f53519c40f211ef8bfb..f802bcb386b67e6c59aee68d6bfa507461f522cf 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2526,7 +2526,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2568,7 +2568,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
public final boolean isDisconnected() {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] String based Action Bar API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a85638fb4022361cb17cac0d666f26cdd1a5ef11..a4afce71be0707c43700b73ae0107074448e3d4a 100644
index 20cb63419a049ce9dcaf2f0c99274501ebf9aa8c..527c116c23a505eead00e73a39ce9f932eb4ad8d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -215,6 +215,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -219,6 +219,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper start

View file

@ -5,29 +5,20 @@ Subject: [PATCH] Firework API's
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
index 4f51b9b654e4a9c9ee43261edb241bcf3c346be2..278ef79d8962cc5d337e34891c7ea3a606336cbb 100644
index fd34a0f2dcfe300763f31eda4d53951d66d875f7..5ac7957016d1ca6bc78ced0bcf3767d358677f45 100644
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -3,6 +3,8 @@ package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
import java.util.OptionalInt;
+import java.util.UUID;
+
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityFireworks extends Entity implements IProjectile {
@@ -12,7 +14,8 @@ public class EntityFireworks extends Entity implements IProjectile {
@@ -13,7 +13,8 @@ public class EntityFireworks extends IProjectile {
public static final DataWatcherObject<Boolean> SHOT_AT_ANGLE = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i);
private int ticksFlown;
public int expectedLifespan;
- private EntityLiving ridingEntity;
+ private EntityLiving ridingEntity; public final EntityLiving getBoostedEntity() { return this.ridingEntity; } // Paper - OBFHELPER
+ public UUID spawningEntity; // Paper
+ public java.util.UUID spawningEntity; // Paper
public EntityFireworks(EntityTypes<? extends EntityFireworks> entitytypes, World world) {
super(entitytypes, world);
@@ -268,6 +271,11 @@ public class EntityFireworks extends Entity implements IProjectile {
@@ -258,6 +259,11 @@ public class EntityFireworks extends IProjectile {
}
nbttagcompound.setBoolean("ShotAtAngle", (Boolean) this.datawatcher.get(EntityFireworks.SHOT_AT_ANGLE));
@ -39,7 +30,7 @@ index 4f51b9b654e4a9c9ee43261edb241bcf3c346be2..278ef79d8962cc5d337e34891c7ea3a6
}
@Override
@@ -283,7 +291,11 @@ public class EntityFireworks extends Entity implements IProjectile {
@@ -274,7 +280,11 @@ public class EntityFireworks extends IProjectile {
if (nbttagcompound.hasKey("ShotAtAngle")) {
this.datawatcher.set(EntityFireworks.SHOT_AT_ANGLE, nbttagcompound.getBoolean("ShotAtAngle"));
}
@ -53,25 +44,25 @@ index 4f51b9b654e4a9c9ee43261edb241bcf3c346be2..278ef79d8962cc5d337e34891c7ea3a6
@Override
diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java
index 313076d6d8aa130451c4d6cc2795d34fd39f3e5d..7be41c8698e86727978db7d72b3dd3fbfe6b7272 100644
index a2549cf1253f472d58ce68e4414448561a7a5ba4..1592e94c78611a4b968bfb24daf68570e778fadd 100644
--- a/src/main/java/net/minecraft/server/ItemCrossbow.java
+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java
@@ -199,6 +199,7 @@ public class ItemCrossbow extends ItemProjectileWeapon {
@@ -183,6 +183,7 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable
if (flag1) {
object = new EntityFireworks(world, itemstack1, entityliving.locX(), entityliving.getHeadY() - 0.15000000596046448D, entityliving.locZ(), true);
object = new EntityFireworks(world, itemstack1, entityliving, entityliving.locX(), entityliving.getHeadY() - 0.15000000596046448D, entityliving.locZ(), true);
+ ((EntityFireworks) object).spawningEntity = entityliving.getUniqueID(); // Paper
} else {
object = a(world, entityliving, itemstack, itemstack1);
if (flag || f3 != 0.0F) {
diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java
index 058c016b7b12cea106916dbd81a231d29c67bc0f..92dac35ec4eefe0d5794d8205bc872d23a62e3cb 100644
index 12ae2d9b747b69533fab2487ad55626c50c1d620..6cc243025f5bdac9be39f8a88a018893a9941dba 100644
--- a/src/main/java/net/minecraft/server/ItemFireworks.java
+++ b/src/main/java/net/minecraft/server/ItemFireworks.java
@@ -18,6 +18,7 @@ public class ItemFireworks extends Item {
Vec3D vec3d = itemactioncontext.getPos();
EnumDirection enumdirection = itemactioncontext.getClickedFace();
EntityFireworks entityfireworks = new EntityFireworks(world, vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack);
EntityFireworks entityfireworks = new EntityFireworks(world, itemactioncontext.getEntity(), vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack);
+ entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper
world.addEntity(entityfireworks);
@ -90,57 +81,36 @@ index 058c016b7b12cea106916dbd81a231d29c67bc0f..92dac35ec4eefe0d5794d8205bc872d2
itemstack.subtract(1);
}
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index 75604dbc69d0a416dc9d56ae3f795ed03e120af8..98deaba12ceb25f59d1b56420fb544a64b417ddd 100644
index c16ff6723d3fd191b990002d40dc021d7870555d..9c445902e6adc05773497bc4444203ca364e4f5c 100644
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
@@ -136,7 +136,7 @@ public class NBTTagCompound implements NBTBase {
return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least"));
@@ -145,6 +145,7 @@ public class NBTTagCompound implements NBTBase {
return GameProfileSerializer.a(this.get(s));
}
- public boolean b(String s) {
+ public final boolean hasUUID(String s) { return this.b(s); } public boolean b(String s) { // Paper - OBFHELPER
return this.hasKeyOfType(s + "Most", 99) && this.hasKeyOfType(s + "Least", 99);
}
+ public final boolean hasUUID(String s) { return this.b(s); } // Paper - OBFHELPER
public boolean b(String s) {
NBTBase nbtbase = this.get(s);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
index 475b7b004b7b30ee9e7d0dad92c4691ecd4afbdc..de74e7214a02a07e3ebdd099036c70bbc84c60e1 100644
index d984a7a78e9f8536abf7c30df9aa59dbfc7984ce..2dfa24e52ae9c46291090d367b1ee4e25a71c213 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
import java.util.Random;
import net.minecraft.server.EntityFireworks;
+import net.minecraft.server.EntityLiving;
import net.minecraft.server.ItemStack;
import net.minecraft.server.Items;
import org.bukkit.Material;
@@ -9,8 +10,11 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
+import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.meta.FireworkMeta;
+import java.util.UUID;
+
public class CraftFirework extends CraftEntity implements Firework {
private final Random random = new Random();
@@ -78,4 +82,17 @@ public class CraftFirework extends CraftEntity implements Firework {
@@ -78,4 +78,17 @@ public class CraftFirework extends CraftProjectile implements Firework {
public void setShotAtAngle(boolean shotAtAngle) {
getHandle().getDataWatcher().set(EntityFireworks.SHOT_AT_ANGLE, shotAtAngle);
}
+
+ // Paper start
+ @Override
+ public UUID getSpawningEntity() {
+ public java.util.UUID getSpawningEntity() {
+ return getHandle().spawningEntity;
+ }
+
+ @Override
+ public LivingEntity getBoostedEntity() {
+ EntityLiving boostedEntity = getHandle().getBoostedEntity();
+ return boostedEntity != null ? (LivingEntity) boostedEntity.getBukkitEntity() : null;
+ public org.bukkit.entity.LivingEntity getBoostedEntity() {
+ net.minecraft.server.EntityLiving boostedEntity = getHandle().getBoostedEntity();
+ return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null;
+ }
+ // Paper end
}

View file

@ -6,10 +6,10 @@ Subject: [PATCH] PlayerTeleportEndGatewayEvent
Allows you to access the Gateway being used in a teleport event
diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
index b907a3c4d8dcf0d6dadb98807779fdfe1d706a52..78fba79378173dc2c4290e048c3497e206332458 100644
index 06880e05cb17bcf9daef72cdbbbbbb8b62e2c584..71134f7f636611065f8cf8e3b82caf299bce0af8 100644
--- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java
+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
@@ -133,7 +133,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
@@ -151,7 +151,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
location.setPitch(player.getLocation().getPitch());
location.setYaw(player.getLocation().getYaw());

View file

@ -7,10 +7,10 @@ Provides counts without the ineffeciency of using .getEntities().size()
which creates copy of the collections.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 1e4f45ef7e10156d6a48d907490009123028bff2..4ca9ddacb7da760b31d405e77b691ef6d8ff534a 100644
index e13decf74e6dd9610253a5c923462d7bdff285c8..426b25c709a8e87f409156e252ea7597c154a50b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -278,6 +278,48 @@ public class CraftWorld implements World {
@@ -279,6 +279,48 @@ public class CraftWorld implements World {
private int waterAnimalSpawn = -1;
private int ambientSpawn = -1;

View file

@ -7,10 +7,10 @@ Saving players async is extremely dangerous. This will force it to main
the same way we handle async chunk loads.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 0f09cacf6d67dab5bc7962f19fcf3eba85ada4ff..18c81bdcf206ecaa331cc5186a29ad321870b57f 100644
index 32be0e35918398f2fd5f62c2cb87c4597985b7b3..414e23fc24e90829b71def39b186f1913ce8300d 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -918,11 +918,13 @@ public abstract class PlayerList {
@@ -960,11 +960,13 @@ public abstract class PlayerList {
}
public void savePlayers() {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 8a2093ac5a6d47c795523a1aab87e46f10b1699e..63649936525efd33f50c602f6d723085edb2896e 100644
index 33262be7f883afeca6a8662ffcb5c44a4800e657..8bac1e7d8ad004fc7d248ed21382ca9042dfa9b7 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2031,6 +2031,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1951,6 +1951,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
protected boolean addPassenger(Entity entity) { // CraftBukkit

View file

@ -8,10 +8,10 @@ Adds lots of information about why this orb exists.
Replaces isFromBottle() with logic that persists entity reloads too.
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 5de881371a485957fd8fadc7540a2b549b20dd65..5f261b9b92de4ca8638f41fa2947016cf590cf05 100644
index 3cc572b0ce757160c7ab4733b98d8ca84f9f325a..247d9300a755aa22c2ca3bcef86b3b25f3ed75ee 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -511,13 +511,13 @@ public class Block implements IMaterial {
@@ -236,13 +236,13 @@ public class Block extends BlockBase implements IMaterial {
}
}
@ -28,7 +28,7 @@ index 5de881371a485957fd8fadc7540a2b549b20dd65..5f261b9b92de4ca8638f41fa2947016c
}
diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java
index 2d2cd09ad1126b3b6b7a979b8e4dd450806d58d3..ed88e208d00f3b19b5c5916cf87513ab511a5fb1 100644
index 5bdb0c3a7a04a55cd5ddff8e375497e402408811..fe9a083b724a8657cac8462b3f44d3cc12a4db58 100644
--- a/src/main/java/net/minecraft/server/ContainerGrindstone.java
+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java
@@ -81,7 +81,7 @@ public class ContainerGrindstone extends Container {
@ -40,11 +40,24 @@ index 2d2cd09ad1126b3b6b7a979b8e4dd450806d58d3..ed88e208d00f3b19b5c5916cf87513ab
}
world.triggerEffect(1042, blockposition, 0);
diff --git a/src/main/java/net/minecraft/server/EntityAnimal.java b/src/main/java/net/minecraft/server/EntityAnimal.java
index 34db358bb1cac095593a5d2b1085ab26e85070b1..8b50bc593993ab60ab06b7b7307a7b78e04fa628 100644
--- a/src/main/java/net/minecraft/server/EntityAnimal.java
+++ b/src/main/java/net/minecraft/server/EntityAnimal.java
@@ -227,7 +227,7 @@ public abstract class EntityAnimal extends EntityAgeable {
if (world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
// CraftBukkit start - use event experience
if (experience > 0) {
- world.addEntity(new EntityExperienceOrb(world, this.locX(), this.locY(), this.locZ(), experience));
+ world.addEntity(new EntityExperienceOrb(world, this.locX(), this.locY(), this.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 87625776963d6143d570cda8e72fda6b3f50047f..138e2ea56a91e519a34fd3be9c0ab111a4b17544 100644
index 72a9430789301b264a36c5060ded31ccdc4a1ebf..05b7cdb33b45a4f503cd7fe4130b54d59e7b6452 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -616,7 +616,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
@@ -612,7 +612,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
int j = EntityExperienceOrb.getOrbValue(i);
i -= j;
@ -54,7 +67,7 @@ index 87625776963d6143d570cda8e72fda6b3f50047f..138e2ea56a91e519a34fd3be9c0ab111
}
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index 0447800d9dc341af647a928abd8b79938eddbd6f..d4275e733d9996d121efd95ae1ff4676a1ebfbb5 100644
index c13a47382d0a7456fa5035a64f42a6ed5e9f1c8e..d9a0cd1e90445ff7a1d9e7cef2f71e27bd3686cb 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -16,9 +16,59 @@ public class EntityExperienceOrb extends Entity {
@ -117,7 +130,7 @@ index 0447800d9dc341af647a928abd8b79938eddbd6f..d4275e733d9996d121efd95ae1ff4676
this.setPosition(d0, d1, d2);
this.yaw = (float) (this.random.nextDouble() * 360.0D);
this.setMot((this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D, this.random.nextDouble() * 0.2D * 2.0D, (this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D);
@@ -158,6 +208,7 @@ public class EntityExperienceOrb extends Entity {
@@ -153,6 +203,7 @@ public class EntityExperienceOrb extends Entity {
nbttagcompound.setShort("Health", (short) this.e);
nbttagcompound.setShort("Age", (short) this.c);
nbttagcompound.setShort("Value", (short) this.value);
@ -125,7 +138,7 @@ index 0447800d9dc341af647a928abd8b79938eddbd6f..d4275e733d9996d121efd95ae1ff4676
}
@Override
@@ -165,6 +216,7 @@ public class EntityExperienceOrb extends Entity {
@@ -160,6 +211,7 @@ public class EntityExperienceOrb extends Entity {
this.e = nbttagcompound.getShort("Health");
this.c = nbttagcompound.getShort("Age");
this.value = nbttagcompound.getShort("Value");
@ -134,23 +147,36 @@ index 0447800d9dc341af647a928abd8b79938eddbd6f..d4275e733d9996d121efd95ae1ff4676
@Override
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 807ec3394db7bef29bf92f2c200fd76f96df03ab..73f5961aa331aa94fbbc57c5b4db9bc43ee5cdde 100644
index 13b46c59b9a017bfa985ad74f80eca77608d1891..03c6a81346857392aacb22a0947bdc6391a260f2 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -401,7 +401,7 @@ public class EntityFishingHook extends Entity {
@@ -454,7 +454,7 @@ public class EntityFishingHook extends IProjectile {
this.world.addEntity(entityitem);
// CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
if (playerFishEvent.getExpToDrop() > 0) {
- this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX(), this.owner.locY() + 0.5D, this.owner.locZ() + 0.5D, playerFishEvent.getExpToDrop()));
+ this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX(), this.owner.locY() + 0.5D, this.owner.locZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.owner, this)); // Paper
- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop()));
+ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getOwner(), this)); // Paper
}
// CraftBukkit end
if (itemstack1.getItem().a(TagsItem.FISHES)) {
if (itemstack1.getItem().a((Tag) TagsItem.FISHES)) {
diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java
index c0c0187447976050ea57ae0c4bd62ba7f14c0f6b..95874526516291607a44ae2213d4d6d65edfe18d 100644
--- a/src/main/java/net/minecraft/server/EntityFox.java
+++ b/src/main/java/net/minecraft/server/EntityFox.java
@@ -1234,7 +1234,7 @@ public class EntityFox extends EntityAnimal {
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
// CraftBukkit start - use event experience
if (experience > 0) {
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience));
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityfox)); // Paper
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 9ba0bf40f823003a5966244e7cdde4e3e11da9ec..78785c11166e3541ee9ad1615c5e6fa46cfea523 100644
index 9086712e1206a980a10c7cc36d3ae3a0b8f8bc79..7e4b79fcee2b5e9a2c24e0372cda7d71f38b22e3 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1379,7 +1379,8 @@ public abstract class EntityLiving extends Entity {
@@ -1488,7 +1488,8 @@ public abstract class EntityLiving extends Entity {
int j = EntityExperienceOrb.getOrbValue(i);
i -= j;
@ -161,10 +187,10 @@ index 9ba0bf40f823003a5966244e7cdde4e3e11da9ec..78785c11166e3541ee9ad1615c5e6fa4
this.expToDrop = 0;
}
diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
index 0bfc0a773da3e26cb0188adc8369215dcc953b62..ba2f90cc6ae617fe9bb8e08656b64ded924afa60 100644
index 7a80b341ee7734cc289abdff8755834447cbef75..2d3ca8c424f2088027d51066d634c48723e96214 100644
--- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
@@ -43,7 +43,7 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable {
@@ -44,7 +44,7 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable {
int j = EntityExperienceOrb.getOrbValue(i);
i -= j;
@ -174,10 +200,10 @@ index 0bfc0a773da3e26cb0188adc8369215dcc953b62..ba2f90cc6ae617fe9bb8e08656b64ded
this.die();
diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java
index c73cc9ae4b1f1f24e017b336b4e0e52275807c8b..76296119a197a433747ee2481079b36aebdb085c 100644
index 13c8fab8a57eb3f90abb4bbc5a6c5b5f8bdad0d2..dd745894614982fad6277e77b98bed75fc2a2f55 100644
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
@@ -510,7 +510,7 @@ public class EntityTurtle extends EntityAnimal {
@@ -499,7 +499,7 @@ public class EntityTurtle extends EntityAnimal {
Random random = this.animal.getRandom();
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
@ -187,10 +213,10 @@ index c73cc9ae4b1f1f24e017b336b4e0e52275807c8b..76296119a197a433747ee2481079b36a
}
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 5e3835851d8c5e804542c256a54187e4ed05bace..6ca4fa43c41ad555c093b90cf08cfdb1e73fda22 100644
index d0b04707e830fbaf3a6bfe92637e4432172fd9c7..00183a7f6e2000ce045ce50454f1296c4c93b148 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -509,7 +509,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@@ -532,7 +532,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
}
if (merchantrecipe.isRewardExp()) {
@ -200,10 +226,10 @@ index 5e3835851d8c5e804542c256a54187e4ed05bace..6ca4fa43c41ad555c093b90cf08cfdb1
}
diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java
index 530c69996470ad79b93254ed39aa1b101c007c89..2ad8dba5c0f8424becacda44232813c5f4451fd4 100644
index e3a80bddc59c8f148a6a195deb3e8fa85fba4c7b..a0841cfaf950508b73b43a5fadbc1796015e5dbb 100644
--- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java
+++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java
@@ -147,7 +147,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract {
@@ -144,7 +144,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract {
if (merchantrecipe.isRewardExp()) {
int i = 3 + this.random.nextInt(4);
@ -212,24 +238,11 @@ index 530c69996470ad79b93254ed39aa1b101c007c89..2ad8dba5c0f8424becacda44232813c5
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
index 1ab2668e910dca6c02d03b88b27fe709cbee785c..2b708761d0401ead80d8ff832decc8d725c5f61c 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
@@ -117,7 +117,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
// CraftBukkit start - use event experience
if (experience > 0) {
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience));
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index f6c6ea4aaf16fae057c356bc4f42fb3a86c63f91..dff3eb118856bb4b79e4378b5c39100d65a09767 100644
index 136bb85aace4efc34e1fe804bbccc78bf7495b41..ee59d76d31b8b8cfd39d612b1e6040891f2256f4 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -374,7 +374,7 @@ public class PlayerInteractManager {
@@ -377,7 +377,7 @@ public class PlayerInteractManager {
// Drop event experience
if (flag && event != null) {
@ -252,30 +265,30 @@ index d2698e847cfcbc4d2f91b4f5d66b38b47f86c10e..edc4a5c34e8064d900668d132b3496e3
public SlotFurnaceResult(EntityHuman entityhuman, IInventory iinventory, int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index 8dc47452a453023e332303575b36732417abd84e..560e2f42b702c5c4870640ad7da3aa48c3f4b1eb 100644
index ba42ca08ca61832cb07bebcfa0b1e5422d7b30e9..623cd63711c6cb79dce7a46056e193fdb13334a5 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -554,7 +554,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
while (i > 0) {
j = EntityExperienceOrb.getOrbValue(i);
i -= j;
- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, j));
+ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, entityhuman)); // Paper
@@ -573,7 +573,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
int k = EntityExperienceOrb.getOrbValue(j);
j -= k;
- world.addEntity(new EntityExperienceOrb(world, vec3d.x, vec3d.y, vec3d.z, k));
+ world.addEntity(new EntityExperienceOrb(world, vec3d.x, vec3d.y, vec3d.z, k, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, entityhuman)); // Paper
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 4ca9ddacb7da760b31d405e77b691ef6d8ff534a..13a83f285126123811a148453ccaea6f9bf197b4 100644
index 426b25c709a8e87f409156e252ea7597c154a50b..876a62a456c8ff938cca4944b0b40a135dd6ac1c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1797,7 +1797,7 @@ public class CraftWorld implements World {
@@ -1805,7 +1805,7 @@ public class CraftWorld implements World {
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
entity = new EntityTNTPrimed(world, x, y, z, null);
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
- entity = new EntityExperienceOrb(world, x, y, z, 0);
+ entity = new EntityExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
entity = new EntityLightning(world, x, y, z, false);
entity = EntityTypes.LIGHTNING_BOLT.a(world);
} else if (Firework.class.isAssignableFrom(clazz)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
index 1b512cc45c7a185b8a7950ff9882e1f2af171cc8..fbad0456757cadea4d7f50c63dbb07bad7e8baa9 100644

View file

@ -27,10 +27,10 @@ index f164844f339793860e773c499443ce160d0a6830..751551f173338217f6682532a9a5e1a2
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 63649936525efd33f50c602f6d723085edb2896e..0b971ad8addd65850162e46707c15fbc1ba9b8b9 100644
index 8bac1e7d8ad004fc7d248ed21382ca9042dfa9b7..400e6d5784d1d92678bf26fa3dbffbe2e0424a65 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -188,6 +188,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -189,6 +189,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE;
@ -39,10 +39,10 @@ index 63649936525efd33f50c602f6d723085edb2896e..0b971ad8addd65850162e46707c15fbc
// Spigot end
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 78785c11166e3541ee9ad1615c5e6fa46cfea523..f4d68a5f0a6d28f278596cb6787d070bacd792a4 100644
index 7e4b79fcee2b5e9a2c24e0372cda7d71f38b22e3..0799f3b025c25204fddfd818b314ec1452a1ba1a 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2626,8 +2626,11 @@ public abstract class EntityLiving extends Entity {
@@ -2778,8 +2778,11 @@ public abstract class EntityLiving extends Entity {
}
}

View file

@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 7 Feb 2017 16:55:35 -0600
Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 9816b64c0760f334e508194ccb3f6b3ab54f7695..cec1baadf5e8e0459837522ca434327491005e8c 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -75,7 +75,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final PlayerMap playerMap;
public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities;
private final Long2ByteMap z;
- private final Queue<Runnable> A;
+ private final Queue<Runnable> A; private final Queue<Runnable> getUnloadQueueTasks() { return this.A; } // Paper - OBFHELPER
private int viewDistance;
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
@@ -133,7 +133,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.playerMap = new PlayerMap();
this.trackedEntities = new Int2ObjectOpenHashMap();
this.z = new Long2ByteOpenHashMap();
- this.A = Queues.newConcurrentLinkedQueue();
+ this.A = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size()
this.definedStructureManager = definedstructuremanager;
this.w = convertable_conversionsession.a(worldserver.getDimensionKey());
this.world = worldserver;
@@ -391,7 +391,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// Spigot start
org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant;
activityAccountant.startActivity(0.5);
- int targetSize = (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR);
+ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
// Spigot end
while (longiterator.hasNext()) { // Spigot
long j = longiterator.nextLong();
@@ -413,7 +413,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
Runnable runnable;
- while ((booleansupplier.getAsBoolean() || this.A.size() > 2000) && (runnable = (Runnable) this.A.poll()) != null) {
+ int queueTarget = Math.min(this.getUnloadQueueTasks().size() - 100, (int) (this.getUnloadQueueTasks().size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Target this queue as well
+ while ((booleansupplier.getAsBoolean() || this.getUnloadQueueTasks().size() > queueTarget) && (runnable = (Runnable)this.getUnloadQueueTasks().poll()) != null) { // Paper - Target this queue as well
runnable.run();
}

View file

@ -1,38 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 7 Feb 2017 16:55:35 -0600
Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 6374bf8785f7d99ab8750deba79867433d31eb5f..0edba596754c6d5379c3c1eb0469aee447b7113f 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -132,7 +132,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.u = new AtomicInteger();
this.playerMap = new PlayerMap();
this.trackedEntities = new Int2ObjectOpenHashMap();
- this.z = Queues.newConcurrentLinkedQueue();
+ this.z = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper
this.definedStructureManager = definedstructuremanager;
this.w = worldserver.getWorldProvider().getDimensionManager().a(file);
this.world = worldserver;
@@ -390,7 +390,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// Spigot start
org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant;
activityAccountant.startActivity(0.5);
- int targetSize = (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR);
+ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
// Spigot end
while (longiterator.hasNext()) { // Spigot
long j = longiterator.nextLong();
@@ -412,7 +412,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
Runnable runnable;
- while ((booleansupplier.getAsBoolean() || this.z.size() > 2000) && (runnable = (Runnable) this.z.poll()) != null) {
+ int queueTarget = Math.min(this.z.size() - 100, (int) (this.z.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Target this queue as well
+ while ((booleansupplier.getAsBoolean() || this.z.size() > queueTarget) && (runnable = (Runnable) this.z.poll()) != null) { // Paper - Target this queue as well
runnable.run();
}