diff --git a/Bukkit-Patches/0001-POM-Changes.patch b/Bukkit-Patches/0001-POM-Changes.patch index 2d0e155d4a..6b91295f81 100644 --- a/Bukkit-Patches/0001-POM-Changes.patch +++ b/Bukkit-Patches/0001-POM-Changes.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - bukkit + org.spigotmc + spigot-api - 1.8-R0.1-SNAPSHOT + 1.8.3-R0.1-SNAPSHOT jar - Bukkit diff --git a/CraftBukkit-Patches/0001-POM-Changes.patch b/CraftBukkit-Patches/0001-POM-Changes.patch index 02822ba575..5d4d5e2747 100644 --- a/CraftBukkit-Patches/0001-POM-Changes.patch +++ b/CraftBukkit-Patches/0001-POM-Changes.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc + spigot jar - 1.8-R0.1-SNAPSHOT + 1.8.3-R0.1-SNAPSHOT - CraftBukkit - http://www.bukkit.org + Spigot @@ -41,6 +41,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - org.bukkit - bukkit ++ net.sf.trove4j ++ trove4j ++ 3.0.3 ++ ++ + org.spigotmc + spigot-api ${project.version} diff --git a/CraftBukkit-Patches/0002-mc-dev-imports.patch b/CraftBukkit-Patches/0002-mc-dev-imports.patch index 0447b61cfe..6bedb56e76 100644 --- a/CraftBukkit-Patches/0002-mc-dev-imports.patch +++ b/CraftBukkit-Patches/0002-mc-dev-imports.patch @@ -46,100 +46,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return d0; + } +} -diff --git a/src/main/java/net/minecraft/server/BanEntrySerializer.java b/src/main/java/net/minecraft/server/BanEntrySerializer.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/BanEntrySerializer.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import com.google.gson.JsonDeserializationContext; -+import com.google.gson.JsonDeserializer; -+import com.google.gson.JsonElement; -+import com.google.gson.JsonObject; -+import com.google.gson.JsonSerializationContext; -+import com.google.gson.JsonSerializer; -+import com.mojang.authlib.GameProfile; -+import java.lang.reflect.Type; -+import java.text.ParseException; -+import java.util.Date; -+import java.util.UUID; -+ -+class BanEntrySerializer implements JsonDeserializer, JsonSerializer { -+ -+ final UserCache a; -+ -+ private BanEntrySerializer(UserCache usercache) { -+ this.a = usercache; -+ } -+ -+ public JsonElement a(UserCacheEntry usercacheentry, Type type, JsonSerializationContext jsonserializationcontext) { -+ JsonObject jsonobject = new JsonObject(); -+ -+ jsonobject.addProperty("name", usercacheentry.a().getName()); -+ UUID uuid = usercacheentry.a().getId(); -+ -+ jsonobject.addProperty("uuid", uuid == null ? "" : uuid.toString()); -+ jsonobject.addProperty("expiresOn", UserCache.a.format(usercacheentry.b())); -+ return jsonobject; -+ } -+ -+ public UserCacheEntry a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) { -+ if (jsonelement.isJsonObject()) { -+ JsonObject jsonobject = jsonelement.getAsJsonObject(); -+ JsonElement jsonelement1 = jsonobject.get("name"); -+ JsonElement jsonelement2 = jsonobject.get("uuid"); -+ JsonElement jsonelement3 = jsonobject.get("expiresOn"); -+ -+ if (jsonelement1 != null && jsonelement2 != null) { -+ String s = jsonelement2.getAsString(); -+ String s1 = jsonelement1.getAsString(); -+ Date date = null; -+ -+ if (jsonelement3 != null) { -+ try { -+ date = UserCache.a.parse(jsonelement3.getAsString()); -+ } catch (ParseException parseexception) { -+ date = null; -+ } -+ } -+ -+ if (s1 != null && s != null) { -+ UUID uuid; -+ -+ try { -+ uuid = UUID.fromString(s); -+ } catch (Throwable throwable) { -+ return null; -+ } -+ -+ UserCacheEntry usercacheentry = new UserCacheEntry(this.a, new GameProfile(uuid, s1), date, (GameProfileLookup) null); -+ -+ return usercacheentry; -+ } else { -+ return null; -+ } -+ } else { -+ return null; -+ } -+ } else { -+ return null; -+ } -+ } -+ -+ public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { -+ return this.a((UserCacheEntry) object, type, jsonserializationcontext); -+ } -+ -+ public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) { -+ return this.a(jsonelement, type, jsondeserializationcontext); -+ } -+ -+ BanEntrySerializer(UserCache usercache, GameProfileLookup gameprofilelookup) { -+ this(usercache); -+ } -+} diff --git a/src/main/java/net/minecraft/server/BlockAnvil.java b/src/main/java/net/minecraft/server/BlockAnvil.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -152,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class BlockAnvil extends BlockFalling { + -+ public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirectionLimit.HORIZONTAL); ++ public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL); + public static final BlockStateInteger DAMAGE = BlockStateInteger.of("damage", 0, 2); + + protected BlockAnvil() { @@ -177,8 +83,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { -+ if (!world.isStatic) { -+ entityhuman.openTileEntity(new TileEntityContainerAnvil(world, blockposition)); ++ if (!world.isClientSide) { ++ entityhuman.openTileEntity(new BlockAnvil.TileEntityContainerAnvil(world, blockposition)); + } + + return true; @@ -191,7 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) { + EnumDirection enumdirection = (EnumDirection) iblockaccess.getType(blockposition).get(BlockAnvil.FACING); + -+ if (enumdirection.k() == EnumAxis.X) { ++ if (enumdirection.k() == EnumDirection.EnumAxis.X) { + this.a(0.0F, 0.0F, 0.125F, 1.0F, 1.0F, 0.875F); + } else { + this.a(0.125F, 0.0F, 0.0F, 0.875F, 1.0F, 1.0F); @@ -223,6 +129,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return new BlockStateList(this, new IBlockState[] { BlockAnvil.FACING, BlockAnvil.DAMAGE}); + } + ++ public static class TileEntityContainerAnvil implements ITileEntityContainer { ++ ++ private final World a; ++ private final BlockPosition b; ++ ++ public TileEntityContainerAnvil(World world, BlockPosition blockposition) { ++ this.a = world; ++ this.b = blockposition; ++ } ++ ++ public String getName() { ++ return "anvil"; ++ } ++ ++ public boolean hasCustomName() { ++ return false; ++ } ++ ++ public IChatBaseComponent getScoreboardDisplayName() { ++ return new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0]); ++ } ++ ++ public Container createContainer(PlayerInventory playerinventory, EntityHuman entityhuman) { ++ return new ContainerAnvil(playerinventory, this.a, this.b, entityhuman); ++ } ++ ++ public String getContainerName() { ++ return "minecraft:anvil"; ++ } ++ } +} diff --git a/src/main/java/net/minecraft/server/BlockBrewingStand.java b/src/main/java/net/minecraft/server/BlockBrewingStand.java new file mode 100644 @@ -238,13 +174,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +public class BlockBrewingStand extends BlockContainer { + + public static final BlockStateBoolean[] HAS_BOTTLE = new BlockStateBoolean[] { BlockStateBoolean.of("has_bottle_0"), BlockStateBoolean.of("has_bottle_1"), BlockStateBoolean.of("has_bottle_2")}; -+ private final Random b = new Random(); + + public BlockBrewingStand() { + super(Material.ORE); + this.j(this.blockStateList.getBlockData().set(BlockBrewingStand.HAS_BOTTLE[0], Boolean.valueOf(false)).set(BlockBrewingStand.HAS_BOTTLE[1], Boolean.valueOf(false)).set(BlockBrewingStand.HAS_BOTTLE[2], Boolean.valueOf(false))); + } + ++ public String getName() { ++ return LocaleI18n.get("item.brewingStand.name"); ++ } ++ + public boolean c() { + return false; + } @@ -261,25 +200,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return false; + } + -+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, AxisAlignedBB axisalignedbb, List list, Entity entity) { ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, AxisAlignedBB axisalignedbb, List list, Entity entity) { + this.a(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); + super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); -+ this.h(); ++ this.j(); + super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); + } + -+ public void h() { ++ public void j() { + this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } + + public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { -+ if (world.isStatic) { ++ if (world.isClientSide) { + return true; + } else { + TileEntity tileentity = world.getTileEntity(blockposition); + + if (tileentity instanceof TileEntityBrewingStand) { + entityhuman.openContainer((TileEntityBrewingStand) tileentity); ++ entityhuman.b(StatisticList.M); + } + + return true; @@ -344,7 +284,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected BlockStateList getStateList() { + return new BlockStateList(this, new IBlockState[] { BlockBrewingStand.HAS_BOTTLE[0], BlockBrewingStand.HAS_BOTTLE[1], BlockBrewingStand.HAS_BOTTLE[2]}); + } -+ +} diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java new file mode 100644 @@ -359,15 +298,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +public class BlockFlowerPot extends BlockContainer { + + public static final BlockStateInteger LEGACY_DATA = BlockStateInteger.of("legacy_data", 0, 15); -+ public static final BlockStateEnum CONTENTS = BlockStateEnum.of("contents", EnumFlowerPotContents.class); ++ public static final BlockStateEnum CONTENTS = BlockStateEnum.of("contents", BlockFlowerPot.EnumFlowerPotContents.class); + + public BlockFlowerPot() { + super(Material.ORIENTABLE); -+ this.j(this.blockStateList.getBlockData().set(BlockFlowerPot.CONTENTS, EnumFlowerPotContents.EMPTY).set(BlockFlowerPot.LEGACY_DATA, Integer.valueOf(0))); -+ this.h(); ++ this.j(this.blockStateList.getBlockData().set(BlockFlowerPot.CONTENTS, BlockFlowerPot.EnumFlowerPotContents.EMPTY).set(BlockFlowerPot.LEGACY_DATA, Integer.valueOf(0))); ++ this.j(); + } + -+ public void h() { ++ public String getName() { ++ return LocaleI18n.get("item.flowerPot.name"); ++ } ++ ++ public void j() { + float f = 0.375F; + float f1 = f / 2.0F; + @@ -390,7 +333,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ItemStack itemstack = entityhuman.inventory.getItemInHand(); + + if (itemstack != null && itemstack.getItem() instanceof ItemBlock) { -+ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); ++ TileEntityFlowerPot tileentityflowerpot = this.f(world, blockposition); + + if (tileentityflowerpot == null) { + return false; @@ -405,6 +348,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + tileentityflowerpot.a(itemstack.getItem(), itemstack.getData()); + tileentityflowerpot.update(); + world.notify(blockposition); ++ entityhuman.b(StatisticList.T); + if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count <= 0) { + entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); + } @@ -418,11 +362,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + private boolean a(Block block, int i) { -+ return block != Blocks.YELLOW_FLOWER && block != Blocks.RED_FLOWER && block != Blocks.CACTUS && block != Blocks.BROWN_MUSHROOM && block != Blocks.RED_MUSHROOM && block != Blocks.SAPLING && block != Blocks.DEADBUSH ? block == Blocks.TALLGRASS && i == EnumTallGrassType.FERN.a() : true; ++ return block != Blocks.YELLOW_FLOWER && block != Blocks.RED_FLOWER && block != Blocks.CACTUS && block != Blocks.BROWN_MUSHROOM && block != Blocks.RED_MUSHROOM && block != Blocks.SAPLING && block != Blocks.DEADBUSH ? block == Blocks.TALLGRASS && i == BlockLongGrass.EnumTallGrassType.FERN.a() : true; + } + + public int getDropData(World world, BlockPosition blockposition) { -+ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); ++ TileEntityFlowerPot tileentityflowerpot = this.f(world, blockposition); + + return tileentityflowerpot != null && tileentityflowerpot.b() != null ? tileentityflowerpot.c() : 0; + } @@ -440,7 +384,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { -+ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); ++ TileEntityFlowerPot tileentityflowerpot = this.f(world, blockposition); + + if (tileentityflowerpot != null && tileentityflowerpot.b() != null) { + a(world, blockposition, new ItemStack(tileentityflowerpot.b(), 1, tileentityflowerpot.c())); @@ -452,7 +396,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { + super.a(world, blockposition, iblockdata, entityhuman); + if (entityhuman.abilities.canInstantlyBuild) { -+ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); ++ TileEntityFlowerPot tileentityflowerpot = this.f(world, blockposition); + + if (tileentityflowerpot != null) { + tileentityflowerpot.a((Item) null, 0); @@ -465,7 +409,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return Items.FLOWER_POT; + } + -+ private TileEntityFlowerPot d(World world, BlockPosition blockposition) { ++ private TileEntityFlowerPot f(World world, BlockPosition blockposition) { + TileEntity tileentity = world.getTileEntity(blockposition); + + return tileentity instanceof TileEntityFlowerPot ? (TileEntityFlowerPot) tileentity : null; @@ -478,7 +422,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + switch (i) { + case 1: + object = Blocks.RED_FLOWER; -+ j = EnumFlowerVarient.POPPY.b(); ++ j = BlockFlowers.EnumFlowerVarient.POPPY.b(); + break; + + case 2: @@ -487,22 +431,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + case 3: + object = Blocks.SAPLING; -+ j = EnumLogVariant.OAK.a(); ++ j = BlockWood.EnumLogVariant.OAK.a(); + break; + + case 4: + object = Blocks.SAPLING; -+ j = EnumLogVariant.SPRUCE.a(); ++ j = BlockWood.EnumLogVariant.SPRUCE.a(); + break; + + case 5: + object = Blocks.SAPLING; -+ j = EnumLogVariant.BIRCH.a(); ++ j = BlockWood.EnumLogVariant.BIRCH.a(); + break; + + case 6: + object = Blocks.SAPLING; -+ j = EnumLogVariant.JUNGLE.a(); ++ j = BlockWood.EnumLogVariant.JUNGLE.a(); + break; + + case 7: @@ -523,17 +467,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + case 11: + object = Blocks.TALLGRASS; -+ j = EnumTallGrassType.FERN.a(); ++ j = BlockLongGrass.EnumTallGrassType.FERN.a(); + break; + + case 12: + object = Blocks.SAPLING; -+ j = EnumLogVariant.ACACIA.a(); ++ j = BlockWood.EnumLogVariant.ACACIA.a(); + break; + + case 13: + object = Blocks.SAPLING; -+ j = EnumLogVariant.DARK_OAK.a(); ++ j = BlockWood.EnumLogVariant.DARK_OAK.a(); + } + + return new TileEntityFlowerPot(Item.getItemOf((Block) object), j); @@ -548,7 +492,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public IBlockData updateState(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { -+ EnumFlowerPotContents enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ BlockFlowerPot.EnumFlowerPotContents blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.EMPTY; + TileEntity tileentity = iblockaccess.getTileEntity(blockposition); + + if (tileentity instanceof TileEntityFlowerPot) { @@ -560,105 +504,224 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Block block = Block.asBlock(item); + + if (block == Blocks.SAPLING) { -+ switch (SwitchHelperBlockFlowerPot.a[EnumLogVariant.a(i).ordinal()]) { ++ switch (BlockFlowerPot.SyntheticClass_1.a[BlockWood.EnumLogVariant.a(i).ordinal()]) { + case 1: -+ enumflowerpotcontents = EnumFlowerPotContents.OAK_SAPLING; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.OAK_SAPLING; + break; + + case 2: -+ enumflowerpotcontents = EnumFlowerPotContents.SPRUCE_SAPLING; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.SPRUCE_SAPLING; + break; + + case 3: -+ enumflowerpotcontents = EnumFlowerPotContents.BIRCH_SAPLING; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.BIRCH_SAPLING; + break; + + case 4: -+ enumflowerpotcontents = EnumFlowerPotContents.JUNGLE_SAPLING; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.JUNGLE_SAPLING; + break; + + case 5: -+ enumflowerpotcontents = EnumFlowerPotContents.ACACIA_SAPLING; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.ACACIA_SAPLING; + break; + + case 6: -+ enumflowerpotcontents = EnumFlowerPotContents.DARK_OAK_SAPLING; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.DARK_OAK_SAPLING; + break; + + default: -+ enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.EMPTY; + } + } else if (block == Blocks.TALLGRASS) { + switch (i) { + case 0: -+ enumflowerpotcontents = EnumFlowerPotContents.DEAD_BUSH; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.DEAD_BUSH; + break; + + case 2: -+ enumflowerpotcontents = EnumFlowerPotContents.FERN; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.FERN; + break; + + default: -+ enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.EMPTY; + } + } else if (block == Blocks.YELLOW_FLOWER) { -+ enumflowerpotcontents = EnumFlowerPotContents.DANDELION; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.DANDELION; + } else if (block == Blocks.RED_FLOWER) { -+ switch (SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.a(EnumFlowerType.RED, i).ordinal()]) { ++ switch (BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.a(BlockFlowers.EnumFlowerType.RED, i).ordinal()]) { + case 1: -+ enumflowerpotcontents = EnumFlowerPotContents.POPPY; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.POPPY; + break; + + case 2: -+ enumflowerpotcontents = EnumFlowerPotContents.BLUE_ORCHID; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.BLUE_ORCHID; + break; + + case 3: -+ enumflowerpotcontents = EnumFlowerPotContents.ALLIUM; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.ALLIUM; + break; + + case 4: -+ enumflowerpotcontents = EnumFlowerPotContents.HOUSTONIA; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.HOUSTONIA; + break; + + case 5: -+ enumflowerpotcontents = EnumFlowerPotContents.RED_TULIP; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.RED_TULIP; + break; + + case 6: -+ enumflowerpotcontents = EnumFlowerPotContents.ORANGE_TULIP; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.ORANGE_TULIP; + break; + + case 7: -+ enumflowerpotcontents = EnumFlowerPotContents.WHITE_TULIP; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.WHITE_TULIP; + break; + + case 8: -+ enumflowerpotcontents = EnumFlowerPotContents.PINK_TULIP; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.PINK_TULIP; + break; + + case 9: -+ enumflowerpotcontents = EnumFlowerPotContents.OXEYE_DAISY; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.OXEYE_DAISY; + break; + + default: -+ enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.EMPTY; + } + } else if (block == Blocks.RED_MUSHROOM) { -+ enumflowerpotcontents = EnumFlowerPotContents.MUSHROOM_RED; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.MUSHROOM_RED; + } else if (block == Blocks.BROWN_MUSHROOM) { -+ enumflowerpotcontents = EnumFlowerPotContents.MUSHROOM_BROWN; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.MUSHROOM_BROWN; + } else if (block == Blocks.DEADBUSH) { -+ enumflowerpotcontents = EnumFlowerPotContents.DEAD_BUSH; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.DEAD_BUSH; + } else if (block == Blocks.CACTUS) { -+ enumflowerpotcontents = EnumFlowerPotContents.CACTUS; ++ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.CACTUS; + } + } + } + -+ return iblockdata.set(BlockFlowerPot.CONTENTS, enumflowerpotcontents); ++ return iblockdata.set(BlockFlowerPot.CONTENTS, blockflowerpot_enumflowerpotcontents); + } + ++ static class SyntheticClass_1 { ++ ++ static final int[] a; ++ static final int[] b = new int[BlockFlowers.EnumFlowerVarient.values().length]; ++ ++ static { ++ try { ++ BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.POPPY.ordinal()] = 1; ++ } catch (NoSuchFieldError nosuchfielderror) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.BLUE_ORCHID.ordinal()] = 2; ++ } catch (NoSuchFieldError nosuchfielderror1) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.ALLIUM.ordinal()] = 3; ++ } catch (NoSuchFieldError nosuchfielderror2) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.HOUSTONIA.ordinal()] = 4; ++ } catch (NoSuchFieldError nosuchfielderror3) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.RED_TULIP.ordinal()] = 5; ++ } catch (NoSuchFieldError nosuchfielderror4) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.ORANGE_TULIP.ordinal()] = 6; ++ } catch (NoSuchFieldError nosuchfielderror5) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.WHITE_TULIP.ordinal()] = 7; ++ } catch (NoSuchFieldError nosuchfielderror6) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.PINK_TULIP.ordinal()] = 8; ++ } catch (NoSuchFieldError nosuchfielderror7) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.OXEYE_DAISY.ordinal()] = 9; ++ } catch (NoSuchFieldError nosuchfielderror8) { ++ ; ++ } ++ ++ a = new int[BlockWood.EnumLogVariant.values().length]; ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.a[BlockWood.EnumLogVariant.OAK.ordinal()] = 1; ++ } catch (NoSuchFieldError nosuchfielderror9) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.a[BlockWood.EnumLogVariant.SPRUCE.ordinal()] = 2; ++ } catch (NoSuchFieldError nosuchfielderror10) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.a[BlockWood.EnumLogVariant.BIRCH.ordinal()] = 3; ++ } catch (NoSuchFieldError nosuchfielderror11) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.a[BlockWood.EnumLogVariant.JUNGLE.ordinal()] = 4; ++ } catch (NoSuchFieldError nosuchfielderror12) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.a[BlockWood.EnumLogVariant.ACACIA.ordinal()] = 5; ++ } catch (NoSuchFieldError nosuchfielderror13) { ++ ; ++ } ++ ++ try { ++ BlockFlowerPot.SyntheticClass_1.a[BlockWood.EnumLogVariant.DARK_OAK.ordinal()] = 6; ++ } catch (NoSuchFieldError nosuchfielderror14) { ++ ; ++ } ++ ++ } ++ } ++ ++ public static enum EnumFlowerPotContents implements INamable { ++ ++ EMPTY("empty"), POPPY("rose"), BLUE_ORCHID("blue_orchid"), ALLIUM("allium"), HOUSTONIA("houstonia"), RED_TULIP("red_tulip"), ORANGE_TULIP("orange_tulip"), WHITE_TULIP("white_tulip"), PINK_TULIP("pink_tulip"), OXEYE_DAISY("oxeye_daisy"), DANDELION("dandelion"), OAK_SAPLING("oak_sapling"), SPRUCE_SAPLING("spruce_sapling"), BIRCH_SAPLING("birch_sapling"), JUNGLE_SAPLING("jungle_sapling"), ACACIA_SAPLING("acacia_sapling"), DARK_OAK_SAPLING("dark_oak_sapling"), MUSHROOM_RED("mushroom_red"), MUSHROOM_BROWN("mushroom_brown"), DEAD_BUSH("dead_bush"), FERN("fern"), CACTUS("cactus"); ++ ++ private final String w; ++ ++ private EnumFlowerPotContents(String s) { ++ this.w = s; ++ } ++ ++ public String toString() { ++ return this.w; ++ } ++ ++ public String getName() { ++ return this.w; ++ } ++ } +} diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java new file mode 100644 @@ -673,11 +736,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class BlockHopper extends BlockContainer { + -+ public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) (new BlockHopperInnerClass1())); ++ public static final BlockStateDirection FACING = BlockStateDirection.of("facing", new Predicate() { ++ public boolean a(EnumDirection enumdirection) { ++ return enumdirection != EnumDirection.UP; ++ } ++ ++ public boolean apply(Object object) { ++ return this.a((EnumDirection) object); ++ } ++ }); + public static final BlockStateBoolean ENABLED = BlockStateBoolean.of("enabled"); + + public BlockHopper() { -+ super(Material.ORE); ++ super(Material.ORE, MaterialMapColor.m); + this.j(this.blockStateList.getBlockData().set(BlockHopper.FACING, EnumDirection.DOWN).set(BlockHopper.ENABLED, Boolean.valueOf(true))); + this.a(CreativeModeTab.d); + this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); @@ -687,7 +758,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + -+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, AxisAlignedBB axisalignedbb, List list, Entity entity) { ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, AxisAlignedBB axisalignedbb, List list, Entity entity) { + this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F); + super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); + float f = 0.125F; @@ -734,13 +805,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { -+ if (world.isStatic) { ++ if (world.isClientSide) { + return true; + } else { + TileEntity tileentity = world.getTileEntity(blockposition); + + if (tileentity instanceof TileEntityHopper) { + entityhuman.openContainer((TileEntityHopper) tileentity); ++ entityhuman.b(StatisticList.P); + } + + return true; @@ -854,8 +926,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { -+ if (!world.isStatic) { -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), explosion.c()); ++ if (!world.isClientSide) { ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.c()); + + entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8; + world.addEntity(entitytntprimed); @@ -867,9 +939,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) { -+ if (!world.isStatic) { ++ if (!world.isClientSide) { + if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) { -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), entityliving); ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving); + + world.addEntity(entitytntprimed); + world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); @@ -879,16 +951,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { -+ if (entityhuman.bY() != null) { -+ Item item = entityhuman.bY().getItem(); ++ if (entityhuman.bZ() != null) { ++ Item item = entityhuman.bZ().getItem(); + + if (item == Items.FLINT_AND_STEEL || item == Items.FIRE_CHARGE) { + this.a(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true)), (EntityLiving) entityhuman); + world.setAir(blockposition); + if (item == Items.FLINT_AND_STEEL) { -+ entityhuman.bY().damage(1, entityhuman); ++ entityhuman.bZ().damage(1, entityhuman); + } else if (!entityhuman.abilities.canInstantlyBuild) { -+ --entityhuman.bY().count; ++ --entityhuman.bZ().count; + } + + return true; @@ -899,7 +971,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) { -+ if (!world.isStatic && entity instanceof EntityArrow) { ++ if (!world.isClientSide && entity instanceof EntityArrow) { + EntityArrow entityarrow = (EntityArrow) entity; + + if (entityarrow.isBurning()) { @@ -925,7 +997,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected BlockStateList getStateList() { + return new BlockStateList(this, new IBlockState[] { BlockTNT.EXPLODE}); + } -+ +} diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java new file mode 100644 @@ -1019,12 +1090,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + chatmessage.getChatModifier().setColor(EnumChatFormat.GRAY); + chatmessage.getChatModifier().setItalic(Boolean.valueOf(true)); + if (flag) { -+ Iterator iterator = minecraftserver.getPlayerList().players.iterator(); ++ Iterator iterator = minecraftserver.getPlayerList().v().iterator(); + + while (iterator.hasNext()) { + EntityHuman entityhuman = (EntityHuman) iterator.next(); + -+ if (entityhuman != icommandlistener && minecraftserver.getPlayerList().isOp(entityhuman.getProfile()) && icommand.canUse(icommandlistener)) { ++ if (entityhuman != icommandlistener && minecraftserver.getPlayerList().isOp(entityhuman.getProfile()) && icommand.canUse(icommandlistener) && (!(icommandlistener instanceof RemoteControlCommandListener) || MinecraftServer.getServer().q())) { + entityhuman.sendMessage(chatmessage); + } + } @@ -1056,6 +1127,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; ++import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; @@ -1068,8 +1140,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + private final Entity a; + private boolean b = true; -+ private static final Map c = Maps.newHashMap(); -+ private final Map d = Maps.newHashMap(); ++ private static final Map, Integer> c = Maps.newHashMap(); ++ private final Map d = Maps.newHashMap(); + private boolean e; + private ReadWriteLock f = new ReentrantReadWriteLock(); + @@ -1077,30 +1149,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a = entity; + } + -+ public void a(int i, Object object) { -+ Integer integer = (Integer) DataWatcher.c.get(object.getClass()); ++ public void a(int i, T t0) { ++ Integer integer = (Integer) DataWatcher.c.get(t0.getClass()); + + if (integer == null) { -+ throw new IllegalArgumentException("Unknown data type: " + object.getClass()); ++ throw new IllegalArgumentException("Unknown data type: " + t0.getClass()); + } else if (i > 31) { + throw new IllegalArgumentException("Data value id is too big with " + i + "! (Max is " + 31 + ")"); + } else if (this.d.containsKey(Integer.valueOf(i))) { + throw new IllegalArgumentException("Duplicate id value for " + i + "!"); + } else { -+ WatchableObject watchableobject = new WatchableObject(integer.intValue(), i, object); ++ DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(integer.intValue(), i, t0); + + this.f.writeLock().lock(); -+ this.d.put(Integer.valueOf(i), watchableobject); ++ this.d.put(Integer.valueOf(i), datawatcher_watchableobject); + this.f.writeLock().unlock(); + this.b = false; + } + } + + public void add(int i, int j) { -+ WatchableObject watchableobject = new WatchableObject(j, i, (Object) null); ++ DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(j, i, (Object) null); + + this.f.writeLock().lock(); -+ this.d.put(Integer.valueOf(i), watchableobject); ++ this.d.put(Integer.valueOf(i), datawatcher_watchableobject); + this.f.writeLock().unlock(); + this.b = false; + } @@ -1129,13 +1201,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return (ItemStack) this.j(i).b(); + } + -+ private WatchableObject j(int i) { ++ private DataWatcher.WatchableObject j(int i) { + this.f.readLock().lock(); + -+ WatchableObject watchableobject; ++ DataWatcher.WatchableObject datawatcher_watchableobject; + + try { -+ watchableobject = (WatchableObject) this.d.get(Integer.valueOf(i)); ++ datawatcher_watchableobject = (DataWatcher.WatchableObject) this.d.get(Integer.valueOf(i)); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Getting synched entity data"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Synched entity data"); @@ -1145,27 +1217,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + this.f.readLock().unlock(); -+ return watchableobject; ++ return datawatcher_watchableobject; + } + + public Vector3f h(int i) { + return (Vector3f) this.j(i).b(); + } + -+ public void watch(int i, Object object) { -+ WatchableObject watchableobject = this.j(i); ++ public void watch(int i, T t0) { ++ DataWatcher.WatchableObject datawatcher_watchableobject = this.j(i); + -+ if (ObjectUtils.notEqual(object, watchableobject.b())) { -+ watchableobject.a(object); ++ if (ObjectUtils.notEqual(t0, datawatcher_watchableobject.b())) { ++ datawatcher_watchableobject.a(t0); + this.a.i(i); -+ watchableobject.a(true); ++ datawatcher_watchableobject.a(true); + this.e = true; + } + + } + + public void update(int i) { -+ WatchableObject.a(this.j(i), true); ++ this.j(i).d = true; + this.e = true; + } + @@ -1173,21 +1245,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.e; + } + -+ public static void a(List list, PacketDataSerializer packetdataserializer) { ++ public static void a(List list, PacketDataSerializer packetdataserializer) throws IOException { + if (list != null) { + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { -+ WatchableObject watchableobject = (WatchableObject) iterator.next(); ++ DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); + -+ a(packetdataserializer, watchableobject); ++ a(packetdataserializer, datawatcher_watchableobject); + } + } + + packetdataserializer.writeByte(127); + } + -+ public List b() { ++ public List b() { + ArrayList arraylist = null; + + if (this.e) { @@ -1195,15 +1267,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Iterator iterator = this.d.values().iterator(); + + while (iterator.hasNext()) { -+ WatchableObject watchableobject = (WatchableObject) iterator.next(); ++ DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); + -+ if (watchableobject.d()) { -+ watchableobject.a(false); ++ if (datawatcher_watchableobject.d()) { ++ datawatcher_watchableobject.a(false); + if (arraylist == null) { + arraylist = Lists.newArrayList(); + } + -+ arraylist.add(watchableobject); ++ arraylist.add(datawatcher_watchableobject); + } + } + @@ -1214,29 +1286,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return arraylist; + } + -+ public void a(PacketDataSerializer packetdataserializer) { ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.f.readLock().lock(); + Iterator iterator = this.d.values().iterator(); + + while (iterator.hasNext()) { -+ WatchableObject watchableobject = (WatchableObject) iterator.next(); ++ DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); + -+ a(packetdataserializer, watchableobject); ++ a(packetdataserializer, datawatcher_watchableobject); + } + + this.f.readLock().unlock(); + packetdataserializer.writeByte(127); + } + -+ public List c() { ++ public List c() { + ArrayList arraylist = null; + + this.f.readLock().lock(); + -+ WatchableObject watchableobject; ++ DataWatcher.WatchableObject datawatcher_watchableobject; + -+ for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(watchableobject)) { -+ watchableobject = (WatchableObject) iterator.next(); ++ for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(datawatcher_watchableobject)) { ++ datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); + if (arraylist == null) { + arraylist = Lists.newArrayList(); + } @@ -1246,39 +1318,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return arraylist; + } + -+ private static void a(PacketDataSerializer packetdataserializer, WatchableObject watchableobject) { -+ int i = (watchableobject.c() << 5 | watchableobject.a() & 31) & 255; ++ private static void a(PacketDataSerializer packetdataserializer, DataWatcher.WatchableObject datawatcher_watchableobject) throws IOException { ++ int i = (datawatcher_watchableobject.c() << 5 | datawatcher_watchableobject.a() & 31) & 255; + + packetdataserializer.writeByte(i); -+ switch (watchableobject.c()) { ++ switch (datawatcher_watchableobject.c()) { + case 0: -+ packetdataserializer.writeByte(((Byte) watchableobject.b()).byteValue()); ++ packetdataserializer.writeByte(((Byte) datawatcher_watchableobject.b()).byteValue()); + break; + + case 1: -+ packetdataserializer.writeShort(((Short) watchableobject.b()).shortValue()); ++ packetdataserializer.writeShort(((Short) datawatcher_watchableobject.b()).shortValue()); + break; + + case 2: -+ packetdataserializer.writeInt(((Integer) watchableobject.b()).intValue()); ++ packetdataserializer.writeInt(((Integer) datawatcher_watchableobject.b()).intValue()); + break; + + case 3: -+ packetdataserializer.writeFloat(((Float) watchableobject.b()).floatValue()); ++ packetdataserializer.writeFloat(((Float) datawatcher_watchableobject.b()).floatValue()); + break; + + case 4: -+ packetdataserializer.a((String) watchableobject.b()); ++ packetdataserializer.a((String) datawatcher_watchableobject.b()); + break; + + case 5: -+ ItemStack itemstack = (ItemStack) watchableobject.b(); ++ ItemStack itemstack = (ItemStack) datawatcher_watchableobject.b(); + + packetdataserializer.a(itemstack); + break; + + case 6: -+ BlockPosition blockposition = (BlockPosition) watchableobject.b(); ++ BlockPosition blockposition = (BlockPosition) datawatcher_watchableobject.b(); + + packetdataserializer.writeInt(blockposition.getX()); + packetdataserializer.writeInt(blockposition.getY()); @@ -1286,7 +1358,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + break; + + case 7: -+ Vector3f vector3f = (Vector3f) watchableobject.b(); ++ Vector3f vector3f = (Vector3f) datawatcher_watchableobject.b(); + + packetdataserializer.writeFloat(vector3f.getX()); + packetdataserializer.writeFloat(vector3f.getY()); @@ -1295,7 +1367,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } + -+ public static List b(PacketDataSerializer packetdataserializer) { ++ public static List b(PacketDataSerializer packetdataserializer) throws IOException { + ArrayList arraylist = null; + + for (byte b0 = packetdataserializer.readByte(); b0 != 127; b0 = packetdataserializer.readByte()) { @@ -1305,31 +1377,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + int i = (b0 & 224) >> 5; + int j = b0 & 31; -+ WatchableObject watchableobject = null; ++ DataWatcher.WatchableObject datawatcher_watchableobject = null; + + switch (i) { + case 0: -+ watchableobject = new WatchableObject(i, j, Byte.valueOf(packetdataserializer.readByte())); ++ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, Byte.valueOf(packetdataserializer.readByte())); + break; + + case 1: -+ watchableobject = new WatchableObject(i, j, Short.valueOf(packetdataserializer.readShort())); ++ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, Short.valueOf(packetdataserializer.readShort())); + break; + + case 2: -+ watchableobject = new WatchableObject(i, j, Integer.valueOf(packetdataserializer.readInt())); ++ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, Integer.valueOf(packetdataserializer.readInt())); + break; + + case 3: -+ watchableobject = new WatchableObject(i, j, Float.valueOf(packetdataserializer.readFloat())); ++ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, Float.valueOf(packetdataserializer.readFloat())); + break; + + case 4: -+ watchableobject = new WatchableObject(i, j, packetdataserializer.c(32767)); ++ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, packetdataserializer.c(32767)); + break; + + case 5: -+ watchableobject = new WatchableObject(i, j, packetdataserializer.i()); ++ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, packetdataserializer.i()); + break; + + case 6: @@ -1337,7 +1409,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int l = packetdataserializer.readInt(); + int i1 = packetdataserializer.readInt(); + -+ watchableobject = new WatchableObject(i, j, new BlockPosition(k, l, i1)); ++ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, new BlockPosition(k, l, i1)); + break; + + case 7: @@ -1345,10 +1417,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + float f1 = packetdataserializer.readFloat(); + float f2 = packetdataserializer.readFloat(); + -+ watchableobject = new WatchableObject(i, j, new Vector3f(f, f1, f2)); ++ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, new Vector3f(f, f1, f2)); + } + -+ arraylist.add(watchableobject); ++ arraylist.add(datawatcher_watchableobject); + } + + return arraylist; @@ -1372,6 +1444,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + DataWatcher.c.put(BlockPosition.class, Integer.valueOf(6)); + DataWatcher.c.put(Vector3f.class, Integer.valueOf(7)); + } ++ ++ public static class WatchableObject { ++ ++ private final int a; ++ private final int b; ++ private Object c; ++ private boolean d; ++ ++ public WatchableObject(int i, int j, Object object) { ++ this.b = j; ++ this.c = object; ++ this.a = i; ++ this.d = true; ++ } ++ ++ public int a() { ++ return this.b; ++ } ++ ++ public void a(Object object) { ++ this.c = object; ++ } ++ ++ public Object b() { ++ return this.c; ++ } ++ ++ public int c() { ++ return this.a; ++ } ++ ++ public boolean d() { ++ return this.d; ++ } ++ ++ public void a(boolean flag) { ++ this.d = flag; ++ } ++ } +} diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java new file mode 100644 @@ -1394,10 +1505,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +public class EnchantmentManager { + + private static final Random a = new Random(); -+ private static final EnchantmentModifierProtection b = new EnchantmentModifierProtection((EmptyClass) null); -+ private static final EnchantmentModifierDamage c = new EnchantmentModifierDamage((EmptyClass) null); -+ private static final EnchantmentModifierThorns d = new EnchantmentModifierThorns((EmptyClass) null); -+ private static final EnchantmentModifierArthropods e = new EnchantmentModifierArthropods((EmptyClass) null); ++ private static final EnchantmentManager.EnchantmentModifierProtection b = new EnchantmentManager.EnchantmentModifierProtection((EnchantmentManager.SyntheticClass_1) null); ++ private static final EnchantmentManager.EnchantmentModifierDamage c = new EnchantmentManager.EnchantmentModifierDamage((EnchantmentManager.SyntheticClass_1) null); ++ private static final EnchantmentManager.EnchantmentModifierThorns d = new EnchantmentManager.EnchantmentModifierThorns((EnchantmentManager.SyntheticClass_1) null); ++ private static final EnchantmentManager.EnchantmentModifierArthropods e = new EnchantmentManager.EnchantmentModifierArthropods((EnchantmentManager.SyntheticClass_1) null); + + public static int getEnchantmentLevel(int i, ItemStack itemstack) { + if (itemstack == null) { @@ -1422,7 +1533,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ public static Map a(ItemStack itemstack) { ++ public static Map a(ItemStack itemstack) { + LinkedHashMap linkedhashmap = Maps.newLinkedHashMap(); + NBTTagList nbttaglist = itemstack.getItem() == Items.ENCHANTED_BOOK ? Items.ENCHANTED_BOOK.h(itemstack) : itemstack.getEnchantments(); + @@ -1438,7 +1549,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return linkedhashmap; + } + -+ public static void a(Map map, ItemStack itemstack) { ++ public static void a(Map map, ItemStack itemstack) { + NBTTagList nbttaglist = new NBTTagList(); + Iterator iterator = map.keySet().iterator(); + @@ -1489,7 +1600,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) { ++ private static void a(EnchantmentManager.EnchantmentModifier enchantmentmanager_enchantmentmodifier, ItemStack itemstack) { + if (itemstack != null) { + NBTTagList nbttaglist = itemstack.getEnchantments(); + @@ -1499,7 +1610,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + short short1 = nbttaglist.get(i).getShort("lvl"); + + if (Enchantment.getById(short0) != null) { -+ enchantmentmodifier.a(Enchantment.getById(short0), short1); ++ enchantmentmanager_enchantmentmodifier.a(Enchantment.getById(short0), short1); + } + } + @@ -1507,14 +1618,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack[] aitemstack) { ++ private static void a(EnchantmentManager.EnchantmentModifier enchantmentmanager_enchantmentmodifier, ItemStack[] aitemstack) { + ItemStack[] aitemstack1 = aitemstack; + int i = aitemstack.length; + + for (int j = 0; j < i; ++j) { + ItemStack itemstack = aitemstack1[j]; + -+ a(enchantmentmodifier, itemstack); ++ a(enchantmentmanager_enchantmentmodifier, itemstack); + } + + } @@ -1522,9 +1633,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static int a(ItemStack[] aitemstack, DamageSource damagesource) { + EnchantmentManager.b.a = 0; + EnchantmentManager.b.b = damagesource; -+ a((EnchantmentModifier) EnchantmentManager.b, aitemstack); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.b, aitemstack); + if (EnchantmentManager.b.a > 25) { + EnchantmentManager.b.a = 25; ++ } else if (EnchantmentManager.b.a < 0) { ++ EnchantmentManager.b.a = 0; + } + + return (EnchantmentManager.b.a + 1 >> 1) + EnchantmentManager.a.nextInt((EnchantmentManager.b.a >> 1) + 1); @@ -1533,7 +1646,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static float a(ItemStack itemstack, EnumMonsterType enummonstertype) { + EnchantmentManager.c.a = 0.0F; + EnchantmentManager.c.b = enummonstertype; -+ a((EnchantmentModifier) EnchantmentManager.c, itemstack); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.c, itemstack); + return EnchantmentManager.c.a; + } + @@ -1541,11 +1654,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + EnchantmentManager.d.b = entity; + EnchantmentManager.d.a = entityliving; + if (entityliving != null) { -+ a((EnchantmentModifier) EnchantmentManager.d, entityliving.getEquipment()); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.d, entityliving.getEquipment()); + } + + if (entity instanceof EntityHuman) { -+ a((EnchantmentModifier) EnchantmentManager.d, entityliving.bz()); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.d, entityliving.bA()); + } + + } @@ -1554,21 +1667,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + EnchantmentManager.e.a = entityliving; + EnchantmentManager.e.b = entity; + if (entityliving != null) { -+ a((EnchantmentModifier) EnchantmentManager.e, entityliving.getEquipment()); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.e, entityliving.getEquipment()); + } + + if (entityliving instanceof EntityHuman) { -+ a((EnchantmentModifier) EnchantmentManager.e, entityliving.bz()); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.e, entityliving.bA()); + } + + } + + public static int a(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.KNOCKBACK.id, entityliving.bz()); ++ return getEnchantmentLevel(Enchantment.KNOCKBACK.id, entityliving.bA()); + } + + public static int getFireAspectEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, entityliving.bz()); ++ return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, entityliving.bA()); + } + + public static int getOxygenEnchantmentLevel(Entity entity) { @@ -1580,27 +1693,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public static int getDigSpeedEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.DIG_SPEED.id, entityliving.bz()); ++ return getEnchantmentLevel(Enchantment.DIG_SPEED.id, entityliving.bA()); + } + + public static boolean hasSilkTouchEnchantment(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, entityliving.bz()) > 0; ++ return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, entityliving.bA()) > 0; + } + + public static int getBonusBlockLootEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, entityliving.bz()); ++ return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, entityliving.bA()); + } + + public static int g(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LUCK.id, entityliving.bz()); ++ return getEnchantmentLevel(Enchantment.LUCK.id, entityliving.bA()); + } + + public static int h(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LURE.id, entityliving.bz()); ++ return getEnchantmentLevel(Enchantment.LURE.id, entityliving.bA()); + } + + public static int getBonusMonsterLootEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, entityliving.bz()); ++ return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, entityliving.bA()); + } + + public static boolean j(EntityLiving entityliving) { @@ -1664,7 +1777,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return itemstack; + } + -+ public static List b(Random random, ItemStack itemstack, int i) { ++ public static List b(Random random, ItemStack itemstack, int i) { + Item item = itemstack.getItem(); + int j = item.b(); + @@ -1730,7 +1843,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ public static Map b(int i, ItemStack itemstack) { ++ public static Map b(int i, ItemStack itemstack) { + Item item = itemstack.getItem(); + HashMap hashmap = null; + boolean flag = itemstack.getItem() == Items.BOOK; @@ -1756,470 +1869,76 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return hashmap; + } + -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; ++ static class SyntheticClass_1 { } + -+final class EnchantmentModifierArthropods implements EnchantmentModifier { ++ static final class EnchantmentModifierArthropods implements EnchantmentManager.EnchantmentModifier { + -+ public EntityLiving a; -+ public Entity b; ++ public EntityLiving a; ++ public Entity b; + -+ private EnchantmentModifierArthropods() {} ++ private EnchantmentModifierArthropods() {} + -+ public void a(Enchantment enchantment, int i) { -+ enchantment.a(this.a, this.b, i); -+ } -+ -+ EnchantmentModifierArthropods(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierDamage implements EnchantmentModifier { -+ -+ public float a; -+ public EnumMonsterType b; -+ -+ private EnchantmentModifierDamage() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ this.a += enchantment.a(i, this.b); -+ } -+ -+ EnchantmentModifierDamage(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierProtection implements EnchantmentModifier { -+ -+ public int a; -+ public DamageSource b; -+ -+ private EnchantmentModifierProtection() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ this.a += enchantment.a(i, this.b); -+ } -+ -+ EnchantmentModifierProtection(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierThorns implements EnchantmentModifier { -+ -+ public EntityLiving a; -+ public Entity b; -+ -+ private EnchantmentModifierThorns() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ enchantment.b(this.a, this.b, i); -+ } -+ -+ EnchantmentModifierThorns(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EntityFireworks.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class EntityFireworks extends Entity { -+ -+ private int ticksFlown; -+ public int expectedLifespan; -+ -+ public EntityFireworks(World world) { -+ super(world); -+ this.a(0.25F, 0.25F); -+ } -+ -+ protected void h() { -+ this.datawatcher.add(8, 5); -+ } -+ -+ public EntityFireworks(World world, double d0, double d1, double d2, ItemStack itemstack) { -+ super(world); -+ this.ticksFlown = 0; -+ this.a(0.25F, 0.25F); -+ this.setPosition(d0, d1, d2); -+ int i = 1; -+ -+ if (itemstack != null && itemstack.hasTag()) { -+ this.datawatcher.watch(8, itemstack); -+ NBTTagCompound nbttagcompound = itemstack.getTag(); -+ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Fireworks"); -+ -+ if (nbttagcompound1 != null) { -+ i += nbttagcompound1.getByte("Flight"); -+ } ++ public void a(Enchantment enchantment, int i) { ++ enchantment.a(this.a, this.b, i); + } + -+ this.motX = this.random.nextGaussian() * 0.001D; -+ this.motZ = this.random.nextGaussian() * 0.001D; -+ this.motY = 0.05D; -+ this.expectedLifespan = 10 * i + this.random.nextInt(6) + this.random.nextInt(7); ++ EnchantmentModifierArthropods(EnchantmentManager.SyntheticClass_1 enchantmentmanager_syntheticclass_1) { ++ this(); ++ } + } + -+ public void s_() { -+ this.P = this.locX; -+ this.Q = this.locY; -+ this.R = this.locZ; -+ super.s_(); -+ this.motX *= 1.15D; -+ this.motZ *= 1.15D; -+ this.motY += 0.04D; -+ this.move(this.motX, this.motY, this.motZ); -+ float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); ++ static final class EnchantmentModifierThorns implements EnchantmentManager.EnchantmentModifier { + -+ this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D); ++ public EntityLiving a; ++ public Entity b; + -+ for (this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) { -+ ; ++ private EnchantmentModifierThorns() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ enchantment.b(this.a, this.b, i); + } + -+ while (this.pitch - this.lastPitch >= 180.0F) { -+ this.lastPitch += 360.0F; ++ EnchantmentModifierThorns(EnchantmentManager.SyntheticClass_1 enchantmentmanager_syntheticclass_1) { ++ this(); + } -+ -+ while (this.yaw - this.lastYaw < -180.0F) { -+ this.lastYaw -= 360.0F; -+ } -+ -+ while (this.yaw - this.lastYaw >= 180.0F) { -+ this.lastYaw += 360.0F; -+ } -+ -+ this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F; -+ this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; -+ if (this.ticksFlown == 0 && !this.R()) { -+ this.world.makeSound(this, "fireworks.launch", 3.0F, 1.0F); -+ } -+ -+ ++this.ticksFlown; -+ if (this.world.isStatic && this.ticksFlown % 2 < 2) { -+ this.world.addParticle(EnumParticle.FIREWORKS_SPARK, this.locX, this.locY - 0.3D, this.locZ, this.random.nextGaussian() * 0.05D, -this.motY * 0.5D, this.random.nextGaussian() * 0.05D, new int[0]); -+ } -+ -+ if (!this.world.isStatic && this.ticksFlown > this.expectedLifespan) { -+ this.world.broadcastEntityEffect(this, (byte) 17); -+ this.die(); -+ } -+ + } + -+ public void b(NBTTagCompound nbttagcompound) { -+ nbttagcompound.setInt("Life", this.ticksFlown); -+ nbttagcompound.setInt("LifeTime", this.expectedLifespan); -+ ItemStack itemstack = this.datawatcher.getItemStack(8); ++ static final class EnchantmentModifierDamage implements EnchantmentManager.EnchantmentModifier { + -+ if (itemstack != null) { -+ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); ++ public float a; ++ public EnumMonsterType b; + -+ itemstack.save(nbttagcompound1); -+ nbttagcompound.set("FireworksItem", nbttagcompound1); ++ private EnchantmentModifierDamage() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ this.a += enchantment.a(i, this.b); + } + ++ EnchantmentModifierDamage(EnchantmentManager.SyntheticClass_1 enchantmentmanager_syntheticclass_1) { ++ this(); ++ } + } + -+ public void a(NBTTagCompound nbttagcompound) { -+ this.ticksFlown = nbttagcompound.getInt("Life"); -+ this.expectedLifespan = nbttagcompound.getInt("LifeTime"); -+ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("FireworksItem"); ++ static final class EnchantmentModifierProtection implements EnchantmentManager.EnchantmentModifier { + -+ if (nbttagcompound1 != null) { -+ ItemStack itemstack = ItemStack.createStack(nbttagcompound1); ++ public int a; ++ public DamageSource b; + -+ if (itemstack != null) { -+ this.datawatcher.watch(8, itemstack); -+ } ++ private EnchantmentModifierProtection() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ this.a += enchantment.a(i, this.b); + } + -+ } -+ -+ public float c(float f) { -+ return super.c(f); -+ } -+ -+ public boolean aE() { -+ return false; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EntityTracker.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import com.google.common.collect.Lists; -+import com.google.common.collect.Sets; -+import java.util.ArrayList; -+import java.util.Iterator; -+import java.util.Set; -+import java.util.concurrent.Callable; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+ -+public class EntityTracker { -+ -+ private static final Logger a = LogManager.getLogger(); -+ private final WorldServer world; -+ private Set c = Sets.newHashSet(); -+ public IntHashMap trackedEntities = new IntHashMap(); -+ private int e; -+ -+ public EntityTracker(WorldServer worldserver) { -+ this.world = worldserver; -+ this.e = worldserver.getMinecraftServer().getPlayerList().d(); -+ } -+ -+ public void track(Entity entity) { -+ if (entity instanceof EntityPlayer) { -+ this.addEntity(entity, 512, 2); -+ EntityPlayer entityplayer = (EntityPlayer) entity; -+ Iterator iterator = this.c.iterator(); -+ -+ while (iterator.hasNext()) { -+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); -+ -+ if (entitytrackerentry.tracker != entityplayer) { -+ entitytrackerentry.updatePlayer(entityplayer); -+ } -+ } -+ } else if (entity instanceof EntityFishingHook) { -+ this.addEntity(entity, 64, 5, true); -+ } else if (entity instanceof EntityArrow) { -+ this.addEntity(entity, 64, 20, false); -+ } else if (entity instanceof EntitySmallFireball) { -+ this.addEntity(entity, 64, 10, false); -+ } else if (entity instanceof EntityFireball) { -+ this.addEntity(entity, 64, 10, false); -+ } else if (entity instanceof EntitySnowball) { -+ this.addEntity(entity, 64, 10, true); -+ } else if (entity instanceof EntityEnderPearl) { -+ this.addEntity(entity, 64, 10, true); -+ } else if (entity instanceof EntityEnderSignal) { -+ this.addEntity(entity, 64, 4, true); -+ } else if (entity instanceof EntityEgg) { -+ this.addEntity(entity, 64, 10, true); -+ } else if (entity instanceof EntityPotion) { -+ this.addEntity(entity, 64, 10, true); -+ } else if (entity instanceof EntityThrownExpBottle) { -+ this.addEntity(entity, 64, 10, true); -+ } else if (entity instanceof EntityFireworks) { -+ this.addEntity(entity, 64, 10, true); -+ } else if (entity instanceof EntityItem) { -+ this.addEntity(entity, 64, 20, true); -+ } else if (entity instanceof EntityMinecartAbstract) { -+ this.addEntity(entity, 80, 3, true); -+ } else if (entity instanceof EntityBoat) { -+ this.addEntity(entity, 80, 3, true); -+ } else if (entity instanceof EntitySquid) { -+ this.addEntity(entity, 64, 3, true); -+ } else if (entity instanceof EntityWither) { -+ this.addEntity(entity, 80, 3, false); -+ } else if (entity instanceof EntityBat) { -+ this.addEntity(entity, 80, 3, false); -+ } else if (entity instanceof EntityEnderDragon) { -+ this.addEntity(entity, 160, 3, true); -+ } else if (entity instanceof IAnimal) { -+ this.addEntity(entity, 80, 3, true); -+ } else if (entity instanceof EntityTNTPrimed) { -+ this.addEntity(entity, 160, 10, true); -+ } else if (entity instanceof EntityFallingBlock) { -+ this.addEntity(entity, 160, 20, true); -+ } else if (entity instanceof EntityHanging) { -+ this.addEntity(entity, 160, Integer.MAX_VALUE, false); -+ } else if (entity instanceof EntityArmorStand) { -+ this.addEntity(entity, 160, 3, true); -+ } else if (entity instanceof EntityExperienceOrb) { -+ this.addEntity(entity, 160, 20, true); -+ } else if (entity instanceof EntityEnderCrystal) { -+ this.addEntity(entity, 256, Integer.MAX_VALUE, false); ++ EnchantmentModifierProtection(EnchantmentManager.SyntheticClass_1 enchantmentmanager_syntheticclass_1) { ++ this(); + } -+ + } + -+ public void addEntity(Entity entity, int i, int j) { -+ this.addEntity(entity, i, j, false); ++ interface EnchantmentModifier { ++ ++ void a(Enchantment enchantment, int i); + } -+ -+ public void addEntity(Entity entity, int i, int j, boolean flag) { -+ if (i > this.e) { -+ i = this.e; -+ } -+ -+ try { -+ if (this.trackedEntities.b(entity.getId())) { -+ throw new IllegalStateException("Entity is already tracked!"); -+ } -+ -+ EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag); -+ -+ this.c.add(entitytrackerentry); -+ this.trackedEntities.a(entity.getId(), entitytrackerentry); -+ entitytrackerentry.scanPlayers(this.world.players); -+ } catch (Throwable throwable) { -+ CrashReport crashreport = CrashReport.a(throwable, "Adding entity to track"); -+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity To Track"); -+ -+ crashreportsystemdetails.a("Tracking range", (Object) (i + " blocks")); -+ crashreportsystemdetails.a("Update interval", (Callable) (new CrashReportEntityTrackerUpdateInterval(this, j))); -+ entity.appendEntityCrashDetails(crashreportsystemdetails); -+ CrashReportSystemDetails crashreportsystemdetails1 = crashreport.a("Entity That Is Already Tracked"); -+ -+ ((EntityTrackerEntry) this.trackedEntities.get(entity.getId())).tracker.appendEntityCrashDetails(crashreportsystemdetails1); -+ -+ try { -+ throw new ReportedException(crashreport); -+ } catch (ReportedException reportedexception) { -+ EntityTracker.a.error("\"Silently\" catching entity tracking error.", reportedexception); -+ } -+ } -+ -+ } -+ -+ public void untrackEntity(Entity entity) { -+ if (entity instanceof EntityPlayer) { -+ EntityPlayer entityplayer = (EntityPlayer) entity; -+ Iterator iterator = this.c.iterator(); -+ -+ while (iterator.hasNext()) { -+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); -+ -+ entitytrackerentry.a(entityplayer); -+ } -+ } -+ -+ EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) this.trackedEntities.d(entity.getId()); -+ -+ if (entitytrackerentry1 != null) { -+ this.c.remove(entitytrackerentry1); -+ entitytrackerentry1.a(); -+ } -+ -+ } -+ -+ public void updatePlayers() { -+ ArrayList arraylist = Lists.newArrayList(); -+ Iterator iterator = this.c.iterator(); -+ -+ while (iterator.hasNext()) { -+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); -+ -+ entitytrackerentry.track(this.world.players); -+ if (entitytrackerentry.n && entitytrackerentry.tracker instanceof EntityPlayer) { -+ arraylist.add((EntityPlayer) entitytrackerentry.tracker); -+ } -+ } -+ -+ for (int i = 0; i < arraylist.size(); ++i) { -+ EntityPlayer entityplayer = (EntityPlayer) arraylist.get(i); -+ Iterator iterator1 = this.c.iterator(); -+ -+ while (iterator1.hasNext()) { -+ EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next(); -+ -+ if (entitytrackerentry1.tracker != entityplayer) { -+ entitytrackerentry1.updatePlayer(entityplayer); -+ } -+ } -+ } -+ -+ } -+ -+ public void a(EntityPlayer entityplayer) { -+ Iterator iterator = this.c.iterator(); -+ -+ while (iterator.hasNext()) { -+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); -+ -+ if (entitytrackerentry.tracker == entityplayer) { -+ entitytrackerentry.scanPlayers(this.world.players); -+ } else { -+ entitytrackerentry.updatePlayer(entityplayer); -+ } -+ } -+ -+ } -+ -+ public void a(Entity entity, Packet packet) { -+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.getId()); -+ -+ if (entitytrackerentry != null) { -+ entitytrackerentry.broadcast(packet); -+ } -+ -+ } -+ -+ public void sendPacketToEntity(Entity entity, Packet packet) { -+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.getId()); -+ -+ if (entitytrackerentry != null) { -+ entitytrackerentry.broadcastIncludingSelf(packet); -+ } -+ -+ } -+ -+ public void untrackPlayer(EntityPlayer entityplayer) { -+ Iterator iterator = this.c.iterator(); -+ -+ while (iterator.hasNext()) { -+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); -+ -+ entitytrackerentry.clear(entityplayer); -+ } -+ -+ } -+ -+ public void a(EntityPlayer entityplayer, Chunk chunk) { -+ Iterator iterator = this.c.iterator(); -+ -+ while (iterator.hasNext()) { -+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); -+ -+ if (entitytrackerentry.tracker != entityplayer && entitytrackerentry.tracker.ae == chunk.locX && entitytrackerentry.tracker.ag == chunk.locZ) { -+ entitytrackerentry.updatePlayer(entityplayer); -+ } -+ } -+ -+ } -+ +} diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/main/java/net/minecraft/server/GameProfileBanEntry.java new file mode 100644 @@ -2234,7 +1953,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.Date; +import java.util.UUID; + -+public class GameProfileBanEntry extends ExpirableListEntry { ++public class GameProfileBanEntry extends ExpirableListEntry { + + public GameProfileBanEntry(GameProfile gameprofile) { + this(gameprofile, (Date) null, (String) null, (Date) null, (String) null); @@ -2393,7 +2112,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + } -+ +} diff --git a/src/main/java/net/minecraft/server/IntCache.java b/src/main/java/net/minecraft/server/IntCache.java new file mode 100644 @@ -2409,10 +2127,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +public class IntCache { + + private static int a = 256; -+ private static List b = Lists.newArrayList(); -+ private static List c = Lists.newArrayList(); -+ private static List d = Lists.newArrayList(); -+ private static List e = Lists.newArrayList(); ++ private static List b = Lists.newArrayList(); ++ private static List c = Lists.newArrayList(); ++ private static List d = Lists.newArrayList(); ++ private static List e = Lists.newArrayList(); + + public static synchronized int[] a(int i) { + int[] aint; @@ -2463,7 +2181,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static synchronized String b() { + return "cache: " + IntCache.d.size() + ", tcache: " + IntCache.b.size() + ", allocated: " + IntCache.e.size() + ", tallocated: " + IntCache.c.size(); + } -+ +} diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java new file mode 100644 @@ -2489,7 +2206,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + IBlockData iblockdata = world.getType(blockposition); + Block block = iblockdata.getBlock(); + -+ if (!block.f(world, blockposition)) { ++ if (!block.a(world, blockposition)) { + blockposition = blockposition.shift(enumdirection); + } + @@ -2519,10 +2236,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + BlockPosition blockposition3 = blockposition.up(); -+ IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag2 ? EnumDoorHinge.RIGHT : EnumDoorHinge.LEFT); ++ IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag2 ? BlockDoor.EnumDoorHinge.RIGHT : BlockDoor.EnumDoorHinge.LEFT); + -+ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.LOWER), 2); -+ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.UPPER), 2); ++ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); ++ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); + world.applyPhysics(blockposition, block); + world.applyPhysics(blockposition3, block); + } @@ -2554,7 +2271,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } else { + IBlockData iblockdata = world.getType(blockposition); + Block block = iblockdata.getBlock(); -+ boolean flag = block.f(world, blockposition); ++ boolean flag = block.a(world, blockposition); + + if (!flag) { + if (!world.getType(blockposition).getBlock().getMaterial().isBuildable()) { @@ -2569,7 +2286,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } else if (!Blocks.SKULL.canPlace(world, blockposition)) { + return false; + } else { -+ if (!world.isStatic) { ++ if (!world.isClientSide) { + world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 3); + int i = 0; + @@ -2656,7 +2373,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return false; + } + } -+ +} diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java new file mode 100644 @@ -2668,14 +2384,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import java.io.DataInput; +import java.io.DataOutput; ++import java.io.IOException; + +public abstract class NBTBase { + + public static final String[] a = new String[] { "END", "BYTE", "SHORT", "INT", "LONG", "FLOAT", "DOUBLE", "BYTE[]", "STRING", "LIST", "COMPOUND", "INT[]"}; + -+ abstract void write(DataOutput dataoutput) throws java.io.IOException; ++ abstract void write(DataOutput dataoutput) throws IOException; + -+ abstract void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException; ++ abstract void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException; + + public abstract String toString(); + @@ -2750,6 +2467,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.toString(); + } + ++ public abstract static class NBTNumber extends NBTBase { ++ ++ protected NBTNumber() {} ++ ++ public abstract long c(); ++ ++ public abstract int d(); ++ ++ public abstract short e(); ++ ++ public abstract byte f(); ++ ++ public abstract double g(); ++ ++ public abstract float h(); ++ } +} diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java new file mode 100644 @@ -2773,8 +2506,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class NBTCompressedStreamTools { + -+ public static NBTTagCompound a(InputStream inputstream) { -+ try { ++ public static NBTTagCompound a(InputStream inputstream) throws IOException { + DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(inputstream))); + + NBTTagCompound nbttagcompound; @@ -2786,11 +2518,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + return nbttagcompound; -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null; + } + -+ public static void a(NBTTagCompound nbttagcompound, OutputStream outputstream) { -+ try { ++ public static void a(NBTTagCompound nbttagcompound, OutputStream outputstream) throws IOException { + DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(outputstream))); + + try { @@ -2798,15 +2528,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } finally { + dataoutputstream.close(); + } -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } ++ + } + -+ public static NBTTagCompound a(DataInputStream datainputstream) { ++ public static NBTTagCompound a(DataInputStream datainputstream) throws IOException { + return a((DataInput) datainputstream, NBTReadLimiter.a); + } + -+ public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) { -+ try { ++ public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException { + NBTBase nbtbase = a(datainput, 0, nbtreadlimiter); + + if (nbtbase instanceof NBTTagCompound) { @@ -2814,25 +2543,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } else { + throw new IOException("Root tag must be a named compound tag"); + } -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null; + } + -+ public static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) { ++ public static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { + a((NBTBase) nbttagcompound, dataoutput); + } + -+ private static void a(NBTBase nbtbase, DataOutput dataoutput) { -+ try { ++ private static void a(NBTBase nbtbase, DataOutput dataoutput) throws IOException { + dataoutput.writeByte(nbtbase.getTypeId()); + if (nbtbase.getTypeId() != 0) { + dataoutput.writeUTF(""); + nbtbase.write(dataoutput); + } -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } + } + -+ private static NBTBase a(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) { -+ try { ++ private static NBTBase a(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { + byte b0 = datainput.readByte(); + + if (b0 == 0) { @@ -2853,7 +2578,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + throw new ReportedException(crashreport); + } + } -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null; + } +} diff --git a/src/main/java/net/minecraft/server/NBTTagByteArray.java b/src/main/java/net/minecraft/server/NBTTagByteArray.java @@ -2866,6 +2590,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import java.io.DataInput; +import java.io.DataOutput; ++import java.io.IOException; +import java.util.Arrays; + +public class NBTTagByteArray extends NBTBase { @@ -2878,12 +2603,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.data = abyte; + } + -+ void write(DataOutput dataoutput) throws java.io.IOException { ++ void write(DataOutput dataoutput) throws IOException { + dataoutput.writeInt(this.data.length); + dataoutput.write(this.data); + } + -+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { ++ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { + int j = datainput.readInt(); + + nbtreadlimiter.a((long) (8 * j)); @@ -2928,6 +2653,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import java.io.DataInput; +import java.io.DataOutput; ++import java.io.IOException; +import java.util.Arrays; + +public class NBTTagIntArray extends NBTBase { @@ -2940,7 +2666,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.data = aint; + } + -+ void write(DataOutput dataoutput) throws java.io.IOException { ++ void write(DataOutput dataoutput) throws IOException { + dataoutput.writeInt(this.data.length); + + for (int i = 0; i < this.data.length; ++i) { @@ -2949,7 +2675,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } + -+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { ++ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { + int j = datainput.readInt(); + + nbtreadlimiter.a((long) (32 * j)); @@ -3006,7 +2732,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+public class NextTickListEntry implements Comparable { ++public class NextTickListEntry implements Comparable { + + private static long d; + private final Block e; @@ -3056,7 +2782,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.e; + } + -+ public int compareTo(Object object) { ++ public int compareTo(NextTickListEntry object) { + return this.a((NextTickListEntry) object); + } +} @@ -3134,59 +2860,60 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class OldChunkLoader { + -+ public static OldChunk a(NBTTagCompound nbttagcompound) { ++ public static OldChunkLoader.OldChunk a(NBTTagCompound nbttagcompound) { + int i = nbttagcompound.getInt("xPos"); + int j = nbttagcompound.getInt("zPos"); -+ OldChunk oldchunk = new OldChunk(i, j); ++ OldChunkLoader.OldChunk oldchunkloader_oldchunk = new OldChunkLoader.OldChunk(i, j); + -+ oldchunk.g = nbttagcompound.getByteArray("Blocks"); -+ oldchunk.f = new OldNibbleArray(nbttagcompound.getByteArray("Data"), 7); -+ oldchunk.e = new OldNibbleArray(nbttagcompound.getByteArray("SkyLight"), 7); -+ oldchunk.d = new OldNibbleArray(nbttagcompound.getByteArray("BlockLight"), 7); -+ oldchunk.c = nbttagcompound.getByteArray("HeightMap"); -+ oldchunk.b = nbttagcompound.getBoolean("TerrainPopulated"); -+ oldchunk.h = nbttagcompound.getList("Entities", 10); -+ oldchunk.i = nbttagcompound.getList("TileEntities", 10); -+ oldchunk.j = nbttagcompound.getList("TileTicks", 10); ++ oldchunkloader_oldchunk.g = nbttagcompound.getByteArray("Blocks"); ++ oldchunkloader_oldchunk.f = new OldNibbleArray(nbttagcompound.getByteArray("Data"), 7); ++ oldchunkloader_oldchunk.e = new OldNibbleArray(nbttagcompound.getByteArray("SkyLight"), 7); ++ oldchunkloader_oldchunk.d = new OldNibbleArray(nbttagcompound.getByteArray("BlockLight"), 7); ++ oldchunkloader_oldchunk.c = nbttagcompound.getByteArray("HeightMap"); ++ oldchunkloader_oldchunk.b = nbttagcompound.getBoolean("TerrainPopulated"); ++ oldchunkloader_oldchunk.h = nbttagcompound.getList("Entities", 10); ++ oldchunkloader_oldchunk.i = nbttagcompound.getList("TileEntities", 10); ++ oldchunkloader_oldchunk.j = nbttagcompound.getList("TileTicks", 10); + + try { -+ oldchunk.a = nbttagcompound.getLong("LastUpdate"); ++ oldchunkloader_oldchunk.a = nbttagcompound.getLong("LastUpdate"); + } catch (ClassCastException classcastexception) { -+ oldchunk.a = (long) nbttagcompound.getInt("LastUpdate"); ++ oldchunkloader_oldchunk.a = (long) nbttagcompound.getInt("LastUpdate"); + } + -+ return oldchunk; ++ return oldchunkloader_oldchunk; + } + -+ public static void a(OldChunk oldchunk, NBTTagCompound nbttagcompound, WorldChunkManager worldchunkmanager) { -+ nbttagcompound.setInt("xPos", oldchunk.k); -+ nbttagcompound.setInt("zPos", oldchunk.l); -+ nbttagcompound.setLong("LastUpdate", oldchunk.a); -+ int[] aint = new int[oldchunk.c.length]; ++ public static void a(OldChunkLoader.OldChunk oldchunkloader_oldchunk, NBTTagCompound nbttagcompound, WorldChunkManager worldchunkmanager) { ++ nbttagcompound.setInt("xPos", oldchunkloader_oldchunk.k); ++ nbttagcompound.setInt("zPos", oldchunkloader_oldchunk.l); ++ nbttagcompound.setLong("LastUpdate", oldchunkloader_oldchunk.a); ++ int[] aint = new int[oldchunkloader_oldchunk.c.length]; + -+ for (int i = 0; i < oldchunk.c.length; ++i) { -+ aint[i] = oldchunk.c[i]; ++ for (int i = 0; i < oldchunkloader_oldchunk.c.length; ++i) { ++ aint[i] = oldchunkloader_oldchunk.c[i]; + } + + nbttagcompound.setIntArray("HeightMap", aint); -+ nbttagcompound.setBoolean("TerrainPopulated", oldchunk.b); ++ nbttagcompound.setBoolean("TerrainPopulated", oldchunkloader_oldchunk.b); + NBTTagList nbttaglist = new NBTTagList(); + + int j; ++ int k; + -+ for (int k = 0; k < 8; ++k) { ++ for (int l = 0; l < 8; ++l) { + boolean flag = true; + + for (j = 0; j < 16 && flag; ++j) { -+ int l = 0; ++ k = 0; + -+ while (l < 16 && flag) { ++ while (k < 16 && flag) { + int i1 = 0; + + while (true) { + if (i1 < 16) { -+ int j1 = j << 11 | i1 << 7 | l + (k << 4); -+ byte b0 = oldchunk.g[j1]; ++ int j1 = j << 11 | i1 << 7 | k + (l << 4); ++ byte b0 = oldchunkloader_oldchunk.g[j1]; + + if (b0 == 0) { + ++i1; @@ -3196,7 +2923,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + flag = false; + } + -+ ++l; ++ ++k; + break; + } + } @@ -3211,20 +2938,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + for (int k1 = 0; k1 < 16; ++k1) { + for (int l1 = 0; l1 < 16; ++l1) { + for (int i2 = 0; i2 < 16; ++i2) { -+ int j2 = k1 << 11 | i2 << 7 | l1 + (k << 4); -+ byte b1 = oldchunk.g[j2]; ++ int j2 = k1 << 11 | i2 << 7 | l1 + (l << 4); ++ byte b1 = oldchunkloader_oldchunk.g[j2]; + + abyte[l1 << 8 | i2 << 4 | k1] = (byte) (b1 & 255); -+ nibblearray.a(k1, l1, i2, oldchunk.f.a(k1, l1 + (k << 4), i2)); -+ nibblearray1.a(k1, l1, i2, oldchunk.e.a(k1, l1 + (k << 4), i2)); -+ nibblearray2.a(k1, l1, i2, oldchunk.d.a(k1, l1 + (k << 4), i2)); ++ nibblearray.a(k1, l1, i2, oldchunkloader_oldchunk.f.a(k1, l1 + (l << 4), i2)); ++ nibblearray1.a(k1, l1, i2, oldchunkloader_oldchunk.e.a(k1, l1 + (l << 4), i2)); ++ nibblearray2.a(k1, l1, i2, oldchunkloader_oldchunk.d.a(k1, l1 + (l << 4), i2)); + } + } + } + + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + -+ nbttagcompound1.setByte("Y", (byte) (k & 255)); ++ nbttagcompound1.setByte("Y", (byte) (l & 255)); + nbttagcompound1.setByteArray("Blocks", abyte); + nbttagcompound1.setByteArray("Data", nibblearray.a()); + nbttagcompound1.setByteArray("SkyLight", nibblearray1.a()); @@ -3235,67 +2962,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + nbttagcompound.set("Sections", nbttaglist); + byte[] abyte1 = new byte[256]; ++ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); + -+ for (int k2 = 0; k2 < 16; ++k2) { -+ for (j = 0; j < 16; ++j) { -+ abyte1[j << 4 | k2] = (byte) (worldchunkmanager.getBiome(new BlockPosition(oldchunk.k << 4 | k2, 0, oldchunk.l << 4 | j), BiomeBase.ad).id & 255); ++ for (j = 0; j < 16; ++j) { ++ for (k = 0; k < 16; ++k) { ++ blockposition_mutableblockposition.c(oldchunkloader_oldchunk.k << 4 | j, 0, oldchunkloader_oldchunk.l << 4 | k); ++ abyte1[k << 4 | j] = (byte) (worldchunkmanager.getBiome(blockposition_mutableblockposition, BiomeBase.ad).id & 255); + } + } + + nbttagcompound.setByteArray("Biomes", abyte1); -+ nbttagcompound.set("Entities", oldchunk.h); -+ nbttagcompound.set("TileEntities", oldchunk.i); -+ if (oldchunk.j != null) { -+ nbttagcompound.set("TileTicks", oldchunk.j); ++ nbttagcompound.set("Entities", oldchunkloader_oldchunk.h); ++ nbttagcompound.set("TileEntities", oldchunkloader_oldchunk.i); ++ if (oldchunkloader_oldchunk.j != null) { ++ nbttagcompound.set("TileTicks", oldchunkloader_oldchunk.j); + } + + } -+} -diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; + -+public class PacketHandshakingInSetProtocol implements Packet { ++ public static class OldChunk { + -+ private int a; -+ public String b; -+ public int c; -+ private EnumProtocol d; ++ public long a; ++ public boolean b; ++ public byte[] c; ++ public OldNibbleArray d; ++ public OldNibbleArray e; ++ public OldNibbleArray f; ++ public byte[] g; ++ public NBTTagList h; ++ public NBTTagList i; ++ public NBTTagList j; ++ public final int k; ++ public final int l; + -+ public PacketHandshakingInSetProtocol() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.e(); -+ this.b = packetdataserializer.c(255); -+ this.c = packetdataserializer.readUnsignedShort(); -+ this.d = EnumProtocol.a(packetdataserializer.e()); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.b(this.a); -+ packetdataserializer.a(this.b); -+ packetdataserializer.writeShort(this.c); -+ packetdataserializer.b(this.d.a()); -+ } -+ -+ public void a(PacketHandshakingInListener packethandshakinginlistener) { -+ packethandshakinginlistener.a(this); -+ } -+ -+ public EnumProtocol a() { -+ return this.d; -+ } -+ -+ public int b() { -+ return this.a; -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketHandshakingInListener) packetlistener); ++ public OldChunk(int i, int j) { ++ this.k = i; ++ this.l = j; ++ } + } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java @@ -3306,7 +3009,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+public class PacketPlayInChat implements Packet { ++import java.io.IOException; ++ ++public class PacketPlayInChat implements Packet { + + private String a; + @@ -3320,11 +3025,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a = s; + } + -+ public void a(PacketDataSerializer packetdataserializer) { ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.a = packetdataserializer.c(100); + } + -+ public void b(PacketDataSerializer packetdataserializer) { ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.a(this.a); + } + @@ -3335,10 +3040,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public String a() { + return this.a; + } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayIn) packetlistener); -+ } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java new file mode 100644 @@ -3349,14 +3050,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +package net.minecraft.server; + +import com.google.common.collect.Lists; ++import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; + -+public class PacketPlayOutMapChunk implements Packet { ++public class PacketPlayOutMapChunk implements Packet { + + private int a; + private int b; -+ private ChunkMap c; ++ private PacketPlayOutMapChunk.ChunkMap c; + private boolean d; + + public PacketPlayOutMapChunk() {} @@ -3368,16 +3070,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i); + } + -+ public void a(PacketDataSerializer packetdataserializer) { ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.a = packetdataserializer.readInt(); + this.b = packetdataserializer.readInt(); + this.d = packetdataserializer.readBoolean(); -+ this.c = new ChunkMap(); ++ this.c = new PacketPlayOutMapChunk.ChunkMap(); + this.c.b = packetdataserializer.readShort(); + this.c.a = packetdataserializer.a(); + } + -+ public void b(PacketDataSerializer packetdataserializer) { ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.writeInt(this.a); + packetdataserializer.writeInt(this.b); + packetdataserializer.writeBoolean(this.d); @@ -3398,9 +3100,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return j + k + l + i1; + } + -+ public static ChunkMap a(Chunk chunk, boolean flag, boolean flag1, int i) { ++ public static PacketPlayOutMapChunk.ChunkMap a(Chunk chunk, boolean flag, boolean flag1, int i) { + ChunkSection[] achunksection = chunk.getSections(); -+ ChunkMap chunkmap = new ChunkMap(); ++ PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = new PacketPlayOutMapChunk.ChunkMap(); + ArrayList arraylist = Lists.newArrayList(); + + int j; @@ -3409,12 +3111,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ChunkSection chunksection = achunksection[j]; + + if (chunksection != null && (!flag || !chunksection.a()) && (i & 1 << j) != 0) { -+ chunkmap.b |= 1 << j; ++ packetplayoutmapchunk_chunkmap.b |= 1 << j; + arraylist.add(chunksection); + } + } + -+ chunkmap.a = new byte[a(Integer.bitCount(chunkmap.b), flag1, flag)]; ++ packetplayoutmapchunk_chunkmap.a = new byte[a(Integer.bitCount(packetplayoutmapchunk_chunkmap.b), flag1, flag)]; + j = 0; + Iterator iterator = arraylist.iterator(); + @@ -3429,26 +3131,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + for (int l = 0; l < k; ++l) { + char c0 = achar1[l]; + -+ chunkmap.a[j++] = (byte) (c0 & 255); -+ chunkmap.a[j++] = (byte) (c0 >> 8 & 255); ++ packetplayoutmapchunk_chunkmap.a[j++] = (byte) (c0 & 255); ++ packetplayoutmapchunk_chunkmap.a[j++] = (byte) (c0 >> 8 & 255); + } + } + -+ for (iterator = arraylist.iterator(); iterator.hasNext(); j = a(chunksection1.getEmittedLightArray().a(), chunkmap.a, j)) { ++ for (iterator = arraylist.iterator(); iterator.hasNext(); j = a(chunksection1.getEmittedLightArray().a(), packetplayoutmapchunk_chunkmap.a, j)) { + chunksection1 = (ChunkSection) iterator.next(); + } + + if (flag1) { -+ for (iterator = arraylist.iterator(); iterator.hasNext(); j = a(chunksection1.getSkyLightArray().a(), chunkmap.a, j)) { ++ for (iterator = arraylist.iterator(); iterator.hasNext(); j = a(chunksection1.getSkyLightArray().a(), packetplayoutmapchunk_chunkmap.a, j)) { + chunksection1 = (ChunkSection) iterator.next(); + } + } + + if (flag) { -+ a(chunk.getBiomeIndex(), chunkmap.a, j); ++ a(chunk.getBiomeIndex(), packetplayoutmapchunk_chunkmap.a, j); + } + -+ return chunkmap; ++ return packetplayoutmapchunk_chunkmap; + } + + private static int a(byte[] abyte, byte[] abyte1, int i) { @@ -3456,8 +3158,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return i + abyte.length; + } + -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); ++ public static class ChunkMap { ++ ++ public byte[] a; ++ public int b; ++ ++ public ChunkMap() {} + } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java @@ -3468,50 +3174,51 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import java.io.IOException; +import java.util.List; + -+public class PacketPlayOutMapChunkBulk implements Packet { ++public class PacketPlayOutMapChunkBulk implements Packet { + + private int[] a; + private int[] b; -+ private ChunkMap[] c; ++ private PacketPlayOutMapChunk.ChunkMap[] c; + private boolean d; + + public PacketPlayOutMapChunkBulk() {} + -+ public PacketPlayOutMapChunkBulk(List list) { ++ public PacketPlayOutMapChunkBulk(List list) { + int i = list.size(); + + this.a = new int[i]; + this.b = new int[i]; -+ this.c = new ChunkMap[i]; ++ this.c = new PacketPlayOutMapChunk.ChunkMap[i]; + this.d = !((Chunk) list.get(0)).getWorld().worldProvider.o(); + + for (int j = 0; j < i; ++j) { + Chunk chunk = (Chunk) list.get(j); -+ ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, this.d, '\uffff'); ++ PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = PacketPlayOutMapChunk.a(chunk, true, this.d, '\uffff'); + + this.a[j] = chunk.locX; + this.b[j] = chunk.locZ; -+ this.c[j] = chunkmap; ++ this.c[j] = packetplayoutmapchunk_chunkmap; + } + + } + -+ public void a(PacketDataSerializer packetdataserializer) { ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.d = packetdataserializer.readBoolean(); + int i = packetdataserializer.e(); + + this.a = new int[i]; + this.b = new int[i]; -+ this.c = new ChunkMap[i]; ++ this.c = new PacketPlayOutMapChunk.ChunkMap[i]; + + int j; + + for (j = 0; j < i; ++j) { + this.a[j] = packetdataserializer.readInt(); + this.b[j] = packetdataserializer.readInt(); -+ this.c[j] = new ChunkMap(); ++ this.c[j] = new PacketPlayOutMapChunk.ChunkMap(); + this.c[j].b = packetdataserializer.readShort() & '\uffff'; + this.c[j].a = new byte[PacketPlayOutMapChunk.a(Integer.bitCount(this.c[j].b), this.d, true)]; + } @@ -3522,7 +3229,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } + -+ public void b(PacketDataSerializer packetdataserializer) { ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.writeBoolean(this.d); + packetdataserializer.b(this.c.length); + @@ -3543,10 +3250,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void a(PacketListenerPlayOut packetlistenerplayout) { + packetlistenerplayout.a(this); + } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java new file mode 100644 @@ -3556,7 +3259,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+public class PacketPlayOutOpenWindow implements Packet { ++import java.io.IOException; ++ ++public class PacketPlayOutOpenWindow implements Packet { + + private int a; + private String b; @@ -3586,7 +3291,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + packetlistenerplayout.a(this); + } + -+ public void a(PacketDataSerializer packetdataserializer) { ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.a = packetdataserializer.readUnsignedByte(); + this.b = packetdataserializer.c(32); + this.c = packetdataserializer.d(); @@ -3597,7 +3302,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } + -+ public void b(PacketDataSerializer packetdataserializer) { ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.writeByte(this.a); + packetdataserializer.a(this.b); + packetdataserializer.a(this.c); @@ -3607,10 +3312,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } +} diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java new file mode 100644 @@ -3633,7 +3334,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean a() { + EntityLiving entityliving = this.a.getGoalTarget(); + -+ return this.a.ck() > 0 || entityliving != null && this.a.h(entityliving) < 9.0D; ++ return this.a.cm() > 0 || entityliving != null && this.a.h(entityliving) < 9.0D; + } + + public void c() { @@ -3682,16 +3383,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +public class PersistentCollection { + + private IDataManager b; -+ protected Map a = Maps.newHashMap(); -+ private List c = Lists.newArrayList(); -+ private Map d = Maps.newHashMap(); ++ protected Map a = Maps.newHashMap(); ++ private List c = Lists.newArrayList(); ++ private Map d = Maps.newHashMap(); + + public PersistentCollection(IDataManager idatamanager) { + this.b = idatamanager; + this.b(); + } + -+ public PersistentBase get(Class oclass, String s) { ++ public PersistentBase get(Class oclass, String s) { + PersistentBase persistentbase = (PersistentBase) this.a.get(s); + + if (persistentbase != null) { @@ -3865,7 +3566,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class RegionFileCache { + -+ private static final Map a = Maps.newHashMap(); ++ private static final Map a = Maps.newHashMap(); + + public static synchronized RegionFile a(File file, int i, int j) { + File file1 = new File(file, "region"); @@ -3919,7 +3620,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + return regionfile.b(i & 31, j & 31); + } -+ +} diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java new file mode 100644 @@ -3930,11 +3630,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +package net.minecraft.server; + +import com.google.common.collect.Lists; ++import com.google.common.util.concurrent.ThreadFactoryBuilder; +import io.netty.bootstrap.ServerBootstrap; ++import io.netty.channel.Channel; ++import io.netty.channel.ChannelException; +import io.netty.channel.ChannelFuture; ++import io.netty.channel.ChannelInitializer; ++import io.netty.channel.ChannelOption; +import io.netty.channel.EventLoopGroup; ++import io.netty.channel.epoll.Epoll; ++import io.netty.channel.epoll.EpollEventLoopGroup; ++import io.netty.channel.epoll.EpollServerSocketChannel; ++import io.netty.channel.local.LocalEventLoopGroup; ++import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.nio.NioServerSocketChannel; ++import io.netty.handler.timeout.ReadTimeoutHandler; ++import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.GenericFutureListener; ++import java.io.IOException; +import java.net.InetAddress; +import java.util.Collections; +import java.util.Iterator; @@ -3945,30 +3658,83 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class ServerConnection { + -+ private static final Logger d = LogManager.getLogger(); -+ public static final LazyInitVar a = new LazyInitNioEventLoopGroup(); -+ public static final LazyInitVar b = new LazyInitLocalEventLoopGroup(); -+ private final MinecraftServer e; -+ public volatile boolean c; -+ private final List f = Collections.synchronizedList(Lists.newArrayList()); -+ private final List g = Collections.synchronizedList(Lists.newArrayList()); ++ private static final Logger e = LogManager.getLogger(); ++ public static final LazyInitVar a = new LazyInitVar() { ++ protected NioEventLoopGroup a() { ++ return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build()); ++ } ++ ++ protected Object init() { ++ return this.a(); ++ } ++ }; ++ public static final LazyInitVar b = new LazyInitVar() { ++ protected EpollEventLoopGroup a() { ++ return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).build()); ++ } ++ ++ protected Object init() { ++ return this.a(); ++ } ++ }; ++ public static final LazyInitVar c = new LazyInitVar() { ++ protected LocalEventLoopGroup a() { ++ return new LocalEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Server IO #%d").setDaemon(true).build()); ++ } ++ ++ protected Object init() { ++ return this.a(); ++ } ++ }; ++ private final MinecraftServer f; ++ public volatile boolean d; ++ private final List g = Collections.synchronizedList(Lists.newArrayList()); ++ private final List h = Collections.synchronizedList(Lists.newArrayList()); + + public ServerConnection(MinecraftServer minecraftserver) { -+ this.e = minecraftserver; -+ this.c = true; ++ this.f = minecraftserver; ++ this.d = true; + } + -+ public void a(InetAddress inetaddress, int i) { -+ List list = this.f; ++ public void a(InetAddress inetaddress, int i) throws IOException { ++ List list = this.g; + -+ synchronized (this.f) { -+ this.f.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(NioServerSocketChannel.class)).childHandler(new ServerConnectionChannel(this)).group((EventLoopGroup) ServerConnection.a.c()).localAddress(inetaddress, i)).bind().syncUninterruptibly()); ++ synchronized (this.g) { ++ Class oclass; ++ LazyInitVar lazyinitvar; ++ ++ if (Epoll.isAvailable() && this.f.ah()) { ++ oclass = EpollServerSocketChannel.class; ++ lazyinitvar = ServerConnection.b; ++ ServerConnection.e.info("Using epoll channel type"); ++ } else { ++ oclass = NioServerSocketChannel.class; ++ lazyinitvar = ServerConnection.a; ++ ServerConnection.e.info("Using default channel type"); ++ } ++ ++ this.g.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer() { ++ protected void initChannel(Channel channel) throws Exception { ++ try { ++ channel.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true)); ++ } catch (ChannelException channelexception) { ++ ; ++ } ++ ++ channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); ++ NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); ++ ++ ServerConnection.this.h.add(networkmanager); ++ channel.pipeline().addLast("packet_handler", networkmanager); ++ networkmanager.a((PacketListener) (new HandshakeListener(ServerConnection.this.f, networkmanager))); ++ } ++ }).group((EventLoopGroup) lazyinitvar.c()).localAddress(inetaddress, i)).bind().syncUninterruptibly()); + } + } + + public void b() { -+ this.c = false; -+ Iterator iterator = this.f.iterator(); ++ this.d = false; ++ Iterator iterator = this.g.iterator(); + + while (iterator.hasNext()) { + ChannelFuture channelfuture = (ChannelFuture) iterator.next(); @@ -3976,20 +3742,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + try { + channelfuture.channel().close().sync(); + } catch (InterruptedException interruptedexception) { -+ ServerConnection.d.error("Interrupted whilst closing channel"); ++ ServerConnection.e.error("Interrupted whilst closing channel"); + } + } + + } + + public void c() { -+ List list = this.g; ++ List list = this.h; + -+ synchronized (this.g) { -+ Iterator iterator = this.g.iterator(); ++ synchronized (this.h) { ++ Iterator iterator = this.h.iterator(); + + while (iterator.hasNext()) { -+ NetworkManager networkmanager = (NetworkManager) iterator.next(); ++ final NetworkManager networkmanager = (NetworkManager) iterator.next(); + + if (!networkmanager.h()) { + if (!networkmanager.g()) { @@ -4003,14 +3769,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + CrashReport crashreport = CrashReport.a(exception, "Ticking memory connection"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Ticking connection"); + -+ crashreportsystemdetails.a("Connection", (Callable) (new CrashReportNetworkManager(this, networkmanager))); ++ crashreportsystemdetails.a("Connection", new Callable() { ++ public String a() throws Exception { ++ return networkmanager.toString(); ++ } ++ ++ public Object call() throws Exception { ++ return this.a(); ++ } ++ }); + throw new ReportedException(crashreport); + } + -+ ServerConnection.d.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception); -+ ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); ++ ServerConnection.e.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception); ++ final ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); + -+ networkmanager.a(new PacketPlayOutKickDisconnect(chatcomponenttext), new NetworkManagerCloseFuture(this, networkmanager, chatcomponenttext), new GenericFutureListener[0]); ++ networkmanager.a(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener>() { ++ public void operationComplete(Future future) throws Exception { ++ networkmanager.close(chatcomponenttext); ++ } ++ }, new GenericFutureListener[0]); + networkmanager.k(); + } + } @@ -4021,59 +3799,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public MinecraftServer d() { -+ return this.e; -+ } -+ -+ static List a(ServerConnection serverconnection) { -+ return serverconnection.g; -+ } -+ -+ static MinecraftServer b(ServerConnection serverconnection) { -+ return serverconnection.e; -+ } -+ -+} -diff --git a/src/main/java/net/minecraft/server/ServerConnectionChannel.java b/src/main/java/net/minecraft/server/ServerConnectionChannel.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ServerConnectionChannel.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import io.netty.channel.Channel; -+import io.netty.channel.ChannelException; -+import io.netty.channel.ChannelInitializer; -+import io.netty.channel.ChannelOption; -+import io.netty.handler.timeout.ReadTimeoutHandler; -+ -+class ServerConnectionChannel extends ChannelInitializer { -+ -+ final ServerConnection a; -+ -+ ServerConnectionChannel(ServerConnection serverconnection) { -+ this.a = serverconnection; -+ } -+ -+ protected void initChannel(Channel channel) { -+ try { -+ channel.config().setOption(ChannelOption.IP_TOS, Integer.valueOf(24)); -+ } catch (ChannelException channelexception) { -+ ; -+ } -+ -+ try { -+ channel.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(false)); -+ } catch (ChannelException channelexception1) { -+ ; -+ } -+ -+ channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(this.a)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); -+ NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); -+ -+ ServerConnection.a(this.a).add(networkmanager); -+ channel.pipeline().addLast("packet_handler", networkmanager); -+ networkmanager.a((PacketListener) (new HandshakeListener(ServerConnection.b(this.a), networkmanager))); ++ return this.f; + } +} diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java @@ -4108,7 +3834,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private static final Logger b = LogManager.getLogger(); + private final MinecraftServer c; + private final File d; -+ private final Set e = Sets.newHashSet(); ++ private final Set e = Sets.newHashSet(); + private int f = -300; + private boolean g = false; + @@ -4147,21 +3873,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.e.add(statistic); + if (statistic.d() && j == 0 && i > 0) { + this.g = true; -+ if (this.c.az()) { ++ if (this.c.aA()) { + this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()})); + } + } + + if (statistic.d() && j > 0 && i == 0) { + this.g = true; -+ if (this.c.az()) { ++ if (this.c.aA()) { + this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement.taken", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()})); + } + } + + } + -+ public Set c() { ++ public Set c() { + HashSet hashset = Sets.newHashSet(this.e); + + this.e.clear(); @@ -4169,7 +3895,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return hashset; + } + -+ public Map a(String s) { ++ public Map a(String s) { + JsonElement jsonelement = (new JsonParser()).parse(s); + + if (!jsonelement.isJsonObject()) { @@ -4218,7 +3944,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ public static String a(Map map) { ++ public static String a(Map map) { + JsonObject jsonobject = new JsonObject(); + Iterator iterator = map.entrySet().iterator(); + @@ -4257,7 +3983,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void a(EntityPlayer entityplayer) { -+ int i = this.c.ar(); ++ int i = this.c.as(); + HashMap hashmap = Maps.newHashMap(); + + if (this.g || i - this.f > 300) { @@ -4293,7 +4019,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean e() { + return this.g; + } -+ +} diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java new file mode 100644 @@ -4313,13 +4038,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +public abstract class StructureGenerator extends WorldGenBase { + + private PersistentStructure d; -+ protected Map e = Maps.newHashMap(); ++ protected Map e = Maps.newHashMap(); + + public StructureGenerator() {} + + public abstract String a(); + -+ protected final void a(World world, int i, int j, int k, int l, ChunkSnapshot chunksnapshot) { ++ protected final void a(World world, final int i, final int j, int k, int l, ChunkSnapshot chunksnapshot) { + this.a(world); + if (!this.e.containsKey(Long.valueOf(ChunkCoordIntPair.a(i, j)))) { + this.b.nextInt(); @@ -4336,10 +4061,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + CrashReport crashreport = CrashReport.a(throwable, "Exception preparing structure feature"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Feature being prepared"); + -+ crashreportsystemdetails.a("Is feature chunk", (Callable) (new CrashReportIsFeatureChunk(this, i, j))); ++ crashreportsystemdetails.a("Is feature chunk", new Callable() { ++ public String a() throws Exception { ++ return StructureGenerator.this.a(i, j) ? "True" : "False"; ++ } ++ ++ public Object call() throws Exception { ++ return this.a(); ++ } ++ }); + crashreportsystemdetails.a("Chunk location", (Object) String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); -+ crashreportsystemdetails.a("Chunk pos hash", (Callable) (new CrashReportChunkPosHash(this, i, j))); -+ crashreportsystemdetails.a("Structure type", (Callable) (new CrashReportStructureType(this))); ++ crashreportsystemdetails.a("Chunk pos hash", new Callable() { ++ public String a() throws Exception { ++ return String.valueOf(ChunkCoordIntPair.a(i, j)); ++ } ++ ++ public Object call() throws Exception { ++ return this.a(); ++ } ++ }); ++ crashreportsystemdetails.a("Structure type", new Callable() { ++ public String a() throws Exception { ++ return StructureGenerator.this.getClass().getCanonicalName(); ++ } ++ ++ public Object call() throws Exception { ++ return this.a(); ++ } ++ }); + throw new ReportedException(crashreport); + } + } @@ -4446,7 +4195,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (blockposition1 != null) { + return blockposition1; + } else { -+ List list = this.y_(); ++ List list = this.z_(); + + if (list != null) { + BlockPosition blockposition3 = null; @@ -4468,7 +4217,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ protected List y_() { ++ protected List z_() { + return null; + } + @@ -4514,114 +4263,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + protected abstract StructureStart b(int i, int j); +} -diff --git a/src/main/java/net/minecraft/server/SwitchHelperBlockFlowerPot.java b/src/main/java/net/minecraft/server/SwitchHelperBlockFlowerPot.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/SwitchHelperBlockFlowerPot.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+class SwitchHelperBlockFlowerPot { -+ -+ static final int[] a; -+ static final int[] b = new int[EnumFlowerVarient.values().length]; -+ -+ static { -+ try { -+ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.POPPY.ordinal()] = 1; -+ } catch (NoSuchFieldError nosuchfielderror) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.BLUE_ORCHID.ordinal()] = 2; -+ } catch (NoSuchFieldError nosuchfielderror1) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.ALLIUM.ordinal()] = 3; -+ } catch (NoSuchFieldError nosuchfielderror2) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.HOUSTONIA.ordinal()] = 4; -+ } catch (NoSuchFieldError nosuchfielderror3) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.RED_TULIP.ordinal()] = 5; -+ } catch (NoSuchFieldError nosuchfielderror4) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.ORANGE_TULIP.ordinal()] = 6; -+ } catch (NoSuchFieldError nosuchfielderror5) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.WHITE_TULIP.ordinal()] = 7; -+ } catch (NoSuchFieldError nosuchfielderror6) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.PINK_TULIP.ordinal()] = 8; -+ } catch (NoSuchFieldError nosuchfielderror7) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.OXEYE_DAISY.ordinal()] = 9; -+ } catch (NoSuchFieldError nosuchfielderror8) { -+ ; -+ } -+ -+ a = new int[EnumLogVariant.values().length]; -+ -+ try { -+ SwitchHelperBlockFlowerPot.a[EnumLogVariant.OAK.ordinal()] = 1; -+ } catch (NoSuchFieldError nosuchfielderror9) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.a[EnumLogVariant.SPRUCE.ordinal()] = 2; -+ } catch (NoSuchFieldError nosuchfielderror10) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.a[EnumLogVariant.BIRCH.ordinal()] = 3; -+ } catch (NoSuchFieldError nosuchfielderror11) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.a[EnumLogVariant.JUNGLE.ordinal()] = 4; -+ } catch (NoSuchFieldError nosuchfielderror12) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.a[EnumLogVariant.ACACIA.ordinal()] = 5; -+ } catch (NoSuchFieldError nosuchfielderror13) { -+ ; -+ } -+ -+ try { -+ SwitchHelperBlockFlowerPot.a[EnumLogVariant.DARK_OAK.ordinal()] = 6; -+ } catch (NoSuchFieldError nosuchfielderror14) { -+ ; -+ } -+ -+ } -+} diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -4637,14 +4278,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.google.common.io.Files; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; ++import com.google.gson.JsonDeserializationContext; ++import com.google.gson.JsonDeserializer; ++import com.google.gson.JsonElement; ++import com.google.gson.JsonObject; ++import com.google.gson.JsonParseException; ++import com.google.gson.JsonSerializationContext; ++import com.google.gson.JsonSerializer; +import com.mojang.authlib.Agent; +import com.mojang.authlib.GameProfile; ++import com.mojang.authlib.ProfileLookupCallback; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.lang.reflect.ParameterizedType; ++import java.lang.reflect.Type; ++import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; @@ -4660,34 +4311,54 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +public class UserCache { + + public static final SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); -+ private final Map c = Maps.newHashMap(); -+ private final Map d = Maps.newHashMap(); -+ private final LinkedList e = Lists.newLinkedList(); ++ private final Map c = Maps.newHashMap(); ++ private final Map d = Maps.newHashMap(); ++ private final LinkedList e = Lists.newLinkedList(); + private final MinecraftServer f; + protected final Gson b; + private final File g; -+ private static final ParameterizedType h = new UserCacheEntryType(); ++ private static final ParameterizedType h = new ParameterizedType() { ++ public Type[] getActualTypeArguments() { ++ return new Type[] { UserCache.UserCacheEntry.class}; ++ } ++ ++ public Type getRawType() { ++ return List.class; ++ } ++ ++ public Type getOwnerType() { ++ return null; ++ } ++ }; + + public UserCache(MinecraftServer minecraftserver, File file) { + this.f = minecraftserver; + this.g = file; + GsonBuilder gsonbuilder = new GsonBuilder(); + -+ gsonbuilder.registerTypeHierarchyAdapter(UserCacheEntry.class, new BanEntrySerializer(this, (GameProfileLookup) null)); ++ gsonbuilder.registerTypeHierarchyAdapter(UserCache.UserCacheEntry.class, new UserCache.BanEntrySerializer(null)); + this.b = gsonbuilder.create(); + this.b(); + } + + private static GameProfile a(MinecraftServer minecraftserver, String s) { -+ GameProfile[] agameprofile = new GameProfile[1]; -+ GameProfileLookup gameprofilelookup = new GameProfileLookup(agameprofile); ++ final GameProfile[] agameprofile = new GameProfile[1]; ++ ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() { ++ public void onProfileLookupSucceeded(GameProfile gameprofile) { ++ agameprofile[0] = gameprofile; ++ } + -+ minecraftserver.getGameProfileRepository().findProfilesByNames(new String[] { s}, Agent.MINECRAFT, gameprofilelookup); ++ public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) { ++ agameprofile[0] = null; ++ } ++ }; ++ ++ minecraftserver.getGameProfileRepository().findProfilesByNames(new String[] { s}, Agent.MINECRAFT, profilelookupcallback); + if (!minecraftserver.getOnlineMode() && agameprofile[0] == null) { + UUID uuid = EntityHuman.a(new GameProfile((UUID) null, s)); + GameProfile gameprofile = new GameProfile(uuid, s); + -+ gameprofilelookup.onProfileLookupSucceeded(gameprofile); ++ profilelookupcallback.onProfileLookupSucceeded(gameprofile); + } + + return agameprofile[0]; @@ -4709,17 +4380,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + String s = gameprofile.getName().toLowerCase(Locale.ROOT); -+ UserCacheEntry usercacheentry = new UserCacheEntry(this, gameprofile, date, (GameProfileLookup) null); ++ UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date, null); + + if (this.d.containsKey(uuid)) { -+ UserCacheEntry usercacheentry1 = (UserCacheEntry) this.d.get(uuid); ++ UserCache.UserCacheEntry usercache_usercacheentry1 = (UserCache.UserCacheEntry) this.d.get(uuid); + -+ this.c.remove(usercacheentry1.a().getName().toLowerCase(Locale.ROOT)); -+ this.c.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercacheentry); ++ this.c.remove(usercache_usercacheentry1.a().getName().toLowerCase(Locale.ROOT)); ++ this.c.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercache_usercacheentry); + this.e.remove(gameprofile); + } else { -+ this.d.put(uuid, usercacheentry); -+ this.c.put(s, usercacheentry); ++ this.d.put(uuid, usercache_usercacheentry); ++ this.c.put(s, usercache_usercacheentry); + } + + this.e.addFirst(gameprofile); @@ -4727,31 +4398,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public GameProfile getProfile(String s) { + String s1 = s.toLowerCase(Locale.ROOT); -+ UserCacheEntry usercacheentry = (UserCacheEntry) this.c.get(s1); ++ UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.c.get(s1); + -+ if (usercacheentry != null && (new Date()).getTime() >= UserCacheEntry.a(usercacheentry).getTime()) { -+ this.d.remove(usercacheentry.a().getId()); -+ this.c.remove(usercacheentry.a().getName().toLowerCase(Locale.ROOT)); -+ this.e.remove(usercacheentry.a()); -+ usercacheentry = null; ++ if (usercache_usercacheentry != null && (new Date()).getTime() >= usercache_usercacheentry.c.getTime()) { ++ this.d.remove(usercache_usercacheentry.a().getId()); ++ this.c.remove(usercache_usercacheentry.a().getName().toLowerCase(Locale.ROOT)); ++ this.e.remove(usercache_usercacheentry.a()); ++ usercache_usercacheentry = null; + } + + GameProfile gameprofile; + -+ if (usercacheentry != null) { -+ gameprofile = usercacheentry.a(); ++ if (usercache_usercacheentry != null) { ++ gameprofile = usercache_usercacheentry.a(); + this.e.remove(gameprofile); + this.e.addFirst(gameprofile); + } else { + gameprofile = a(this.f, s1); + if (gameprofile != null) { + this.a(gameprofile); -+ usercacheentry = (UserCacheEntry) this.c.get(s1); ++ usercache_usercacheentry = (UserCache.UserCacheEntry) this.c.get(s1); + } + } + + this.c(); -+ return usercacheentry == null ? null : usercacheentry.a(); ++ return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); + } + + public String[] a() { @@ -4761,22 +4432,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public GameProfile a(UUID uuid) { -+ UserCacheEntry usercacheentry = (UserCacheEntry) this.d.get(uuid); ++ UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(uuid); + -+ return usercacheentry == null ? null : usercacheentry.a(); ++ return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); + } + -+ private UserCacheEntry b(UUID uuid) { -+ UserCacheEntry usercacheentry = (UserCacheEntry) this.d.get(uuid); ++ private UserCache.UserCacheEntry b(UUID uuid) { ++ UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(uuid); + -+ if (usercacheentry != null) { -+ GameProfile gameprofile = usercacheentry.a(); ++ if (usercache_usercacheentry != null) { ++ GameProfile gameprofile = usercache_usercacheentry.a(); + + this.e.remove(gameprofile); + this.e.addFirst(gameprofile); + } + -+ return usercacheentry; ++ return usercache_usercacheentry; + } + + public void b() { @@ -4805,10 +4476,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { -+ UserCacheEntry usercacheentry = (UserCacheEntry) iterator.next(); ++ UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) iterator.next(); + -+ if (usercacheentry != null) { -+ this.a(usercacheentry.a(), usercacheentry.b()); ++ if (usercache_usercacheentry != null) { ++ this.a(usercache_usercacheentry.a(), usercache_usercacheentry.b()); + } + } + } @@ -4833,111 +4504,115 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } + -+ private List a(int i) { ++ private List a(int i) { + ArrayList arraylist = Lists.newArrayList(); + ArrayList arraylist1 = Lists.newArrayList(Iterators.limit(this.e.iterator(), i)); + Iterator iterator = arraylist1.iterator(); + + while (iterator.hasNext()) { + GameProfile gameprofile = (GameProfile) iterator.next(); -+ UserCacheEntry usercacheentry = this.b(gameprofile.getId()); ++ UserCache.UserCacheEntry usercache_usercacheentry = this.b(gameprofile.getId()); + -+ if (usercacheentry != null) { -+ arraylist.add(usercacheentry); ++ if (usercache_usercacheentry != null) { ++ arraylist.add(usercache_usercacheentry); + } + } + + return arraylist; + } + -+} -diff --git a/src/main/java/net/minecraft/server/UserCacheEntry.java b/src/main/java/net/minecraft/server/UserCacheEntry.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/UserCacheEntry.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; ++ class UserCacheEntry { + -+import com.mojang.authlib.GameProfile; -+import java.util.Date; ++ private final GameProfile b; ++ private final Date c; + -+class UserCacheEntry { ++ private UserCacheEntry(GameProfile gameprofile, Date date) { ++ this.b = gameprofile; ++ this.c = date; ++ } + -+ private final GameProfile b; -+ private final Date c; -+ final UserCache a; ++ public GameProfile a() { ++ return this.b; ++ } + -+ private UserCacheEntry(UserCache usercache, GameProfile gameprofile, Date date) { -+ this.a = usercache; -+ this.b = gameprofile; -+ this.c = date; ++ public Date b() { ++ return this.c; ++ } ++ ++ UserCacheEntry(GameProfile gameprofile, Date date, Object object) { ++ this(gameprofile, date); ++ } + } + -+ public GameProfile a() { -+ return this.b; -+ } ++ class BanEntrySerializer implements JsonDeserializer, JsonSerializer { + -+ public Date b() { -+ return this.c; -+ } ++ private BanEntrySerializer() {} + -+ UserCacheEntry(UserCache usercache, GameProfile gameprofile, Date date, GameProfileLookup gameprofilelookup) { -+ this(usercache, gameprofile, date); -+ } ++ public JsonElement a(UserCache.UserCacheEntry usercache_usercacheentry, Type type, JsonSerializationContext jsonserializationcontext) { ++ JsonObject jsonobject = new JsonObject(); + -+ static Date a(UserCacheEntry usercacheentry) { -+ return usercacheentry.c; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/WatchableObject.java b/src/main/java/net/minecraft/server/WatchableObject.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/WatchableObject.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; ++ jsonobject.addProperty("name", usercache_usercacheentry.a().getName()); ++ UUID uuid = usercache_usercacheentry.a().getId(); + -+public class WatchableObject { ++ jsonobject.addProperty("uuid", uuid == null ? "" : uuid.toString()); ++ jsonobject.addProperty("expiresOn", UserCache.a.format(usercache_usercacheentry.b())); ++ return jsonobject; ++ } + -+ private final int a; -+ private final int b; -+ private Object c; -+ private boolean d; ++ public UserCache.UserCacheEntry a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { ++ if (jsonelement.isJsonObject()) { ++ JsonObject jsonobject = jsonelement.getAsJsonObject(); ++ JsonElement jsonelement1 = jsonobject.get("name"); ++ JsonElement jsonelement2 = jsonobject.get("uuid"); ++ JsonElement jsonelement3 = jsonobject.get("expiresOn"); + -+ public WatchableObject(int i, int j, Object object) { -+ this.b = j; -+ this.c = object; -+ this.a = i; -+ this.d = true; -+ } ++ if (jsonelement1 != null && jsonelement2 != null) { ++ String s = jsonelement2.getAsString(); ++ String s1 = jsonelement1.getAsString(); ++ Date date = null; + -+ public int a() { -+ return this.b; -+ } ++ if (jsonelement3 != null) { ++ try { ++ date = UserCache.a.parse(jsonelement3.getAsString()); ++ } catch (ParseException parseexception) { ++ date = null; ++ } ++ } + -+ public void a(Object object) { -+ this.c = object; -+ } ++ if (s1 != null && s != null) { ++ UUID uuid; + -+ public Object b() { -+ return this.c; -+ } ++ try { ++ uuid = UUID.fromString(s); ++ } catch (Throwable throwable) { ++ return null; ++ } + -+ public int c() { -+ return this.a; -+ } ++ UserCache.UserCacheEntry usercache_usercacheentry = UserCache.this.new UserCacheEntry(new GameProfile(uuid, s1), date, null); + -+ public boolean d() { -+ return this.d; -+ } ++ return usercache_usercacheentry; ++ } else { ++ return null; ++ } ++ } else { ++ return null; ++ } ++ } else { ++ return null; ++ } ++ } + -+ public void a(boolean flag) { -+ this.d = flag; -+ } ++ public JsonElement serialize(UserCache.UserCacheEntry object, Type type, JsonSerializationContext jsonserializationcontext) { ++ return this.a((UserCache.UserCacheEntry) object, type, jsonserializationcontext); ++ } + -+ static boolean a(WatchableObject watchableobject, boolean flag) { -+ return watchableobject.d = flag; ++ public UserCache.UserCacheEntry deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { ++ return this.a(jsonelement, type, jsondeserializationcontext); ++ } ++ ++ BanEntrySerializer(Object object) { ++ this(); ++ } + } +} diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java @@ -4952,162 +4627,174 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class WorldGenForestTree extends WorldGenTreeAbstract { + ++ private static final IBlockData a = Blocks.LOG2.getBlockData().set(BlockLog2.VARIANT, BlockWood.EnumLogVariant.DARK_OAK); ++ private static final IBlockData b = Blocks.LEAVES2.getBlockData().set(BlockLeaves2.VARIANT, BlockWood.EnumLogVariant.DARK_OAK).set(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); ++ + public WorldGenForestTree(boolean flag) { + super(flag); + } + + public boolean generate(World world, Random random, BlockPosition blockposition) { + int i = random.nextInt(3) + random.nextInt(2) + 6; -+ boolean flag = true; ++ int j = blockposition.getX(); ++ int k = blockposition.getY(); ++ int l = blockposition.getZ(); + -+ if (blockposition.getY() >= 1 && blockposition.getY() + i + 1 <= 256) { -+ int j; -+ int k; ++ if (k >= 1 && k + i + 1 < 256) { ++ BlockPosition blockposition1 = blockposition.down(); ++ Block block = world.getType(blockposition1).getBlock(); + -+ for (int l = blockposition.getY(); l <= blockposition.getY() + 1 + i; ++l) { -+ byte b0 = 1; -+ -+ if (l == blockposition.getY()) { -+ b0 = 0; -+ } -+ -+ if (l >= blockposition.getY() + 1 + i - 2) { -+ b0 = 2; -+ } -+ -+ for (j = blockposition.getX() - b0; j <= blockposition.getX() + b0 && flag; ++j) { -+ for (k = blockposition.getZ() - b0; k <= blockposition.getZ() + b0 && flag; ++k) { -+ if (l >= 0 && l < 256) { -+ if (!this.a(world.getType(new BlockPosition(j, l, k)).getBlock())) { -+ flag = false; -+ } -+ } else { -+ flag = false; -+ } -+ } -+ } -+ } -+ -+ if (!flag) { ++ if (block != Blocks.GRASS && block != Blocks.DIRT) { ++ return false; ++ } else if (!this.a(world, blockposition, i)) { + return false; + } else { -+ Block block = world.getType(blockposition.down()).getBlock(); ++ this.a(world, blockposition1); ++ this.a(world, blockposition1.east()); ++ this.a(world, blockposition1.south()); ++ this.a(world, blockposition1.south().east()); ++ EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.a(random); ++ int i1 = i - random.nextInt(4); ++ int j1 = 2 - random.nextInt(3); ++ int k1 = j; ++ int l1 = l; ++ int i2 = k + i - 1; + -+ if ((block == Blocks.GRASS || block == Blocks.DIRT) && blockposition.getY() < 256 - i - 1) { -+ this.a(world, blockposition.down()); -+ this.a(world, blockposition.a(1, -1, 0)); -+ this.a(world, blockposition.a(1, -1, 1)); -+ this.a(world, blockposition.a(0, -1, 1)); -+ EnumDirection enumdirection = EnumDirectionLimit.HORIZONTAL.a(random); ++ int j2; ++ int k2; + -+ j = i - random.nextInt(4); -+ k = 2 - random.nextInt(3); -+ int i1 = blockposition.getX(); -+ int j1 = blockposition.getZ(); -+ int k1 = 0; -+ -+ int l1; -+ int i2; -+ -+ for (l1 = 0; l1 < i; ++l1) { -+ i2 = blockposition.getY() + l1; -+ if (l1 >= j && k > 0) { -+ i1 += enumdirection.getAdjacentX(); -+ j1 += enumdirection.getAdjacentZ(); -+ --k; -+ } -+ -+ BlockPosition blockposition1 = new BlockPosition(i1, i2, j1); -+ Material material = world.getType(blockposition1).getBlock().getMaterial(); -+ -+ if (material == Material.AIR || material == Material.LEAVES) { -+ this.a(world, blockposition1, Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); -+ this.a(world, blockposition1.east(), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); -+ this.a(world, blockposition1.south(), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); -+ this.a(world, blockposition1.east().south(), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); -+ k1 = i2; -+ } ++ for (j2 = 0; j2 < i; ++j2) { ++ if (j2 >= i1 && j1 > 0) { ++ k1 += enumdirection.getAdjacentX(); ++ l1 += enumdirection.getAdjacentZ(); ++ --j1; + } + -+ for (l1 = -2; l1 <= 0; ++l1) { -+ for (i2 = -2; i2 <= 0; ++i2) { -+ byte b1 = -1; ++ k2 = k + j2; ++ BlockPosition blockposition2 = new BlockPosition(k1, k2, l1); ++ Material material = world.getType(blockposition2).getBlock().getMaterial(); + -+ this.a(world, i1 + l1, k1 + b1, j1 + i2); -+ this.a(world, 1 + i1 - l1, k1 + b1, j1 + i2); -+ this.a(world, i1 + l1, k1 + b1, 1 + j1 - i2); -+ this.a(world, 1 + i1 - l1, k1 + b1, 1 + j1 - i2); -+ if ((l1 > -2 || i2 > -1) && (l1 != -1 || i2 != -2)) { -+ byte b2 = 1; -+ -+ this.a(world, i1 + l1, k1 + b2, j1 + i2); -+ this.a(world, 1 + i1 - l1, k1 + b2, j1 + i2); -+ this.a(world, i1 + l1, k1 + b2, 1 + j1 - i2); -+ this.a(world, 1 + i1 - l1, k1 + b2, 1 + j1 - i2); -+ } -+ } ++ if (material == Material.AIR || material == Material.LEAVES) { ++ this.b(world, blockposition2); ++ this.b(world, blockposition2.east()); ++ this.b(world, blockposition2.south()); ++ this.b(world, blockposition2.east().south()); + } -+ -+ if (random.nextBoolean()) { -+ this.a(world, i1, k1 + 2, j1); -+ this.a(world, i1 + 1, k1 + 2, j1); -+ this.a(world, i1 + 1, k1 + 2, j1 + 1); -+ this.a(world, i1, k1 + 2, j1 + 1); -+ } -+ -+ for (l1 = -3; l1 <= 4; ++l1) { -+ for (i2 = -3; i2 <= 4; ++i2) { -+ if ((l1 != -3 || i2 != -3) && (l1 != -3 || i2 != 4) && (l1 != 4 || i2 != -3) && (l1 != 4 || i2 != 4) && (Math.abs(l1) < 3 || Math.abs(i2) < 3)) { -+ this.a(world, i1 + l1, k1, j1 + i2); -+ } -+ } -+ } -+ -+ for (l1 = -1; l1 <= 2; ++l1) { -+ for (i2 = -1; i2 <= 2; ++i2) { -+ if ((l1 < 0 || l1 > 1 || i2 < 0 || i2 > 1) && random.nextInt(3) <= 0) { -+ int j2 = random.nextInt(3) + 2; -+ -+ int k2; -+ -+ for (k2 = 0; k2 < j2; ++k2) { -+ this.a(world, new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); -+ } -+ -+ int l2; -+ -+ for (k2 = -1; k2 <= 1; ++k2) { -+ for (l2 = -1; l2 <= 1; ++l2) { -+ this.a(world, i1 + l1 + k2, k1 - 0, j1 + i2 + l2); -+ } -+ } -+ -+ for (k2 = -2; k2 <= 2; ++k2) { -+ for (l2 = -2; l2 <= 2; ++l2) { -+ if (Math.abs(k2) != 2 || Math.abs(l2) != 2) { -+ this.a(world, i1 + l1 + k2, k1 - 1, j1 + i2 + l2); -+ } -+ } -+ } -+ } -+ } -+ } -+ -+ return true; -+ } else { -+ return false; + } ++ ++ for (j2 = -2; j2 <= 0; ++j2) { ++ for (k2 = -2; k2 <= 0; ++k2) { ++ byte b0 = -1; ++ ++ this.a(world, k1 + j2, i2 + b0, l1 + k2); ++ this.a(world, 1 + k1 - j2, i2 + b0, l1 + k2); ++ this.a(world, k1 + j2, i2 + b0, 1 + l1 - k2); ++ this.a(world, 1 + k1 - j2, i2 + b0, 1 + l1 - k2); ++ if ((j2 > -2 || k2 > -1) && (j2 != -1 || k2 != -2)) { ++ byte b1 = 1; ++ ++ this.a(world, k1 + j2, i2 + b1, l1 + k2); ++ this.a(world, 1 + k1 - j2, i2 + b1, l1 + k2); ++ this.a(world, k1 + j2, i2 + b1, 1 + l1 - k2); ++ this.a(world, 1 + k1 - j2, i2 + b1, 1 + l1 - k2); ++ } ++ } ++ } ++ ++ if (random.nextBoolean()) { ++ this.a(world, k1, i2 + 2, l1); ++ this.a(world, k1 + 1, i2 + 2, l1); ++ this.a(world, k1 + 1, i2 + 2, l1 + 1); ++ this.a(world, k1, i2 + 2, l1 + 1); ++ } ++ ++ for (j2 = -3; j2 <= 4; ++j2) { ++ for (k2 = -3; k2 <= 4; ++k2) { ++ if ((j2 != -3 || k2 != -3) && (j2 != -3 || k2 != 4) && (j2 != 4 || k2 != -3) && (j2 != 4 || k2 != 4) && (Math.abs(j2) < 3 || Math.abs(k2) < 3)) { ++ this.a(world, k1 + j2, i2, l1 + k2); ++ } ++ } ++ } ++ ++ for (j2 = -1; j2 <= 2; ++j2) { ++ for (k2 = -1; k2 <= 2; ++k2) { ++ if ((j2 < 0 || j2 > 1 || k2 < 0 || k2 > 1) && random.nextInt(3) <= 0) { ++ int l2 = random.nextInt(3) + 2; ++ ++ int i3; ++ ++ for (i3 = 0; i3 < l2; ++i3) { ++ this.b(world, new BlockPosition(j + j2, i2 - i3 - 1, l + k2)); ++ } ++ ++ int j3; ++ ++ for (i3 = -1; i3 <= 1; ++i3) { ++ for (j3 = -1; j3 <= 1; ++j3) { ++ this.a(world, k1 + j2 + i3, i2, l1 + k2 + j3); ++ } ++ } ++ ++ for (i3 = -2; i3 <= 2; ++i3) { ++ for (j3 = -2; j3 <= 2; ++j3) { ++ if (Math.abs(i3) != 2 || Math.abs(j3) != 2) { ++ this.a(world, k1 + j2 + i3, i2 - 1, l1 + k2 + j3); ++ } ++ } ++ } ++ } ++ } ++ } ++ ++ return true; + } + } else { + return false; + } + } + ++ private boolean a(World world, BlockPosition blockposition, int i) { ++ int j = blockposition.getX(); ++ int k = blockposition.getY(); ++ int l = blockposition.getZ(); ++ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); ++ ++ for (int i1 = 0; i1 <= i + 1; ++i1) { ++ byte b0 = 1; ++ ++ if (i1 == 0) { ++ b0 = 0; ++ } ++ ++ if (i1 >= i - 1) { ++ b0 = 2; ++ } ++ ++ for (int j1 = -b0; j1 <= b0; ++j1) { ++ for (int k1 = -b0; k1 <= b0; ++k1) { ++ if (!this.a(world.getType(blockposition_mutableblockposition.c(j + j1, k + i1, l + k1)).getBlock())) { ++ return false; ++ } ++ } ++ } ++ } ++ ++ return true; ++ } ++ ++ private void b(World world, BlockPosition blockposition) { ++ if (this.a(world.getType(blockposition).getBlock())) { ++ this.a(world, blockposition, WorldGenForestTree.a); ++ } ++ ++ } ++ + private void a(World world, int i, int j, int k) { -+ Block block = world.getType(new BlockPosition(i, j, k)).getBlock(); ++ BlockPosition blockposition = new BlockPosition(i, j, k); ++ Block block = world.getType(blockposition).getBlock(); + + if (block.getMaterial() == Material.AIR) { -+ this.a(world, new BlockPosition(i, j, k), Blocks.LEAVES2, 1); ++ this.a(world, blockposition, WorldGenForestTree.b); + } + + } @@ -5130,8 +4817,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class WorldGenLargeFeature extends StructureGenerator { + -+ private static final List d = Arrays.asList(new BiomeBase[] { BiomeBase.DESERT, BiomeBase.DESERT_HILLS, BiomeBase.JUNGLE, BiomeBase.JUNGLE_HILLS, BiomeBase.SWAMPLAND}); -+ private List f; ++ private static final List d = Arrays.asList(new BiomeBase[] { BiomeBase.DESERT, BiomeBase.DESERT_HILLS, BiomeBase.JUNGLE, BiomeBase.JUNGLE_HILLS, BiomeBase.SWAMPLAND}); ++ private List f; + private int g; + private int h; + @@ -5139,10 +4826,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.f = Lists.newArrayList(); + this.g = 32; + this.h = 8; -+ this.f.add(new BiomeMeta(EntityWitch.class, 1, 1, 1)); ++ this.f.add(new BiomeBase.BiomeMeta(EntityWitch.class, 1, 1, 1)); + } + -+ public WorldGenLargeFeature(Map map) { ++ public WorldGenLargeFeature(Map map) { + this(); + Iterator iterator = map.entrySet().iterator(); + @@ -5202,25 +4889,52 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + protected StructureStart b(int i, int j) { -+ return new WorldGenLargeFeatureStart(this.c, this.b, i, j); ++ return new WorldGenLargeFeature.WorldGenLargeFeatureStart(this.c, this.b, i, j); + } + + public boolean a(BlockPosition blockposition) { + StructureStart structurestart = this.c(blockposition); + -+ if (structurestart != null && structurestart instanceof WorldGenLargeFeatureStart && !structurestart.a.isEmpty()) { ++ if (structurestart != null && structurestart instanceof WorldGenLargeFeature.WorldGenLargeFeatureStart && !structurestart.a.isEmpty()) { + StructurePiece structurepiece = (StructurePiece) structurestart.a.getFirst(); + -+ return structurepiece instanceof WorldGenWitchHut; ++ return structurepiece instanceof WorldGenRegistration.WorldGenWitchHut; + } else { + return false; + } + } + -+ public List b() { ++ public List b() { + return this.f; + } + ++ public static class WorldGenLargeFeatureStart extends StructureStart { ++ ++ public WorldGenLargeFeatureStart() {} ++ ++ public WorldGenLargeFeatureStart(World world, Random random, int i, int j) { ++ super(i, j); ++ BiomeBase biomebase = world.getBiome(new BlockPosition(i * 16 + 8, 0, j * 16 + 8)); ++ ++ if (biomebase != BiomeBase.JUNGLE && biomebase != BiomeBase.JUNGLE_HILLS) { ++ if (biomebase == BiomeBase.SWAMPLAND) { ++ WorldGenRegistration.WorldGenWitchHut worldgenregistration_worldgenwitchhut = new WorldGenRegistration.WorldGenWitchHut(random, i * 16, j * 16); ++ ++ this.a.add(worldgenregistration_worldgenwitchhut); ++ } else if (biomebase == BiomeBase.DESERT || biomebase == BiomeBase.DESERT_HILLS) { ++ WorldGenRegistration.WorldGenPyramidPiece worldgenregistration_worldgenpyramidpiece = new WorldGenRegistration.WorldGenPyramidPiece(random, i * 16, j * 16); ++ ++ this.a.add(worldgenregistration_worldgenpyramidpiece); ++ } ++ } else { ++ WorldGenRegistration.WorldGenJungleTemple worldgenregistration_worldgenjungletemple = new WorldGenRegistration.WorldGenJungleTemple(random, i * 16, j * 16); ++ ++ this.a.add(worldgenregistration_worldgenjungletemple); ++ } ++ ++ this.c(); ++ } ++ } +} diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java new file mode 100644 @@ -5270,13 +4984,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Block block = world.getType(blockposition.a(i1, k, j1)).getBlock(); + + if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { -+ this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE); ++ this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE.getBlockData()); + } + + if (k != 0 && l > 1) { + block = world.getType(blockposition.a(i1, -k, j1)).getBlock(); + if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { -+ this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE); ++ this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData()); + } + } + } @@ -5307,7 +5021,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Block block1 = world.getType(blockposition1).getBlock(); + + if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { -+ this.a(world, blockposition1, Blocks.PACKED_ICE); ++ this.a(world, blockposition1, Blocks.PACKED_ICE.getBlockData()); + blockposition1 = blockposition1.down(); + --l1; + if (l1 <= 0) { @@ -5345,7 +5059,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class WorldGenVillage extends StructureGenerator { + -+ public static final List d = Arrays.asList(new BiomeBase[] { BiomeBase.PLAINS, BiomeBase.DESERT, BiomeBase.SAVANNA}); ++ public static final List d = Arrays.asList(new BiomeBase[] { BiomeBase.PLAINS, BiomeBase.DESERT, BiomeBase.SAVANNA}); + private int f; + private int g; + private int h; @@ -5355,7 +5069,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.h = 8; + } + -+ public WorldGenVillage(Map map) { ++ public WorldGenVillage(Map map) { + this(); + Iterator iterator = map.entrySet().iterator(); + @@ -5407,9 +5121,70 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + protected StructureStart b(int i, int j) { -+ return new WorldGenVillageStart(this.c, this.b, i, j, this.f); ++ return new WorldGenVillage.WorldGenVillageStart(this.c, this.b, i, j, this.f); + } + ++ public static class WorldGenVillageStart extends StructureStart { ++ ++ private boolean c; ++ ++ public WorldGenVillageStart() {} ++ ++ public WorldGenVillageStart(World world, Random random, int i, int j, int k) { ++ super(i, j); ++ List list = WorldGenVillagePieces.a(random, k); ++ WorldGenVillagePieces.WorldGenVillageStartPiece worldgenvillagepieces_worldgenvillagestartpiece = new WorldGenVillagePieces.WorldGenVillageStartPiece(world.getWorldChunkManager(), 0, random, (i << 4) + 2, (j << 4) + 2, list, k); ++ ++ this.a.add(worldgenvillagepieces_worldgenvillagestartpiece); ++ worldgenvillagepieces_worldgenvillagestartpiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, (List) this.a, random); ++ List list1 = worldgenvillagepieces_worldgenvillagestartpiece.g; ++ List list2 = worldgenvillagepieces_worldgenvillagestartpiece.f; ++ ++ int l; ++ ++ while (!list1.isEmpty() || !list2.isEmpty()) { ++ StructurePiece structurepiece; ++ ++ if (list1.isEmpty()) { ++ l = random.nextInt(list2.size()); ++ structurepiece = (StructurePiece) list2.remove(l); ++ structurepiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, (List) this.a, random); ++ } else { ++ l = random.nextInt(list1.size()); ++ structurepiece = (StructurePiece) list1.remove(l); ++ structurepiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, (List) this.a, random); ++ } ++ } ++ ++ this.c(); ++ l = 0; ++ Iterator iterator = this.a.iterator(); ++ ++ while (iterator.hasNext()) { ++ StructurePiece structurepiece1 = (StructurePiece) iterator.next(); ++ ++ if (!(structurepiece1 instanceof WorldGenVillagePieces.WorldGenVillageRoadPiece)) { ++ ++l; ++ } ++ } ++ ++ this.c = l > 2; ++ } ++ ++ public boolean d() { ++ return this.c; ++ } ++ ++ public void a(NBTTagCompound nbttagcompound) { ++ super.a(nbttagcompound); ++ nbttagcompound.setBoolean("Valid", this.c); ++ } ++ ++ public void b(NBTTagCompound nbttagcompound) { ++ super.b(nbttagcompound); ++ this.c = nbttagcompound.getBoolean("Valid"); ++ } ++ } +} diff --git a/src/main/java/org/spigotmc/SneakyThrow.java b/src/main/java/org/spigotmc/SneakyThrow.java new file mode 100644 diff --git a/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch b/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch index 494564a503..53f469c106 100644 --- a/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch +++ b/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs } @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.q; + } + // Spigot End - public ServerConnection ao() { + public ServerConnection ap() { return this.q; } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch b/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch index 39e234543d..a0d41d63c0 100644 --- a/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch +++ b/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch @@ -10,14 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - public Scoreboard scoreboard = new Scoreboard(); - public final boolean isStatic; + public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - public + public final boolean isClientSide; // CraftBukkit - longhashset - protected LongHashSet chunkTickList = new LongHashSet(); + // protected LongHashSet chunkTickList = new LongHashSet(); // Spigot - private int K; - public boolean allowMonsters; - public boolean allowAnimals; + private int L; + public boolean allowMonsters; // CraftBukkit - public + public boolean allowAnimals; // CraftBukkit - public @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { public long ticksPerMonsterSpawns; public boolean populating; @@ -59,9 +59,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE ); + this.chunkTickList.setAutoCompactionFactor( 0 ); + // Spigot end - - this.K = this.random.nextInt(12000); ++ + this.L = this.random.nextInt(12000); this.allowMonsters = true; + this.allowAnimals = true; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { int k; int l; @@ -157,7 +158,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); int k = chunkX * 16; int l = chunkZ * 16; - + @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { } diff --git a/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch b/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch index 5a7e84a439..79e0ae2e7e 100644 --- a/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch +++ b/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - // CraftBukkit start + if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot // CraftBukkit start IBlockData data = iblockdata.set(AGE, Integer.valueOf(i + 1)); - CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data)); + CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data)); // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -111,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/BlockSapling.java @@ -0,0 +0,0 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - if (!world.isStatic) { + if (!world.isClientSide) { super.b(world, blockposition, iblockdata, random); - if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) { + if (world.getLightLevel(blockposition.up()) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot) { diff --git a/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch b/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch index 4117ca95ad..c613bf3e3a 100644 --- a/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch +++ b/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch @@ -13,12 +13,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { private static final Logger a = LogManager.getLogger(); -- private List b = Lists.newArrayList(); -- private Set c = Sets.newHashSet(); +- private List b = Lists.newArrayList(); +- private Set c = Sets.newHashSet(); + // Spigot start + private java.util.LinkedHashMap pendingSaves = new java.util.LinkedHashMap(); -+ // private List b = Lists.newArrayList(); -+ // private Set c = Sets.newHashSet(); ++ // private List b = Lists.newArrayList(); ++ // private Set c = Sets.newHashSet(); + // Spigot end private Object d = new Object(); private final File e; @@ -48,8 +48,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 synchronized (this.d) { - if (this.c.contains(chunkcoordintpair)) { - for (int k = 0; k < this.b.size(); ++k) { -- if (((PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) { -- nbttagcompound = ((PendingChunkToSave) this.b.get(k)).b; +- if (((ChunkRegionLoader.PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) { +- nbttagcompound = ((ChunkRegionLoader.PendingChunkToSave) this.b.get(k)).b; - break; - } - } @@ -68,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 synchronized (this.d) { - if (this.c.contains(chunkcoordintpair)) { - for (int i = 0; i < this.b.size(); ++i) { -- if (((PendingChunkToSave) this.b.get(i)).a.equals(chunkcoordintpair)) { -- this.b.set(i, new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); +- if (((ChunkRegionLoader.PendingChunkToSave) this.b.get(i)).a.equals(chunkcoordintpair)) { +- this.b.set(i, new ChunkRegionLoader.PendingChunkToSave(chunkcoordintpair, nbttagcompound)); - return; - } - } @@ -78,9 +78,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return; } -- this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); +- this.b.add(new ChunkRegionLoader.PendingChunkToSave(chunkcoordintpair, nbttagcompound)); - this.c.add(chunkcoordintpair); -+ // this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); ++ // this.b.add(new ChunkRegionLoader.PendingChunkToSave(chunkcoordintpair, nbttagcompound)); + // this.c.add(chunkcoordintpair); + // Spigot end FileIOThread.a().a(this); @@ -96,12 +96,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return false; } -- pendingchunktosave = (PendingChunkToSave) this.b.remove(0); -- this.c.remove(pendingchunktosave.a); -+ pendingchunktosave = this.pendingSaves.values().iterator().next(); -+ this.pendingSaves.remove(pendingchunktosave.a); +- chunkregionloader_pendingchunktosave = (ChunkRegionLoader.PendingChunkToSave) this.b.remove(0); +- this.c.remove(chunkregionloader_pendingchunktosave.a); ++ chunkregionloader_pendingchunktosave = this.pendingSaves.values().iterator().next(); ++ this.pendingSaves.remove(chunkregionloader_pendingchunktosave.a); + // Spigot end } - if (pendingchunktosave != null) { + if (chunkregionloader_pendingchunktosave != null) { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0010-Async-Operation-Catching.patch b/CraftBukkit-Patches/0010-Async-Operation-Catching.patch index b6853d8eef..228d97bf87 100644 --- a/CraftBukkit-Patches/0010-Async-Operation-Catching.patch +++ b/CraftBukkit-Patches/0010-Async-Operation-Catching.patch @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityTracker { } - public void addEntity(Entity entity, int i, int j, boolean flag) { + public void addEntity(Entity entity, int i, final int j, boolean flag) { + org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot if (i > this.e) { i = this.e; @@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc.AsyncCatcher.catchOp( "player tracker update"); // Spigot if (entityplayer != this.tracker) { if (this.c(entityplayer)) { - if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) { + if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) { @@ -0,0 +0,0 @@ public class EntityTrackerEntry { } @@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { } - public void b(Collection collection) { + public void b(Collection collection) { + org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot // CraftBukkit start // this.entityList.addAll(collection); diff --git a/CraftBukkit-Patches/0011-View-Distance.patch b/CraftBukkit-Patches/0011-View-Distance.patch index 7c53455f20..b1bf82310d 100644 --- a/CraftBukkit-Patches/0011-View-Distance.patch +++ b/CraftBukkit-Patches/0011-View-Distance.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public PlayerChunkMap(WorldServer worldserver) { + public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) { this.world = worldserver; -- this.a(worldserver.getMinecraftServer().getPlayerList().t()); +- this.a(worldserver.getMinecraftServer().getPlayerList().s()); + this.a(viewDistance); // Spigot } diff --git a/CraftBukkit-Patches/0012-Spigot-Timings.patch b/CraftBukkit-Patches/0012-Spigot-Timings.patch index bd0d263719..53e49d32ec 100644 --- a/CraftBukkit-Patches/0012-Spigot-Timings.patch +++ b/CraftBukkit-Patches/0012-Spigot-Timings.patch @@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (chunk == null) { if (this.chunkProvider == null) { @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { + } // CraftBukkit end - chunk.loadNearby(this, this, i, j); + world.timings.syncChunkLoadTimer.stopTiming(); // Spigot } @@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { // CraftBukkit start - Add async variant, provide compatibility - public Chunk a(World world, int i, int j) { + public Chunk a(World world, int i, int j) throws IOException { + world.timings.syncChunkLoadDataTimer.startTiming(); // Spigot Object[] data = loadChunk(world, i, j); + world.timings.syncChunkLoadDataTimer.stopTiming(); // Spigot @@ -73,6 +73,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) { // CraftBukkit end +- + world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10); @@ -102,7 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + world.timings.syncChunkLoadTileTicksTimer.stopTiming(); // Spigot - // return chunk; // CraftBukkit + // return chunk; // CraftBukkit } diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -114,15 +115,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.craftbukkit.LoggerOutputStream; +import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.event.server.ServerCommandEvent; - // CraftBukkit end - + import org.bukkit.craftbukkit.util.Waitable; + import org.bukkit.event.server.RemoteServerCommandEvent; @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } - public void aM() { + public void aN() { + SpigotTimings.serverCommandTimer.startTiming(); // Spigot - while (!this.k.isEmpty()) { - ServerCommand servercommand = (ServerCommand) this.k.remove(0); + while (!this.l.isEmpty()) { + ServerCommand servercommand = (ServerCommand) this.l.remove(0); @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer // CraftBukkit end @@ -158,8 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void move(double d0, double d1, double d2) { + org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot -+ - if (this.T) { + if (this.noclip) { this.a(this.getBoundingBox().c(d0, d1, d2)); this.recalcPosition(); @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { @@ -186,11 +186,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } - public void s_() { + public void t_() { + SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot - super.s_(); - if (!this.world.isStatic) { - int i = this.bu(); + super.t_(); + if (!this.world.isClientSide) { + int i = this.bv(); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } } @@ -204,7 +204,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.world.methodProfiler.b(); - this.aR += f2; + this.aT += f2; + SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } @@ -214,9 +214,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.methodProfiler.a("ai"); + SpigotTimings.timerEntityAI.startTiming(); // Spigot - if (this.bC()) { - this.aW = false; - this.aX = 0.0F; + if (this.bD()) { + this.aY = false; + this.aZ = 0.0F; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.doTick(); this.world.methodProfiler.b(); @@ -226,17 +226,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.methodProfiler.b(); this.world.methodProfiler.a("jump"); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.aX *= 0.98F; - this.aY *= 0.98F; - this.aZ *= 0.9F; + this.aZ *= 0.98F; + this.ba *= 0.98F; + this.bb *= 0.9F; + SpigotTimings.timerEntityAIMove.startTiming(); // Spigot - this.g(this.aX, this.aY); + this.g(this.aZ, this.ba); + SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot this.world.methodProfiler.b(); this.world.methodProfiler.a("push"); - if (!this.world.isStatic) { + if (!this.world.isClientSide) { + SpigotTimings.timerEntityAICollision.startTiming(); // Spigot - this.bK(); + this.bL(); + SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot } @@ -253,15 +253,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.server.RemoteServerCommandEvent; import org.bukkit.event.world.WorldSaveEvent; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - protected void x() {} +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + protected void y() {} - protected void y() throws ExceptionWorldConflict { // CraftBukkit - added throws + protected void z() throws ExceptionWorldConflict { // CraftBukkit - added throws + SpigotTimings.serverTickTimer.startTiming(); // Spigot long i = System.nanoTime(); ++this.ticks; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs } if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit @@ -274,7 +274,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.methodProfiler.a("tallying"); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.methodProfiler.b(); this.methodProfiler.b(); @@ -282,8 +282,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc.CustomTimingsHandler.tick(); // Spigot } - public void z() { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + public void A() { +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.methodProfiler.c("levels"); @@ -307,7 +307,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Send time updates to everyone, it will get the right time from the world the player is in. if (this.ticks % 20 == 0) { for (int i = 0; i < this.getPlayerList().players.size(); ++i) { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time } } @@ -315,27 +315,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs CrashReport crashreport; try { + worldserver.timings.doTick.startTiming(); // Spigot worldserver.doTick(); + worldserver.timings.doTick.stopTiming(); // Spigot - } catch (Throwable throwable1) { - crashreport = CrashReport.a(throwable1, "Exception ticking world"); + } catch (Throwable throwable) { + crashreport = CrashReport.a(throwable, "Exception ticking world"); worldserver.a(crashreport); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs } try { + worldserver.timings.tickEntities.startTiming(); // Spigot worldserver.tickEntities(); + worldserver.timings.tickEntities.stopTiming(); // Spigot - } catch (Throwable throwable2) { - crashreport = CrashReport.a(throwable2, "Exception ticking world entities"); + } catch (Throwable throwable1) { + crashreport = CrashReport.a(throwable1, "Exception ticking world entities"); worldserver.a(crashreport); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.methodProfiler.b(); this.methodProfiler.a("tracker"); @@ -345,12 +345,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.b(); this.methodProfiler.b(); // } // CraftBukkit -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs } this.methodProfiler.c("connection"); + SpigotTimings.connectionTimer.startTiming(); // Spigot - this.ao().c(); + this.ap().c(); + SpigotTimings.connectionTimer.stopTiming(); // Spigot this.methodProfiler.c("players"); + SpigotTimings.playerListTimer.startTiming(); // Spigot @@ -359,8 +359,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.c("tickables"); + SpigotTimings.tickablesTimer.startTiming(); // Spigot - for (i = 0; i < this.o.size(); ++i) { - ((IUpdatePlayerListBox) this.o.get(i)).c(); + for (i = 0; i < this.p.size(); ++i) { + ((IUpdatePlayerListBox) this.p.get(i)).c(); } + SpigotTimings.tickablesTimer.stopTiming(); // Spigot @@ -373,9 +373,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit end - private void handleCommand(String s) { + private void handleCommand(String s) { + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot -+ // CraftBukkit start - whole method this.c.info(this.player.getName() + " issued server command: " + s); @@ -417,8 +416,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot private static final Logger a = LogManager.getLogger(); - private static Map f = Maps.newHashMap(); - private static Map g = Maps.newHashMap(); + private static Map> f = Maps.newHashMap(); + private static Map, String> g = Maps.newHashMap(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java @@ -441,10 +440,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.world; } @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.M.a(new WorldBorderListener(((WorldServer) this).getServer().getHandle())); // CraftBukkit - - this.getServer().addWorld(this.world); // CraftBukkit -+ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings + }); + this.getServer().addWorld(this.world); + // CraftBukkit end ++ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings } public World b() { @@ -473,12 +472,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + timings.entityTick.stopTiming(); // Spigot this.methodProfiler.c("blockEntities"); + timings.tileEntityTick.startTiming(); // Spigot - this.L = true; + this.M = true; // CraftBukkit start - From below, clean up tile entities before ticking them - if (!this.b.isEmpty()) { + if (!this.c.isEmpty()) { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - if (this.isLoaded(blockposition) && this.M.a(blockposition)) { + if (this.isLoaded(blockposition) && this.N.a(blockposition)) { try { + tileentity.tickTimer.startTiming(); // Spigot ((IUpdatePlayerListBox) tileentity).c(); @@ -502,11 +501,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + timings.tileEntityTick.stopTiming(); // Spigot + timings.tileEntityPending.startTiming(); // Spigot - this.L = false; + this.M = false; /* CraftBukkit start - Moved up - if (!this.b.isEmpty()) { + if (!this.c.isEmpty()) { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.a.clear(); + this.b.clear(); } + timings.tileEntityPending.stopTiming(); // Spigot @@ -577,12 +576,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.b(); + timings.doSounds.startTiming(); // Spigot this.ak(); - + this.getWorld().processChunkGC(); // CraftBukkit + timings.doChunkGC.stopTiming(); // Spigot } - public BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { + public BiomeBase.BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/CraftBukkit-Patches/0013-Fix-Mob-Spawning-Relative-to-View-Distance.patch b/CraftBukkit-Patches/0013-Fix-Mob-Spawning-Relative-to-View-Distance.patch index 7fe8b2be81..99c3020116 100644 --- a/CraftBukkit-Patches/0013-Fix-Mob-Spawning-Relative-to-View-Distance.patch +++ b/CraftBukkit-Patches/0013-Fix-Mob-Spawning-Relative-to-View-Distance.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Chunk { private long u; private int v; - private ConcurrentLinkedQueue w; + private ConcurrentLinkedQueue w; + protected gnu.trove.map.hash.TObjectIntHashMap entityCount = new gnu.trove.map.hash.TObjectIntHashMap(); // Spigot // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking @@ -140,7 +140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + continue label115; + } + // Spigot end - if (l2 >= entityinsentient.bU()) { + if (l2 >= entityinsentient.bV()) { continue label115; } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0015-Entity-Activation-Range.patch b/CraftBukkit-Patches/0015-Entity-Activation-Range.patch index 51e745aef4..11385f8c5f 100644 --- a/CraftBukkit-Patches/0015-Entity-Activation-Range.patch +++ b/CraftBukkit-Patches/0015-Entity-Activation-Range.patch @@ -15,17 +15,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { public int ticksLived; public int maxFireTicks; - public int fireTicks; + public int fireTicks; // CraftBukkit - public - protected boolean inWater; + public boolean inWater; // Spigot - protected -> public public int noDamageTicks; protected boolean justCreated; protected boolean fireProof; protected DataWatcher datawatcher; - private double ap; - private double aq; + private double ar; + private double as; - public boolean ad; -+ public boolean ad;public boolean isAddedToChunk() { return ad; } // Spigot ++ public boolean ad; public boolean isAddedToChunk() { return ad; } // Spigot public int ae; public int af; public int ag; @@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityAgeable.java +++ b/src/main/java/net/minecraft/server/EntityAgeable.java @@ -0,0 +0,0 @@ public abstract class EntityAgeable extends EntityCreature { - private float bl; + private float bn; public boolean ageLocked = false; // CraftBukkit + // Spigot start @@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void inactiveTick() + { + super.inactiveTick(); -+ if ( this.world.isStatic || this.ageLocked ) ++ if ( this.world.isClientSide || this.ageLocked ) + { // CraftBukkit + this.a( this.isBaby() ); + } else @@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public Entity shooter; @@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { private double damage = 2.0D; - public int knockbackStrength; + public int knockbackStrength; // CraftBukkit - public + // Spigot Start + @Override @@ -115,7 +115,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + if ( this.inGround ) + { -+ this.ap += 1; // Despawn counter. First int after shooter ++ this.ar += 1; // Despawn counter. First int after shooter + } + super.inactiveTick(); + } @@ -130,7 +130,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityFireworks.java @@ -0,0 +0,0 @@ public class EntityFireworks extends Entity { private int ticksFlown; - public int expectedLifespan; + public int expectedLifespan; // CraftBukkit - public + // Spigot Start + @Override @@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public EntityFireworks(World world) { super(world); - this.a(0.25F, 0.25F); + this.setSize(0.25F, 0.25F); diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java @@ -162,7 +162,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.lastTick = MinecraftServer.currentTick; + // CraftBukkit end + -+ if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot ++ if (!this.world.isClientSide && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot + // CraftBukkit start - fire ItemDespawnEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { + this.age = 0; @@ -189,7 +189,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void inactiveTick() + { + super.inactiveTick(); -+ ++this.aO; // Above all the floats ++ ++this.ticksFarFromPlayer; // Above all the floats + } + // Spigot end diff --git a/CraftBukkit-Patches/0017-PlayerItemDamageEvent.patch b/CraftBukkit-Patches/0017-PlayerItemDamageEvent.patch index 150cd640d7..9297b7815d 100644 --- a/CraftBukkit-Patches/0017-PlayerItemDamageEvent.patch +++ b/CraftBukkit-Patches/0017-PlayerItemDamageEvent.patch @@ -42,8 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void damage(int i, EntityLiving entityliving) { if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) { if (this.e()) { -- if (this.isDamaged(i, entityliving.bb())) { -+ if (this.isDamaged(i, entityliving.bb(), entityliving)) { // Spigot +- if (this.isDamaged(i, entityliving.bc())) { ++ if (this.isDamaged(i, entityliving.bc(), entityliving)) { // Spigot entityliving.b(this); --this.count; if (entityliving instanceof EntityHuman) { diff --git a/CraftBukkit-Patches/0019-Entity-Tracking-Ranges.patch b/CraftBukkit-Patches/0019-Entity-Tracking-Ranges.patch index 409ca0f9f5..9eb173ab02 100644 --- a/CraftBukkit-Patches/0019-Entity-Tracking-Ranges.patch +++ b/CraftBukkit-Patches/0019-Entity-Tracking-Ranges.patch @@ -17,12 +17,51 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityTracker.java @@ -0,0 +0,0 @@ public class EntityTracker { - public void addEntity(Entity entity, int i, int j, boolean flag) { + public void addEntity(Entity entity, int i, final int j, boolean flag) { org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot + i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot if (i > this.e) { i = this.e; } +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -0,0 +0,0 @@ public class ActivationRange + maxRange = Math.max( maxRange, miscActivationRange ); + maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange ); + +- for ( Entity player : (List) world.players ) ++ for ( Entity player : (List) (List) world.players ) + { + + player.activatedTick = MinecraftServer.currentTick; +@@ -0,0 +0,0 @@ public class ActivationRange + public static boolean checkEntityImmunities(Entity entity) + { + // quick checks. +- if ( entity.inWater /* isInWater */ || entity.fireTicks > 0 ) ++ if ( entity.inWater || entity.fireTicks > 0 ) + { + return true; + } +@@ -0,0 +0,0 @@ public class ActivationRange + { + return true; + } +- if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).ck() /* Getter for first boolean */ ) ++ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).cm() /* Getter for first boolean */ ) + { + return true; + } + if ( entity instanceof EntityAnimal ) + { + EntityAnimal animal = (EntityAnimal) entity; +- if ( animal.isBaby() || animal.cp() /*love*/ ) ++ if ( animal.isBaby() || animal.isInLove() ) + { + return true; + } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0021-Close-Unloaded-Save-Files.patch b/CraftBukkit-Patches/0021-Close-Unloaded-Save-Files.patch index 1b1fe4e60e..14c8b6f75a 100644 --- a/CraftBukkit-Patches/0021-Close-Unloaded-Save-Files.patch +++ b/CraftBukkit-Patches/0021-Close-Unloaded-Save-Files.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class RegionFileCache { -- private static final Map a = Maps.newHashMap(); -+ public static final Map a = Maps.newHashMap(); // Spigot - private -> public +- private static final Map a = Maps.newHashMap(); ++ public static final Map a = Maps.newHashMap(); // Spigot - private -> public public static synchronized RegionFile a(File file, int i, int j) { File file1 = new File(file, "region"); diff --git a/CraftBukkit-Patches/0023-Recipe-Deconstruction.patch b/CraftBukkit-Patches/0023-Recipe-Deconstruction.patch index 992d650dce..59bc82ae3d 100644 --- a/CraftBukkit-Patches/0023-Recipe-Deconstruction.patch +++ b/CraftBukkit-Patches/0023-Recipe-Deconstruction.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/IRecipe.java @@ -0,0 +0,0 @@ public interface IRecipe { ItemStack[] b(InventoryCrafting inventorycrafting); - + org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit + + java.util.List getIngredients(); // Spigot @@ -30,8 +30,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) { @@ -0,0 +0,0 @@ public class ShapedRecipes implements IRecipe { - this.e = true; - return this; + public int a() { + return this.width * this.height; } + + // Spigot start @@ -51,9 +51,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private final ItemStack result; + public final ItemStack result; // Spigot - private final List ingredients; + private final List ingredients; - public ShapelessRecipes(ItemStack itemstack, List list) { + public ShapelessRecipes(ItemStack itemstack, List list) { @@ -0,0 +0,0 @@ public class ShapelessRecipes implements IRecipe { public int a() { return this.ingredients.size(); diff --git a/CraftBukkit-Patches/0025-Hopper-Customisations.patch b/CraftBukkit-Patches/0025-Hopper-Customisations.patch index 61c114b028..03e108c985 100644 --- a/CraftBukkit-Patches/0025-Hopper-Customisations.patch +++ b/CraftBukkit-Patches/0025-Hopper-Customisations.patch @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return false; @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU // ItemStack itemstack1 = addItem(iinventory, this.splitStack(i, 1), enumdirection); - + // CraftBukkit start - Call event when pushing items into other inventories - CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, 1)); + CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, world.spigotConfig.hopperAmount)); // Spigot @@ -75,10 +75,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - ((TileEntityHopper) ihopper).d(8); // Delay hopper checks + ((TileEntityHopper) ihopper).d(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot } else if (ihopper instanceof EntityMinecartHopper) { -- ((EntityMinecartHopper) ihopper).l(4); // Delay hopper minecart checks -+ ((EntityMinecartHopper) ihopper).l(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot +- ((EntityMinecartHopper) ihopper).m(4); // Delay hopper minecart checks ++ ((EntityMinecartHopper) ihopper).m(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot } - +- return false; } + int origCount = event.getItem().getAmount(); // Spigot diff --git a/CraftBukkit-Patches/0026-Implement-SpawnerSpawnEvent.patch b/CraftBukkit-Patches/0026-Implement-SpawnerSpawnEvent.patch index a4c52371f2..5c4831da56 100644 --- a/CraftBukkit-Patches/0026-Implement-SpawnerSpawnEvent.patch +++ b/CraftBukkit-Patches/0026-Implement-SpawnerSpawnEvent.patch @@ -49,9 +49,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit } @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { + if (entity instanceof EntityInsentient) { + ((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null); } - } else if (entity instanceof EntityInsentient && entity.world != null && flag) { // CraftBukkit - EntityLiving -> EntityInsentient - ((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null); +- - entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + // Spigot start - call SpawnerSpawnEvent, abort if cancelled + SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); diff --git a/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch b/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch index a9fc486ace..3b1e99d085 100644 --- a/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch +++ b/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + private void handleCommand(String s) { org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot - // CraftBukkit start - whole method + if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.c.info(this.player.getName() + " issued server command: " + s); diff --git a/CraftBukkit-Patches/0030-Configurable-Messages.patch b/CraftBukkit-Patches/0030-Configurable-Messages.patch index 68f077aa5f..c4ae1c53b2 100644 --- a/CraftBukkit-Patches/0030-Configurable-Messages.patch +++ b/CraftBukkit-Patches/0030-Configurable-Messages.patch @@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end if (packethandshakinginsetprotocol.b() > 47) { -- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8"); -+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage, "1.8" ) ); // Spigot +- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.3"); ++ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage, "1.8.3" ) ); // Spigot this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); this.b.close(chatcomponenttext); } else if (packethandshakinginsetprotocol.b() < 47) { -- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8"); -+ chatcomponenttext = new ChatComponentText(java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage, "1.8" ) ); // Spigot +- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8.3"); ++ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage, "1.8.3" ) ); // Spigot this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); this.b.close(chatcomponenttext); } else { diff --git a/CraftBukkit-Patches/0036-Plug-World-Unload-Memory-Leak.patch b/CraftBukkit-Patches/0036-Plug-World-Unload-Memory-Leak.patch index 642f25c7b3..f2111747fb 100644 --- a/CraftBukkit-Patches/0036-Plug-World-Unload-Memory-Leak.patch +++ b/CraftBukkit-Patches/0036-Plug-World-Unload-Memory-Leak.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class BlockRedstoneTorch extends BlockTorch { -- private static Map b = Maps.newHashMap(); -+ private static Map b = new java.util.WeakHashMap(); // Spigot +- private static Map> b = Maps.newHashMap(); ++ private static Map> b = new java.util.WeakHashMap(); // Spigot private final boolean isOn; private boolean a(World world, BlockPosition blockposition, boolean flag) { diff --git a/CraftBukkit-Patches/0037-Player-Collision-API.patch b/CraftBukkit-Patches/0037-Player-Collision-API.patch index fe62a03e1f..d05a0010e1 100644 --- a/CraftBukkit-Patches/0037-Player-Collision-API.patch +++ b/CraftBukkit-Patches/0037-Player-Collision-API.patch @@ -29,14 +29,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - protected void bK() { - List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + } + })); -- if (list != null && !list.isEmpty()) { -+ if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() condition +- if (!list.isEmpty()) { ++ if (this.ad() && !list.isEmpty()) { // Spigot: Add this.ad() condition for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); - + diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java diff --git a/CraftBukkit-Patches/0038-Fully-Disable-Snooper-When-Not-Required.patch b/CraftBukkit-Patches/0038-Fully-Disable-Snooper-When-Not-Required.patch index 0bd89b9a9b..39d3cba250 100644 --- a/CraftBukkit-Patches/0038-Fully-Disable-Snooper-When-Not-Required.patch +++ b/CraftBukkit-Patches/0038-Fully-Disable-Snooper-When-Not-Required.patch @@ -8,18 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - this.g[this.ticks % 100] = System.nanoTime() - i; +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + this.h[this.ticks % 100] = System.nanoTime() - i; this.methodProfiler.b(); this.methodProfiler.a("snooper"); -- if (!this.m.d() && this.ticks > 100) { -+ if (getSnooperEnabled() && !this.m.d() && this.ticks > 100) { // Spigot - this.m.a(); +- if (!this.n.d() && this.ticks > 100) { ++ if (getSnooperEnabled() && !this.n.d() && this.ticks > 100) { // Spigot + this.n.a(); } - if (this.ticks % 6000 == 0) { + if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot - this.m.b(); + this.n.b(); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0044-Item-Despawn-Rate.patch b/CraftBukkit-Patches/0044-Item-Despawn-Rate.patch index 940820a406..3d10c4d226 100644 --- a/CraftBukkit-Patches/0044-Item-Despawn-Rate.patch +++ b/CraftBukkit-Patches/0044-Item-Despawn-Rate.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -0,0 +0,0 @@ public class EntityItem extends Entity { - // Craftbukkit end */ + this.W(); -- if (!this.world.isStatic && this.age >= 6000) { -+ if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot +- if (!this.world.isClientSide && this.age >= 6000) { ++ if (!this.world.isClientSide && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot // CraftBukkit start - fire ItemDespawnEvent if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; diff --git a/CraftBukkit-Patches/0047-Arrow-Despawn-Rate.patch b/CraftBukkit-Patches/0047-Arrow-Despawn-Rate.patch index 987d47477e..62d53baed0 100644 --- a/CraftBukkit-Patches/0047-Arrow-Despawn-Rate.patch +++ b/CraftBukkit-Patches/0047-Arrow-Despawn-Rate.patch @@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { if (block == this.g && i == this.h) { - ++this.ap; -- if (this.ap >= 1200) { -+ if (this.ap >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter + ++this.ar; +- if (this.ar >= 1200) { ++ if (this.ar >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter this.die(); } - + } else { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0048-Fix-packed-ice-generation.patch b/CraftBukkit-Patches/0048-Fix-packed-ice-generation.patch index c429037d93..4f2fb7f8f0 100644 --- a/CraftBukkit-Patches/0048-Fix-packed-ice-generation.patch +++ b/CraftBukkit-Patches/0048-Fix-packed-ice-generation.patch @@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Block block = world.getType(blockposition.a(i1, k, j1)).getBlock(); if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { -- this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE); +- this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE.getBlockData()); + world.setTypeUpdate(blockposition.a(i1, k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot } if (k != 0 && l > 1) { block = world.getType(blockposition.a(i1, -k, j1)).getBlock(); if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { -- this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE); +- this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData()); + world.setTypeUpdate(blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot } } @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Block block1 = world.getType(blockposition1).getBlock(); if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { -- this.a(world, blockposition1, Blocks.PACKED_ICE); +- this.a(world, blockposition1, Blocks.PACKED_ICE.getBlockData()); + world.setTypeUpdate(blockposition1, Blocks.PACKED_ICE.getBlockData()); // Spigot blockposition1 = blockposition1.down(); --l1; diff --git a/CraftBukkit-Patches/0049-Watchdog-Thread.patch b/CraftBukkit-Patches/0049-Watchdog-Thread.patch index 57a51c414c..6166510680 100644 --- a/CraftBukkit-Patches/0049-Watchdog-Thread.patch +++ b/CraftBukkit-Patches/0049-Watchdog-Thread.patch @@ -12,24 +12,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end -- if (this.aQ() > 0L) { -+ if (false && this.aQ() > 0L) { // Spigot - disable - Thread thread = new Thread(new ThreadWatchdog(this)); +- if (this.aR() > 0L) { ++ if (false && this.aR() > 0L) { // Spigot - disable + Thread thread1 = new Thread(new ThreadWatchdog(this)); - thread.setName("Server Watchdog"); + thread1.setName("Server Watchdog"); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.a(crashreport); } finally { try { + org.spigotmc.WatchdogThread.doStop(); - this.stop(); this.isStopped = true; + this.stop(); } catch (Throwable throwable1) { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.methodProfiler.b(); this.methodProfiler.b(); @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +index 0000000000000000000000000000000000000000..00000000000000000000000000000000000000000 --- /dev/null +++ b/src/main/java/org/spigotmc/RestartCommand.java @@ -0,0 +0,0 @@ diff --git a/CraftBukkit-Patches/0052-Fix-Broken-Async-Chat.patch b/CraftBukkit-Patches/0052-Fix-Broken-Async-Chat.patch index c9eb4df3f0..25c0033931 100644 --- a/CraftBukkit-Patches/0052-Fix-Broken-Async-Chat.patch +++ b/CraftBukkit-Patches/0052-Fix-Broken-Async-Chat.patch @@ -8,17 +8,15 @@ diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInChat.java +++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java -@@ -0,0 +0,0 @@ public class PacketPlayInChat implements Packet { - return this.a; +@@ -0,0 +0,0 @@ public class PacketPlayInChat implements Packet { + packetdataserializer.a(this.a); } -- public void a(PacketListener packetlistener) { +- public void a(PacketListenerPlayIn packetlistenerplayin) { + // Spigot Start + private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool( + new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).build() ); -+ @Override -+ public void a(final PacketListener packetlistener) -+ { ++ public void a(final PacketListenerPlayIn packetlistenerplayin) { + if ( !a.startsWith("/") ) + { + executors.submit( new Runnable() @@ -27,13 +25,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public void run() + { -+ PacketPlayInChat.this.a( (PacketListenerPlayIn) packetlistener ); ++ packetlistenerplayin.a( PacketPlayInChat.this ); + } + } ); + return; + } + // Spigot End - this.a((PacketListenerPlayIn) packetlistener); + packetlistenerplayin.a(this); } - } + -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0053-Orebfuscator.patch b/CraftBukkit-Patches/0053-Orebfuscator.patch index 5e1957110e..cfd4708a3f 100644 --- a/CraftBukkit-Patches/0053-Orebfuscator.patch +++ b/CraftBukkit-Patches/0053-Orebfuscator.patch @@ -13,17 +13,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) { this.world.setAir(blockposition); + world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot - } else if (!this.world.isStatic) { + } else if (!this.world.isClientSide) { this.die(); return; @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { - return; - } - this.world.setTypeAndData(blockposition, this.block, 3); -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot - // CraftBukkit end - if (block instanceof BlockFalling) { - ((BlockFalling) block).a_(this.world, blockposition); + return; + } + this.world.setTypeAndData(blockposition, this.block, 3); ++ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot + // CraftBukkit end + if (block instanceof BlockFalling) { + ((BlockFalling) block).a_(this.world, blockposition); diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Explosion.java @@ -40,37 +40,37 @@ diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { this.b = chunk.locZ; this.d = flag; this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i); + chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world); } - public void a(PacketDataSerializer packetdataserializer) { + public void a(PacketDataSerializer packetdataserializer) throws IOException { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet { +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet private int[] b; - private ChunkMap[] c; + private PacketPlayOutMapChunk.ChunkMap[] c; private boolean d; + private World world; // Spigot public PacketPlayOutMapChunkBulk() {} -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet { +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet this.b[j] = chunk.locZ; - this.c[j] = chunkmap; + this.c[j] = packetplayoutmapchunk_chunkmap; } - + + world = ((Chunk) list.get(0)).getWorld(); // Spigot } - public void a(PacketDataSerializer packetdataserializer) { -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet { + public void a(PacketDataSerializer packetdataserializer) throws IOException { +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet } for (i = 0; i < this.a.length; ++i) { diff --git a/CraftBukkit-Patches/0054-Optimize-DataWatcher.patch b/CraftBukkit-Patches/0054-Optimize-DataWatcher.patch index a172968bda..7dce3137f2 100644 --- a/CraftBukkit-Patches/0054-Optimize-DataWatcher.patch +++ b/CraftBukkit-Patches/0054-Optimize-DataWatcher.patch @@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final Entity a; private boolean b = true; -- private static final Map c = Maps.newHashMap(); -- private final Map d = Maps.newHashMap(); +- private static final Map, Integer> c = Maps.newHashMap(); +- private final Map d = Maps.newHashMap(); + // Spigot Start + private static final gnu.trove.map.TObjectIntMap classToId = new gnu.trove.map.hash.TObjectIntHashMap( 10, 0.5f, -1 ); + private final gnu.trove.map.TIntObjectMap dataValues = new gnu.trove.map.hash.TIntObjectHashMap( 10, 0.5f, -1 ); + // These exist as an attempt at backwards compatability for (broken) NMS plugins -+ private static final Map c = gnu.trove.TDecorators.wrap( classToId ); -+ private final Map d = gnu.trove.TDecorators.wrap( dataValues ); ++ private static final Map, Integer> c = gnu.trove.TDecorators.wrap( classToId ); ++ private final Map d = gnu.trove.TDecorators.wrap( dataValues ); + // Spigot End private boolean e; private ReadWriteLock f = new ReentrantReadWriteLock(); @@ -28,43 +28,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class DataWatcher { } - public void a(int i, Object object) { -- Integer integer = (Integer) DataWatcher.c.get(object.getClass()); -+ int integer = classToId.get(object.getClass()); // Spigot + public void a(int i, T t0) { +- Integer integer = (Integer) DataWatcher.c.get(t0.getClass()); ++ int integer = classToId.get(t0.getClass()); // Spigot - if (integer == null) { + if (integer == -1) { // Spigot - throw new IllegalArgumentException("Unknown data type: " + object.getClass()); + throw new IllegalArgumentException("Unknown data type: " + t0.getClass()); } else if (i > 31) { throw new IllegalArgumentException("Data value id is too big with " + i + "! (Max is " + 31 + ")"); - } else if (this.d.containsKey(Integer.valueOf(i))) { + } else if (this.dataValues.containsKey(i)) { // Spigot throw new IllegalArgumentException("Duplicate id value for " + i + "!"); } else { -- WatchableObject watchableobject = new WatchableObject(integer.intValue(), i, object); -+ WatchableObject watchableobject = new WatchableObject(integer, i, object); // Spigot +- DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(integer.intValue(), i, t0); ++ DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(integer, i, t0); // Spigot this.f.writeLock().lock(); -- this.d.put(Integer.valueOf(i), watchableobject); -+ this.dataValues.put(i, watchableobject); // Spigot +- this.d.put(Integer.valueOf(i), datawatcher_watchableobject); ++ this.dataValues.put(i, datawatcher_watchableobject); // Spigot this.f.writeLock().unlock(); this.b = false; } @@ -0,0 +0,0 @@ public class DataWatcher { - WatchableObject watchableobject = new WatchableObject(j, i, (Object) null); + DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(j, i, (Object) null); this.f.writeLock().lock(); -- this.d.put(Integer.valueOf(i), watchableobject); -+ this.dataValues.put(i, watchableobject); // Spigot +- this.d.put(Integer.valueOf(i), datawatcher_watchableobject); ++ this.dataValues.put(i, datawatcher_watchableobject); // Spigot this.f.writeLock().unlock(); this.b = false; } @@ -0,0 +0,0 @@ public class DataWatcher { - WatchableObject watchableobject; + DataWatcher.WatchableObject datawatcher_watchableobject; try { -- watchableobject = (WatchableObject) this.d.get(Integer.valueOf(i)); -+ watchableobject = (WatchableObject) this.dataValues.get(i); // Spigot +- datawatcher_watchableobject = (DataWatcher.WatchableObject) this.d.get(Integer.valueOf(i)); ++ datawatcher_watchableobject = (DataWatcher.WatchableObject) this.dataValues.get(i); // Spigot } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Getting synched entity data"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Synched entity data"); @@ -76,29 +76,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Iterator iterator = this.dataValues.valueCollection().iterator(); // Spigot while (iterator.hasNext()) { - WatchableObject watchableobject = (WatchableObject) iterator.next(); + DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); @@ -0,0 +0,0 @@ public class DataWatcher { - public void a(PacketDataSerializer packetdataserializer) { + public void a(PacketDataSerializer packetdataserializer) throws IOException { this.f.readLock().lock(); - Iterator iterator = this.d.values().iterator(); + Iterator iterator = this.dataValues.valueCollection().iterator(); // Spigot while (iterator.hasNext()) { - WatchableObject watchableobject = (WatchableObject) iterator.next(); + DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); @@ -0,0 +0,0 @@ public class DataWatcher { } - public List c() { + public List c() { - ArrayList arraylist = null; + ArrayList arraylist = Lists.newArrayList(); // Spigot this.f.readLock().lock(); -- WatchableObject watchableobject; +- DataWatcher.WatchableObject datawatcher_watchableobject; - -- for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(watchableobject)) { -- watchableobject = (WatchableObject) iterator.next(); +- for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(datawatcher_watchableobject)) { +- datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); - if (arraylist == null) { - arraylist = Lists.newArrayList(); - } @@ -130,5 +130,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + classToId.put(Vector3f.class, 7); + // Spigot End } - } + + public static class WatchableObject { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0055-Fire-PreLogin-Events-in-Offline-Mode.patch b/CraftBukkit-Patches/0055-Fire-PreLogin-Events-in-Offline-Mode.patch index cda684438c..39fd0e91f1 100644 --- a/CraftBukkit-Patches/0055-Fire-PreLogin-Events-in-Offline-Mode.patch +++ b/CraftBukkit-Patches/0055-Fire-PreLogin-Events-in-Offline-Mode.patch @@ -8,6 +8,14 @@ diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java +@@ -0,0 +0,0 @@ import java.util.Arrays; + import java.util.Random; + import java.util.UUID; + import java.util.concurrent.atomic.AtomicInteger; ++import java.util.logging.Level; + import javax.crypto.SecretKey; + import org.apache.commons.lang3.Validate; + import org.apache.logging.log4j.LogManager; @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo } @@ -33,125 +41,96 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start - fire PlayerLoginEvent EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname); @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo - this.g = EnumProtocolState.KEY; + this.g = LoginListener.EnumProtocolState.KEY; this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.P().getPublic(), this.e)); } else { -- this.g = EnumProtocolState.READY_TO_ACCEPT; -+ (new ThreadPlayerLookupUUID(this, "User Authenticator #" + b.incrementAndGet())).start(); // Spigot +- this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; ++ // Spigot start ++ try { ++ new LoginHandler().fireEvents(); ++ } catch (Exception ex) { ++ disconnect("Failed to verify username!"); ++ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex); ++ } ++ // Spigot end } } -diff --git a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java -+++ b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java -@@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread { - GameProfile gameprofile = LoginListener.b(this.a); +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo + return; + } - try { -+ // Spigot Start -+ if ( !LoginListener.a( this.a ).getOnlineMode() ) -+ { -+ a.initUUID(); -+ fireLoginEvents(); -+ return; -+ } -+ // Spigot End - String s = (new BigInteger(MinecraftEncryption.a(LoginListener.c(this.a), LoginListener.a(this.a).P().getPublic(), LoginListener.d(this.a)))).toString(16); - - LoginListener.a(this.a, LoginListener.a(this.a).aB().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s)); - if (LoginListener.b(this.a) != null) { -- // CraftBukkit start - fire PlayerPreLoginEvent -- if (!this.a.networkManager.g()) { -- return; -- } -- -- String playerName = LoginListener.b(this.a).getName(); -- java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress(); -- java.util.UUID uniqueId = LoginListener.b(this.a).getId(); -- final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server; -- -- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); -- server.getPluginManager().callEvent(asyncEvent); -- -- if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { -- final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); -- if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { -- event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage()); -- } -- Waitable waitable = new Waitable() { -- @Override -- protected PlayerPreLoginEvent.Result evaluate() { -- server.getPluginManager().callEvent(event); -- return event.getResult(); -- }}; -- -- LoginListener.a(this.a).processQueue.add(waitable); -- if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { -- this.a.disconnect(event.getKickMessage()); -- return; -- } -- } else { -- if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { -- this.a.disconnect(asyncEvent.getKickMessage()); -- return; -- } -- } -- // CraftBukkit end -- -- LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId()); -- LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT); -+ fireLoginEvents(); // Spigot - } else if (LoginListener.a(this.a).S()) { - LoginListener.e().warn("Failed to verify username but will let them in anyway!"); - LoginListener.a(this.a, this.a.a(gameprofile)); -@@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread { - } - - } ++ new LoginHandler().fireEvents(); ++ } else if (LoginListener.this.server.S()) { ++ LoginListener.c.warn("Failed to verify username but will let them in anyway!"); ++ LoginListener.this.i = LoginListener.this.a(gameprofile); ++ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; ++ } else { ++ LoginListener.this.disconnect("Failed to verify username!"); ++ LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer ++ } ++ } catch (AuthenticationUnavailableException authenticationunavailableexception) { ++ if (LoginListener.this.server.S()) { ++ LoginListener.c.warn("Authentication servers are down but will let them in anyway!"); ++ LoginListener.this.i = LoginListener.this.a(gameprofile); ++ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; ++ } else { ++ LoginListener.this.disconnect("Authentication servers are down. Please try again later, sorry!"); ++ LoginListener.c.error("Couldn\'t verify username because servers are unavailable"); ++ } ++ // CraftBukkit start - catch all exceptions ++ } catch (Exception exception) { ++ disconnect("Failed to verify username!"); ++ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception); ++ // CraftBukkit end ++ } + -+ private void fireLoginEvents() throws Exception -+ { -+ // CraftBukkit start - fire PlayerPreLoginEvent -+ if (!this.a.networkManager.g()) { -+ return; ++ } ++ }).start(); + } -+ -+ String playerName = LoginListener.b(this.a).getName(); -+ java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress(); -+ java.util.UUID uniqueId = LoginListener.b(this.a).getId(); -+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server; -+ -+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); -+ server.getPluginManager().callEvent(asyncEvent); -+ -+ if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { -+ final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); -+ if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { -+ event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage()); -+ } -+ Waitable waitable = new Waitable() { -+ @Override -+ protected PlayerPreLoginEvent.Result evaluate() { -+ server.getPluginManager().callEvent(event); -+ return event.getResult(); -+ }}; -+ -+ LoginListener.a(this.a).processQueue.add(waitable); -+ if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { -+ this.a.disconnect(event.getKickMessage()); -+ return; -+ } -+ } else { -+ if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { -+ this.a.disconnect(asyncEvent.getKickMessage()); -+ return; -+ } -+ } -+ // CraftBukkit end -+ -+ LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId()); -+ LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT); + } - } ++ ++ // Spigot start ++ public class LoginHandler { ++ ++ public void fireEvents() throws Exception { + String playerName = i.getName(); + java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress(); + java.util.UUID uniqueId = i.getId(); +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo + // CraftBukkit end + LoginListener.c.info("UUID of player " + LoginListener.this.i.getName() + " is " + LoginListener.this.i.getId()); + LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; +- } else if (LoginListener.this.server.S()) { +- LoginListener.c.warn("Failed to verify username but will let them in anyway!"); +- LoginListener.this.i = LoginListener.this.a(gameprofile); +- LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; +- } else { +- LoginListener.this.disconnect("Failed to verify username!"); +- LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer +- } +- } catch (AuthenticationUnavailableException authenticationunavailableexception) { +- if (LoginListener.this.server.S()) { +- LoginListener.c.warn("Authentication servers are down but will let them in anyway!"); +- LoginListener.this.i = LoginListener.this.a(gameprofile); +- LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; +- } else { +- LoginListener.this.disconnect("Authentication servers are down. Please try again later, sorry!"); +- LoginListener.c.error("Couldn\'t verify username because servers are unavailable"); +- } +- // CraftBukkit start - catch all exceptions +- } catch (Exception exception) { +- disconnect("Failed to verify username!"); +- server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception); +- // CraftBukkit end +- } +- +- } +- }).start(); + } + } ++ // Spigot end + + protected GameProfile a(GameProfile gameprofile) { + UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + gameprofile.getName()).getBytes(Charsets.UTF_8)); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0056-BungeeCord-Support.patch b/CraftBukkit-Patches/0056-BungeeCord-Support.patch index 0e7d16efa8..06a7183936 100644 --- a/CraftBukkit-Patches/0056-BungeeCord-Support.patch +++ b/CraftBukkit-Patches/0056-BungeeCord-Support.patch @@ -10,11 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java @@ -0,0 +0,0 @@ import java.util.HashMap; - // CraftBukkit end public class HandshakeListener implements PacketHandshakingInListener { -- -+ + + private static final com.google.gson.Gson gson = new com.google.gson.Gson(); // Spigot // CraftBukkit start - add fields private static final HashMap throttleTracker = new HashMap(); @@ -28,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + String[] split = packethandshakinginsetprotocol.b.split("\00"); + if ( split.length == 3 || split.length == 4 ) { + packethandshakinginsetprotocol.b = split[0]; -+ b.j = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort()); ++ b.l = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort()); + b.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] ); + } else + { @@ -80,28 +78,28 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - private final EnumProtocolDirection g; - private final Queue h = Queues.newConcurrentLinkedQueue(); - private Channel i; -- private SocketAddress j; +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { + private final Queue i = Queues.newConcurrentLinkedQueue(); + private final ReentrantReadWriteLock j = new ReentrantReadWriteLock(); + public Channel k; // CraftBukkit - public, PAIL: rename +- private SocketAddress l; + // Spigot Start -+ public SocketAddress j; ++ public SocketAddress l; + public java.util.UUID spoofedUUID; + public com.mojang.authlib.properties.Property[] spoofedProfile; + // Spigot End - private PacketListener k; - private IChatBaseComponent l; - private boolean m; -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - static Channel a(NetworkManager networkmanager) { - return networkmanager.i; + private PacketListener m; + private IChatBaseComponent n; + private boolean o; +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { + this.b = agenericfuturelistener; + } } + + // Spigot Start + public SocketAddress getRawAddress() + { -+ return this.i.remoteAddress(); ++ return this.k.remoteAddress(); + } + // Spigot End } @@ -109,9 +107,9 @@ diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -@@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet { +@@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet p = Lists.newArrayList(); + protected final ICommandHandler b; public final MethodProfiler methodProfiler = new MethodProfiler(); - private final ServerConnection q; + private ServerConnection q; // Spigot private final ServerPing r = new ServerPing(); private final Random s = new Random(); private String serverIp; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - this.d = proxy; - MinecraftServer.k = this; +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + this.e = proxy; + MinecraftServer.l = this; // this.universe = file; // CraftBukkit - this.q = new ServerConnection(this); + // this.q = new ServerConnection(this); // Spigot this.Z = new UserCache(this, file1); - this.p = this.h(); + this.b = this.h(); // this.convertable = new WorldLoaderServer(file); // CraftBukkit - moved to DedicatedServer.init -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs } // Spigot End - public ServerConnection ao() { + public ServerConnection ap() { - return this.q; + return this.q == null ? this.q = new ServerConnection(this) : this.q; // Spigot } - public boolean aq() { + public boolean ar() { diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0060-Log-Cause-of-Unexpected-Exceptions.patch b/CraftBukkit-Patches/0060-Log-Cause-of-Unexpected-Exceptions.patch index 74c07fbe18..8a6e754be7 100644 --- a/CraftBukkit-Patches/0060-Log-Cause-of-Unexpected-Exceptions.patch +++ b/CraftBukkit-Patches/0060-Log-Cause-of-Unexpected-Exceptions.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs } } catch (Throwable throwable) { MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable); diff --git a/CraftBukkit-Patches/0063-More-Efficient-GetCubes.patch b/CraftBukkit-Patches/0063-More-Efficient-GetCubes.patch index 3714c6d16d..1938279273 100644 --- a/CraftBukkit-Patches/0063-More-Efficient-GetCubes.patch +++ b/CraftBukkit-Patches/0063-More-Efficient-GetCubes.patch @@ -9,22 +9,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - int i1 = MathHelper.floor(axisalignedbb.c); - int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); + IBlockData iblockdata = Blocks.STONE.getBlockData(); + BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); - for (int k1 = i; k1 < j; ++k1) { - for (int l1 = i1; l1 < j1; ++l1) { -- if (this.isLoaded(new BlockPosition(k1, 64, l1))) { +- if (this.isLoaded(blockposition_mutableblockposition.c(k1, 64, l1))) { - for (int i2 = k - 1; i2 < l; ++i2) { -- BlockPosition blockposition = new BlockPosition(k1, i2, l1); -- boolean flag = entity.aS(); -- boolean flag1 = this.a(this.af(), entity); -- +- blockposition_mutableblockposition.c(k1, i2, l1); - if (flag && flag1) { - entity.h(false); - } else if (!flag && !flag1) { - entity.h(true); - } +- +- IBlockData iblockdata1 = iblockdata; + // Spigot start + int ystart = ( ( k - 1 ) < 0 ) ? 0 : ( k - 1 ); + for ( int chunkx = ( i >> 4 ); chunkx <= ( ( j - 1 ) >> 4 ); chunkx++ ) @@ -51,8 +50,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + for ( int y = ystart; y < l; y++ ) + { + BlockPosition blockposition = new BlockPosition( x, y, z ); -+ boolean flag = entity.aS(); -+ boolean flag1 = this.a(this.af(), entity); + + if (flag && flag1) { + entity.h(false); @@ -60,15 +57,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + entity.h(true); + } -- IBlockData iblockdata; -+ IBlockData iblockdata; - -- if (!this.af().a(blockposition) && flag1) { -- iblockdata = Blocks.STONE.getBlockData(); -- } else { -- iblockdata = this.getType(blockposition); +- if (worldborder.a((BlockPosition) blockposition_mutableblockposition) || !flag1) { +- iblockdata1 = this.getType(blockposition_mutableblockposition); + IBlockData block; -+ if (!this.af().a(blockposition) && flag1) { ++ if (!this.getWorldBorder().a(blockposition) && flag1) { + block = Blocks.STONE.getBlockData(); + } else + { @@ -80,7 +72,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } } - -- iblockdata.getBlock().a(this, blockposition, iblockdata, axisalignedbb, arraylist, entity); +- iblockdata1.getBlock().a(this, blockposition_mutableblockposition, iblockdata1, axisalignedbb, arraylist, entity); } } } diff --git a/CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch b/CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch index 3da86b1fbd..a718ac17c9 100644 --- a/CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch +++ b/CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot End this.world.methodProfiler.a("sensing"); - this.bi.a(); + this.bk.a(); this.world.methodProfiler.b(); diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/CraftBukkit-Patches/0067-Add-Late-Bind-Option.patch b/CraftBukkit-Patches/0067-Add-Late-Bind-Option.patch index c4dd480c4d..5e5e7bc299 100644 --- a/CraftBukkit-Patches/0067-Add-Late-Bind-Option.patch +++ b/CraftBukkit-Patches/0067-Add-Late-Bind-Option.patch @@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (!org.spigotmc.SpigotConfig.lateBind) { try { - this.ao().a(inetaddress, this.Q()); - } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable + this.ap().a(inetaddress, this.Q()); + } catch (IOException ioexception) { @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); return false; @@ -31,8 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (org.spigotmc.SpigotConfig.lateBind) { + try { -+ this.ao().a(inetaddress, this.Q()); -+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable ++ this.ap().a(inetaddress, this.Q()); ++ } catch (IOException ioexception) { + DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); + DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()}); + DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); @@ -40,8 +40,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + - if (false && this.aQ() > 0L) { // Spigot - disable - Thread thread = new Thread(new ThreadWatchdog(this)); + if (false && this.aR() > 0L) { // Spigot - disable + Thread thread1 = new Thread(new ThreadWatchdog(this)); diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/CraftBukkit-Patches/0070-Try-and-Debug-Crash-Reports-Crashing.patch b/CraftBukkit-Patches/0070-Try-and-Debug-Crash-Reports-Crashing.patch index a97b4b9192..f3cf9c5cb7 100644 --- a/CraftBukkit-Patches/0070-Try-and-Debug-Crash-Reports-Crashing.patch +++ b/CraftBukkit-Patches/0070-Try-and-Debug-Crash-Reports-Crashing.patch @@ -8,13 +8,13 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs worldserver.doTick(); worldserver.timings.doTick.stopTiming(); // Spigot - } catch (Throwable throwable1) { + } catch (Throwable throwable) { + // Spigot Start + try { - crashreport = CrashReport.a(throwable1, "Exception ticking world"); + crashreport = CrashReport.a(throwable, "Exception ticking world"); + } catch (Throwable t){ + throw new RuntimeException("Error generating crash report", t); + } @@ -22,13 +22,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 worldserver.a(crashreport); throw new ReportedException(crashreport); } -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs worldserver.tickEntities(); worldserver.timings.tickEntities.stopTiming(); // Spigot - } catch (Throwable throwable2) { + } catch (Throwable throwable1) { + // Spigot Start + try { - crashreport = CrashReport.a(throwable2, "Exception ticking world entities"); + crashreport = CrashReport.a(throwable1, "Exception ticking world entities"); + } catch (Throwable t){ + throw new RuntimeException("Error generating crash report", t); + } diff --git a/CraftBukkit-Patches/0071-Improve-AutoSave-Mechanism.patch b/CraftBukkit-Patches/0071-Improve-AutoSave-Mechanism.patch index 21aab4bc84..046d53fc34 100644 --- a/CraftBukkit-Patches/0071-Improve-AutoSave-Mechanism.patch +++ b/CraftBukkit-Patches/0071-Improve-AutoSave-Mechanism.patch @@ -27,7 +27,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs SpigotTimings.worldSaveTimer.startTiming(); // Spigot this.methodProfiler.a("save"); this.v.savePlayers(); diff --git a/CraftBukkit-Patches/0072-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch b/CraftBukkit-Patches/0072-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch index 5dcd77ed46..7ec0f6c47e 100644 --- a/CraftBukkit-Patches/0072-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch +++ b/CraftBukkit-Patches/0072-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java @@ -0,0 +0,0 @@ public class NBTTagByteArray extends NBTBase { - void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { + void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { int j = datainput.readInt(); + com.google.common.base.Preconditions.checkArgument( j < 1 << 24); @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java @@ -0,0 +0,0 @@ public class NBTTagIntArray extends NBTBase { - void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { + void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { int j = datainput.readInt(); + com.google.common.base.Preconditions.checkArgument( j < 1 << 24); diff --git a/CraftBukkit-Patches/0074-Highly-Optimized-Tick-Loop.patch b/CraftBukkit-Patches/0074-Highly-Optimized-Tick-Loop.patch index 745e68b4d4..f60fc7bcb4 100644 --- a/CraftBukkit-Patches/0074-Highly-Optimized-Tick-Loop.patch +++ b/CraftBukkit-Patches/0074-Highly-Optimized-Tick-Loop.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs public java.util.Queue processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; // CraftBukkit end @@ -20,8 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot end public MinecraftServer(OptionSet options, Proxy proxy, File file1) { - this.d = proxy; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + this.e = proxy; +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.isRunning = false; } @@ -35,15 +35,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void run() { try { if (this.init()) { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - this.r.setServerInfo(new ServerPingServerData("1.8", 47)); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + this.r.setServerInfo(new ServerPing.ServerData("1.8.3", 47)); this.a(this.r); + // Spigot start + Arrays.fill( recentTps, 20 ); + long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; while (this.isRunning) { -- long j = ax(); +- long j = ay(); - long k = j - this.ab; - - if (k > 2000L && this.ab - this.R >= 15000L) { @@ -68,14 +68,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - i += k; - this.ab = j; -- if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit -- this.y(); +- if (this.worlds.get(0).everyoneDeeplySleeping()) { +- this.z(); - i = 0L; - } else { - while (i > 50L) { - MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit - i -= 50L; -- this.y(); +- this.z(); - } + if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) + { @@ -88,7 +88,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + lastTick = curTime; - Thread.sleep(Math.max(1L, 50L - i)); -+ this.y(); ++ this.z(); this.Q = true; } + // Spigot end diff --git a/CraftBukkit-Patches/0076-Configurable-Ping-Sample-Size.patch b/CraftBukkit-Patches/0076-Configurable-Ping-Sample-Size.patch index 82a0d61ffd..be99278f00 100644 --- a/CraftBukkit-Patches/0076-Configurable-Ping-Sample-Size.patch +++ b/CraftBukkit-Patches/0076-Configurable-Ping-Sample-Size.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PacketStatusListener implements PacketStatusInListener { } - ServerPingPlayerSample playerSample = new ServerPingPlayerSample(event.getMaxPlayers(), profiles.size()); + ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size()); + // Spigot Start + if ( !profiles.isEmpty() ) + { diff --git a/CraftBukkit-Patches/0077-Add-Optional-Tick-Shuffling.patch b/CraftBukkit-Patches/0077-Add-Optional-Tick-Shuffling.patch index bcc4d436a9..96ad363d0b 100644 --- a/CraftBukkit-Patches/0077-Add-Optional-Tick-Shuffling.patch +++ b/CraftBukkit-Patches/0077-Add-Optional-Tick-Shuffling.patch @@ -10,17 +10,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ServerConnection.java +++ b/src/main/java/net/minecraft/server/ServerConnection.java @@ -0,0 +0,0 @@ public class ServerConnection { - List list = this.g; + List list = this.h; - synchronized (this.g) { + synchronized (this.h) { + // Spigot Start + // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order + if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 ) + { -+ Collections.shuffle( this.g ); ++ Collections.shuffle( this.h ); + } + // Spigot End - Iterator iterator = this.g.iterator(); + Iterator iterator = this.h.iterator(); while (iterator.hasNext()) { diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0079-Implement-Locale-Getter-for-Players.patch b/CraftBukkit-Patches/0079-Implement-Locale-Getter-for-Players.patch index d891ff401f..21d20c13b2 100644 --- a/CraftBukkit-Patches/0079-Implement-Locale-Getter-for-Players.patch +++ b/CraftBukkit-Patches/0079-Implement-Locale-Getter-for-Players.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class EntityPlayer extends EntityHuman implements ICrafting { - private static final Logger bF = LogManager.getLogger(); + private static final Logger bH = LogManager.getLogger(); - private String locale = "en_US"; + public String locale = "en_US"; // Spigot public PlayerConnection playerConnection; diff --git a/CraftBukkit-Patches/0080-Cap-Entity-Collisions.patch b/CraftBukkit-Patches/0080-Cap-Entity-Collisions.patch index 049d5dae96..007edf4b44 100644 --- a/CraftBukkit-Patches/0080-Cap-Entity-Collisions.patch +++ b/CraftBukkit-Patches/0080-Cap-Entity-Collisions.patch @@ -17,29 +17,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int numCollisions = 0; // Spigot public void collide(Entity entity) { if (entity.passenger != this && entity.vehicle != this) { - if (!entity.T && !this.T) { + if (!entity.noclip && !this.noclip) { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + })); - if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() condition + if (this.ad() && !list.isEmpty()) { // Spigot: Add this.ad() condition + numCollisions -= world.spigotConfig.maxCollisionsPerEntity; // Spigot for (int i = 0; i < list.size(); ++i) { + if (numCollisions > world.spigotConfig.maxCollisionsPerEntity) { break; } // Spigot Entity entity = (Entity) list.get(i); - + // TODO better check now? @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + } // CraftBukkit end - if (entity.ae()) { -+ entity.numCollisions++; // Spigot -+ numCollisions++; // Spigot - this.s(entity); - } ++ entity.numCollisions++; // Spigot ++ numCollisions++; // Spigot + this.s(entity); } + numCollisions = 0; // Spigot } diff --git a/CraftBukkit-Patches/0081-Fix-dispensing-bone-meal-not-having-the-correct-data.patch b/CraftBukkit-Patches/0081-Fix-dispensing-bone-meal-not-having-the-correct-data.patch index 139e68cb72..3eb16339ca 100644 --- a/CraftBukkit-Patches/0081-Fix-dispensing-bone-meal-not-having-the-correct-data.patch +++ b/CraftBukkit-Patches/0081-Fix-dispensing-bone-meal-not-having-the-correct-data.patch @@ -4,17 +4,17 @@ Date: Thu, 6 Feb 2014 21:59:20 +0000 Subject: [PATCH] Fix dispensing bone meal not having the correct data value -diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java +diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java -+++ b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java -@@ -0,0 +0,0 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem { - - // CraftBukkit start - org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -- CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); // Spigot +--- a/src/main/java/net/minecraft/server/DispenserRegistry.java ++++ b/src/main/java/net/minecraft/server/DispenserRegistry.java +@@ -0,0 +0,0 @@ public class DispenserRegistry { - BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); - if (!BlockDispenser.eventFired) { + // CraftBukkit start + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); +- CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); // Spigot + + BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); + if (!BlockDispenser.eventFired) { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0085-Allow-Disabling-Creative-Item-Filter.patch b/CraftBukkit-Patches/0085-Allow-Disabling-Creative-Item-Filter.patch index 1075ba0b8c..dcdbd5827a 100644 --- a/CraftBukkit-Patches/0085-Allow-Disabling-Creative-Item-Filter.patch +++ b/CraftBukkit-Patches/0085-Allow-Disabling-Creative-Item-Filter.patch @@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - boolean flag2 = itemstack == null || itemstack.getItem() != null && !invalidItems.contains(Item.getId(itemstack.getItem())); + boolean flag2 = itemstack == null || itemstack.getItem() != null && (!invalidItems.contains(Item.getId(itemstack.getItem())) || !org.spigotmc.SpigotConfig.filterCreativeItems); // Spigot boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0; - - + // CraftBukkit start - Call click event + if (flag || (flag1 && !ItemStack.matches(this.player.defaultContainer.getSlot(packetplayinsetcreativeslot.a()).getItem(), packetplayinsetcreativeslot.getItemStack()))) { // Insist on valid slot diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0088-Unfinalize-the-isDisconnected-method-by-bukkit.patch b/CraftBukkit-Patches/0088-Unfinalize-the-isDisconnected-method-by-bukkit.patch index a95d9ef1a5..6cdb0bd5e8 100644 --- a/CraftBukkit-Patches/0088-Unfinalize-the-isDisconnected-method-by-bukkit.patch +++ b/CraftBukkit-Patches/0088-Unfinalize-the-isDisconnected-method-by-bukkit.patch @@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start - Add "isDisconnected" method - public final boolean isDisconnected() { -+ public boolean isDisconnected() { - return !this.player.joining && !NetworkManager.a(this.networkManager).config().isAutoRead(); ++ public boolean isDisconnected() { // Spigot + return !this.player.joining && !this.networkManager.k.config().isAutoRead(); } - } + -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0089-Implement-Silenceable-Lightning-API.patch b/CraftBukkit-Patches/0089-Implement-Silenceable-Lightning-API.patch index 579a7c5130..05f311cefc 100644 --- a/CraftBukkit-Patches/0089-Implement-Silenceable-Lightning-API.patch +++ b/CraftBukkit-Patches/0089-Implement-Silenceable-Lightning-API.patch @@ -31,8 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Spigot end - public void s_() { - super.s_(); + public void t_() { + super.t_(); - if (this.lifeTicks == 2) { + if (!isSilent && this.lifeTicks == 2) { // Spigot // CraftBukkit start - Use relative location for far away sounds diff --git a/CraftBukkit-Patches/0091-Prevent-hoppers-from-loading-chunks.patch b/CraftBukkit-Patches/0091-Prevent-hoppers-from-loading-chunks.patch index da96ad8080..96e7be1428 100644 --- a/CraftBukkit-Patches/0091-Prevent-hoppers-from-loading-chunks.patch +++ b/CraftBukkit-Patches/0091-Prevent-hoppers-from-loading-chunks.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int k = MathHelper.floor(d2); BlockPosition blockposition = new BlockPosition(i, j, k); + if ( !world.isLoaded( blockposition ) ) return null; // Spigot - TileEntity tileentity = world.getTileEntity(new BlockPosition(i, j, k)); + Block block = world.getType(blockposition).getBlock(); - if (tileentity instanceof IInventory) { + if (block.isTileEntity()) { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0092-Guard-Entity-List.patch b/CraftBukkit-Patches/0092-Guard-Entity-List.patch index eb46f552ca..f3b425930a 100644 --- a/CraftBukkit-Patches/0092-Guard-Entity-List.patch +++ b/CraftBukkit-Patches/0092-Guard-Entity-List.patch @@ -8,16 +8,16 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ import org.bukkit.event.weather.ThunderChangeEvent; - public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + private int a = 63; protected boolean e; -- public final List entityList = Lists.newArrayList(); +- public final List entityList = Lists.newArrayList(); + // Spigot start - guard entity list from removals -+ public List entityList = new java.util.ArrayList() ++ public final List entityList = new java.util.ArrayList() + { + @Override -+ public Object remove(int index) ++ public Entity remove(int index) + { + guard(); + return super.remove( index ); @@ -39,9 +39,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + }; + // Spigot end - protected final List g = Lists.newArrayList(); - public final List h = Lists.newArrayList(); - public final List tileEntityList = Lists.newArrayList(); + protected final List g = Lists.newArrayList(); + public final List h = Lists.newArrayList(); + public final List tileEntityList = Lists.newArrayList(); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { private int tickPosition; diff --git a/CraftBukkit-Patches/0094-Cancellable-WitherSkull-potion-effect.patch b/CraftBukkit-Patches/0094-Cancellable-WitherSkull-potion-effect.patch index e46e208f6a..0a962b7c55 100644 --- a/CraftBukkit-Patches/0094-Cancellable-WitherSkull-potion-effect.patch +++ b/CraftBukkit-Patches/0094-Cancellable-WitherSkull-potion-effect.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java @@ -0,0 +0,0 @@ public class EntityWitherSkull extends EntityFireball { protected void a(MovingObjectPosition movingobjectposition) { - if (!this.world.isStatic) { + if (!this.world.isClientSide) { if (movingobjectposition.entity != null) { + // Spigot start + boolean didDamage = false; diff --git a/CraftBukkit-Patches/0097-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch b/CraftBukkit-Patches/0097-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch index 89cecad8c5..98ccc3d94e 100644 --- a/CraftBukkit-Patches/0097-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch +++ b/CraftBukkit-Patches/0097-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs } public String getServerModName() { diff --git a/CraftBukkit-Patches/0098-Treat-Bungee-as-Online-Mode.patch b/CraftBukkit-Patches/0098-Treat-Bungee-as-Online-Mode.patch index c90134d659..9a6ec96b50 100644 --- a/CraftBukkit-Patches/0098-Treat-Bungee-as-Online-Mode.patch +++ b/CraftBukkit-Patches/0098-Treat-Bungee-as-Online-Mode.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java @@ -0,0 +0,0 @@ public class NameReferencingFileConverter { - private static void a(MinecraftServer minecraftserver, Collection collection, ProfileLookupCallback profilelookupcallback) { - String[] astring = (String[]) Iterators.toArray(Iterators.filter(collection.iterator(), new PredicateEmptyList()), String.class); + } + }), String.class); - if (minecraftserver.getOnlineMode()) { + if (minecraftserver.getOnlineMode() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now. diff --git a/CraftBukkit-Patches/0099-Add-Conversion-Message.patch b/CraftBukkit-Patches/0099-Add-Conversion-Message.patch index 3c3312542f..97240f600c 100644 --- a/CraftBukkit-Patches/0099-Add-Conversion-Message.patch +++ b/CraftBukkit-Patches/0099-Add-Conversion-Message.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } - protected boolean aP() { + protected boolean aQ() { + server.getLogger().info( "**** Beginning UUID conversion, this may take A LONG time ****"); // Spigot, let the user know whats up! boolean flag = false; diff --git a/CraftBukkit-Patches/0101-Print-Stack-on-InternalException.patch b/CraftBukkit-Patches/0101-Print-Stack-on-InternalException.patch index dcefccec14..c5663fa67d 100644 --- a/CraftBukkit-Patches/0101-Print-Stack-on-InternalException.patch +++ b/CraftBukkit-Patches/0101-Print-Stack-on-InternalException.patch @@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) { - NetworkManager.f.debug("Disconnecting " + this.getSocketAddress(), throwable); - this.close(new ChatMessage("disconnect.genericReason", new Object[] { "Internal Exception: " + throwable})); +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { + } + + this.close(chatmessage); + if (MinecraftServer.getServer().isDebugging()) throwable.printStackTrace(); // Spigot } - protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) { + protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) throws Exception { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0103-Use-Provided-Case-for-Non-Existent-Offline-Players.patch b/CraftBukkit-Patches/0103-Use-Provided-Case-for-Non-Existent-Offline-Players.patch index 432b3bf053..8bb8218dc7 100644 --- a/CraftBukkit-Patches/0103-Use-Provided-Case-for-Non-Existent-Offline-Players.patch +++ b/CraftBukkit-Patches/0103-Use-Provided-Case-for-Non-Existent-Offline-Players.patch @@ -16,5 +16,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + gameprofile = a(this.f, s); // Spigot - use correct case for offline players if (gameprofile != null) { this.a(gameprofile); - usercacheentry = (UserCacheEntry) this.c.get(s1); + usercache_usercacheentry = (UserCache.UserCacheEntry) this.c.get(s1); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0105-Fix-Player-Banning.patch b/CraftBukkit-Patches/0105-Fix-Player-Banning.patch index c9d9c8921e..15689ad1bc 100644 --- a/CraftBukkit-Patches/0105-Fix-Player-Banning.patch +++ b/CraftBukkit-Patches/0105-Fix-Player-Banning.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/GameProfileBanEntry.java +++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -@@ -0,0 +0,0 @@ public class GameProfileBanEntry extends ExpirableListEntry { +@@ -0,0 +0,0 @@ public class GameProfileBanEntry extends ExpirableListEntry { } private static GameProfile b(JsonObject jsonobject) { diff --git a/CraftBukkit-Patches/0106-Fix-ban-expire-dates.patch b/CraftBukkit-Patches/0106-Fix-ban-expire-dates.patch index 2f87f738bc..a28e0a163c 100644 --- a/CraftBukkit-Patches/0106-Fix-ban-expire-dates.patch +++ b/CraftBukkit-Patches/0106-Fix-ban-expire-dates.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/GameProfileBanEntry.java +++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -@@ -0,0 +0,0 @@ public class GameProfileBanEntry extends ExpirableListEntry { +@@ -0,0 +0,0 @@ public class GameProfileBanEntry extends ExpirableListEntry { } public GameProfileBanEntry(GameProfile gameprofile, Date date, String s, Date date1, String s1) { diff --git a/CraftBukkit-Patches/0113-Convert-player-skulls-async.patch b/CraftBukkit-Patches/0113-Convert-player-skulls-async.patch index 7cb066ae13..10c6d80366 100644 --- a/CraftBukkit-Patches/0113-Convert-player-skulls-async.patch +++ b/CraftBukkit-Patches/0113-Convert-player-skulls-async.patch @@ -33,10 +33,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return true; } else { return false; - } - } -- - } diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntitySkull.java @@ -56,12 +52,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.mojang.authlib.Agent; ++import com.mojang.authlib.ProfileLookupCallback; +// Spigot end + public class TileEntitySkull extends TileEntity { private int a; - public int rotation; + private int rotation; private GameProfile g = null; + // Spigot start + public static final Executor executor = Executors.newFixedThreadPool(3, @@ -77,8 +74,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public GameProfile load(String key) throws Exception + { -+ GameProfile[] profiles = new GameProfile[1]; -+ GameProfileLookup gameProfileLookup = new GameProfileLookup(profiles); ++ final GameProfile[] profiles = new GameProfile[1]; ++ ProfileLookupCallback gameProfileLookup = new ProfileLookupCallback() { ++ ++ @Override ++ public void onProfileLookupSucceeded(GameProfile gp) { ++ profiles[0] = gp; ++ } ++ ++ @Override ++ public void onProfileLookupFailed(GameProfile gp, Exception excptn) { ++ profiles[0] = gp; ++ } ++ }; + + MinecraftServer.getServer().getGameProfileRepository().findProfilesByNames(new String[] { key }, Agent.MINECRAFT, gameProfileLookup); + @@ -95,7 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if ( property == null ) + { -+ profile = MinecraftServer.getServer().aB().fillProfileProperties( profile, true ); ++ profile = MinecraftServer.getServer().aC().fillProfileProperties( profile, true ); + } + } + @@ -153,10 +161,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + callback.apply(profile); } else { - Property property = (Property) Iterables.getFirst(gameprofile1.getProperties().get("textures"), (Object) null); -- ++ Property property = (Property) Iterables.getFirst(profile.getProperties().get("textures"), (Object) null); + - if (property == null) { -- gameprofile1 = MinecraftServer.getServer().aB().fillProfileProperties(gameprofile1, true); -- } +- gameprofile1 = MinecraftServer.getServer().aC().fillProfileProperties(gameprofile1, true); ++ if (property != null) { ++ callback.apply(profile); ++ return; + } - - return gameprofile1; + executor.execute(new Runnable() { diff --git a/CraftBukkit-Patches/0115-Check-Skull-canPlace.patch b/CraftBukkit-Patches/0115-Check-Skull-canPlace.patch index ab9893051b..0f3826bfe2 100644 --- a/CraftBukkit-Patches/0115-Check-Skull-canPlace.patch +++ b/CraftBukkit-Patches/0115-Check-Skull-canPlace.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ItemSkull extends Item { return false; } else { - if (!world.isStatic) { + if (!world.isClientSide) { + // Spigot Start + if ( !Blocks.SKULL.canPlace( world, blockposition ) ) + { diff --git a/CraftBukkit-Patches/0116-Don-t-let-trees-replace-any-block.patch b/CraftBukkit-Patches/0116-Don-t-let-trees-replace-any-block.patch deleted file mode 100644 index 5b59c6c120..0000000000 --- a/CraftBukkit-Patches/0116-Don-t-let-trees-replace-any-block.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Mon, 20 Jan 2014 20:42:28 +0000 -Subject: [PATCH] Don't let trees replace any block. - - -diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldGenForestTree.java -+++ b/src/main/java/net/minecraft/server/WorldGenForestTree.java -@@ -0,0 +0,0 @@ public class WorldGenForestTree extends WorldGenTreeAbstract { - int k2; - - for (k2 = 0; k2 < j2; ++k2) { -- this.a(world, new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); -+ // Spigot start -+ BlockPosition position = new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2); -+ Block bl = world.getType(position).getBlock(); -+ -+ if (bl.getMaterial() == Material.AIR || bl.getMaterial() == Material.LEAVES) -+ { -+ this.a(world, position, Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); -+ } -+ // Spigot end - } - - int l2; --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0117-Fix-race-condition-that-could-kill-connections-befor.patch b/CraftBukkit-Patches/0116-Fix-race-condition-that-could-kill-connections-befor.patch similarity index 86% rename from CraftBukkit-Patches/0117-Fix-race-condition-that-could-kill-connections-befor.patch rename to CraftBukkit-Patches/0116-Fix-race-condition-that-could-kill-connections-befor.patch index 43d75053d1..8906ffb6b9 100644 --- a/CraftBukkit-Patches/0117-Fix-race-condition-that-could-kill-connections-befor.patch +++ b/CraftBukkit-Patches/0116-Fix-race-condition-that-could-kill-connections-befor.patch @@ -15,34 +15,34 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - public SocketAddress j; +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { + public SocketAddress l; public java.util.UUID spoofedUUID; public com.mojang.authlib.properties.Property[] spoofedProfile; + public boolean preparing = true; // Spigot End - private PacketListener k; - private IChatBaseComponent l; -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { + private PacketListener m; + private IChatBaseComponent n; +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { super.channelActive(channelhandlercontext); - this.i = channelhandlercontext.channel(); - this.j = this.i.remoteAddress(); + this.k = channelhandlercontext.channel(); + this.l = this.k.remoteAddress(); + // Spigot Start + this.preparing = false; + // Spigot End try { this.a(EnumProtocol.HANDSHAKING); -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { } public void close(IChatBaseComponent ichatbasecomponent) { + // Spigot Start + this.preparing = false; + // Spigot End - if (this.i.isOpen()) { - this.i.close(); // We can't wait as this may be called from an event loop. - this.l = ichatbasecomponent; + if (this.k.isOpen()) { + this.k.close(); // We can't wait as this may be called from an event loop. + this.n = ichatbasecomponent; diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/ServerConnection.java diff --git a/CraftBukkit-Patches/0118-Configurable-UserCache-cap.patch b/CraftBukkit-Patches/0117-Configurable-UserCache-cap.patch similarity index 100% rename from CraftBukkit-Patches/0118-Configurable-UserCache-cap.patch rename to CraftBukkit-Patches/0117-Configurable-UserCache-cap.patch diff --git a/CraftBukkit-Patches/0119-Implement-PlayerSpawnLocationEvent.patch b/CraftBukkit-Patches/0118-Implement-PlayerSpawnLocationEvent.patch similarity index 96% rename from CraftBukkit-Patches/0119-Implement-PlayerSpawnLocationEvent.patch rename to CraftBukkit-Patches/0118-Implement-PlayerSpawnLocationEvent.patch index 8aeb557744..4d449c8afc 100644 --- a/CraftBukkit-Patches/0119-Implement-PlayerSpawnLocationEvent.patch +++ b/CraftBukkit-Patches/0118-Implement-PlayerSpawnLocationEvent.patch @@ -34,6 +34,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot end + // CraftBukkit - Moved message to after join - // PlayerList.h.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); + // PlayerList.f.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0120-Cap-Objective-Score-Length.patch b/CraftBukkit-Patches/0119-Cap-Objective-Score-Length.patch similarity index 100% rename from CraftBukkit-Patches/0120-Cap-Objective-Score-Length.patch rename to CraftBukkit-Patches/0119-Cap-Objective-Score-Length.patch diff --git a/CraftBukkit-Patches/0121-Process-conversation-input-on-the-main-thread.-Fixes.patch b/CraftBukkit-Patches/0120-Process-conversation-input-on-the-main-thread.-Fixes.patch similarity index 91% rename from CraftBukkit-Patches/0121-Process-conversation-input-on-the-main-thread.-Fixes.patch rename to CraftBukkit-Patches/0120-Process-conversation-input-on-the-main-thread.-Fixes.patch index a4ef761659..5434044b63 100644 --- a/CraftBukkit-Patches/0121-Process-conversation-input-on-the-main-thread.-Fixes.patch +++ b/CraftBukkit-Patches/0120-Process-conversation-input-on-the-main-thread.-Fixes.patch @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } ); + // Spigot end - } else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) { // Re-add "Command Only" flag check + } else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) { // Re-add "Command Only" flag check ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0122-Configurable-save-on-stop-only-for-UserCache.patch b/CraftBukkit-Patches/0121-Configurable-save-on-stop-only-for-UserCache.patch similarity index 91% rename from CraftBukkit-Patches/0122-Configurable-save-on-stop-only-for-UserCache.patch rename to CraftBukkit-Patches/0121-Configurable-save-on-stop-only-for-UserCache.patch index f9de20448e..d63f5d474f 100644 --- a/CraftBukkit-Patches/0122-Configurable-save-on-stop-only-for-UserCache.patch +++ b/CraftBukkit-Patches/0121-Configurable-save-on-stop-only-for-UserCache.patch @@ -8,9 +8,9 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - if (this.m.d()) { - this.m.e(); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + if (this.n.d()) { + this.n.e(); } - + // Spigot start @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.c(); + if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled - return usercacheentry == null ? null : usercacheentry.a(); + return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0123-Prevent-Unbounded-IntCache-Growth.patch b/CraftBukkit-Patches/0122-Prevent-Unbounded-IntCache-Growth.patch similarity index 100% rename from CraftBukkit-Patches/0123-Prevent-Unbounded-IntCache-Growth.patch rename to CraftBukkit-Patches/0122-Prevent-Unbounded-IntCache-Growth.patch diff --git a/CraftBukkit-Patches/0124-Add-damager-to-the-unhandled-error.patch b/CraftBukkit-Patches/0123-Add-damager-to-the-unhandled-error.patch similarity index 100% rename from CraftBukkit-Patches/0124-Add-damager-to-the-unhandled-error.patch rename to CraftBukkit-Patches/0123-Add-damager-to-the-unhandled-error.patch diff --git a/CraftBukkit-Patches/0125-Cross-World-Entity-Teleportation.patch b/CraftBukkit-Patches/0124-Cross-World-Entity-Teleportation.patch similarity index 100% rename from CraftBukkit-Patches/0125-Cross-World-Entity-Teleportation.patch rename to CraftBukkit-Patches/0124-Cross-World-Entity-Teleportation.patch diff --git a/CraftBukkit-Patches/0126-Limit-block-placement-interaction-packets.patch b/CraftBukkit-Patches/0125-Limit-block-placement-interaction-packets.patch similarity index 97% rename from CraftBukkit-Patches/0126-Limit-block-placement-interaction-packets.patch rename to CraftBukkit-Patches/0125-Limit-block-placement-interaction-packets.patch index 545552eba5..09e81a15dd 100644 --- a/CraftBukkit-Patches/0126-Limit-block-placement-interaction-packets.patch +++ b/CraftBukkit-Patches/0125-Limit-block-placement-interaction-packets.patch @@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u()); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); +- + boolean throttled = false; + if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { + throttled = true; @@ -28,14 +29,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + packets = 0; + } + // Spigot end - ++ // CraftBukkit start if (this.player.dead) return; + @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit start int itemstackAmount = itemstack.count; -- +- + // Spigot start - skip the event if throttled + if (!throttled) { // Raytrace to look for 'rogue armswings' @@ -53,10 +55,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } - if (this.checkMovement && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.af().a(blockposition)) { + if (this.checkMovement && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { - always = !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, blockposition, enumdirection, packetplayinblockplace.d(), packetplayinblockplace.e(), packetplayinblockplace.f()); + always = throttled || !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, blockposition, enumdirection, packetplayinblockplace.d(), packetplayinblockplace.e(), packetplayinblockplace.f()); } - // CraftBukkit end + flag = true; -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0127-Better-item-validation.patch b/CraftBukkit-Patches/0126-Better-item-validation.patch similarity index 91% rename from CraftBukkit-Patches/0127-Better-item-validation.patch rename to CraftBukkit-Patches/0126-Better-item-validation.patch index 07a98007c8..7abae2f01e 100644 --- a/CraftBukkit-Patches/0127-Better-item-validation.patch +++ b/CraftBukkit-Patches/0126-Better-item-validation.patch @@ -12,18 +12,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 arraylist = Lists.newArrayList(); } -+ // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions -+ if ( watchableobject.b() instanceof ItemStack ) ++ // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions ++ if ( datawatcher_watchableobject.b() instanceof ItemStack ) + { -+ watchableobject = new WatchableObject( -+ watchableobject.c(), -+ watchableobject.a(), -+ ( (ItemStack) watchableobject.b() ).cloneItemStack() ++ datawatcher_watchableobject = new WatchableObject( ++ datawatcher_watchableobject.c(), ++ datawatcher_watchableobject.a(), ++ ( (ItemStack) datawatcher_watchableobject.b() ).cloneItemStack() + ); + } + // Spigot end + - arraylist.add(watchableobject); + arraylist.add(datawatcher_watchableobject); } } @@ -0,0 +0,0 @@ public class DataWatcher { diff --git a/CraftBukkit-Patches/0128-Further-Seed-Customisation.patch b/CraftBukkit-Patches/0127-Further-Seed-Customisation.patch similarity index 100% rename from CraftBukkit-Patches/0128-Further-Seed-Customisation.patch rename to CraftBukkit-Patches/0127-Further-Seed-Customisation.patch diff --git a/CraftBukkit-Patches/0129-Disable-ResourceLeakDetector.patch b/CraftBukkit-Patches/0128-Disable-ResourceLeakDetector.patch similarity index 91% rename from CraftBukkit-Patches/0129-Disable-ResourceLeakDetector.patch rename to CraftBukkit-Patches/0128-Disable-ResourceLeakDetector.patch index 697b0c56e9..9afa2ff53f 100644 --- a/CraftBukkit-Patches/0129-Disable-ResourceLeakDetector.patch +++ b/CraftBukkit-Patches/0128-Disable-ResourceLeakDetector.patch @@ -9,12 +9,12 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs // Spigot end public MinecraftServer(OptionSet options, Proxy proxy, File file1) { + io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable - this.d = proxy; - MinecraftServer.k = this; + this.e = proxy; + MinecraftServer.l = this; // this.universe = file; // CraftBukkit -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0130-Add-More-Information-to-session.lock-Errors.patch b/CraftBukkit-Patches/0129-Add-More-Information-to-session.lock-Errors.patch similarity index 100% rename from CraftBukkit-Patches/0130-Add-More-Information-to-session.lock-Errors.patch rename to CraftBukkit-Patches/0129-Add-More-Information-to-session.lock-Errors.patch diff --git a/CraftBukkit-Patches/0131-Safer-JSON-Loading.patch b/CraftBukkit-Patches/0130-Safer-JSON-Loading.patch similarity index 96% rename from CraftBukkit-Patches/0131-Safer-JSON-Loading.patch rename to CraftBukkit-Patches/0130-Safer-JSON-Loading.patch index c2729b19c9..c4b68cc2ba 100644 --- a/CraftBukkit-Patches/0131-Safer-JSON-Loading.patch +++ b/CraftBukkit-Patches/0130-Safer-JSON-Loading.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/ne index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/JsonList.java +++ b/src/main/java/net/minecraft/server/JsonList.java -@@ -0,0 +0,0 @@ public class JsonList { +@@ -0,0 +0,0 @@ public class JsonList> { try { bufferedreader = Files.newReader(this.c, Charsets.UTF_8); collection = (Collection) this.b.fromJson(bufferedreader, JsonList.f); diff --git a/CraftBukkit-Patches/0132-Fix-Slow-Loading-Libraries.patch b/CraftBukkit-Patches/0131-Fix-Slow-Loading-Libraries.patch similarity index 100% rename from CraftBukkit-Patches/0132-Fix-Slow-Loading-Libraries.patch rename to CraftBukkit-Patches/0131-Fix-Slow-Loading-Libraries.patch diff --git a/CraftBukkit-Patches/0133-Add-CommandLine-EULA-Flag.patch b/CraftBukkit-Patches/0132-Add-CommandLine-EULA-Flag.patch similarity index 92% rename from CraftBukkit-Patches/0133-Add-CommandLine-EULA-Flag.patch rename to CraftBukkit-Patches/0132-Add-CommandLine-EULA-Flag.patch index 3dd93d9669..a71d064b6e 100644 --- a/CraftBukkit-Patches/0133-Add-CommandLine-EULA-Flag.patch +++ b/CraftBukkit-Patches/0132-Add-CommandLine-EULA-Flag.patch @@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer DedicatedServer.LOGGER.info("Loading properties"); this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support - this.o = new EULA(new File("eula.txt")); -- if (!this.o.a()) { + this.p = new EULA(new File("eula.txt")); +- if (!this.p.a()) { + // Spigot Start + boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" ); + if ( eulaAgreed ) @@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." ); + } + // Spigot End -+ if (!this.o.a() && !eulaAgreed) { // Spigot ++ if (!this.p.a() && !eulaAgreed) { // Spigot DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); - this.o.b(); + this.p.b(); return false; -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0134-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch b/CraftBukkit-Patches/0133-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch similarity index 100% rename from CraftBukkit-Patches/0134-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch rename to CraftBukkit-Patches/0133-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch diff --git a/CraftBukkit-Patches/0135-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch b/CraftBukkit-Patches/0134-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch similarity index 95% rename from CraftBukkit-Patches/0135-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch rename to CraftBukkit-Patches/0134-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch index 5738644fe9..d9d1bb9c9f 100644 --- a/CraftBukkit-Patches/0135-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch +++ b/CraftBukkit-Patches/0134-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch @@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityOcelot.java @@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal { - private PathfinderGoalAvoidTarget bm; - private PathfinderGoalTempt bn; + private PathfinderGoalAvoidTarget bo; + private PathfinderGoalTempt bp; + public boolean spawnBonus = true; // Spigot public EntityOcelot(World world) { diff --git a/CraftBukkit-Patches/0136-Prevent-a-crash-involving-attributes.patch b/CraftBukkit-Patches/0135-Prevent-a-crash-involving-attributes.patch similarity index 100% rename from CraftBukkit-Patches/0136-Prevent-a-crash-involving-attributes.patch rename to CraftBukkit-Patches/0135-Prevent-a-crash-involving-attributes.patch diff --git a/CraftBukkit-Patches/0137-Make-moved-wrongly-limit-configurable.patch b/CraftBukkit-Patches/0136-Make-moved-wrongly-limit-configurable.patch similarity index 100% rename from CraftBukkit-Patches/0137-Make-moved-wrongly-limit-configurable.patch rename to CraftBukkit-Patches/0136-Make-moved-wrongly-limit-configurable.patch diff --git a/CraftBukkit-Patches/0138-Fix-Null-Tile-Entity-Worlds.patch b/CraftBukkit-Patches/0137-Fix-Null-Tile-Entity-Worlds.patch similarity index 94% rename from CraftBukkit-Patches/0138-Fix-Null-Tile-Entity-Worlds.patch rename to CraftBukkit-Patches/0137-Fix-Null-Tile-Entity-Worlds.patch index 328b008975..1d52865631 100644 --- a/CraftBukkit-Patches/0138-Fix-Null-Tile-Entity-Worlds.patch +++ b/CraftBukkit-Patches/0137-Fix-Null-Tile-Entity-Worlds.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + tileentity.a(this); // Spigot - No null worlds - this.a.add(tileentity); + this.b.add(tileentity); } else { this.a(tileentity); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0139-Make-moved-too-quickly-limit-configurable.patch b/CraftBukkit-Patches/0138-Make-moved-too-quickly-limit-configurable.patch similarity index 100% rename from CraftBukkit-Patches/0139-Make-moved-too-quickly-limit-configurable.patch rename to CraftBukkit-Patches/0138-Make-moved-too-quickly-limit-configurable.patch diff --git a/CraftBukkit-Patches/0141-Apply-NBTReadLimiter-to-more-things.patch b/CraftBukkit-Patches/0139-Apply-NBTReadLimiter-to-more-things.patch similarity index 97% rename from CraftBukkit-Patches/0141-Apply-NBTReadLimiter-to-more-things.patch rename to CraftBukkit-Patches/0139-Apply-NBTReadLimiter-to-more-things.patch index 9eea78c597..b3787c7dbc 100644 --- a/CraftBukkit-Patches/0141-Apply-NBTReadLimiter-to-more-things.patch +++ b/CraftBukkit-Patches/0139-Apply-NBTReadLimiter-to-more-things.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java @@ -0,0 +0,0 @@ public class NBTCompressedStreamTools { + } - public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) { - try { + public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException { + // Spigot start + if ( datainput instanceof io.netty.buffer.ByteBufInputStream ) + { diff --git a/CraftBukkit-Patches/0142-Allow-Attribute-Capping.patch b/CraftBukkit-Patches/0140-Allow-Attribute-Capping.patch similarity index 100% rename from CraftBukkit-Patches/0142-Allow-Attribute-Capping.patch rename to CraftBukkit-Patches/0140-Allow-Attribute-Capping.patch diff --git a/CraftBukkit-Patches/0140-Alternative-Hopper-Ticking.patch b/CraftBukkit-Patches/0140-Alternative-Hopper-Ticking.patch deleted file mode 100644 index 40b6b9dc64..0000000000 --- a/CraftBukkit-Patches/0140-Alternative-Hopper-Ticking.patch +++ /dev/null @@ -1,499 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Evan A. Haskell" -Date: Sat, 19 Apr 2014 16:58:26 -0400 -Subject: [PATCH] Alternative Hopper Ticking - - -diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockHopper.java -+++ b/src/main/java/net/minecraft/server/BlockHopper.java -@@ -0,0 +0,0 @@ public class BlockHopper extends BlockContainer { - - if (flag != ((Boolean) iblockdata.get(BlockHopper.ENABLED)).booleanValue()) { - world.setTypeAndData(blockposition, iblockdata.set(BlockHopper.ENABLED, Boolean.valueOf(flag)), 4); -+ // Spigot start - When this hopper becomes unpowered, make it active. -+ // Called when this block's power level changes. flag1 is the current -+ // isNotPowered from metadata. flag is the recalculated isNotPowered. -+ if (world.spigotConfig.altHopperTicking) { -+ // e returns the TileEntityHopper associated with this BlockHopper. -+ TileEntityHopper hopper = (TileEntityHopper) world.getTileEntity(blockposition); -+ if (flag && hopper != null) { -+ hopper.makeTick(); -+ } -+ } -+ // Spigot end - } - - } -@@ -0,0 +0,0 @@ public class BlockHopper extends BlockContainer { - protected BlockStateList getStateList() { - return new BlockStateList(this, new IBlockState[] { BlockHopper.FACING, BlockHopper.ENABLED}); - } -+ -+ // Spigot start - Use random block updates to make hoppers active. -+ @Override -+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, java.util.Random random) { -+ if (world.spigotConfig.altHopperTicking) { -+ // e returns the TileEntityHopper associated with this BlockHopper. -+ TileEntityHopper hopper = (TileEntityHopper) world.getTileEntity(blockposition); -+ if (hopper != null) { -+ hopper.makeTick(); -+ } -+ } -+ } -+ // Spigot end - } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - - tileentity.D(); - this.tileEntities.put(blockposition, tileentity); -+ // Spigot start - The tile entity has a world, now hoppers can be born ticking. -+ if (this.world.spigotConfig.altHopperTicking) { -+ this.world.triggerHoppersList.add(tileentity); -+ } -+ // Spigot end - // CraftBukkit start - } else { - System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -0,0 +0,0 @@ public class EntityItem extends Entity { - if (this.onGround) { - this.motY *= -0.5D; - } -+ // Spigot start - Make the hopper(s) below this item active. -+ // Called each tick on each item entity. -+ if (this.world.spigotConfig.altHopperTicking) { -+ int xi = MathHelper.floor(this.getBoundingBox().a); -+ int yi = MathHelper.floor(this.getBoundingBox().b) - 1; -+ int zi = MathHelper.floor(this.getBoundingBox().c); -+ int xf = MathHelper.floor(this.getBoundingBox().d); -+ int yf = MathHelper.floor(this.getBoundingBox().e) - 1; -+ int zf = MathHelper.floor(this.getBoundingBox().f); -+ for (int a = xi; a <= xf; a++) { -+ for (int c = zi; c <= zf; c++) { -+ for (int b = yi; b <= yf; b++) { -+ TileEntity tileEntity = this.world.getTileEntity(new BlockPosition(a, b, c)); -+ if (tileEntity instanceof TileEntityHopper) { -+ ((TileEntityHopper) tileEntity).makeTick(); -+ } -+ } -+ } -+ } -+ } -+ // Spigot end - - /* Craftbukkit start - moved up - if (this.age != -32768) { -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT - this.passenger = null; - } - -+ // Spigot start - Make hoppers around this container minecart active. -+ // Called each tick on each minecart. -+ if (this.world.spigotConfig.altHopperTicking && this instanceof EntityMinecartContainer) { -+ int xi = MathHelper.floor(this.getBoundingBox().a) - 1; -+ int yi = MathHelper.floor(this.getBoundingBox().b) - 1; -+ int zi = MathHelper.floor(this.getBoundingBox().c) - 1; -+ int xf = MathHelper.floor(this.getBoundingBox().d) + 1; -+ int yf = MathHelper.floor(this.getBoundingBox().e) + 1; -+ int zf = MathHelper.floor(this.getBoundingBox().f) + 1; -+ for (int a = xi; a <= xf; a++) { -+ for (int b = yi; b <= yf; b++) { -+ for (int c = zi; c <= zf; c++) { -+ TileEntity tileEntity = this.world.getTileEntity(new BlockPosition(a, b, c)); -+ if (tileEntity instanceof TileEntityHopper) { -+ ((TileEntityHopper) tileEntity).makeTick(); -+ } -+ } -+ } -+ } -+ } -+ // Spigot end -+ - this.W(); - } - } -diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityOcelot.java -+++ b/src/main/java/net/minecraft/server/EntityOcelot.java -@@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal { - this.datawatcher.a(18, Byte.valueOf((byte) 0)); - } - -+ // Spigot start - When this ocelot begins standing, chests below this ocelot must be -+ // updated as if its contents have changed. We update chests if this ocelot is sitting -+ // knowing that it may be dead, gone, or standing after this method returns. -+ // Called each tick on each ocelot. -+ @Override -+ public void s_() { -+ if (this.world.spigotConfig.altHopperTicking && this.isSitting()) { -+ int xi = MathHelper.floor(this.getBoundingBox().a); -+ int yi = MathHelper.floor(this.getBoundingBox().b) - 1; -+ int zi = MathHelper.floor(this.getBoundingBox().c); -+ int xf = MathHelper.floor(this.getBoundingBox().d); -+ int yf = MathHelper.floor(this.getBoundingBox().e) - 1; -+ int zf = MathHelper.floor(this.getBoundingBox().f); -+ for (int a = xi; a <= xf; a++) { -+ for (int c = zi; c <= zf; c++) { -+ for (int b = yi; b <= yf; b++) { -+ this.world.updateChestAndHoppers(new BlockPosition(a, b, c)); -+ } -+ } -+ } -+ } -+ super.s_(); -+ } -+ // Spigot end -+ - public void E() { - if (this.getControllerMove().a()) { - double d0 = this.getControllerMove().b(); -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -0,0 +0,0 @@ public abstract class TileEntity { - private int h; - protected Block e; - -+ // Spigot start -+ // Helper method for scheduleTicks. If the hopper at x0, y0, z0 is pointed -+ // at this tile entity, then make it active. -+ private void scheduleTick(BlockPosition blockposition) { -+ TileEntity tileEntity = this.world.getTileEntity(blockposition); -+ if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) { -+ // i is the metadeta assoiated with the direction the hopper faces. -+ EnumDirection dir = BlockHopper.b(tileEntity.u()); -+ -+ // Facing class provides arrays for direction offset. -+ if (tileEntity.position.shift(dir).equals(position)) { -+ ((TileEntityHopper) tileEntity).makeTick(); -+ } -+ } -+ } -+ -+ // Called from update when the contents have changed, so hoppers need updates. -+ // Check all 6 faces. -+ public void scheduleTicks() { -+ if (this.world != null && this.world.spigotConfig.altHopperTicking) { -+ // Check the top -+ this.scheduleTick(position.up()); -+ // Check the sides -+ for (int i = 2; i < 6; i++) { -+ this.scheduleTick(position.shift(EnumDirection.fromType1(i))); -+ } -+ // Check the bottom. -+ TileEntity tileEntity = this.world.getTileEntity(position.down()); -+ if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) { -+ ((TileEntityHopper) tileEntity).makeTick(); -+ } -+ } -+ } -+ // Spigot end -+ - public TileEntity() { - this.position = BlockPosition.ZERO; - this.h = -1; -@@ -0,0 +0,0 @@ public abstract class TileEntity { - if (this.w() != Blocks.AIR) { - this.world.updateAdjacentComparators(this.position, this.w()); - } -+ // Spigot start - Called when the contents have changed, so hoppers around this -+ // tile need updating. -+ this.scheduleTicks(); -+ // Spigot end - } - - } -diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityHopper.java -+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU - private ItemStack[] items = new ItemStack[5]; - private String f; - private int g = -1; -+ -+ // Spigot start -+ private long nextTick = -1; // Next tick this hopper will be ticked. -+ private long lastTick = -1; // Last tick this hopper was polled. -+ -+ // If this hopper is not cooling down, assaign a visible tick for next time. -+ public void makeTick() { -+ if (!this.n()) { -+ this.d(0); -+ } -+ } -+ -+ // Contents changed, so make this hopper active. -+ public void scheduleHopperTick() { -+ if (this.world != null && this.world.spigotConfig.altHopperTicking) { -+ this.makeTick(); -+ } -+ } -+ -+ // Called after this hopper is assaigned a world or when altHopperTicking is turned -+ // on from reload. -+ public void convertToScheduling() { -+ // j is the cooldown in ticks -+ this.d(this.g); -+ } -+ -+ // Called when alt hopper ticking is turned off from the reload command -+ public void convertToPolling() { -+ long cooldownDiff; -+ if (this.lastTick == this.world.getTime()) { -+ cooldownDiff = this.nextTick - this.world.getTime(); -+ } else { -+ cooldownDiff = this.nextTick - this.world.getTime() + 1; -+ } -+ this.d((int) Math.max(0, Math.min(cooldownDiff, Integer.MAX_VALUE))); -+ } -+ // Spigot end - - // CraftBukkit start - add fields and methods - public List transaction = new java.util.ArrayList(); -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU - } - - nbttagcompound.set("Items", nbttaglist); -- nbttagcompound.setInt("TransferCooldown", this.g); -+ // Spigot start - Need to write the correct cooldown to disk. We convert from long to int on saving. -+ if (this.world != null && this.world.spigotConfig.altHopperTicking) { -+ long cooldownDiff; -+ if (this.lastTick == this.world.getTime()) { -+ cooldownDiff = this.nextTick - this.world.getTime(); -+ } else { -+ cooldownDiff = this.nextTick - this.world.getTime() + 1; -+ } -+ nbttagcompound.setInt("TransferCooldown", (int) Math.max(0, Math.min(cooldownDiff, Integer.MAX_VALUE))); -+ } else { -+ // g is the cooldown in ticks. -+ nbttagcompound.setInt("TransferCooldown", this.g); -+ } -+ // Spigot end - if (this.hasCustomName()) { - nbttagcompound.setString("CustomName", this.f); - } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU - - public void update() { - super.update(); -+ // Spigot start - The contents have changed, so make this hopper active. -+ this.scheduleHopperTick(); -+ // Spigot end - } - - public int getSize() { -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU - - public void c() { - if (this.world != null && !this.world.isStatic) { -- --this.g; -- if (!this.n()) { -- this.d(0); -- this.m(); -+ // Spigot start -+ if (this.world.spigotConfig.altHopperTicking) { -+ this.lastTick = this.world.getTime(); -+ if (this.nextTick == this.world.getTime()) { -+ // Method that does the pushing and pulling. -+ this.m(); -+ } -+ } else { -+ --this.g; -+ if (!this.n()) { -+ this.d(0); -+ this.m(); -+ } - } - - } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU - } - - // Spigot start -- if ( !this.n() ) -+ if ( !world.spigotConfig.altHopperTicking && !this.n() ) - { - this.d( world.spigotConfig.hopperCheck ); - } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU - } - - public void d(int i) { -- this.g = i; -+ // Spigot start - i is the delay for which this hopper will be ticked next. -+ // i of 1 or below implies a tick next tick. -+ if (this.world != null && this.world.spigotConfig.altHopperTicking) { -+ if (i <= 0) { -+ i = 1; -+ } -+ if (this.lastTick == this.world.getTime()) { -+ this.nextTick = this.world.getTime() + i; -+ } else { -+ this.nextTick = this.world.getTime() + i - 1; -+ } -+ } else { -+ this.g = i; -+ } -+ // Spigot end - } - - public boolean n() { -- return this.g > 0; -+ // Spigot start - Return whether this hopper is cooling down. -+ if (this.world != null && this.world.spigotConfig.altHopperTicking) { -+ if (this.lastTick == this.world.getTime()) { -+ return this.nextTick > this.world.getTime(); -+ } else { -+ return this.nextTick >= this.world.getTime(); -+ } -+ } else { -+ return this.g > 0; -+ } -+ // Spigot end - } - - public boolean o() { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - private final byte chunkTickRadius; - public static boolean haveWeSilencedAPhysicsCrash; - public static String blockLocation; -+ public List triggerHoppersList = new ArrayList(); // Spigot, When altHopperTicking, tile entities being added go through here. - - public static long chunkToKey(int x, int z) - { -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - { - return (int) ( ( ( k >> 32 ) & 0xFFFF0000L ) | ( ( k >> 16 ) & 0x0000FFFF ) ); - } -+ -+ // Spigot Start - Hoppers need to be born ticking. -+ private void initializeHoppers() { -+ if (this.spigotConfig.altHopperTicking) { -+ for (TileEntity o : this.triggerHoppersList) { -+ o.scheduleTicks(); -+ if (o instanceof TileEntityHopper) { -+ ((TileEntityHopper) o).convertToScheduling(); -+ ((TileEntityHopper) o).scheduleHopperTick(); -+ } -+ } -+ } -+ triggerHoppersList.clear(); -+ } -+ -+ // Helper method for altHopperTicking. Updates chests at the specified location, -+ // accounting for double chests. Updating the chest will update adjacent hoppers. -+ public void updateChestAndHoppers(BlockPosition blockposition) { -+ Block block = this.getType(blockposition).getBlock(); -+ if (block instanceof BlockChest) { -+ TileEntity tile = this.getTileEntity(blockposition); -+ if (tile instanceof TileEntityChest) { -+ tile.scheduleTicks(); -+ } -+ for (int i = 2; i < 6; i++) { -+ // Facing class provides arrays for direction offset. -+ BlockPosition pos = blockposition.shift(EnumDirection.fromType1(i)); -+ if (this.getType(pos) == block) { -+ tile = this.getTileEntity(pos); -+ if (tile instanceof TileEntityChest) { -+ tile.scheduleTicks(); -+ } -+ break; -+ } -+ } -+ } -+ } - // Spigot end - - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - // Modularize client and physic updates - notifyAndUpdatePhysics(blockposition, chunk, block1, block, i); - } -+ // Spigot start - If this block is changing to that which a chest beneath it -+ // becomes able to be opened, then the chest must be updated. -+ // block1 is the old block. block is the new block. r returns true if the block type -+ // prevents access to a chest. -+ if (this.spigotConfig.altHopperTicking && block1 != null && block1.isOccluding()&& !block.isOccluding()) { -+ this.updateChestAndHoppers(blockposition.down()); -+ } -+ // Spigot end - // CraftBukkit end - - return true; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - } - // CraftBukkit end - -+ this.initializeHoppers(); // Spigot - Initializes hoppers which have been added recently. - Iterator iterator = this.tileEntityList.iterator(); - - while (iterator.hasNext()) { -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class SpigotWorldConfig - log( "Entity Tracking Range: Pl " + playerTrackingRange + " / An " + animalTrackingRange + " / Mo " + monsterTrackingRange + " / Mi " + miscTrackingRange + " / Other " + otherTrackingRange ); - } - -+ public boolean altHopperTicking; - public int hopperTransfer; - public int hopperCheck; - public int hopperAmount; - private void hoppers() - { -+ // Alternate ticking method. Uses inventory changes, redstone updates etc. -+ // to update hoppers. Hopper-check is disabled when this is true. -+ boolean prev = altHopperTicking; -+ altHopperTicking = getBoolean( "hopper-alt-ticking", false ); -+ // Necessary for the reload command -+ if (prev != altHopperTicking) { -+ net.minecraft.server.World world = (net.minecraft.server.World) Bukkit.getWorld(this.worldName); -+ if (world != null) { -+ if (altHopperTicking) { -+ for (Object o : world.tileEntityList) { -+ if (o instanceof net.minecraft.server.TileEntityHopper) { -+ ((net.minecraft.server.TileEntityHopper) o).convertToScheduling(); -+ } -+ } -+ } else { -+ for (Object o : world.tileEntityList) { -+ if (o instanceof net.minecraft.server.TileEntityHopper) { -+ ((net.minecraft.server.TileEntityHopper) o).convertToPolling(); -+ } -+ } -+ } -+ } -+ } - // Set the tick delay between hopper item movements - hopperTransfer = getInt( "ticks-per.hopper-transfer", 8 ); - // Set the tick delay between checking for items after the associated -@@ -0,0 +0,0 @@ public class SpigotWorldConfig - // hopper sorting machines from becoming out of sync. - hopperCheck = getInt( "ticks-per.hopper-check", hopperTransfer ); - hopperAmount = getInt( "hopper-amount", 1 ); -+ log( "Alternative Hopper Ticking: " + altHopperTicking ); - log( "Hopper Transfer: " + hopperTransfer + " Hopper Check: " + hopperCheck + " Hopper Amount: " + hopperAmount ); - } - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0143-Only-fetch-an-online-UUID-in-online-mode.patch b/CraftBukkit-Patches/0141-Only-fetch-an-online-UUID-in-online-mode.patch similarity index 100% rename from CraftBukkit-Patches/0143-Only-fetch-an-online-UUID-in-online-mode.patch rename to CraftBukkit-Patches/0141-Only-fetch-an-online-UUID-in-online-mode.patch diff --git a/CraftBukkit-Patches/0144-Filter-attribute-modifiers-which-cause-the-attribute.patch b/CraftBukkit-Patches/0142-Filter-attribute-modifiers-which-cause-the-attribute.patch similarity index 100% rename from CraftBukkit-Patches/0144-Filter-attribute-modifiers-which-cause-the-attribute.patch rename to CraftBukkit-Patches/0142-Filter-attribute-modifiers-which-cause-the-attribute.patch diff --git a/CraftBukkit-Patches/0145-Plug-WorldMap-Memory-Leak.patch b/CraftBukkit-Patches/0143-Plug-WorldMap-Memory-Leak.patch similarity index 75% rename from CraftBukkit-Patches/0145-Plug-WorldMap-Memory-Leak.patch rename to CraftBukkit-Patches/0143-Plug-WorldMap-Memory-Leak.patch index 14465103dd..72c80da1ce 100644 --- a/CraftBukkit-Patches/0145-Plug-WorldMap-Memory-Leak.patch +++ b/CraftBukkit-Patches/0143-Plug-WorldMap-Memory-Leak.patch @@ -11,10 +11,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PersistentCollection { private IDataManager b; - protected Map a = Maps.newHashMap(); -- private List c = Lists.newArrayList(); -+ public List c = Lists.newArrayList(); // Spigot - private Map d = Maps.newHashMap(); + protected Map a = Maps.newHashMap(); +- private List c = Lists.newArrayList(); ++ public List c = Lists.newArrayList(); // Spigot + private Map d = Maps.newHashMap(); public PersistentCollection(IDataManager idatamanager) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java @@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + WorldMap map = (WorldMap) o; + map.i.remove( entity ); -+ for ( Iterator iter = (Iterator) map.g.iterator(); iter.hasNext(); ) ++ for ( Iterator iter = (Iterator) map.g.iterator(); iter.hasNext(); ) + { + if ( iter.next().trackee == entity ) + { @@ -52,10 +52,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { public byte scale; public byte[] colors = new byte[16384]; - public List g = Lists.newArrayList(); -- private Map i = Maps.newHashMap(); -+ public Map i = Maps.newHashMap(); // Spigot - public Map decorations = Maps.newLinkedHashMap(); - + public List g = Lists.newArrayList(); +- private Map i = Maps.newHashMap(); ++ public Map i = Maps.newHashMap(); // Spigot + public Map decorations = Maps.newLinkedHashMap(); + // CraftBukkit start -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0146-Fix-Corrupted-Trapped-Chest.patch b/CraftBukkit-Patches/0144-Fix-Corrupted-Trapped-Chest.patch similarity index 100% rename from CraftBukkit-Patches/0146-Fix-Corrupted-Trapped-Chest.patch rename to CraftBukkit-Patches/0144-Fix-Corrupted-Trapped-Chest.patch diff --git a/CraftBukkit-Patches/0147-Remove-uneeded-validation.patch b/CraftBukkit-Patches/0145-Remove-uneeded-validation.patch similarity index 100% rename from CraftBukkit-Patches/0147-Remove-uneeded-validation.patch rename to CraftBukkit-Patches/0145-Remove-uneeded-validation.patch diff --git a/CraftBukkit-Patches/0148-Add-Hunger-Config-Values.patch b/CraftBukkit-Patches/0146-Add-Hunger-Config-Values.patch similarity index 99% rename from CraftBukkit-Patches/0148-Add-Hunger-Config-Values.patch rename to CraftBukkit-Patches/0146-Add-Hunger-Config-Values.patch index bd0b4dfeed..f24df3114f 100644 --- a/CraftBukkit-Patches/0148-Add-Hunger-Config-Values.patch +++ b/CraftBukkit-Patches/0146-Add-Hunger-Config-Values.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity.extinguish(); } @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - super.bE(); + super.bF(); this.b(StatisticList.u); if (this.isSprinting()) { - this.applyExhaustion(0.8F); diff --git a/CraftBukkit-Patches/0149-Make-debug-logging-togglable.patch b/CraftBukkit-Patches/0147-Make-debug-logging-togglable.patch similarity index 100% rename from CraftBukkit-Patches/0149-Make-debug-logging-togglable.patch rename to CraftBukkit-Patches/0147-Make-debug-logging-togglable.patch diff --git a/CraftBukkit-Patches/0150-Skip-invalid-enchants-in-CraftMetaItem.patch b/CraftBukkit-Patches/0148-Skip-invalid-enchants-in-CraftMetaItem.patch similarity index 100% rename from CraftBukkit-Patches/0150-Skip-invalid-enchants-in-CraftMetaItem.patch rename to CraftBukkit-Patches/0148-Skip-invalid-enchants-in-CraftMetaItem.patch diff --git a/CraftBukkit-Patches/0151-Limit-TNT-Detonations-per-tick.patch b/CraftBukkit-Patches/0149-Limit-TNT-Detonations-per-tick.patch similarity index 99% rename from CraftBukkit-Patches/0151-Limit-TNT-Detonations-per-tick.patch rename to CraftBukkit-Patches/0149-Limit-TNT-Detonations-per-tick.patch index f79524b9f4..b79357ab13 100644 --- a/CraftBukkit-Patches/0151-Limit-TNT-Detonations-per-tick.patch +++ b/CraftBukkit-Patches/0149-Limit-TNT-Detonations-per-tick.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { } - public void s_() { + public void t_() { + if (world.spigotConfig.currentPrimedTnt++ > world.spigotConfig.maxTntTicksPerTick) { return; } // Spigot this.lastX = this.locX; this.lastY = this.locY; diff --git a/CraftBukkit-Patches/0152-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/CraftBukkit-Patches/0150-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch similarity index 100% rename from CraftBukkit-Patches/0152-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch rename to CraftBukkit-Patches/0150-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch diff --git a/CraftBukkit-Patches/0153-Configurable-Hanging-Tick.patch b/CraftBukkit-Patches/0151-Configurable-Hanging-Tick.patch similarity index 91% rename from CraftBukkit-Patches/0153-Configurable-Hanging-Tick.patch rename to CraftBukkit-Patches/0151-Configurable-Hanging-Tick.patch index d25fb39380..3452c9b59d 100644 --- a/CraftBukkit-Patches/0153-Configurable-Hanging-Tick.patch +++ b/CraftBukkit-Patches/0151-Configurable-Hanging-Tick.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; -- if (this.c++ == 100 && !this.world.isStatic) { -+ if (this.c++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isStatic) { // Spigot - 100 -> this.world.spigotConfig.hangingTickFrequency +- if (this.c++ == 100 && !this.world.isClientSide) { ++ if (this.c++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isClientSide) { this.c = 0; if (!this.dead && !this.survives()) { // CraftBukkit start - fire break events diff --git a/CraftBukkit-Patches/0154-Fix-Some-Memory-Leaks.patch b/CraftBukkit-Patches/0152-Fix-Some-Memory-Leaks.patch similarity index 88% rename from CraftBukkit-Patches/0154-Fix-Some-Memory-Leaks.patch rename to CraftBukkit-Patches/0152-Fix-Some-Memory-Leaks.patch index 4e55c83087..5ce20aa106 100644 --- a/CraftBukkit-Patches/0154-Fix-Some-Memory-Leaks.patch +++ b/CraftBukkit-Patches/0152-Fix-Some-Memory-Leaks.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EnchantmentManager.java @@ -0,0 +0,0 @@ public class EnchantmentManager { if (entity instanceof EntityHuman) { - a((EnchantmentModifier) EnchantmentManager.d, entityliving.bz()); + a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.d, entityliving.bA()); } - + // Spigot start @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static void b(EntityLiving entityliving, Entity entity) { @@ -0,0 +0,0 @@ public class EnchantmentManager { if (entityliving instanceof EntityHuman) { - a((EnchantmentModifier) EnchantmentManager.e, entityliving.bz()); + a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.e, entityliving.bA()); } - + // Spigot start @@ -45,13 +45,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.UUID; @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { protected NavigationAbstract navigation; - public PathfinderGoalSelector goalSelector; // PAIL protected final to public - public PathfinderGoalSelector targetSelector; // PAIL protected final to public + public PathfinderGoalSelector goalSelector; // CraftBukkit - public + public PathfinderGoalSelector targetSelector; // CraftBukkit - public - private EntityLiving goalTarget; + private WeakReference goalTarget = new WeakReference(null); - private EntitySenses bi; + private EntitySenses bk; private ItemStack[] equipment = new ItemStack[5]; - public float[] dropChances = new float[5]; + public float[] dropChances = new float[5]; // CraftBukkit - public @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { } @@ -74,14 +74,14 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { public void close(IChatBaseComponent ichatbasecomponent) { // Spigot Start this.preparing = false; -+ this.h.clear(); ++ this.i.clear(); // Spigot End - if (this.i.isOpen()) { - this.i.close(); // We can't wait as this may be called from an event loop. + if (this.k.isOpen()) { + this.k.close(); // We can't wait as this may be called from an event loop. diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java diff --git a/CraftBukkit-Patches/0155-Refactor-ItemDoor-Place.patch b/CraftBukkit-Patches/0153-Refactor-ItemDoor-Place.patch similarity index 80% rename from CraftBukkit-Patches/0155-Refactor-ItemDoor-Place.patch rename to CraftBukkit-Patches/0153-Refactor-ItemDoor-Place.patch index 6e1c0d7c82..73db3e8512 100644 --- a/CraftBukkit-Patches/0155-Refactor-ItemDoor-Place.patch +++ b/CraftBukkit-Patches/0153-Refactor-ItemDoor-Place.patch @@ -10,15 +10,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/ItemDoor.java @@ -0,0 +0,0 @@ public class ItemDoor extends Item { BlockPosition blockposition3 = blockposition.up(); - IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag2 ? EnumDoorHinge.RIGHT : EnumDoorHinge.LEFT); + IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag2 ? BlockDoor.EnumDoorHinge.RIGHT : BlockDoor.EnumDoorHinge.LEFT); -- world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.LOWER), 2); -- world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.UPPER), 2); +- world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); +- world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); - world.applyPhysics(blockposition, block); - world.applyPhysics(blockposition3, block); + // Spigot start - update physics after the block multi place event -+ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.LOWER), 3); -+ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.UPPER), 3); ++ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 3); ++ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 3); + // world.applyPhysics(blockposition, block); + // world.applyPhysics(blockposition3, block); + // Spigot end diff --git a/CraftBukkit-Patches/0156-Don-t-Fire-InventoryCloseEvent-Unless-Required.patch b/CraftBukkit-Patches/0154-Don-t-Fire-InventoryCloseEvent-Unless-Required.patch similarity index 100% rename from CraftBukkit-Patches/0156-Don-t-Fire-InventoryCloseEvent-Unless-Required.patch rename to CraftBukkit-Patches/0154-Don-t-Fire-InventoryCloseEvent-Unless-Required.patch diff --git a/CraftBukkit-Patches/0157-BungeeCord-Chat-API.patch b/CraftBukkit-Patches/0155-BungeeCord-Chat-API.patch similarity index 93% rename from CraftBukkit-Patches/0157-BungeeCord-Chat-API.patch rename to CraftBukkit-Patches/0155-BungeeCord-Chat-API.patch index 1bd886e20c..c901b0bfd1 100644 --- a/CraftBukkit-Patches/0157-BungeeCord-Chat-API.patch +++ b/CraftBukkit-Patches/0155-BungeeCord-Chat-API.patch @@ -12,7 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+public class PacketPlayOutChat implements Packet { ++import java.io.IOException; ++ ++public class PacketPlayOutChat implements Packet { + + private IChatBaseComponent a; + public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot @@ -29,12 +31,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.b = b0; + } + -+ public void a(PacketDataSerializer packetdataserializer) { ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.a = packetdataserializer.d(); + this.b = packetdataserializer.readByte(); + } + -+ public void b(PacketDataSerializer packetdataserializer) { ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { + // Spigot start + if (components != null) { + packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); @@ -52,10 +54,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean b() { + return this.b == 1 || this.b == 2; + } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/CraftBukkit-Patches/0159-Use-Standard-List-for-EntitySlices.patch b/CraftBukkit-Patches/0156-Use-Standard-List-for-EntitySlices.patch similarity index 81% rename from CraftBukkit-Patches/0159-Use-Standard-List-for-EntitySlices.patch rename to CraftBukkit-Patches/0156-Use-Standard-List-for-EntitySlices.patch index 6e0442f204..7884ec4c09 100644 --- a/CraftBukkit-Patches/0159-Use-Standard-List-for-EntitySlices.patch +++ b/CraftBukkit-Patches/0156-Use-Standard-List-for-EntitySlices.patch @@ -11,10 +11,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Chunk { public final int locZ; private boolean k; - public final Map tileEntities; -- public final EntitySlice[] entitySlices; -+ public final List[] entitySlices; // Spigot - public boolean done; + public final Map tileEntities; +- public final EntitySlice[] entitySlices; // CraftBukkit - public ++ public final List[] entitySlices; // Spigot + private boolean done; private boolean lit; private boolean p; @@ -0,0 +0,0 @@ public class Chunk { @@ -38,23 +38,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); for (int k = i; k <= j; ++k) { -- Iterator iterator = this.entitySlices[k].b(oclass).iterator(); +- Iterator iterator = this.entitySlices[k].c(oclass).iterator(); + Iterator iterator = this.entitySlices[k].iterator(); // Spigot while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); -- if (entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply(entity))) { -+ if (oclass.isInstance(entity) && entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply(entity))) { // Spigot - list.add(entity); +- if (entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply((T) entity))) { // CraftBukkit - fix decompile error ++ if (oclass.isInstance(entity) && entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply((T) entity))) { // CraftBukkit - fix decompile error // Spigot + list.add((T) entity); // Fix decompile error } } @@ -0,0 +0,0 @@ public class Chunk { return this.tileEntities; } -- public EntitySlice[] getEntitySlices() { -+ public List[] getEntitySlices() { +- public EntitySlice[] getEntitySlices() { ++ public List[] getEntitySlices() { return this.entitySlices; } diff --git a/CraftBukkit-Patches/0160-Allow-Capping-Tile-Entity-Tick-Time.patch b/CraftBukkit-Patches/0157-Allow-Capping-Tile-Entity-Tick-Time.patch similarity index 95% rename from CraftBukkit-Patches/0160-Allow-Capping-Tile-Entity-Tick-Time.patch rename to CraftBukkit-Patches/0157-Allow-Capping-Tile-Entity-Tick-Time.patch index 0e1ff8b35f..eb8f1f276a 100644 --- a/CraftBukkit-Patches/0160-Allow-Capping-Tile-Entity-Tick-Time.patch +++ b/CraftBukkit-Patches/0157-Allow-Capping-Tile-Entity-Tick-Time.patch @@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + private final byte chunkTickRadius; public static boolean haveWeSilencedAPhysicsCrash; public static String blockLocation; - public List triggerHoppersList = new ArrayList(); // Spigot, When altHopperTicking, tile entities being added go through here. + private org.spigotmc.TickLimiter entityLimiter; + private org.spigotmc.TickLimiter tileLimiter; + private int tileTickPosition; @@ -24,9 +24,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static long chunkToKey(int x, int z) { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - - this.getServer().addWorld(this.world); // CraftBukkit - timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings + this.getServer().addWorld(this.world); + // CraftBukkit end + timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings + this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); + this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } @@ -47,9 +47,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end if (entity.vehicle != null) { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + this.c.clear(); + } // CraftBukkit end - - this.initializeHoppers(); // Spigot - Initializes hoppers which have been added recently. - Iterator iterator = this.tileEntityList.iterator(); - while (iterator.hasNext()) { diff --git a/CraftBukkit-Patches/0158-Disable-Explosion-avoiding-for-all-mobs.patch b/CraftBukkit-Patches/0158-Disable-Explosion-avoiding-for-all-mobs.patch deleted file mode 100644 index 0e9829b9c6..0000000000 --- a/CraftBukkit-Patches/0158-Disable-Explosion-avoiding-for-all-mobs.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sat, 27 Dec 2014 21:08:51 +0000 -Subject: [PATCH] Disable Explosion avoiding for all mobs - -Its going in 1.8.1 anyway - -diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMonster.java -+++ b/src/main/java/net/minecraft/server/EntityMonster.java -@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit - - public abstract class EntityMonster extends EntityCreature implements IMonster { - -- protected final PathfinderGoal a = new PathfinderGoalAvoidTarget(this, new EntitySelectorExplodingCreeper(this), 4.0F, 1.0D, 2.0D); -+ protected final PathfinderGoal a = null; // Spigot : new PathfinderGoalAvoidTarget(this, new EntitySelectorExplodingCreeper(this), 4.0F, 1.0D, 2.0D); - - public EntityMonster(World world) { - super(world); -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -@@ -0,0 +0,0 @@ public class PathfinderGoalSelector { - } - - public void a(int i, PathfinderGoal pathfindergoal) { -+ if (pathfindergoal == null) return; // Spigot - this.b.add(new PathfinderGoalSelectorItem(this, i, pathfindergoal)); - } - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0161-Use-FastMatches-for-ItemStack-Dirty-Check.patch b/CraftBukkit-Patches/0158-Use-FastMatches-for-ItemStack-Dirty-Check.patch similarity index 94% rename from CraftBukkit-Patches/0161-Use-FastMatches-for-ItemStack-Dirty-Check.patch rename to CraftBukkit-Patches/0158-Use-FastMatches-for-ItemStack-Dirty-Check.patch index 24b8d46667..8c81db375b 100644 --- a/CraftBukkit-Patches/0161-Use-FastMatches-for-ItemStack-Dirty-Check.patch +++ b/CraftBukkit-Patches/0158-Use-FastMatches-for-ItemStack-Dirty-Check.patch @@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Container.java +++ b/src/main/java/net/minecraft/server/Container.java @@ -0,0 +0,0 @@ public abstract class Container { - private final Set h = Sets.newHashSet(); - protected List listeners = Lists.newArrayList(); - private Set i = Sets.newHashSet(); + private final Set h = Sets.newHashSet(); + protected List listeners = Lists.newArrayList(); + private Set i = Sets.newHashSet(); + private int tickCount; // Spigot - + // CraftBukkit start public boolean checkReachable = true; @@ -0,0 +0,0 @@ public abstract class Container {