summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nms-patches/Advancement.patch9
-rw-r--r--nms-patches/BlockDiodeAbstract.patch2
-rw-r--r--nms-patches/BlockFire.patch4
-rw-r--r--nms-patches/BlockObserver.patch2
-rw-r--r--nms-patches/BlockRedstoneLamp.patch2
-rw-r--r--nms-patches/Chunk.patch10
-rw-r--r--nms-patches/ChunkMap.patch31
-rw-r--r--nms-patches/ChunkProviderGenerate.patch9
-rw-r--r--nms-patches/ChunkRegionLoader.patch2
-rw-r--r--nms-patches/CommandDispatcher.patch2
-rw-r--r--nms-patches/ContainerAnvil.patch32
-rw-r--r--nms-patches/CustomFunctionData.patch6
-rw-r--r--nms-patches/DedicatedServer.patch43
-rw-r--r--nms-patches/DispenserRegistry.patch19
-rw-r--r--nms-patches/EnchantmentFrostWalker.patch4
-rw-r--r--nms-patches/Entity.patch26
-rw-r--r--nms-patches/EntityAgeable.patch4
-rw-r--r--nms-patches/EntityChicken.patch4
-rw-r--r--nms-patches/EntityCreeper.patch8
-rw-r--r--nms-patches/EntityDolphin.patch9
-rw-r--r--nms-patches/EntityEnderDragon.patch2
-rw-r--r--nms-patches/EntityEnderPearl.patch4
-rw-r--r--nms-patches/EntityEnderman.patch4
-rw-r--r--nms-patches/EntityFallingBlock.patch6
-rw-r--r--nms-patches/EntityHorseAbstract.patch4
-rw-r--r--nms-patches/EntityHuman.patch23
-rw-r--r--nms-patches/EntityIllagerIllusioner.patch13
-rw-r--r--nms-patches/EntityLiving.patch4
-rw-r--r--nms-patches/EntityMinecartAbstract.patch4
-rw-r--r--nms-patches/EntityParrot.patch16
-rw-r--r--nms-patches/EntityPhantom.patch20
-rw-r--r--nms-patches/EntityPlayer.patch44
-rw-r--r--nms-patches/EntityRabbit.patch6
-rw-r--r--nms-patches/EntitySheep.patch2
-rw-r--r--nms-patches/EntityShulker.patch9
-rw-r--r--nms-patches/EntityTurtle.patch24
-rw-r--r--nms-patches/EntityZombie.patch15
-rw-r--r--nms-patches/ExpirableListEntry.patch6
-rw-r--r--nms-patches/ExpiringMap.patch6
-rw-r--r--nms-patches/FurnaceRecipe.patch14
-rw-r--r--nms-patches/JsonList.patch23
-rw-r--r--nms-patches/LegacyPingHandler.patch8
-rw-r--r--nms-patches/LootEnchantFunction.patch9
-rw-r--r--nms-patches/LootItemConditionRandomChanceWithLooting.patch9
-rw-r--r--nms-patches/LootTableInfo.patch18
-rw-r--r--nms-patches/MethodProfiler.patch23
-rw-r--r--nms-patches/MinecraftServer.patch50
-rw-r--r--nms-patches/NameReferencingFileConverter.patch36
-rw-r--r--nms-patches/NetworkManager.patch9
-rw-r--r--nms-patches/PathfinderGoalMakeLove.patch2
-rw-r--r--nms-patches/PathfinderGoalNearestAttackableTarget.patch22
-rw-r--r--nms-patches/PlayerChunk.patch41
-rw-r--r--nms-patches/PlayerChunkMap.patch16
-rw-r--r--nms-patches/PlayerConnection.patch24
-rw-r--r--nms-patches/PlayerList.patch18
-rw-r--r--nms-patches/PortalTravelAgent.patch11
-rw-r--r--nms-patches/RegionFileCache.patch8
-rw-r--r--nms-patches/SecondaryWorldServer.patch2
-rw-r--r--nms-patches/ShapedRecipes.patch14
-rw-r--r--nms-patches/ShapelessRecipes.patch14
-rw-r--r--nms-patches/TickListServer.patch2
-rw-r--r--nms-patches/TileEntityBanner.patch2
-rw-r--r--nms-patches/TileEntityBeacon.patch4
-rw-r--r--nms-patches/TileEntityChest.patch2
-rw-r--r--nms-patches/TileEntityFurnace.patch8
-rw-r--r--nms-patches/TileEntityHopper.patch2
-rw-r--r--nms-patches/TileEntitySign.patch2
-rw-r--r--nms-patches/UserCache.patch33
-rw-r--r--nms-patches/World.patch4
-rw-r--r--nms-patches/WorldBorder.patch9
-rw-r--r--nms-patches/WorldServer.patch12
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftLootTable.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java6
-rw-r--r--src/test/java/org/bukkit/entity/EnderDragonPhaseTest.java44
80 files changed, 469 insertions, 518 deletions
diff --git a/nms-patches/Advancement.patch b/nms-patches/Advancement.patch
index 0d66cce1..1c31b840 100644
--- a/nms-patches/Advancement.patch
+++ b/nms-patches/Advancement.patch
@@ -17,6 +17,15 @@
});
this.h = (new ChatComponentText("[")).addSibling(ichatbasecomponent2).a("]").a(enumchatformat);
+@@ -55,7 +56,7 @@
+ }
+
+ public Advancement.SerializedAdvancement a() {
+- return new Advancement.SerializedAdvancement(this.a == null ? null : this.a.getName(), this.b, this.c, this.e, this.f, null);
++ return new Advancement.SerializedAdvancement(this.a == null ? null : this.a.getName(), this.b, this.c, this.e, this.f); // CraftBukkit - decompile error
+ }
+
+ @Nullable
@@ -206,7 +207,7 @@
}
diff --git a/nms-patches/BlockDiodeAbstract.patch b/nms-patches/BlockDiodeAbstract.patch
index 8b0ee45d..2ecd9be0 100644
--- a/nms-patches/BlockDiodeAbstract.patch
+++ b/nms-patches/BlockDiodeAbstract.patch
@@ -27,4 +27,4 @@
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, true), 2);
if (!flag1) {
- world.J().a(blockposition, this, this.k(iblockdata), TickListPriority.HIGH);
+ world.getBlockTickList().a(blockposition, this, this.k(iblockdata), TickListPriority.HIGH);
diff --git a/nms-patches/BlockFire.patch b/nms-patches/BlockFire.patch
index d36f2df3..6279bab5 100644
--- a/nms-patches/BlockFire.patch
+++ b/nms-patches/BlockFire.patch
@@ -58,7 +58,7 @@
int j = Math.min(15, i + random.nextInt(3) / 2);
@@ -103,14 +126,14 @@
- world.J().a(blockposition, this, this.a((IWorldReader) world) + random.nextInt(10));
+ world.getBlockTickList().a(blockposition, this, this.a((IWorldReader) world) + random.nextInt(10));
if (!this.d(world, blockposition)) {
if (!world.getType(blockposition.down()).q() || i > 3) {
- world.setAir(blockposition);
@@ -145,7 +145,7 @@
- world.setAir(blockposition);
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
} else {
- world.J().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10));
+ world.getBlockTickList().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10));
}
@@ -387,4 +432,12 @@
blockfire.a(Blocks.BLACK_CARPET, 60, 20);
diff --git a/nms-patches/BlockObserver.patch b/nms-patches/BlockObserver.patch
index 592fe5ac..f3bf60c4 100644
--- a/nms-patches/BlockObserver.patch
+++ b/nms-patches/BlockObserver.patch
@@ -26,5 +26,5 @@
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, true), 2);
- world.J().a(blockposition, this, 2);
+ world.getBlockTickList().a(blockposition, this, 2);
}
diff --git a/nms-patches/BlockRedstoneLamp.patch b/nms-patches/BlockRedstoneLamp.patch
index 72a465e3..422cfd55 100644
--- a/nms-patches/BlockRedstoneLamp.patch
+++ b/nms-patches/BlockRedstoneLamp.patch
@@ -11,7 +11,7 @@
public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
@@ -33,6 +35,11 @@
if (flag) {
- world.J().a(blockposition, this, 4);
+ world.getBlockTickList().a(blockposition, this, 4);
} else {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
diff --git a/nms-patches/Chunk.patch b/nms-patches/Chunk.patch
index d87b2e2d..a4356f0c 100644
--- a/nms-patches/Chunk.patch
+++ b/nms-patches/Chunk.patch
@@ -60,7 +60,7 @@
+ // CraftBukkit end
+
public Chunk(World world, ProtoChunk protochunk, int i, int j) {
- this(world, i, j, protochunk.getBiomeIndex(), protochunk.v(), protochunk.n(), protochunk.o(), protochunk.m());
+ this(world, i, j, protochunk.getBiomeIndex(), protochunk.v(), protochunk.k(), protochunk.l(), protochunk.m());
@@ -136,14 +175,15 @@
HeightMap.Type heightmap_type = (HeightMap.Type) iterator.next();
@@ -230,17 +230,17 @@
}
if (this.s instanceof ProtoChunkTickList) {
-- ((ProtoChunkTickList) this.s).a(this.world.J(), (blockposition) -> {
+- ((ProtoChunkTickList) this.s).a(this.world.getBlockTickList(), (blockposition) -> {
- return this.world.getType(blockposition).getBlock();
-+ ((ProtoChunkTickList<Block>) this.s).a(this.world.J(), (blockposition1) -> { // CraftBukkit - decompile error
++ ((ProtoChunkTickList<Block>) this.s).a(this.world.getBlockTickList(), (blockposition1) -> { // CraftBukkit - decompile error
+ return this.world.getType(blockposition1).getBlock();
});
}
if (this.t instanceof ProtoChunkTickList) {
-- ((ProtoChunkTickList) this.t).a(this.world.I(), (blockposition) -> {
+- ((ProtoChunkTickList) this.t).a(this.world.getFluidTickList(), (blockposition) -> {
- return this.world.getFluid(blockposition).c();
-+ ((ProtoChunkTickList<FluidType>) this.t).a(this.world.I(), (blockposition1) -> { // CraftBukkit - decompile error
++ ((ProtoChunkTickList<FluidType>) this.t).a(this.world.getFluidTickList(), (blockposition1) -> { // CraftBukkit - decompile error
+ return this.world.getFluid(blockposition1).c();
});
}
diff --git a/nms-patches/ChunkMap.patch b/nms-patches/ChunkMap.patch
index cea89b73..19e3aad4 100644
--- a/nms-patches/ChunkMap.patch
+++ b/nms-patches/ChunkMap.patch
@@ -24,34 +24,3 @@
return chunk1;
}
-@@ -69,23 +86,25 @@
- throw new RuntimeException("Not yet implemented");
- }
-
-- public Object remove(long i) {
-+ // CraftBukkit start - decompile errors
-+ public Chunk remove(long i) {
- return this.a(i);
- }
-
-- public Object put(long i, Object object) {
-+ public Chunk put(long i, Chunk object) {
- return this.a(i, (Chunk) object);
- }
-
-- public Object remove(Object object) {
-+ public Chunk remove(Object object) {
- return this.a(object);
- }
-
-- public Object put(Long olong, Object object) {
-+ public Chunk put(Long olong, Chunk object) {
- return this.a(olong, (Chunk) object);
- }
-
-- public Object put(Object object, Object object1) {
-+ public Object put(Object object, Chunk object1) {
- return this.a((Long) object, (Chunk) object1);
- }
-+ // CraftBukkit end
- }
diff --git a/nms-patches/ChunkProviderGenerate.patch b/nms-patches/ChunkProviderGenerate.patch
index f884de90..403f7a37 100644
--- a/nms-patches/ChunkProviderGenerate.patch
+++ b/nms-patches/ChunkProviderGenerate.patch
@@ -12,12 +12,3 @@
float f7 = this.o[l1 + 2 + (i2 + 2) * 5] / (f5 + 2.0F);
-@@ -267,7 +272,7 @@
- return this.a.getSeaLevel() + 1;
- }
-
-- public GeneratorSettings getSettings() {
-+ public GeneratorSettingsOverworld getSettings() { // CraftBukkit - decompile error
- return this.f();
- }
- }
diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch
index 352c4680..16101c6f 100644
--- a/nms-patches/ChunkRegionLoader.patch
+++ b/nms-patches/ChunkRegionLoader.patch
@@ -71,7 +71,7 @@
+ if (k < 1466) {
+ NBTTagCompound level = nbttagcompound1.getCompound("Level");
+ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
-+ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkProviderServer();
++ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkProvider();
+ if (check(cps, i - 1, j) && check(cps, i - 1, j - 1) && check(cps, i, j - 1)) {
+ level.setBoolean("LightPopulated", true);
+ }
diff --git a/nms-patches/CommandDispatcher.patch b/nms-patches/CommandDispatcher.patch
index dde0a788..c762ac7e 100644
--- a/nms-patches/CommandDispatcher.patch
+++ b/nms-patches/CommandDispatcher.patch
@@ -176,7 +176,7 @@
+ return b1;
+ }
} finally {
- commandlistenerwrapper.getServer().methodProfiler.e();
+ commandlistenerwrapper.getServer().methodProfiler.exit();
}
@@ -191,11 +248,36 @@
}
diff --git a/nms-patches/ContainerAnvil.patch b/nms-patches/ContainerAnvil.patch
index 890b2c47..54caf0ad 100644
--- a/nms-patches/ContainerAnvil.patch
+++ b/nms-patches/ContainerAnvil.patch
@@ -14,24 +14,24 @@
@@ -22,8 +26,15 @@
private int k;
public String renameText;
- private final EntityHuman m;
+ private final EntityHuman player;
+ // CraftBukkit start
+ public int maximumRepairCost = 40;
+ private int lastLevelCost;
+ private CraftInventoryView bukkitEntity;
-+ private PlayerInventory player;
++ private PlayerInventory playerInventory;
+ // CraftBukkit end
public ContainerAnvil(PlayerInventory playerinventory, final World world, final BlockPosition blockposition, EntityHuman entityhuman) {
-+ this.player = playerinventory; // CraftBukkit
- this.j = blockposition;
- this.i = world;
- this.m = entityhuman;
++ this.playerInventory = playerinventory; // CraftBukkit
+ this.position = blockposition;
+ this.world = world;
+ this.player = entityhuman;
@@ -111,7 +122,7 @@
byte b1 = 0;
if (itemstack.isEmpty()) {
-- this.g.setItem(0, ItemStack.a);
+- this.resultInventory.setItem(0, ItemStack.a);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
this.levelCost = 0;
} else {
@@ -40,7 +40,7 @@
if (itemstack1.e() && itemstack1.getItem().a(itemstack, itemstack2)) {
k = Math.min(itemstack1.getDamage(), itemstack1.h() / 4);
if (k <= 0) {
-- this.g.setItem(0, ItemStack.a);
+- this.resultInventory.setItem(0, ItemStack.a);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
this.levelCost = 0;
return;
@@ -49,7 +49,7 @@
this.k = i1;
} else {
if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.e())) {
-- this.g.setItem(0, ItemStack.a);
+- this.resultInventory.setItem(0, ItemStack.a);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
this.levelCost = 0;
return;
@@ -58,7 +58,7 @@
}
if (flag2 && !flag1) {
-- this.g.setItem(0, ItemStack.a);
+- this.resultInventory.setItem(0, ItemStack.a);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
this.levelCost = 0;
return;
@@ -73,8 +73,8 @@
+ this.levelCost = maximumRepairCost - 1; // CraftBukkit
}
-- if (this.levelCost >= 40 && !this.m.abilities.canInstantlyBuild) {
-+ if (this.levelCost >= maximumRepairCost && !this.m.abilities.canInstantlyBuild) { // CraftBukkit
+- if (this.levelCost >= 40 && !this.player.abilities.canInstantlyBuild) {
++ if (this.levelCost >= maximumRepairCost && !this.player.abilities.canInstantlyBuild) { // CraftBukkit
itemstack1 = ItemStack.a;
}
@@ -82,7 +82,7 @@
EnchantmentManager.a(map, itemstack1);
}
-- this.g.setItem(0, itemstack1);
+- this.resultInventory.setItem(0, itemstack1);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), itemstack1); // CraftBukkit
this.b();
}
@@ -92,7 +92,7 @@
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
- return !this.i.getType(this.j).a(TagsBlock.ANVIL) ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D;
+ return !this.world.getType(this.position).a(TagsBlock.ANVIL) ? false : entityhuman.d((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D;
}
@@ -354,4 +366,33 @@
@@ -123,8 +123,8 @@
+ }
+
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(
-+ new org.bukkit.Location(i.getWorld(), j.getX(), j.getY(), j.getZ()), this.h, this.g, this);
-+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
++ new org.bukkit.Location(world.getWorld(), position.getX(), position.getY(), position.getZ()), this.repairInventory, this.resultInventory, this);
++ bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
diff --git a/nms-patches/CustomFunctionData.patch b/nms-patches/CustomFunctionData.patch
index 8542f3a5..03f28821 100644
--- a/nms-patches/CustomFunctionData.patch
+++ b/nms-patches/CustomFunctionData.patch
@@ -13,11 +13,11 @@
}
public com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> d() {
-- return this.f.getCommandDispatcher().a();
-+ return this.f.vanillaCommandDispatcher.a(); // CraftBukkit
+- return this.server.getCommandDispatcher().a();
++ return this.server.vanillaCommandDispatcher.a(); // CraftBukkit
}
- public void Y_() {
+ public void tick() {
@@ -164,7 +164,7 @@
arraylist.add(CompletableFuture.supplyAsync(() -> {
return a(iresourcemanager, minecraftkey);
diff --git a/nms-patches/DedicatedServer.patch b/nms-patches/DedicatedServer.patch
index bb84a01c..68c4b08c 100644
--- a/nms-patches/DedicatedServer.patch
+++ b/nms-patches/DedicatedServer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/DedicatedServer.java
+++ b/net/minecraft/server/DedicatedServer.java
-@@ -23,11 +23,22 @@
+@@ -23,6 +23,17 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -18,12 +18,6 @@
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
private static final Logger LOGGER = LogManager.getLogger();
- private static final Pattern h = Pattern.compile("^[a-fA-F0-9]{40}$");
-- private final List<ServerCommand> serverCommandQueue = Collections.synchronizedList(Lists.newArrayList());
-+ private final List<ServerCommand> serverCommandQueue = Collections.synchronizedList(Lists.<ServerCommand>newArrayList()); // CraftBukkit - fix decompile error
- private RemoteStatusListener j;
- public final RemoteControlCommandListener remoteControlCommandListener = new RemoteControlCommandListener(this);
- private RemoteControlListener l;
@@ -37,8 +48,10 @@
private EnumGamemode p;
private boolean q;
@@ -106,8 +100,8 @@
DedicatedServer.LOGGER.info("Loading properties");
- this.propertyManager = new PropertyManager(new File("server.properties"));
+ this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
- this.n = new EULA(new File("eula.txt"));
- if (!this.n.a()) {
+ this.eula = new EULA(new File("eula.txt"));
+ if (!this.eula.a()) {
DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
@@ -143,6 +191,12 @@
return false;
@@ -128,7 +122,7 @@
} else {
- this.a((PlayerList) (new DedicatedPlayerList(this)));
+ this.convertable = new WorldLoaderServer(server.getWorldContainer().toPath(), server.getWorldContainer().toPath().resolve("../backups"), this.dataConverterManager); // CraftBukkit - moved from MinecraftServer constructor
- long j = SystemUtils.c();
+ long j = SystemUtils.getMonotonicNanos();
if (this.getWorld() == null) {
@@ -204,7 +258,13 @@
@@ -163,7 +157,7 @@
+ }
+ // CraftBukkit end
+
- if (this.aY() > 0L) {
+ if (this.getMaxTickTime() > 0L) {
Thread thread1 = new Thread(new ThreadWatchdog(this));
@@ -303,11 +374,11 @@
@@ -178,7 +172,7 @@
- protected void b(BooleanSupplier booleansupplier) {
+ public void b(BooleanSupplier booleansupplier) { // CraftBukkit - fix decompile error
super.b(booleansupplier);
- this.aU();
+ this.handleCommandQueue();
}
@@ -342,7 +413,15 @@
while (!this.serverCommandQueue.isEmpty()) {
@@ -197,12 +191,11 @@
}
}
-@@ -549,16 +628,75 @@
+@@ -549,12 +628,71 @@
}
public String getPlugins() {
- return "";
-- }
+ // CraftBukkit start - Whole method
+ StringBuilder result = new StringBuilder();
+ org.bukkit.plugin.Plugin[] plugins = server.getPluginManager().getPlugins();
@@ -224,11 +217,7 @@
+ result.append(plugins[i].getDescription().getVersion().replaceAll(";", ","));
+ }
+ }
-
-- public String executeRemoteCommand(String s) {
-- this.remoteControlCommandListener.clearMessages();
-- this.getCommandDispatcher().a(this.remoteControlCommandListener.f(), s);
-- return this.remoteControlCommandListener.getMessages();
++
+ return result.toString();
+ // CraftBukkit end
+ }
@@ -261,21 +250,21 @@
+ throw new RuntimeException("Interrupted processing rcon command " + s, e);
+ }
+ // CraftBukkit end
- }
-
- public PlayerList getPlayerList() {
- return this.aV();
- }
++ }
+
+ // CraftBukkit start
+ @Override
+ public PropertyManager getPropertyManager() {
+ return this.propertyManager;
-+ }
-+
+ }
+
+- public String executeRemoteCommand(String s) {
+- this.remoteControlCommandListener.clearMessages();
+- this.getCommandDispatcher().a(this.remoteControlCommandListener.f(), s);
+- return this.remoteControlCommandListener.getMessages();
+ @Override
+ public CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
+ return console;
-+ }
+ }
+ // CraftBukkit end
}
diff --git a/nms-patches/DispenserRegistry.patch b/nms-patches/DispenserRegistry.patch
index 55a8defc..edb177e3 100644
--- a/nms-patches/DispenserRegistry.patch
+++ b/nms-patches/DispenserRegistry.patch
@@ -458,6 +458,23 @@
this.a = true;
if (world.isEmpty(blockposition) && blockpumpkincarved.a((IWorldReader) world, blockposition)) {
if (!world.isClientSide) {
+@@ -336,14 +652,14 @@
+ return itemstack;
+ }
+ }));
+- BlockDispenser.a((IMaterial) Blocks.SHULKER_BOX.getItem(), (IDispenseBehavior) (new DispenserRegistry.d(null)));
++ BlockDispenser.a((IMaterial) Blocks.SHULKER_BOX.getItem(), (IDispenseBehavior) (new DispenserRegistry.d())); // CraftBukkit - decompile error
+ EnumColor[] aenumcolor = EnumColor.values();
+ int i = aenumcolor.length;
+
+ for (int j = 0; j < i; ++j) {
+ EnumColor enumcolor = aenumcolor[j];
+
+- BlockDispenser.a((IMaterial) BlockShulkerBox.a(enumcolor).getItem(), (IDispenseBehavior) (new DispenserRegistry.d(null)));
++ BlockDispenser.a((IMaterial) BlockShulkerBox.a(enumcolor).getItem(), (IDispenseBehavior) (new DispenserRegistry.d())); // CraftBukkit - decompile error
+ }
+
+ }
@@ -385,6 +701,51 @@
}
@@ -550,7 +567,7 @@
this.a = ((ItemBlock) item).a((BlockActionContext) (new DispenserRegistry.b(isourceblock.getWorld(), blockposition, enumdirection, itemstack, enumdirection1))) == EnumInteractionResult.SUCCESS;
if (this.a) {
itemstack.subtract(1);
-@@ -535,12 +920,40 @@
+@@ -531,12 +916,40 @@
d3 = 0.0D;
}
diff --git a/nms-patches/EnchantmentFrostWalker.patch b/nms-patches/EnchantmentFrostWalker.patch
index 5b87723d..ea98ad6a 100644
--- a/nms-patches/EnchantmentFrostWalker.patch
+++ b/nms-patches/EnchantmentFrostWalker.patch
@@ -16,10 +16,10 @@
if (iblockdata2.getMaterial() == Material.WATER && (Integer) iblockdata2.get(BlockFluids.LEVEL) == 0 && iblockdata.canPlace(world, blockposition_mutableblockposition1) && world.a(iblockdata, (BlockPosition) blockposition_mutableblockposition1)) {
- world.setTypeUpdate(blockposition_mutableblockposition1, iblockdata);
-- world.J().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+- world.getBlockTickList().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ // CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition_mutableblockposition1, iblockdata, entityliving)) {
-+ world.J().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
++ world.getBlockTickList().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ }
+ // CraftBukkit End
}
diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch
index ab58cf20..80926a08 100644
--- a/nms-patches/Entity.patch
+++ b/nms-patches/Entity.patch
@@ -123,7 +123,7 @@
+ public void postTick() {
+ // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle
+ if (!this.world.isClientSide && this.world instanceof WorldServer) {
-+ this.world.methodProfiler.a("portal");
++ this.world.methodProfiler.enter("portal");
+ if (this.an) {
+ MinecraftServer minecraftserver = this.world.getMinecraftServer();
+
@@ -159,13 +159,13 @@
+ }
+
+ this.E();
-+ this.world.methodProfiler.e();
++ this.world.methodProfiler.exit();
+ }
+ }
+ // CraftBukkit end
+
public void W() {
- this.world.methodProfiler.a("entityBaseTick");
+ this.world.methodProfiler.enter("entityBaseTick");
if (this.isPassenger() && this.getVehicle().dead) {
@@ -250,6 +380,8 @@
this.lastZ = this.locZ;
@@ -174,11 +174,11 @@
+ // Moved up to postTick
+ /*
if (!this.world.isClientSide && this.world instanceof WorldServer) {
- this.world.methodProfiler.a("portal");
+ this.world.methodProfiler.enter("portal");
if (this.an) {
@@ -289,6 +421,7 @@
this.E();
- this.world.methodProfiler.e();
+ this.world.methodProfiler.exit();
}
+ */
@@ -219,7 +219,7 @@
if (this.Q > 0.0F && flag && (d7 != d0 || d9 != d2)) {
@@ -592,7 +741,7 @@
- this.world.methodProfiler.a("rest");
+ this.world.methodProfiler.enter("rest");
this.recalcPosition();
this.positionChanged = d7 != d0 || d9 != d2;
- this.C = d1 != d1;
@@ -602,7 +602,7 @@
public void j(boolean flag) {
@@ -2036,19 +2387,72 @@
if (!this.world.isClientSide && !this.dead) {
- this.world.methodProfiler.a("changeDimension");
+ this.world.methodProfiler.enter("changeDimension");
MinecraftServer minecraftserver = this.bK();
- DimensionManager dimensionmanager1 = this.dimension;
- WorldServer worldserver = minecraftserver.getWorldServer(dimensionmanager1);
@@ -647,7 +647,7 @@
+
+ // Need to make sure the profiler state is reset afterwards (but we still want to time the call)
+ Entity entity = this.teleportTo(exit, true);
-+ this.world.methodProfiler.e();
++ this.world.methodProfiler.exit();
+ return entity;
+ } else {
+ return null;
@@ -671,7 +671,7 @@
this.world.kill(this);
this.dead = false;
- this.world.methodProfiler.a("reposition");
+ this.world.methodProfiler.enter("reposition");
+ /* CraftBukkit start - Handled in calculateTarget
BlockPosition blockposition;
@@ -687,7 +687,7 @@
+ worldserver1.getMinecraftServer().getPlayerList().repositionEntity(this, exit, portal);
+ // worldserver.entityJoinedWorld(this, false); // Handled in repositionEntity
+ // CraftBukkit end
- this.world.methodProfiler.c("reloading");
+ this.world.methodProfiler.exitEnter("reloading");
Entity entity = this.P().a((World) worldserver1);
if (entity != null) {
@@ -719,11 +719,11 @@
}
this.dead = true;
- this.world.methodProfiler.e();
+ this.world.methodProfiler.exit();
worldserver.p();
worldserver1.p();
-- this.world.methodProfiler.e();
-+ // this.world.methodProfiler.e(); // CraftBukkit: Moved up to keep balanced
+- this.world.methodProfiler.exit();
++ // this.world.methodProfiler.exit(); // CraftBukkit: Moved up to keep balanced
return entity;
} else {
return null;
diff --git a/nms-patches/EntityAgeable.patch b/nms-patches/EntityAgeable.patch
index 02e44b54..29aa1f78 100644
--- a/nms-patches/EntityAgeable.patch
+++ b/nms-patches/EntityAgeable.patch
@@ -34,8 +34,8 @@
public void a(DataWatcherObject<?> datawatcherobject) {
@@ -115,7 +118,7 @@
- public void k() {
- super.k();
+ public void movementTick() {
+ super.movementTick();
- if (this.world.isClientSide) {
+ if (this.world.isClientSide || ageLocked) { // CraftBukkit
if (this.c > 0) {
diff --git a/nms-patches/EntityChicken.patch b/nms-patches/EntityChicken.patch
index 11ec20a8..06badbfa 100644
--- a/nms-patches/EntityChicken.patch
+++ b/nms-patches/EntityChicken.patch
@@ -3,13 +3,13 @@
@@ -42,6 +42,11 @@
}
- public void k() {
+ public void movementTick() {
+ // CraftBukkit start
+ if (this.isChickenJockey()) {
+ this.persistent = !this.isTypeNotPersistent();
+ }
+ // CraftBukkit end
- super.k();
+ super.movementTick();
this.bG = this.bC;
this.bE = this.bD;
@@ -59,7 +64,9 @@
diff --git a/nms-patches/EntityCreeper.patch b/nms-patches/EntityCreeper.patch
index 855f9b89..b35ba7f6 100644
--- a/nms-patches/EntityCreeper.patch
+++ b/nms-patches/EntityCreeper.patch
@@ -53,18 +53,18 @@
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
float f = this.isPowered() ? 2.0F : 1.0F;
-- this.aX = true;
+- this.killed = true;
- this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, flag);
- this.die();
-- this.dF();
+- this.createEffectCloud();
+ // CraftBukkit start
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
-+ this.aX = true;
++ this.killed = true;
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
+ this.die();
-+ this.dF();
++ this.createEffectCloud();
+ } else {
+ fuseTicks = 0;
+ }
diff --git a/nms-patches/EntityDolphin.patch b/nms-patches/EntityDolphin.patch
index 8b681bd9..06ac5150 100644
--- a/nms-patches/EntityDolphin.patch
+++ b/nms-patches/EntityDolphin.patch
@@ -1,5 +1,14 @@
--- a/net/minecraft/server/EntityDolphin.java
+++ b/net/minecraft/server/EntityDolphin.java
+@@ -95,7 +95,7 @@
+ this.goalSelector.a(5, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
+ this.goalSelector.a(5, new PathfinderGoalWaterJump(this, 10));
+ this.goalSelector.a(6, new PathfinderGoalMeleeAttack(this, 1.2000000476837158D, true));
+- this.goalSelector.a(8, new EntityDolphin.d(null));
++ this.goalSelector.a(8, new EntityDolphin.d()); // CraftBukkit - decompile error
+ this.goalSelector.a(8, new PathfinderGoalFollowBoat(this));
+ this.goalSelector.a(9, new PathfinderGoalAvoidTarget(this, EntityGuardian.class, 8.0F, 1.0D, 1.0D));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityGuardian.class}));
@@ -412,7 +412,7 @@
}
diff --git a/nms-patches/EntityEnderDragon.patch b/nms-patches/EntityEnderDragon.patch
index cd259333..8f36ebfe 100644
--- a/nms-patches/EntityEnderDragon.patch
+++ b/nms-patches/EntityEnderDragon.patch
@@ -26,7 +26,7 @@
Vec3D vec3d = idragoncontroller.g();
- if (vec3d != null) {
-+ if (vec3d != null && idragoncontroller.getControllerPhase() != DragonControllerPhase.k) { // CraftBukkit - Don't move when hovering // PAIL: rename
++ if (vec3d != null && idragoncontroller.getControllerPhase() != DragonControllerPhase.HOVER) { // CraftBukkit - Don't move when hovering
d0 = vec3d.x - this.locX;
d1 = vec3d.y - this.locY;
d2 = vec3d.z - this.locZ;
diff --git a/nms-patches/EntityEnderPearl.patch b/nms-patches/EntityEnderPearl.patch
index 9f8b18a9..12b25eb0 100644
--- a/nms-patches/EntityEnderPearl.patch
+++ b/nms-patches/EntityEnderPearl.patch
@@ -20,7 +20,7 @@
- if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) {
- EntityEndermite entityendermite = new EntityEndermite(this.world);
-
-- entityendermite.a(true);
+- entityendermite.setPlayerSpawned(true);
- entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
- this.world.addEntity(entityendermite);
- }
@@ -40,7 +40,7 @@
+ if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) {
+ EntityEndermite entityendermite = new EntityEndermite(this.world);
+
-+ entityendermite.a(true);
++ entityendermite.setPlayerSpawned(true);
+ entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
+ this.world.addEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
+ }
diff --git a/nms-patches/EntityEnderman.patch b/nms-patches/EntityEnderman.patch
index f39be4b0..fbe30e3f 100644
--- a/nms-patches/EntityEnderman.patch
+++ b/nms-patches/EntityEnderman.patch
@@ -4,12 +4,12 @@
this.goalSelector.a(11, new EntityEnderman.PathfinderGoalEndermanPickupBlock(this));
this.targetSelector.a(1, new EntityEnderman.PathfinderGoalPlayerWhoLookedAtTarget(this));
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false, new Class[0]));
-- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityEndermite.class, 10, true, false, EntityEndermite::l));
+- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityEndermite.class, 10, true, false, EntityEndermite::isPlayerSpawned));
+ // CraftBukkit - decompile error
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityEndermite.class, 10, true, false, new Predicate<EntityEndermite>() {
+ @Override
+ public boolean test(EntityEndermite entityendermite) {
-+ return entityendermite.l();
++ return entityendermite.isPlayerSpawned();
+ }
+ }));
+ // CraftBukkit end
diff --git a/nms-patches/EntityFallingBlock.patch b/nms-patches/EntityFallingBlock.patch
index 0dbf54de..37b5e828 100644
--- a/nms-patches/EntityFallingBlock.patch
+++ b/nms-patches/EntityFallingBlock.patch
@@ -20,7 +20,7 @@
this.die();
@@ -112,7 +114,7 @@
- if (!flag1 && BlockFalling.k(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) {
+ if (!flag1 && BlockFalling.canFallThrough(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) {
this.onGround = false;
- return;
+ // return; // CraftBukkit
@@ -31,9 +31,9 @@
if (iblockdata.getBlock() != Blocks.MOVING_PISTON) {
this.die();
if (!this.f) {
-- if (iblockdata.getMaterial().isReplaceable() && (flag1 || !BlockFalling.k(this.world.getType(blockposition.down()))) && this.world.setTypeAndData(blockposition, this.block, 3)) {
+- if (iblockdata.getMaterial().isReplaceable() && (flag1 || !BlockFalling.canFallThrough(this.world.getType(blockposition.down()))) && this.world.setTypeAndData(blockposition, this.block, 3)) {
+ // CraftBukkit start
-+ if (iblockdata.getMaterial().isReplaceable() && (flag1 || !BlockFalling.k(this.world.getType(blockposition.down())))) {
++ if (iblockdata.getMaterial().isReplaceable() && (flag1 || !BlockFalling.canFallThrough(this.world.getType(blockposition.down())))) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.block).isCancelled()) {
+ return;
+ }
diff --git a/nms-patches/EntityHorseAbstract.patch b/nms-patches/EntityHorseAbstract.patch
index 04726e1a..8d0d0bc4 100644
--- a/nms-patches/EntityHorseAbstract.patch
+++ b/nms-patches/EntityHorseAbstract.patch
@@ -59,9 +59,9 @@
+ super.die(damagesource); // CraftBukkit
}
- public void k() {
+ public void movementTick() {
@@ -480,7 +483,7 @@
- super.k();
+ super.movementTick();
if (!this.world.isClientSide) {
if (this.random.nextInt(900) == 0 && this.deathTicks == 0) {
- this.heal(1.0F);
diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch
index 06172c79..8d81262a 100644
--- a/nms-patches/EntityHuman.patch
+++ b/nms-patches/EntityHuman.patch
@@ -171,8 +171,8 @@
}
public boolean a(EntityHuman entityhuman) {
-- ScoreboardTeamBase scoreboardteambase = this.be();
-- ScoreboardTeamBase scoreboardteambase1 = entityhuman.be();
+- ScoreboardTeamBase scoreboardteambase = this.getScoreboardTeam();
+- ScoreboardTeamBase scoreboardteambase1 = entityhuman.getScoreboardTeam();
+ // CraftBukkit start - Change to check OTHER player's scoreboard team according to API
+ // To summarize this method's logic, it's "Can parameter hurt this"
+ org.bukkit.scoreboard.Team team;
@@ -330,7 +330,15 @@
return EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE;
}
-@@ -1143,6 +1270,26 @@
+@@ -1136,13 +1263,33 @@
+ if (!this.u()) {
+ double d0 = 8.0D;
+ double d1 = 5.0D;
+- List list = this.world.a(EntityMonster.class, new AxisAlignedBB((double) blockposition.getX() - 8.0D, (double) blockposition.getY() - 5.0D, (double) blockposition.getZ() - 8.0D, (double) blockposition.getX() + 8.0D, (double) blockposition.getY() + 5.0D, (double) blockposition.getZ() + 8.0D), (Predicate) (new EntityHuman.c(this, null)));
++ List list = this.world.a(EntityMonster.class, new AxisAlignedBB((double) blockposition.getX() - 8.0D, (double) blockposition.getY() - 5.0D, (double) blockposition.getZ() - 8.0D, (double) blockposition.getX() + 8.0D, (double) blockposition.getY() + 5.0D, (double) blockposition.getZ() + 8.0D), (Predicate) (new EntityHuman.c(this))); // CraftBukkit - decompile error
+
+ if (!list.isEmpty()) {
+ return EntityHuman.EnumBedResult.NOT_SAFE;
}
}
}
@@ -442,12 +450,3 @@
}
public abstract boolean isSpectator();
-@@ -1856,7 +2032,7 @@
- return entitymonster.c(this.a);
- }
-
-- public boolean test(@Nullable Object object) {
-+ public boolean test(@Nullable EntityMonster object) { // CraftBukkit - decompile error
- return this.a((EntityMonster) object);
- }
-
diff --git a/nms-patches/EntityIllagerIllusioner.patch b/nms-patches/EntityIllagerIllusioner.patch
index 33651b67..25b148f7 100644
--- a/nms-patches/EntityIllagerIllusioner.patch
+++ b/nms-patches/EntityIllagerIllusioner.patch
@@ -1,5 +1,16 @@
--- a/net/minecraft/server/EntityIllagerIllusioner.java
+++ b/net/minecraft/server/EntityIllagerIllusioner.java
+@@ -24,8 +24,8 @@
+ super.n();
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(1, new EntityIllagerWizard.b());
+- this.goalSelector.a(4, new EntityIllagerIllusioner.b(null));
+- this.goalSelector.a(5, new EntityIllagerIllusioner.a(null));
++ this.goalSelector.a(4, new EntityIllagerIllusioner.b()); // CraftBukkit - decompile error
++ this.goalSelector.a(5, new EntityIllagerIllusioner.a()); // CraftBukkit - decompile error
+ this.goalSelector.a(6, new PathfinderGoalBowShoot(this, 0.5D, 20, 15.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomStroll(this, 0.6D));
+ this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 3.0F, 1.0F));
@@ -164,7 +164,7 @@
}
@@ -9,7 +20,7 @@
}
protected SoundEffect k() {
-@@ -199,7 +199,7 @@
+@@ -195,7 +195,7 @@
}
protected void j() {
diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch
index 1fada008..2d7a54d8 100644
--- a/nms-patches/EntityLiving.patch
+++ b/nms-patches/EntityLiving.patch
@@ -73,7 +73,7 @@
}
@@ -264,6 +304,18 @@
- this.world.methodProfiler.e();
+ this.world.methodProfiler.exit();
}
+ // CraftBukkit start
@@ -89,7 +89,7 @@
+ // CraftBukkit end
+
protected void b(BlockPosition blockposition) {
- int i = EnchantmentManager.a(Enchantments.j, this);
+ int i = EnchantmentManager.a(Enchantments.FROST_WALKER, this);
@@ -283,19 +335,19 @@
diff --git a/nms-patches/EntityMinecartAbstract.patch b/nms-patches/EntityMinecartAbstract.patch
index 0ddb6149..6737e406 100644
--- a/nms-patches/EntityMinecartAbstract.patch
+++ b/nms-patches/EntityMinecartAbstract.patch
@@ -92,11 +92,11 @@
+ // CraftBukkit - handled in postTick
+ /*
if (!this.world.isClientSide && this.world instanceof WorldServer) {
- this.world.methodProfiler.a("portal");
+ this.world.methodProfiler.enter("portal");
MinecraftServer minecraftserver = this.world.getMinecraftServer();
@@ -190,6 +242,7 @@
- this.world.methodProfiler.e();
+ this.world.methodProfiler.exit();
}
+ */
diff --git a/nms-patches/EntityParrot.patch b/nms-patches/EntityParrot.patch
index 54bd63ae..2ea16e16 100644
--- a/nms-patches/EntityParrot.patch
+++ b/nms-patches/EntityParrot.patch
@@ -1,6 +1,14 @@
--- a/net/minecraft/server/EntityParrot.java
+++ b/net/minecraft/server/EntityParrot.java
-@@ -27,7 +27,7 @@
+@@ -16,14 +16,14 @@
+ public class EntityParrot extends EntityPerchable implements EntityBird {
+
+ private static final DataWatcherObject<Integer> bL = DataWatcher.a(EntityParrot.class, DataWatcherRegistry.b);
+- private static final Predicate<EntityInsentient> bM = new Predicate() {
++ private static final Predicate<EntityInsentient> bM = new Predicate<EntityInsentient>() { // CraftBukkit - decompile error
+ public boolean test(@Nullable EntityInsentient entityinsentient) {
+ return entityinsentient != null && EntityParrot.bP.containsKey(entityinsentient.P());
+ }
};
private static final Item bN = Items.COOKIE;
private static final Set<Item> bO = Sets.newHashSet(new Item[] { Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS});
@@ -9,7 +17,7 @@
hashmap.put(EntityTypes.BLAZE, SoundEffects.ENTITY_PARROT_IMITATE_BLAZE);
hashmap.put(EntityTypes.CAVE_SPIDER, SoundEffects.ENTITY_PARROT_IMITATE_SPIDER);
hashmap.put(EntityTypes.CREEPER, SoundEffects.ENTITY_PARROT_IMITATE_CREEPER);
-@@ -174,7 +174,7 @@
+@@ -170,7 +170,7 @@
}
if (!this.world.isClientSide) {
@@ -18,7 +26,7 @@
this.c(entityhuman);
this.s(true);
this.world.broadcastEntityEffect(this, (byte) 7);
-@@ -190,7 +190,7 @@
+@@ -186,7 +186,7 @@
itemstack.subtract(1);
}
@@ -27,7 +35,7 @@
if (entityhuman.u() || !this.bl()) {
this.damageEntity(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
}
-@@ -310,7 +310,8 @@
+@@ -306,7 +306,8 @@
return false;
} else {
if (this.goalSit != null) {
diff --git a/nms-patches/EntityPhantom.patch b/nms-patches/EntityPhantom.patch
index a6589d39..eca94bc6 100644
--- a/nms-patches/EntityPhantom.patch
+++ b/nms-patches/EntityPhantom.patch
@@ -1,6 +1,22 @@
--- a/net/minecraft/server/EntityPhantom.java
+++ b/net/minecraft/server/EntityPhantom.java
-@@ -186,7 +186,7 @@
+@@ -28,10 +28,11 @@
+ }
+
+ protected void n() {
+- this.goalSelector.a(1, new EntityPhantom.c(null));
+- this.goalSelector.a(2, new EntityPhantom.i(null));
+- this.goalSelector.a(3, new EntityPhantom.e(null));
+- this.targetSelector.a(1, new EntityPhantom.b(null));
++ // CraftBukkit - decompile errors
++ this.goalSelector.a(1, new EntityPhantom.c());
++ this.goalSelector.a(2, new EntityPhantom.i());
++ this.goalSelector.a(3, new EntityPhantom.e());
++ this.targetSelector.a(1, new EntityPhantom.b());
+ }
+
+ protected void initAttributes() {
+@@ -186,7 +187,7 @@
} else {
this.b = 60;
AxisAlignedBB axisalignedbb = EntityPhantom.this.getBoundingBox().grow(16.0D, 64.0D, 16.0D);
@@ -9,7 +25,7 @@
if (!list.isEmpty()) {
list.sort((entityhuman, entityhuman1) -> {
-@@ -198,7 +198,7 @@
+@@ -198,7 +199,7 @@
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (PathfinderGoalTarget.a(EntityPhantom.this, entityhuman, false, false)) {
diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch
index e1d1c6f2..564f7049 100644
--- a/nms-patches/EntityPlayer.patch
+++ b/nms-patches/EntityPlayer.patch
@@ -104,7 +104,7 @@
@@ -132,6 +206,7 @@
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
- this.cy.a(nbttagcompound.getCompound("recipeBook"));
+ this.recipeBook.a(nbttagcompound.getCompound("recipeBook"));
}
+ this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
@@ -135,7 +135,7 @@
@@ -162,8 +250,34 @@
}
- nbttagcompound.set("recipeBook", this.cy.e());
+ nbttagcompound.set("recipeBook", this.recipeBook.e());
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
}
@@ -182,14 +182,14 @@
@@ -275,7 +394,7 @@
}
- if (this.getHealth() != this.lastHealthSent || this.co != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cp) {
+ if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cp) {
- this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel()));
+ this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel())); // CraftBukkit
this.lastHealthSent = this.getHealth();
- this.co = this.foodData.getFoodLevel();
+ this.lastFoodSent = this.foodData.getFoodLevel();
this.cp = this.foodData.getSaturationLevel() == 0.0F;
@@ -306,6 +425,12 @@
- this.a(IScoreboardCriteria.k, MathHelper.f((float) this.cm));
+ this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.cm));
}
+ // CraftBukkit start - Force max health updates
@@ -200,7 +200,7 @@
+
if (this.expLevel != this.cl) {
this.cl = this.expLevel;
- this.a(IScoreboardCriteria.l, MathHelper.f((float) this.cl));
+ this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.cl));
@@ -320,6 +445,16 @@
CriterionTriggers.p.a(this);
}
@@ -279,20 +279,20 @@
this.releaseShoulderEntities();
- if (!this.world.getGameRules().getBoolean("keepInventory") && !this.isSpectator()) {
-- this.dj();
-- this.inventory.q();
+- this.removeCursedItems();
+- this.inventory.dropContents();
+ // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
+ if (!event.getKeepInventory()) {
+ this.inventory.clear();
}
-- this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.d, this.getName(), ScoreboardScore::incrementScore);
+- this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.DEATH_COUNT, this.getName(), ScoreboardScore::incrementScore);
+ this.closeInventory();
+ this.setSpectatorTarget(this); // Remove spectated target
+ // CraftBukkit end
+
+ // CraftBukkit - Get our scores instead
-+ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getName(), ScoreboardScore::incrementScore);
++ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getName(), ScoreboardScore::incrementScore);
EntityLiving entityliving = this.cv();
if (entityliving != null) {
@@ -300,14 +300,14 @@
String s = this.getName();
String s1 = entity.getName();
-- this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.f, s, ScoreboardScore::incrementScore);
+- this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.TOTAL_KILL_COUNT, s, ScoreboardScore::incrementScore);
+ // CraftBukkit - Get our scores instead
-+ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.f, s, ScoreboardScore::incrementScore);
++ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.TOTAL_KILL_COUNT, s, ScoreboardScore::incrementScore);
if (entity instanceof EntityHuman) {
this.a(StatisticList.PLAYER_KILLS);
-- this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.e, s, ScoreboardScore::incrementScore);
+- this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.PLAYER_KILL_COUNT, s, ScoreboardScore::incrementScore);
+ // CraftBukkit - Get our scores instead
-+ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, s, ScoreboardScore::incrementScore);
++ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.PLAYER_KILL_COUNT, s, ScoreboardScore::incrementScore);
} else {
this.a(StatisticList.MOB_KILLS);
}
@@ -545,9 +545,9 @@
@@ -882,7 +1121,7 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
- this.co = -1;
-- this.cy.a((RecipeBook) entityplayer.cy);
-+ // this.cy.a((RecipeBook) entityplayer.cy); // CraftBukkit
+ this.lastFoodSent = -1;
+- this.recipeBook.a((RecipeBook) entityplayer.recipeBook);
++ // this.recipeBook.a((RecipeBook) entityplayer.recipeBook); // CraftBukkit
this.removeQueue.addAll(entityplayer.removeQueue);
this.cx = entityplayer.cx;
this.cC = entityplayer.cC;
@@ -605,11 +605,11 @@
protected void C() {
@@ -1053,7 +1315,7 @@
- this.cv = (Entity) (entity == null ? this : entity);
- if (entity1 != this.cv) {
- this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cv));
-- this.enderTeleportTo(this.cv.locX, this.cv.locY, this.cv.locZ);
-+ this.playerConnection.a(this.cv.locX, this.cv.locY, this.cv.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
+ this.spectatedEntity = (Entity) (entity == null ? this : entity);
+ if (entity1 != this.spectatedEntity) {
+ this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
+- this.enderTeleportTo(this.spectatedEntity.locX, this.spectatedEntity.locY, this.spectatedEntity.locZ);
++ this.playerConnection.a(this.spectatedEntity.locX, this.spectatedEntity.locY, this.spectatedEntity.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
}
}
diff --git a/nms-patches/EntityRabbit.patch b/nms-patches/EntityRabbit.patch
index 131620cc..0d08e2b0 100644
--- a/nms-patches/EntityRabbit.patch
+++ b/nms-patches/EntityRabbit.patch
@@ -15,12 +15,12 @@
protected void n() {
this.goalSelector.a(1, new PathfinderGoalFloat(this));
-@@ -397,9 +403,23 @@
+@@ -393,9 +399,23 @@
Integer integer = (Integer) iblockdata.get(BlockCarrots.AGE);
if (integer == 0) {
+ // CraftBukkit start
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.f, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.entity, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
@@ -29,7 +29,7 @@
} else {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
-+ this.f,
++ this.entity,
+ blockposition,
+ iblockdata.set(BlockCarrots.AGE, integer - 1)
+ ).isCancelled()) {
diff --git a/nms-patches/EntitySheep.patch b/nms-patches/EntitySheep.patch
index 5df9a4f1..0bdde89d 100644
--- a/nms-patches/EntitySheep.patch
+++ b/nms-patches/EntitySheep.patch
@@ -71,6 +71,6 @@
this.container.setItem(0, new ItemStack(ItemDye.a(enumcolor)));
this.container.setItem(1, new ItemStack(ItemDye.a(enumcolor1)));
+ this.container.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
- ItemStack itemstack = entityanimal.world.E().craft(this.container, ((EntitySheep) entityanimal).world);
+ ItemStack itemstack = entityanimal.world.getCraftingManager().craft(this.container, ((EntitySheep) entityanimal).world);
Item item = itemstack.getItem();
EnumColor enumcolor2;
diff --git a/nms-patches/EntityShulker.patch b/nms-patches/EntityShulker.patch
index 3eaf40b8..450f5b46 100644
--- a/nms-patches/EntityShulker.patch
+++ b/nms-patches/EntityShulker.patch
@@ -11,6 +11,15 @@
public class EntityShulker extends EntityGolem implements IMonster {
+@@ -44,7 +48,7 @@
+ protected void n() {
+ this.goalSelector.a(1, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(4, new EntityShulker.a());
+- this.goalSelector.a(7, new EntityShulker.e(null));
++ this.goalSelector.a(7, new EntityShulker.e()); // CraftBukkit - decompile error
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[0]));
+ this.targetSelector.a(2, new EntityShulker.d(this));
@@ -321,8 +325,17 @@
EnumDirection enumdirection = aenumdirection[k];
diff --git a/nms-patches/EntityTurtle.patch b/nms-patches/EntityTurtle.patch
index fbe0c15f..4c06eaa9 100644
--- a/nms-patches/EntityTurtle.patch
+++ b/nms-patches/EntityTurtle.patch
@@ -1,5 +1,19 @@
--- a/net/minecraft/server/EntityTurtle.java
+++ b/net/minecraft/server/EntityTurtle.java
+@@ -130,11 +130,11 @@
+ this.goalSelector.a(1, new EntityTurtle.a(this, 1.0D));
+ this.goalSelector.a(1, new EntityTurtle.d(this, 1.0D));
+ this.goalSelector.a(2, new EntityTurtle.i(this, 1.1D, Blocks.SEAGRASS.getItem()));
+- this.goalSelector.a(3, new EntityTurtle.c(this, 1.0D, null));
++ this.goalSelector.a(3, new EntityTurtle.c(this, 1.0D)); // CraftBukkit - decompile error
+ this.goalSelector.a(4, new EntityTurtle.b(this, 1.0D));
+ this.goalSelector.a(7, new EntityTurtle.j(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+- this.goalSelector.a(9, new EntityTurtle.h(this, 1.0D, 100, null));
++ this.goalSelector.a(9, new EntityTurtle.h(this, 1.0D, 100)); // CraftBukkit - decompile error
+ }
+
+ protected void initAttributes() {
@@ -232,7 +232,9 @@
protected void l() {
super.l();
@@ -20,7 +34,7 @@
}
public void die(DamageSource damagesource) {
-@@ -435,8 +439,12 @@
+@@ -423,15 +427,19 @@
} else if (this.f.bK > 200) {
World world = this.f.world;
@@ -33,3 +47,11 @@
this.f.s(false);
this.f.t(false);
this.f.d(600);
+ }
+
+ if (this.f.dz()) {
+- EntityTurtle.g(this.f);
++ this.f.bK++; // CraftBukkit - decompile error
+ }
+ }
+
diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch
index 1a0a9240..d4176432 100644
--- a/nms-patches/EntityZombie.patch
+++ b/nms-patches/EntityZombie.patch
@@ -96,15 +96,17 @@
}
}
-@@ -362,7 +395,7 @@
+@@ -362,8 +395,8 @@
EntityZombieVillager entityzombievillager = new EntityZombieVillager(this.world);
entityzombievillager.u(entityvillager);
- this.world.kill(entityvillager);
+- entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false, null), (NBTTagCompound) null);
+ // this.world.kill(entityvillager); // CraftBukkit - moved down
- entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false, null), (NBTTagCompound) null);
++ entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false), (NBTTagCompound) null); // CraftBukkit - decompile error
entityzombievillager.setProfession(entityvillager.getProfession());
entityzombievillager.setBaby(entityvillager.isBaby());
+ entityzombievillager.setNoAI(entityvillager.isNoAI());
@@ -372,7 +405,13 @@
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
}
@@ -120,6 +122,15 @@
this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0);
}
+@@ -399,7 +438,7 @@
+
+ this.p(this.random.nextFloat() < 0.55F * f);
+ if (object == null) {
+- object = new EntityZombie.GroupDataZombie(this.world.random.nextFloat() < 0.05F, null);
++ object = new EntityZombie.GroupDataZombie(this.world.random.nextFloat() < 0.05F); // CraftBukkit - decompile error
+ }
+
+ if (object instanceof EntityZombie.GroupDataZombie) {
@@ -422,7 +461,7 @@
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
diff --git a/nms-patches/ExpirableListEntry.patch b/nms-patches/ExpirableListEntry.patch
index 6b07ceff..533982ef 100644
--- a/nms-patches/ExpirableListEntry.patch
+++ b/nms-patches/ExpirableListEntry.patch
@@ -9,16 +9,12 @@
Date date;
-@@ -72,4 +72,30 @@
+@@ -72,4 +72,26 @@
jsonobject.addProperty("expires", this.d == null ? "forever" : ExpirableListEntry.a.format(this.d));
jsonobject.addProperty("reason", this.e);
}
+
+ // CraftBukkit start
-+ public String getSource() {
-+ return this.c;
-+ }
-+
+ public Date getCreated() {
+ return this.b;
+ }
diff --git a/nms-patches/ExpiringMap.patch b/nms-patches/ExpiringMap.patch
index 874be687..16adacb2 100644
--- a/nms-patches/ExpiringMap.patch
+++ b/nms-patches/ExpiringMap.patch
@@ -12,7 +12,7 @@
public class ExpiringMap<T> extends Long2ObjectOpenHashMap<T> {
@@ -21,11 +23,17 @@
- long j = SystemUtils.b();
+ long j = SystemUtils.getMonotonicMillis();
this.b.put(i, j);
- ObjectIterator objectiterator = this.b.long2LongEntrySet().iterator();
@@ -21,7 +21,7 @@
+ }
+
+ public void cleanup() {
-+ long j = SystemUtils.b();
++ long j = SystemUtils.getMonotonicMillis();
+ ObjectIterator<Long2LongMap.Entry> objectiterator = this.b.long2LongEntrySet().iterator(); // CraftBukkit - decompile error
while (objectiterator.hasNext()) {
@@ -48,7 +48,7 @@
+ // CraftBukkit start
+ @Override
+ public T computeIfAbsent(long l, LongFunction<? extends T> lf) {
-+ this.b.put(l, SystemUtils.b());
++ this.b.put(l, SystemUtils.getMonotonicMillis());
+ return super.computeIfAbsent(l, lf);
+ }
+
diff --git a/nms-patches/FurnaceRecipe.patch b/nms-patches/FurnaceRecipe.patch
index a26f71d9..ef5091f1 100644
--- a/nms-patches/FurnaceRecipe.patch
+++ b/nms-patches/FurnaceRecipe.patch
@@ -41,17 +41,3 @@
public static class a implements RecipeSerializer<FurnaceRecipe> {
public a() {}
-@@ -106,11 +133,11 @@
- return "smelting";
- }
-
-- public IRecipe a(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) {
-+ public FurnaceRecipe a(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) { // CraftBukkit - decompile error
- return this.b(minecraftkey, packetdataserializer);
- }
-
-- public IRecipe a(MinecraftKey minecraftkey, JsonObject jsonobject) {
-+ public FurnaceRecipe a(MinecraftKey minecraftkey, JsonObject jsonobject) { // CraftBukkit - decompile error
- return this.b(minecraftkey, jsonobject);
- }
- }
diff --git a/nms-patches/JsonList.patch b/nms-patches/JsonList.patch
index 0db0f198..f443fe22 100644
--- a/nms-patches/JsonList.patch
+++ b/nms-patches/JsonList.patch
@@ -1,5 +1,14 @@
--- a/net/minecraft/server/JsonList.java
+++ b/net/minecraft/server/JsonList.java
+@@ -56,7 +56,7 @@
+ this.c = file;
+ GsonBuilder gsonbuilder = (new GsonBuilder()).setPrettyPrinting();
+
+- gsonbuilder.registerTypeHierarchyAdapter(JsonListEntry.class, new JsonList.JsonListEntrySerializer(null));
++ gsonbuilder.registerTypeHierarchyAdapter(JsonListEntry.class, new JsonList.JsonListEntrySerializer()); // CraftBukkit - decompile error
+ this.b = gsonbuilder.create();
+ }
+
@@ -86,7 +86,7 @@
@Nullable
public V get(K k0) {
@@ -40,17 +49,3 @@
}
}
}
-@@ -212,11 +218,11 @@
- }
- }
-
-- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
-+ public JsonElement serialize(JsonListEntry<K> object, Type type, JsonSerializationContext jsonserializationcontext) { // CraftBukkit - fix decompile error
- return this.a((JsonListEntry) object, type, jsonserializationcontext);
- }
-
-- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
-+ public JsonListEntry<K> deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // CraftBukkit - fix decompile error
- return this.a(jsonelement, type, jsondeserializationcontext);
- }
-
diff --git a/nms-patches/LegacyPingHandler.patch b/nms-patches/LegacyPingHandler.patch
index 98526ece..b5efd460 100644
--- a/nms-patches/LegacyPingHandler.patch
+++ b/nms-patches/LegacyPingHandler.patch
@@ -4,12 +4,12 @@
MinecraftServer minecraftserver = this.b.d();
int i = bytebuf.readableBytes();
String s;
-+ org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.y(), minecraftserver.z()); // CraftBukkit
++ org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); // CraftBukkit
switch (i) {
case 0:
LegacyPingHandler.a.debug("Ping: (<1.3.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
-- s = String.format("%s\u00a7%d\u00a7%d", new Object[] { minecraftserver.getMotd(), minecraftserver.y(), minecraftserver.z()});
+- s = String.format("%s\u00a7%d\u00a7%d", new Object[] { minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()});
+ s = String.format("%s\u00a7%d\u00a7%d", new Object[] { event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit
this.a(channelhandlercontext, this.a(s));
break;
@@ -18,7 +18,7 @@
}
LegacyPingHandler.a.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
-- s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.y(), minecraftserver.z()});
+- s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()});
+ s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit
this.a(channelhandlercontext, this.a(s));
break;
@@ -27,7 +27,7 @@
}
LegacyPingHandler.a.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
-- String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.y(), minecraftserver.z()});
+- String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()});
+ String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit
ByteBuf bytebuf1 = this.a(s1);
diff --git a/nms-patches/LootEnchantFunction.patch b/nms-patches/LootEnchantFunction.patch
index af3c6d1c..24cf4e94 100644
--- a/nms-patches/LootEnchantFunction.patch
+++ b/nms-patches/LootEnchantFunction.patch
@@ -15,12 +15,3 @@
return itemstack;
}
-@@ -57,7 +62,7 @@
- return new LootEnchantFunction(alootitemcondition, (LootValueBounds) ChatDeserializer.a(jsonobject, "count", jsondeserializationcontext, LootValueBounds.class), i);
- }
-
-- public LootItemFunction b(JsonObject jsonobject, JsonDeserializationContext jsondeserializationcontext, LootItemCondition[] alootitemcondition) {
-+ public LootEnchantFunction b(JsonObject jsonobject, JsonDeserializationContext jsondeserializationcontext, LootItemCondition[] alootitemcondition) { // CraftBukkit - decompile error
- return this.a(jsonobject, jsondeserializationcontext, alootitemcondition);
- }
- }
diff --git a/nms-patches/LootItemConditionRandomChanceWithLooting.patch b/nms-patches/LootItemConditionRandomChanceWithLooting.patch
index 078a8684..111d6a0b 100644
--- a/nms-patches/LootItemConditionRandomChanceWithLooting.patch
+++ b/nms-patches/LootItemConditionRandomChanceWithLooting.patch
@@ -12,12 +12,3 @@
return random.nextFloat() < this.a + (float) i * this.b;
}
-@@ -40,7 +45,7 @@
- return new LootItemConditionRandomChanceWithLooting(ChatDeserializer.l(jsonobject, "chance"), ChatDeserializer.l(jsonobject, "looting_multiplier"));
- }
-
-- public LootItemCondition b(JsonObject jsonobject, JsonDeserializationContext jsondeserializationcontext) {
-+ public LootItemConditionRandomChanceWithLooting b(JsonObject jsonobject, JsonDeserializationContext jsondeserializationcontext) { // CraftBukkit - decompile error
- return this.a(jsonobject, jsondeserializationcontext);
- }
- }
diff --git a/nms-patches/LootTableInfo.patch b/nms-patches/LootTableInfo.patch
index 41fb44e6..cb701f45 100644
--- a/nms-patches/LootTableInfo.patch
+++ b/nms-patches/LootTableInfo.patch
@@ -26,21 +26,7 @@
}
@Nullable
-@@ -124,11 +127,11 @@
- return LootTableInfo.EntityTarget.a(jsonreader.nextString());
- }
-
-- public Object read(JsonReader jsonreader) throws IOException {
-+ public LootTableInfo.EntityTarget read(JsonReader jsonreader) throws IOException { // CraftBukkit - decompile error
- return this.a(jsonreader);
- }
-
-- public void write(JsonWriter jsonwriter, Object object) throws IOException {
-+ public void write(JsonWriter jsonwriter, LootTableInfo.EntityTarget object) throws IOException { // CraftBukkit - decompile error
- this.a(jsonwriter, (LootTableInfo.EntityTarget) object);
- }
- }
-@@ -138,6 +141,7 @@
+@@ -130,6 +133,7 @@
private final WorldServer a;
private float b;
@@ -48,7 +34,7 @@
private Entity c;
private EntityHuman d;
private DamageSource e;
-@@ -172,8 +176,15 @@
+@@ -164,8 +168,15 @@
return this;
}
diff --git a/nms-patches/MethodProfiler.patch b/nms-patches/MethodProfiler.patch
index 0b8930e6..c4d954a2 100644
--- a/nms-patches/MethodProfiler.patch
+++ b/nms-patches/MethodProfiler.patch
@@ -19,7 +19,7 @@
@@ -52,6 +54,7 @@
}
- public void a(String s) {
+ public void enter(String s) {
+ if (!ENABLED) return; // CraftBukkit
if (this.d) {
if (!this.e.isEmpty()) {
@@ -30,14 +30,14 @@
public void a(Supplier<String> supplier) {
+ if (!ENABLED) return; // CraftBukkit
if (this.d) {
- this.a((String) supplier.get());
+ this.enter((String) supplier.get());
}
}
- public void e() {
+ public void exit() {
+ if (!ENABLED) return; // CraftBukkit
if (this.d && !this.c.isEmpty()) {
- long i = SystemUtils.c();
+ long i = SystemUtils.getMonotonicNanos();
long j = (Long) this.c.remove(this.c.size() - 1);
@@ -92,6 +97,7 @@
}
@@ -50,10 +50,10 @@
@@ -154,11 +160,13 @@
}
- public void c(String s) {
+ public void exitEnter(String s) {
+ if (!ENABLED) return; // CraftBukkit
- this.e();
- this.a(s);
+ this.exit();
+ this.enter(s);
}
public String f() {
@@ -61,12 +61,3 @@
return this.b.isEmpty() ? "[UNKNOWN]" : (String) this.b.get(this.b.size() - 1);
}
-@@ -178,7 +186,7 @@
- return methodprofiler_profilerinfo.a < this.a ? -1 : (methodprofiler_profilerinfo.a > this.a ? 1 : methodprofiler_profilerinfo.c.compareTo(this.c));
- }
-
-- public int compareTo(Object object) {
-+ public int compareTo(MethodProfiler.ProfilerInfo object) { // CraftBukkit: decompile error
- return this.a((MethodProfiler.ProfilerInfo) object);
- }
- }
diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch
index c4053f53..e5c12e98 100644
--- a/nms-patches/MinecraftServer.patch
+++ b/nms-patches/MinecraftServer.patch
@@ -49,10 +49,10 @@
this.W = gameprofilerepository;
this.X = usercache;
- this.universe = file;
-- this.l = file == null ? null : new ServerConnection(this);
+- this.serverConnection = file == null ? null : new ServerConnection(this);
- this.convertable = file == null ? null : new WorldLoaderServer(file.toPath(), file.toPath().resolve("../backups"), datafixer);
+ // this.universe = file; // CraftBukkit
-+ this.l = new ServerConnection(this); // CraftBukkit
++ this.serverConnection = new ServerConnection(this); // CraftBukkit
+ // this.convertable = file == null ? null : new WorldLoaderServer(file.toPath(), file.toPath().resolve("../backups"), datafixer); // CraftBukkit - moved to DedicatedServer.init
this.dataConverterManager = datafixer;
this.ac.a((IResourcePackListener) this.ah);
@@ -189,7 +189,7 @@
+ world = (WorldServer) (new WorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), gen)).i_();
+ }
-- SecondaryWorldServer secondaryworldserver = (new SecondaryWorldServer(this, idatamanager, DimensionManager.NETHER, worldserver, this.methodProfiler)).b();
+- SecondaryWorldServer secondaryworldserver = (new SecondaryWorldServer(this, idatamanager, DimensionManager.NETHER, worldserver, this.methodProfiler)).i_();
+ world.a(worldsettings);
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
+ } else {
@@ -203,7 +203,7 @@
+ File newWorld = new File(new File(name), dim);
+ File oldWorld = new File(new File(s), dim);
-- SecondaryWorldServer secondaryworldserver1 = (new SecondaryWorldServer(this, idatamanager, DimensionManager.THE_END, worldserver, this.methodProfiler)).b();
+- SecondaryWorldServer secondaryworldserver1 = (new SecondaryWorldServer(this, idatamanager, DimensionManager.THE_END, worldserver, this.methodProfiler)).i_();
+ if ((!newWorld.isDirectory()) && (oldWorld.isDirectory())) {
+ MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder required ----");
+ MinecraftServer.LOGGER.info("Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly.");
@@ -246,7 +246,7 @@
+ worlddata = new WorldData(worldsettings, name);
+ }
+ worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
-+ world = (WorldServer) new SecondaryWorldServer(this, idatamanager, DimensionManager.a(dimension), this.getWorldServer(DimensionManager.OVERWORLD), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen).b();
++ world = (WorldServer) new SecondaryWorldServer(this, idatamanager, DimensionManager.a(dimension), this.getWorldServer(DimensionManager.OVERWORLD), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen).i_();
+ }
+
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld()));
@@ -319,7 +319,7 @@
+ continue;
}
-- CompletableFuture completablefuture = worldserver.getChunkProviderServer().a((Iterable) arraylist, (chunk) -> {
+- CompletableFuture completablefuture = worldserver.getChunkProvider().a((Iterable) arraylist, (chunk) -> {
- set.add(chunk.getPos());
- });
+ BlockPosition blockposition = worldserver.getSpawn();
@@ -340,7 +340,7 @@
- if (executionexception.getCause() instanceof RuntimeException) {
- throw (RuntimeException) executionexception.getCause();
- }
-+ CompletableFuture completablefuture = worldserver.getChunkProviderServer().a((Iterable) arraylist, (chunk) -> {
++ CompletableFuture completablefuture = worldserver.getChunkProvider().a((Iterable) arraylist, (chunk) -> {
+ set.add(chunk.getPos());
+ });
+
@@ -415,25 +415,25 @@
}
@@ -452,6 +624,7 @@
MinecraftServer.LOGGER.info("Saving players");
- this.s.savePlayers();
- this.s.u();
+ this.playerList.savePlayers();
+ this.playerList.u();
+ try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
MinecraftServer.LOGGER.info("Saving worlds");
@@ -516,11 +689,13 @@
- if (i > 2000L && this.aa - this.Q >= 15000L) {
+ if (i > 2000L && this.nextTick - this.lastOverloadTime >= 15000L) {
long j = i / 50L;
+ if (server.getWarnOnOverload()) // CraftBukkit
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
- this.aa += j * 50L;
- this.Q = this.aa;
+ this.nextTick += j * 50L;
+ this.lastOverloadTime = this.nextTick;
}
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
- this.a(this::aT);
- this.aa += 50L;
+ this.a(this::canSleepForTick);
+ this.nextTick += 50L;
@@ -559,6 +734,12 @@
} catch (Throwable throwable1) {
@@ -454,20 +454,20 @@
- if (this.ticks % 900 == 0) {
+ if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
- this.methodProfiler.a("save");
- this.s.savePlayers();
+ this.methodProfiler.enter("save");
+ this.playerList.savePlayers();
this.saveChunks(true);
@@ -653,6 +834,7 @@
}
public void b(BooleanSupplier booleansupplier) {
+ this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit
- this.methodProfiler.a("jobs");
+ this.methodProfiler.enter("jobs");
FutureTask futuretask;
@@ -665,23 +847,40 @@
- this.getFunctionData().Y_();
- this.methodProfiler.c("levels");
+ this.getFunctionData().tick();
+ this.methodProfiler.exitEnter("levels");
- WorldServer worldserver;
+ // CraftBukkit start
@@ -491,12 +491,12 @@
- for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();((long[]) this.e.computeIfAbsent(worldserver.worldProvider.getDimensionManager(), (dimensionmanager) -> {
- return new long[100];
-- }))[this.ticks % 100] = SystemUtils.c() - i) {
+- }))[this.ticks % 100] = SystemUtils.getMonotonicNanos() - i) {
- worldserver = (WorldServer) iterator.next();
+ // CraftBukkit - dropTickTime
+ for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();) {
+ WorldServer worldserver = (WorldServer) iterator.next();
- i = SystemUtils.c();
+ i = SystemUtils.getMonotonicNanos();
- if (worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) {
+ if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit
this.methodProfiler.a(() -> {
@@ -504,13 +504,13 @@
});
+ /* Drop global time updates
if (this.ticks % 20 == 0) {
- this.methodProfiler.a("timeSync");
- this.s.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))), worldserver.worldProvider.getDimensionManager());
- this.methodProfiler.e();
+ this.methodProfiler.enter("timeSync");
+ this.playerList.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))), worldserver.worldProvider.getDimensionManager());
+ this.methodProfiler.exit();
}
+ // CraftBukkit end */
- this.methodProfiler.a("tick");
+ this.methodProfiler.enter("tick");
@@ -732,10 +931,11 @@
this.k.add(itickable);
diff --git a/nms-patches/NameReferencingFileConverter.patch b/nms-patches/NameReferencingFileConverter.patch
index b2978b2f..9877efe9 100644
--- a/nms-patches/NameReferencingFileConverter.patch
+++ b/nms-patches/NameReferencingFileConverter.patch
@@ -12,6 +12,15 @@
}
}
+@@ -113,7 +114,7 @@
+ public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) {
+ NameReferencingFileConverter.e.warn("Could not lookup user banlist entry for {}", gameprofile.getName(), exception);
+ if (!(exception instanceof ProfileNotFoundException)) {
+- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null);
++ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error
+ }
+ }
+ };
@@ -141,8 +142,9 @@
if (ipbanlist.c().exists()) {
try {
@@ -36,6 +45,15 @@
}
}
+@@ -198,7 +201,7 @@
+ public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) {
+ NameReferencingFileConverter.e.warn("Could not lookup oplist entry for {}", gameprofile.getName(), exception);
+ if (!(exception instanceof ProfileNotFoundException)) {
+- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null);
++ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error
+ }
+ }
+ };
@@ -226,8 +229,9 @@
if (whitelist.c().exists()) {
try {
@@ -48,6 +66,24 @@
}
}
+@@ -242,7 +246,7 @@
+ public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) {
+ NameReferencingFileConverter.e.warn("Could not lookup user whitelist entry for {}", gameprofile.getName(), exception);
+ if (!(exception instanceof ProfileNotFoundException)) {
+- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null);
++ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error
+ }
+ }
+ };
+@@ -337,7 +341,7 @@
+
+ this.a(file, s, s);
+ } else {
+- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null);
++ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error
+ }
+ }
+
@@ -345,6 +349,30 @@
File file1 = new File(file2, s + ".dat");
File file3 = new File(file, s1 + ".dat");
diff --git a/nms-patches/NetworkManager.patch b/nms-patches/NetworkManager.patch
index 5caf383c..e9b6393d 100644
--- a/nms-patches/NetworkManager.patch
+++ b/nms-patches/NetworkManager.patch
@@ -27,12 +27,3 @@
this.n = ichatbasecomponent;
}
-@@ -319,7 +319,7 @@
- }
- }
-
-- protected void channelRead0(ChannelHandlerContext channelhandlercontext, Object object) throws Exception {
-+ protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet object) throws Exception { // CraftBukkit - fix decompile error
- this.a(channelhandlercontext, (Packet) object);
- }
-
diff --git a/nms-patches/PathfinderGoalMakeLove.patch b/nms-patches/PathfinderGoalMakeLove.patch
index 4ef924b9..58d75f19 100644
--- a/nms-patches/PathfinderGoalMakeLove.patch
+++ b/nms-patches/PathfinderGoalMakeLove.patch
@@ -3,7 +3,7 @@
@@ -80,6 +80,11 @@
private void i() {
- EntityVillager entityvillager = this.a.b((EntityAgeable) this.b);
+ EntityVillager entityvillager = this.a.createChild(this.b);
+ // CraftBukkit start - call EntityBreedEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityvillager, this.a, this.b, null, null, 0).isCancelled()) {
+ return;
diff --git a/nms-patches/PathfinderGoalNearestAttackableTarget.patch b/nms-patches/PathfinderGoalNearestAttackableTarget.patch
index 7ca3e982..e306d1b2 100644
--- a/nms-patches/PathfinderGoalNearestAttackableTarget.patch
+++ b/nms-patches/PathfinderGoalNearestAttackableTarget.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
+++ b/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
-@@ -44,11 +44,11 @@
+@@ -44,18 +44,18 @@
return false;
} else {
Collections.sort(list, this.b);
@@ -12,22 +12,17 @@
- this.d = this.e.world.a(this.e.locX, this.e.locY + (double) this.e.getHeadHeight(), this.e.locZ, this.i(), this.i(), new Function() {
+ this.d = (T) this.e.world.a(this.e.locX, this.e.locY + (double) this.e.getHeadHeight(), this.e.locZ, this.i(), this.i(), new Function<EntityHuman, Double>() { // CraftBukkit - fix decompile error
@Nullable
- public Double a(@Nullable EntityHuman entityhuman) {
+ public Double apply(@Nullable EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.getEquipment(EnumItemSlot.HEAD);
-@@ -57,10 +57,10 @@
- }
- @Nullable
-- public Object apply(@Nullable Object object) {
-+ public Double apply(@Nullable EntityHuman object) { // CraftBukkit - fix decompile error
- return this.a((EntityHuman) object);
+ return (!(PathfinderGoalNearestAttackableTarget.this.e instanceof EntitySkeleton) || itemstack.getItem() != Items.SKELETON_SKULL) && (!(PathfinderGoalNearestAttackableTarget.this.e instanceof EntityZombie) || itemstack.getItem() != Items.ZOMBIE_HEAD) && (!(PathfinderGoalNearestAttackableTarget.this.e instanceof EntityCreeper) || itemstack.getItem() != Items.CREEPER_HEAD) ? 1.0D : 0.5D;
}
- }, this.c);
+ }, (Predicate<EntityHuman>) this.c); // CraftBukkit - fix decompile error
return this.d != null;
}
}
-@@ -70,7 +70,7 @@
+@@ -65,7 +65,7 @@
}
public void c() {
@@ -36,12 +31,3 @@
super.c();
}
-@@ -89,7 +89,7 @@
- return d0 < d1 ? -1 : (d0 > d1 ? 1 : 0);
- }
-
-- public int compare(Object object, Object object1) {
-+ public int compare(Entity object, Entity object1) { // CraftBukkit - fix decompile error
- return this.a((Entity) object, (Entity) object1);
- }
- }
diff --git a/nms-patches/PlayerChunk.patch b/nms-patches/PlayerChunk.patch
deleted file mode 100644
index 14c17553..00000000
--- a/nms-patches/PlayerChunk.patch
+++ /dev/null
@@ -1,41 +0,0 @@
---- a/net/minecraft/server/PlayerChunk.java
-+++ b/net/minecraft/server/PlayerChunk.java
-@@ -7,21 +7,36 @@
- import javax.annotation.Nullable;
- import org.apache.logging.log4j.LogManager;
- import org.apache.logging.log4j.Logger;
-+// CraftBukkit Start
-+import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
-+// CraftBukkit end
-
- public class PlayerChunk {
-
- private static final Logger a = LogManager.getLogger();
- private final PlayerChunkMap playerChunkMap;
-- private final List<EntityPlayer> c = Lists.newArrayList();
-+ public final List<EntityPlayer> c = Lists.newArrayList(); // CraftBukkit - public
- private final ChunkCoordIntPair location;
- private final short[] dirtyBlocks = new short[64];
- @Nullable
-- private Chunk chunk;
-+ public Chunk chunk; // CraftBukkit - public
- private int dirtyCount;
- private int h;
- private long i;
- private boolean done;
-
-+ // CraftBukkit start - add fields
-+ // You know the drill, https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse
-+ // All may seem good at first, but there's deeper issues if you play for a bit
-+ private boolean loadInProgress = false;
-+ private Runnable loadedRunnable = new Runnable() {
-+ public void run() {
-+ loadInProgress = false;
-+ PlayerChunk.this.chunk = PlayerChunk.this.playerChunkMap.getWorld().getChunkProviderServer().getChunkAt(location.x, location.z, true, true);
-+ }
-+ };
-+ // CraftBukkit end
-+
- public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) {
- this.playerChunkMap = playerchunkmap;
- this.location = new ChunkCoordIntPair(i, j);
diff --git a/nms-patches/PlayerChunkMap.patch b/nms-patches/PlayerChunkMap.patch
index 40a1805e..0639fafd 100644
--- a/nms-patches/PlayerChunkMap.patch
+++ b/nms-patches/PlayerChunkMap.patch
@@ -19,7 +19,7 @@
public PlayerChunkMap(WorldServer worldserver) {
this.world = worldserver;
-@@ -107,16 +112,18 @@
+@@ -103,16 +108,18 @@
if (this.l && i % 4L == 0L) {
this.l = false;
@@ -42,7 +42,7 @@
}
if (!this.h.isEmpty()) {
-@@ -141,7 +148,11 @@
+@@ -137,7 +144,11 @@
break;
}
}
@@ -54,7 +54,7 @@
}
}
-@@ -203,6 +214,16 @@
+@@ -199,6 +210,16 @@
return playerchunk;
}
@@ -62,7 +62,7 @@
+ public final boolean isChunkInUse(int x, int z) {
+ PlayerChunk pi = getChunk(x, z);
+ if (pi != null) {
-+ return (pi.c.size() > 0);
++ return (pi.players.size() > 0);
+ }
+ return false;
+ }
@@ -71,7 +71,7 @@
public void flagDirty(BlockPosition blockposition) {
int i = blockposition.getX() >> 4;
int j = blockposition.getZ() >> 4;
-@@ -221,12 +242,22 @@
+@@ -217,12 +238,22 @@
entityplayer.d = entityplayer.locX;
entityplayer.e = entityplayer.locZ;
@@ -95,7 +95,7 @@
this.managedPlayers.add(entityplayer);
this.e();
}
-@@ -270,11 +301,14 @@
+@@ -266,11 +297,14 @@
int j1 = i - k;
int k1 = j - l;
@@ -111,7 +111,7 @@
}
if (!this.a(l1 - j1, i2 - k1, i, j, i1)) {
-@@ -290,6 +324,13 @@
+@@ -286,6 +320,13 @@
entityplayer.d = entityplayer.locX;
entityplayer.e = entityplayer.locZ;
this.e();
@@ -125,7 +125,7 @@
}
}
}
-@@ -374,4 +415,47 @@
+@@ -370,4 +411,47 @@
}
}
diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch
index dc4ef720..5d4a3de2 100644
--- a/nms-patches/PlayerConnection.patch
+++ b/nms-patches/PlayerConnection.patch
@@ -52,8 +52,8 @@
private static final Logger LOGGER = LogManager.getLogger();
@@ -27,7 +71,10 @@
- private long f;
- private boolean g;
+ private long lastKeepAlive;
+ private boolean awaitingKeepAlive;
private long h;
- private int chatThrottle;
+ // CraftBukkit start - multithreaded fields
@@ -95,21 +95,21 @@
}
+ // CraftBukkit end
- public void Y_() {
+ public void tick() {
this.syncPosition();
@@ -105,7 +178,7 @@
- this.minecraftServer.methodProfiler.a("keepAlive");
- long i = SystemUtils.b();
+ this.minecraftServer.methodProfiler.enter("keepAlive");
+ long i = SystemUtils.getMonotonicMillis();
-- if (i - this.f >= 15000L) {
-+ if (i - this.f >= 25000L) { // CraftBukkit
- if (this.g) {
+- if (i - this.lastKeepAlive >= 15000L) {
++ if (i - this.lastKeepAlive >= 25000L) { // CraftBukkit
+ if (this.awaitingKeepAlive) {
this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
} else {
@@ -117,15 +190,21 @@
}
- this.minecraftServer.methodProfiler.e();
+ this.minecraftServer.methodProfiler.exit();
+ // CraftBukkit start
+ for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ;
+ /* Use thread-safe field access instead
@@ -123,7 +123,7 @@
--this.j;
}
- if (this.player.F() > 0L && this.minecraftServer.getIdleTimeout() > 0 && SystemUtils.b() - this.player.F() > (long) (this.minecraftServer.getIdleTimeout() * 1000 * 60)) {
+ if (this.player.F() > 0L && this.minecraftServer.getIdleTimeout() > 0 && SystemUtils.getMonotonicMillis() - this.player.F() > (long) (this.minecraftServer.getIdleTimeout() * 1000 * 60)) {
+ this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854
this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0]));
}
@@ -1600,8 +1600,8 @@
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
+ PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit
- if (this.g && packetplayinkeepalive.b() == this.h) {
- int i = (int) (SystemUtils.b() - this.f);
+ if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) {
+ int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive);
@@ -1222,7 +2330,17 @@
diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch
index 8fe54067..6de4d27f 100644
--- a/nms-patches/PlayerList.patch
+++ b/nms-patches/PlayerList.patch
@@ -481,7 +481,7 @@
+ entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
+ // CraftBukkit end
- worldserver.getChunkProviderServer().getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4, true, true);
+ worldserver.getChunkProvider().getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4, true, true);
- while (!worldserver.getCubes(entityplayer1, entityplayer1.getBoundingBox()) && entityplayer1.locY < 256.0D) {
+ while (avoidSuffocation && !worldserver.getCubes(entityplayer1, entityplayer1.getBoundingBox()) && entityplayer1.locY < 256.0D) {
@@ -635,7 +635,7 @@
float f = entity.yaw;
+ */
- worldserver.methodProfiler.a("moving");
+ worldserver.methodProfiler.enter("moving");
- if (entity.dimension == DimensionManager.NETHER) {
+ if (worldserver1.dimension == DimensionManager.NETHER) {
d0 = MathHelper.a(d0 / 8.0D, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
@@ -679,9 +679,9 @@
+ */
}
- worldserver.methodProfiler.e();
+ worldserver.methodProfiler.exit();
@@ -542,22 +865,119 @@
- worldserver.methodProfiler.a("placing");
+ worldserver.methodProfiler.enter("placing");
d0 = (double) MathHelper.clamp((int) d0, -29999872, 29999872);
d1 = (double) MathHelper.clamp((int) d1, -29999872, 29999872);
+ /*
@@ -693,7 +693,7 @@
}
+ */
+
-+ worldserver.methodProfiler.e();
++ worldserver.methodProfiler.exit();
+ }
+
+ // entity.spawnIn(worldserver1);
@@ -713,7 +713,7 @@
+ float f = entity.yaw;
+ */
+
-+ worldserver.methodProfiler.a("moving");
++ worldserver.methodProfiler.enter("moving");
+ entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch());
+ if (entity.isAlive()) {
+ worldserver.entityJoinedWorld(entity, false);
@@ -754,9 +754,9 @@
+ }
+ */
+
-+ worldserver.methodProfiler.e();
++ worldserver.methodProfiler.exit();
+ if (dimensionmanager != DimensionManager.THE_END) {
-+ worldserver.methodProfiler.a("placing");
++ worldserver.methodProfiler.enter("placing");
+ /*
+ d0 = (double) MathHelper.clamp((int) d0, -29999872, 29999872);
+ d1 = (double) MathHelper.clamp((int) d1, -29999872, 29999872);
@@ -776,7 +776,7 @@
+ worldserver1.entityJoinedWorld(entity, false);
+ }
- worldserver.methodProfiler.e();
+ worldserver.methodProfiler.exit();
}
entity.spawnIn(worldserver1);
diff --git a/nms-patches/PortalTravelAgent.patch b/nms-patches/PortalTravelAgent.patch
index 2ad05052..f7ab8e66 100644
--- a/nms-patches/PortalTravelAgent.patch
+++ b/nms-patches/PortalTravelAgent.patch
@@ -276,14 +276,3 @@
d4 = d1 * d1 + d3 * d3 + d2 * d2;
if (d0 < 0.0D || d4 < d0) {
d0 = d4;
-@@ -354,5 +468,10 @@
- super(blockposition.getX(), blockposition.getY(), blockposition.getZ());
- this.b = i;
- }
-+
-+ @Override
-+ public int compareTo(BaseBlockPosition o) {
-+ return this.l(o);
-+ }
- }
- }
diff --git a/nms-patches/RegionFileCache.patch b/nms-patches/RegionFileCache.patch
index aef8ddb9..9258d3e1 100644
--- a/nms-patches/RegionFileCache.patch
+++ b/nms-patches/RegionFileCache.patch
@@ -8,18 +8,18 @@
+ public static synchronized RegionFile b(File file, int i, int j) {
+ File file1 = new File(file, "region");
+ File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca");
-+ RegionFile regionfile = (RegionFile) RegionFileCache.a.get(file2);
++ RegionFile regionfile = (RegionFile) RegionFileCache.cache.get(file2);
+
+ if (regionfile != null) {
+ return regionfile;
+ } else if (file1.exists() && file2.exists()) {
-+ if (RegionFileCache.a.size() >= 256) {
++ if (RegionFileCache.cache.size() >= 256) {
+ a();
+ }
+
+ RegionFile regionfile1 = new RegionFile(file2);
+
-+ RegionFileCache.a.put(file2, regionfile1);
++ RegionFileCache.cache.put(file2, regionfile1);
+ return regionfile1;
+ } else {
+ return null;
@@ -28,7 +28,7 @@
+ // CraftBukkit end
+
public static synchronized void a() {
- Iterator iterator = RegionFileCache.a.values().iterator();
+ Iterator iterator = RegionFileCache.cache.values().iterator();
@@ -55,16 +78,32 @@
}
diff --git a/nms-patches/SecondaryWorldServer.patch b/nms-patches/SecondaryWorldServer.patch
index 9a941819..f0a83f94 100644
--- a/nms-patches/SecondaryWorldServer.patch
+++ b/nms-patches/SecondaryWorldServer.patch
@@ -24,7 +24,7 @@
- protected void a() {}
+ // protected void a() {} // CraftBukkit
- public SecondaryWorldServer b() {
+ public SecondaryWorldServer i_() {
String s = PersistentVillage.a(this.worldProvider);
@@ -51,7 +55,7 @@
this.villages.a((World) this);
diff --git a/nms-patches/ShapedRecipes.patch b/nms-patches/ShapedRecipes.patch
index 519a9f35..827b8c90 100644
--- a/nms-patches/ShapedRecipes.patch
+++ b/nms-patches/ShapedRecipes.patch
@@ -85,17 +85,3 @@
public MinecraftKey getKey() {
return this.key;
}
-@@ -302,11 +373,11 @@
- packetdataserializer.a(shapedrecipes.result);
- }
-
-- public IRecipe a(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) {
-+ public ShapedRecipes a(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) { // CraftBukkit - decompile error
- return this.b(minecraftkey, packetdataserializer);
- }
-
-- public IRecipe a(MinecraftKey minecraftkey, JsonObject jsonobject) {
-+ public ShapedRecipes a(MinecraftKey minecraftkey, JsonObject jsonobject) { // CraftBukkit - decompile error
- return this.b(minecraftkey, jsonobject);
- }
- }
diff --git a/nms-patches/ShapelessRecipes.patch b/nms-patches/ShapelessRecipes.patch
index 8b7e92dd..9e7a932a 100644
--- a/nms-patches/ShapelessRecipes.patch
+++ b/nms-patches/ShapelessRecipes.patch
@@ -41,17 +41,3 @@
public MinecraftKey getKey() {
return this.key;
}
-@@ -127,11 +154,11 @@
- packetdataserializer.a(shapelessrecipes.result);
- }
-
-- public IRecipe a(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) {
-+ public ShapelessRecipes a(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) { // CraftBukkit - decompile error
- return this.b(minecraftkey, packetdataserializer);
- }
-
-- public IRecipe a(MinecraftKey minecraftkey, JsonObject jsonobject) {
-+ public ShapelessRecipes a(MinecraftKey minecraftkey, JsonObject jsonobject) { // CraftBukkit - decompile error
- return this.b(minecraftkey, jsonobject);
- }
- }
diff --git a/nms-patches/TickListServer.patch b/nms-patches/TickListServer.patch
index 50a952e3..4cc3e3ca 100644
--- a/nms-patches/TickListServer.patch
+++ b/nms-patches/TickListServer.patch
@@ -37,7 +37,7 @@
+ // CraftBukkit end
}
- this.f.methodProfiler.a("cleaning");
+ this.f.methodProfiler.enter("cleaning");
- NextTickListEntry nextticklistentry;
+ NextTickListEntry<T> nextticklistentry; // CraftBukkit - decompile error
diff --git a/nms-patches/TileEntityBanner.patch b/nms-patches/TileEntityBanner.patch
index 4f501b82..1c10a36a 100644
--- a/nms-patches/TileEntityBanner.patch
+++ b/nms-patches/TileEntityBanner.patch
@@ -3,7 +3,7 @@
@@ -30,6 +30,11 @@
if (nbttagcompound != null && nbttagcompound.hasKeyOfType("Patterns", 9)) {
- this.patterns = nbttagcompound.getList("Patterns", 10).c();
+ this.patterns = nbttagcompound.getList("Patterns", 10).clone();
+ // CraftBukkit start
+ while (this.patterns.size() > 20) {
+ this.patterns.remove(20);
diff --git a/nms-patches/TileEntityBeacon.patch b/nms-patches/TileEntityBeacon.patch
index 914439e0..2b2bf7ed 100644
--- a/nms-patches/TileEntityBeacon.patch
+++ b/nms-patches/TileEntityBeacon.patch
@@ -57,7 +57,7 @@
this.world.a((EntityHuman) null, this.position, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
-- private void D() {
+- private void applyEffects() {
- if (this.i && this.levels > 0 && !this.world.isClientSide && this.primaryEffect != null) {
- double d0 = (double) (this.levels * 10 + 10);
+ // CraftBukkit start - split into components
@@ -123,7 +123,7 @@
+ }
+ }
+
-+ private void D() {
++ private void applyEffects() {
+ if (this.i && this.levels > 0 && !this.world.isClientSide && this.primaryEffect != null) {
+ byte b0 = getAmplification();
+
diff --git a/nms-patches/TileEntityChest.patch b/nms-patches/TileEntityChest.patch
index 44cba102..c4e28bbb 100644
--- a/nms-patches/TileEntityChest.patch
+++ b/nms-patches/TileEntityChest.patch
@@ -51,7 +51,7 @@
+ return maxStack; // CraftBukkit
}
- public void Y_() {
+ public void tick() {
@@ -170,8 +199,20 @@
if (this.f < 0) {
this.f = 0;
diff --git a/nms-patches/TileEntityFurnace.patch b/nms-patches/TileEntityFurnace.patch
index e71bc3fd..a775a281 100644
--- a/nms-patches/TileEntityFurnace.patch
+++ b/nms-patches/TileEntityFurnace.patch
@@ -51,14 +51,14 @@
@@ -219,7 +253,7 @@
}
- public void Y_() {
+ public void tick() {
- boolean flag = this.isBurning();
+ boolean flag = this.getBlock().get(BlockFurnace.LIT); // CraftBukkit - SPIGOT-844 - Check if furnace block is lit using the block instead of burn time
boolean flag1 = false;
if (this.isBurning()) {
@@ -237,9 +271,20 @@
- IRecipe irecipe = this.world.E().b(this, this.world);
+ IRecipe irecipe = this.world.getCraftingManager().b(this, this.world);
if (!this.isBurning() && this.canBurn(irecipe)) {
- this.burnTime = fuelTime(itemstack);
@@ -92,8 +92,8 @@
}
private int s() {
-- FurnaceRecipe furnacerecipe = (FurnaceRecipe) this.world.E().b(this, this.world);
-+ FurnaceRecipe furnacerecipe = (this.hasWorld()) ? (FurnaceRecipe) this.world.E().b(this, this.world) : null; // CraftBukkit - SPIGOT-4302
+- FurnaceRecipe furnacerecipe = (FurnaceRecipe) this.world.getCraftingManager().b(this, this.world);
++ FurnaceRecipe furnacerecipe = (this.hasWorld()) ? (FurnaceRecipe) this.world.getCraftingManager().b(this, this.world) : null; // CraftBukkit - SPIGOT-4302
return furnacerecipe != null ? furnacerecipe.h() : 200;
}
diff --git a/nms-patches/TileEntityHopper.patch b/nms-patches/TileEntityHopper.patch
index 41cba66f..4115190f 100644
--- a/nms-patches/TileEntityHopper.patch
+++ b/nms-patches/TileEntityHopper.patch
@@ -55,7 +55,7 @@
+ return maxStack; // CraftBukkit
}
- public void Y_() {
+ public void tick() {
@@ -165,7 +199,28 @@
for (int i = 0; i < this.getSize(); ++i) {
if (!this.getItem(i).isEmpty()) {
diff --git a/nms-patches/TileEntitySign.patch b/nms-patches/TileEntitySign.patch
index 8cd01331..9362d3fc 100644
--- a/nms-patches/TileEntitySign.patch
+++ b/nms-patches/TileEntitySign.patch
@@ -66,7 +66,7 @@
+ // CraftBukkit start
+ @Override
+ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
-+ return wrapper.f() != null ? wrapper.f().getBukkitSender(wrapper) : new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper, this);
++ return wrapper.getEntity() != null ? wrapper.getEntity().getBukkitSender(wrapper) : new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper, this);
+ }
+ // CraftBukkit end
+
diff --git a/nms-patches/UserCache.patch b/nms-patches/UserCache.patch
index a91279c6..8883cde8 100644
--- a/nms-patches/UserCache.patch
+++ b/nms-patches/UserCache.patch
@@ -9,17 +9,30 @@
private final GameProfileRepository g;
protected final Gson b;
private final File h;
-@@ -330,11 +330,11 @@
- }
- }
+@@ -69,7 +69,7 @@
+ this.h = file;
+ GsonBuilder gsonbuilder = new GsonBuilder();
-- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
-+ public JsonElement serialize(UserCacheEntry object, Type type, JsonSerializationContext jsonserializationcontext) { // CraftBukkit - decompile error
- return this.a((UserCache.UserCacheEntry) object, type, jsonserializationcontext);
+- gsonbuilder.registerTypeHierarchyAdapter(UserCache.UserCacheEntry.class, new UserCache.BanEntrySerializer(null));
++ gsonbuilder.registerTypeHierarchyAdapter(UserCache.UserCacheEntry.class, new UserCache.BanEntrySerializer()); // CraftBukkit - decompile error
+ this.b = gsonbuilder.create();
+ this.b();
+ }
+@@ -120,7 +120,7 @@
+ date = calendar.getTime();
}
-- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
-+ public UserCacheEntry deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // CraftBukkit - decompile error
- return this.a(jsonelement, type, jsondeserializationcontext);
- }
+- UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date, null);
++ UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date); // CraftBukkit - decompile error
+
+ if (this.e.containsKey(uuid)) {
+ UserCache.UserCacheEntry usercache_usercacheentry1 = (UserCache.UserCacheEntry) this.e.get(uuid);
+@@ -314,7 +314,7 @@
+ return null;
+ }
+- return UserCache.this.new UserCacheEntry(new GameProfile(uuid, s1), date, null);
++ return UserCache.this.new UserCacheEntry(new GameProfile(uuid, s1), date); // CraftBukkit - decompile error
+ } else {
+ return null;
+ }
diff --git a/nms-patches/World.patch b/nms-patches/World.patch
index 012f4cfe..19dc116c 100644
--- a/nms-patches/World.patch
+++ b/nms-patches/World.patch
@@ -168,7 +168,7 @@
} else {
IBlockData iblockdata2 = this.getType(blockposition);
@@ -168,6 +294,7 @@
- this.methodProfiler.e();
+ this.methodProfiler.exit();
}
+ /*
@@ -465,7 +465,7 @@
});
entity.tick();
+ entity.postTick(); // CraftBukkit
- this.methodProfiler.e();
+ this.methodProfiler.exit();
}
}
@@ -1310,11 +1582,18 @@
diff --git a/nms-patches/WorldBorder.patch b/nms-patches/WorldBorder.patch
index f28a690f..b1420a70 100644
--- a/nms-patches/WorldBorder.patch
+++ b/nms-patches/WorldBorder.patch
@@ -8,6 +8,15 @@
public WorldBorder() {}
+@@ -108,7 +109,7 @@
+ }
+
+ public void transitionSizeBetween(double d0, double d1, long i) {
+- this.i = (WorldBorder.a) (d0 != d1 ? new WorldBorder.b(d0, d1, i, null) : new WorldBorder.c(d1));
++ this.i = (WorldBorder.a) (d0 != d1 ? new WorldBorder.b(d0, d1, i) : new WorldBorder.c(d1)); // CraftBukkit - decompile error
+ Iterator iterator = this.k().iterator();
+
+ while (iterator.hasNext()) {
@@ -124,6 +125,7 @@
}
diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch
index bde040ab..bd17e446 100644
--- a/nms-patches/WorldServer.patch
+++ b/nms-patches/WorldServer.patch
@@ -223,21 +223,21 @@
@@ -128,9 +271,12 @@
}
- this.methodProfiler.a("spawner");
+ this.methodProfiler.enter("spawner");
- if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
- this.spawnerCreature.a(this, this.allowMonsters, this.allowAnimals, this.worldData.getTime() % 400L == 0L);
-- this.getChunkProviderServer().a(this, this.allowMonsters, this.allowAnimals);
+- this.getChunkProvider().a(this, this.allowMonsters, this.allowAnimals);
+ // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
+ long time = this.worldData.getTime();
+ if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) {
+ this.spawnerCreature.a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L);
-+ this.getChunkProviderServer().a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L));
++ this.getChunkProvider().a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L));
+ // CraftBukkit end
}
- this.methodProfiler.c("chunkSource");
+ this.methodProfiler.exitEnter("chunkSource");
@@ -160,6 +306,8 @@
- this.methodProfiler.e();
+ this.methodProfiler.exit();
this.an();
this.P = false;
+
@@ -413,7 +413,7 @@
WorldServer.a.warn("Unable to find spawn biome");
}
@@ -647,6 +848,7 @@
- ChunkProviderServer chunkproviderserver = this.getChunkProviderServer();
+ ChunkProviderServer chunkproviderserver = this.getChunkProvider();
if (chunkproviderserver.d()) {
+ org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
index 8822e6b9..d76fe60f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
@@ -39,7 +39,7 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
@Override
public Collection<ItemStack> populateLoot(Random random, LootContext context) {
LootTableInfo nmsContext = convertContext(context);
- List<net.minecraft.server.ItemStack> nmsItems = handle.a(random, nmsContext); // PAIL rename populateLoot
+ List<net.minecraft.server.ItemStack> nmsItems = handle.populateLoot(random, nmsContext);
Collection<ItemStack> bukkit = new ArrayList<>(nmsItems.size());
for (net.minecraft.server.ItemStack item : nmsItems) {
@@ -59,7 +59,7 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
IInventory handle = craftInventory.getInventory();
// TODO: When events are added, call event here w/ custom reason?
- getHandle().a(handle, random, nmsContext); // PAIL rename fillInventory
+ getHandle().fillInventory(handle, random, nmsContext);
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f97be218..f86cc694 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -962,7 +962,7 @@ public final class CraftServer implements Server {
}
BlockPosition chunkcoordinates = internal.getSpawn();
- internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4, true, true);
+ internal.getChunkProvider().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4, true, true);
}
}
}
@@ -978,7 +978,7 @@ public final class CraftServer implements Server {
long k = longiterator.nextLong();
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(k);
- internal.getChunkProviderServer().getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, true, true);
+ internal.getChunkProvider().getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, true, true);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 944595a1..27ebfb30 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -140,7 +140,7 @@ public class CraftWorld implements World {
}
public Chunk getChunkAt(int x, int z) {
- return this.world.getChunkProviderServer().getChunkAt(x, z, true, true).bukkitChunk;
+ return this.world.getChunkProvider().getChunkAt(x, z, true, true).bukkitChunk;
}
public Chunk getChunkAt(Block block) {
@@ -148,16 +148,16 @@ public class CraftWorld implements World {
}
public boolean isChunkLoaded(int x, int z) {
- return world.getChunkProviderServer().isLoaded(x, z);
+ return world.getChunkProvider().isLoaded(x, z);
}
@Override
public boolean isChunkGenerated(int x, int z) {
- return isChunkLoaded(x, z) || ((ChunkRegionLoader) world.getChunkProviderServer().chunkLoader).chunkExists(x, z);
+ return isChunkLoaded(x, z) || ((ChunkRegionLoader) world.getChunkProvider().chunkLoader).chunkExists(x, z);
}
public Chunk[] getLoadedChunks() {
- Object[] chunks = world.getChunkProviderServer().chunks.values().toArray();
+ Object[] chunks = world.getChunkProvider().chunks.values().toArray();
org.bukkit.Chunk[] craftChunks = new CraftChunk[chunks.length];
for (int i = 0; i < chunks.length; i++) {
@@ -193,9 +193,9 @@ public class CraftWorld implements World {
return false;
}
- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkAt(x, z, false, false);
+ net.minecraft.server.Chunk chunk = world.getChunkProvider().getChunkAt(x, z, false, false);
if (chunk != null) {
- world.getChunkProviderServer().unload(chunk);
+ world.getChunkProvider().unload(chunk);
}
return true;
@@ -210,13 +210,13 @@ public class CraftWorld implements World {
}
private boolean unloadChunk0(int x, int z, boolean save) {
- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkAt(x, z, false, false);
+ net.minecraft.server.Chunk chunk = world.getChunkProvider().getChunkAt(x, z, false, false);
if (chunk == null) {
return true;
}
// If chunk had previously been queued to save, must do save to avoid loss of that data
- return world.getChunkProviderServer().unloadChunk(chunk, chunk.mustSave || save);
+ return world.getChunkProvider().unloadChunk(chunk, chunk.mustSave || save);
}
public boolean regenerateChunk(int x, int z) {
@@ -225,9 +225,9 @@ public class CraftWorld implements World {
}
final long chunkKey = ChunkCoordIntPair.a(x, z);
- world.getChunkProviderServer().unloadQueue.remove(chunkKey);
+ world.getChunkProvider().unloadQueue.remove(chunkKey);
- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().generateChunk(x, z);
+ net.minecraft.server.Chunk chunk = world.getChunkProvider().generateChunk(x, z);
PlayerChunk playerChunk = world.getPlayerChunkMap().getChunk(x, z);
if (playerChunk != null) {
playerChunk.chunk = chunk;
@@ -266,7 +266,7 @@ public class CraftWorld implements World {
public boolean loadChunk(int x, int z, boolean generate) {
chunkLoadCount++;
- return world.getChunkProviderServer().getChunkAt(x, z, true, generate) != null;
+ return world.getChunkProvider().getChunkAt(x, z, true, generate) != null;
}
public boolean isChunkLoaded(Chunk chunk) {
@@ -1723,7 +1723,7 @@ public class CraftWorld implements World {
@Override
public Location locateNearestStructure(Location origin, StructureType structureType, int radius, boolean findUnexplored) {
BlockPosition originPos = new BlockPosition(origin.getX(), origin.getY(), origin.getZ());
- BlockPosition nearest = getHandle().getChunkProviderServer().getChunkGenerator().findNearestMapFeature(getHandle(), structureType.getName(), originPos, radius, findUnexplored);
+ BlockPosition nearest = getHandle().getChunkProvider().getChunkGenerator().findNearestMapFeature(getHandle(), structureType.getName(), originPos, radius, findUnexplored);
return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
}
@@ -1738,7 +1738,7 @@ public class CraftWorld implements World {
return;
}
- ChunkProviderServer cps = world.getChunkProviderServer();
+ ChunkProviderServer cps = world.getChunkProvider();
for (net.minecraft.server.Chunk chunk : cps.chunks.values()) {
// If in use, skip it
if (isChunkInUse(chunk.locX, chunk.locZ)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
index 771eea2d..31c5d97e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
@@ -28,11 +28,11 @@ public class CraftEndermite extends CraftMonster implements Endermite {
@Override
public boolean isPlayerSpawned() {
- return getHandle().l(); // PAIL
+ return getHandle().isPlayerSpawned();
}
@Override
public void setPlayerSpawned(boolean playerSpawned) {
- getHandle().a(playerSpawned); // PAIL
+ getHandle().setPlayerSpawned(playerSpawned);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index 8c8fa453..3f2948a5 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -174,7 +174,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
}
@Override
- public int e() {
+ public int getGenerationDepth() {
return world.getHeight();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java
index aaa1bc1c..fd5280e0 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java
@@ -108,7 +108,7 @@ public class NormalChunkGenerator<C extends GeneratorSettings> extends InternalC
}
@Override
- public int e() {
- return generator.e(); // PAIL: Gen depth
+ public int getGenerationDepth() {
+ return generator.getGenerationDepth();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 19e52317..dc344be4 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -421,7 +421,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
continue;
}
- EquipmentSlot slot = CraftEquipmentSlot.getSlot(EnumItemSlot.a(slotName.toLowerCase(Locale.ROOT))); // PAIL rename fromName
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(EnumItemSlot.fromName(slotName.toLowerCase(Locale.ROOT)));
if (slot == null) {
modifiers.put(attribute, attribMod);
continue;
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index 3cf5deac..b1ecf5a5 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -44,17 +44,17 @@ public class DummyGeneratorAccess implements GeneratorAccess {
}
@Override
- public TickList<Block> J() {
+ public TickList<Block> getBlockTickList() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- public TickList<FluidType> I() {
+ public TickList<FluidType> getFluidTickList() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- public IChunkAccess b(int i, int i1) {
+ public IChunkAccess getChunkAt(int i, int i1) {
throw new UnsupportedOperationException("Not supported yet.");
}
diff --git a/src/test/java/org/bukkit/entity/EnderDragonPhaseTest.java b/src/test/java/org/bukkit/entity/EnderDragonPhaseTest.java
index 8bd4e82c..7e8d5a0e 100644
--- a/src/test/java/org/bukkit/entity/EnderDragonPhaseTest.java
+++ b/src/test/java/org/bukkit/entity/EnderDragonPhaseTest.java
@@ -20,31 +20,31 @@ public class EnderDragonPhaseTest {
@Test
public void testBukkitToMinecraft() {
- Assert.assertEquals("CIRCLING", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.CIRCLING), DragonControllerPhase.a); // PAIL: Rename HOLDING_PATTERN
- Assert.assertEquals("STRAFING", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.STRAFING), DragonControllerPhase.b); // PAIL: Rename STRAFE_PLAYER
- Assert.assertEquals("FLY_TO_PORTAL", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.FLY_TO_PORTAL), DragonControllerPhase.c); // PAIL: Rename LANDING_APPROACH
- Assert.assertEquals("LAND_ON_PORTAL", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.LAND_ON_PORTAL), DragonControllerPhase.d); // PAIL: Rename LANDING
- Assert.assertEquals("LEAVE_PORTAL", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.LEAVE_PORTAL), DragonControllerPhase.e); // PAIL: Rename TAKEOFF
- Assert.assertEquals("BREATH_ATTACK", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.BREATH_ATTACK), DragonControllerPhase.f); // PAIL: Rename SITTING_FLAMING
- Assert.assertEquals("SEARCH_FOR_BREATH_ATTACK_TARGET", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.SEARCH_FOR_BREATH_ATTACK_TARGET), DragonControllerPhase.g); // PAIL: Rename SITTING_SCANNING
- Assert.assertEquals("ROAR_BEFORE_ATTACK", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.ROAR_BEFORE_ATTACK), DragonControllerPhase.h); // PAIL: Rename SITTING_ATTACKING
- Assert.assertEquals("CHARGE_PLAYER", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.CHARGE_PLAYER), DragonControllerPhase.i); // PAIL: Rename CHARGING_PLAYER
- Assert.assertEquals("DYING", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.DYING), DragonControllerPhase.j); // PAIL: Rename DYING
- Assert.assertEquals("HOVER", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.HOVER), DragonControllerPhase.k); // PAIL: Rename HOVER
+ Assert.assertEquals("CIRCLING", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.CIRCLING), DragonControllerPhase.HOLDING_PATTERN);
+ Assert.assertEquals("STRAFING", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.STRAFING), DragonControllerPhase.STRAFE_PLAYER);
+ Assert.assertEquals("FLY_TO_PORTAL", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.FLY_TO_PORTAL), DragonControllerPhase.LANDING_APPROACH);
+ Assert.assertEquals("LAND_ON_PORTAL", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.LAND_ON_PORTAL), DragonControllerPhase.LANDING);
+ Assert.assertEquals("LEAVE_PORTAL", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.LEAVE_PORTAL), DragonControllerPhase.TAKEOFF);
+ Assert.assertEquals("BREATH_ATTACK", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.BREATH_ATTACK), DragonControllerPhase.SITTING_FLAMING);
+ Assert.assertEquals("SEARCH_FOR_BREATH_ATTACK_TARGET", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.SEARCH_FOR_BREATH_ATTACK_TARGET), DragonControllerPhase.SITTING_SCANNING);
+ Assert.assertEquals("ROAR_BEFORE_ATTACK", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.ROAR_BEFORE_ATTACK), DragonControllerPhase.SITTING_ATTACKING);
+ Assert.assertEquals("CHARGE_PLAYER", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.CHARGE_PLAYER), DragonControllerPhase.CHARGING_PLAYER);
+ Assert.assertEquals("DYING", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.DYING), DragonControllerPhase.DYING);
+ Assert.assertEquals("HOVER", CraftEnderDragon.getMinecraftPhase(EnderDragon.Phase.HOVER), DragonControllerPhase.HOVER);
}
@Test
public void testMinecraftToBukkit() {
- Assert.assertEquals("CIRCLING", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.a), EnderDragon.Phase.CIRCLING);
- Assert.assertEquals("STRAFING", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.b), EnderDragon.Phase.STRAFING);
- Assert.assertEquals("FLY_TO_PORTAL", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.c), EnderDragon.Phase.FLY_TO_PORTAL);
- Assert.assertEquals("LAND_ON_PORTAL", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.d), EnderDragon.Phase.LAND_ON_PORTAL);
- Assert.assertEquals("LEAVE_PORTAL", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.e), EnderDragon.Phase.LEAVE_PORTAL);
- Assert.assertEquals("BREATH_ATTACK", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.f), EnderDragon.Phase.BREATH_ATTACK);
- Assert.assertEquals("SEARCH_FOR_BREATH_ATTACK_TARGET", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.g), EnderDragon.Phase.SEARCH_FOR_BREATH_ATTACK_TARGET);
- Assert.assertEquals("ROAR_BEFORE_ATTACK", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.h), EnderDragon.Phase.ROAR_BEFORE_ATTACK);
- Assert.assertEquals("CHARGE_PLAYER", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.i), EnderDragon.Phase.CHARGE_PLAYER);
- Assert.assertEquals("DYING", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.j), EnderDragon.Phase.DYING);
- Assert.assertEquals("HOVER", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.k), EnderDragon.Phase.HOVER);
+ Assert.assertEquals("CIRCLING", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.HOLDING_PATTERN), EnderDragon.Phase.CIRCLING);
+ Assert.assertEquals("STRAFING", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.STRAFE_PLAYER), EnderDragon.Phase.STRAFING);
+ Assert.assertEquals("FLY_TO_PORTAL", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.LANDING_APPROACH), EnderDragon.Phase.FLY_TO_PORTAL);
+ Assert.assertEquals("LAND_ON_PORTAL", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.LANDING), EnderDragon.Phase.LAND_ON_PORTAL);
+ Assert.assertEquals("LEAVE_PORTAL", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.TAKEOFF), EnderDragon.Phase.LEAVE_PORTAL);
+ Assert.assertEquals("BREATH_ATTACK", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.SITTING_FLAMING), EnderDragon.Phase.BREATH_ATTACK);
+ Assert.assertEquals("SEARCH_FOR_BREATH_ATTACK_TARGET", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.SITTING_SCANNING), EnderDragon.Phase.SEARCH_FOR_BREATH_ATTACK_TARGET);
+ Assert.assertEquals("ROAR_BEFORE_ATTACK", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.SITTING_ATTACKING), EnderDragon.Phase.ROAR_BEFORE_ATTACK);
+ Assert.assertEquals("CHARGE_PLAYER", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.CHARGING_PLAYER), EnderDragon.Phase.CHARGE_PLAYER);
+ Assert.assertEquals("DYING", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.DYING), EnderDragon.Phase.DYING);
+ Assert.assertEquals("HOVER", CraftEnderDragon.getBukkitPhase(DragonControllerPhase.HOVER), EnderDragon.Phase.HOVER);
}
}