diff --git a/Bukkit-Patches/0001-POM-Changes.patch b/Bukkit-Patches/0001-POM-Changes.patch index 472ed0430e..bbaf636289 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.8-R0.1-SNAPSHOT + 1.9-SNAPSHOT jar - Bukkit diff --git a/Bukkit-Patches/0004-BungeeCord-Support.patch b/Bukkit-Patches/0004-BungeeCord-Support.patch index dc1af3d944..d1636b5009 100644 --- a/Bukkit-Patches/0004-BungeeCord-Support.patch +++ b/Bukkit-Patches/0004-BungeeCord-Support.patch @@ -10,9 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline */ - @Deprecated - public void resetTitle(); -+ + public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data); + + // Spigot start + public class Spigot extends Entity.Spigot + { diff --git a/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch b/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch index 801d762957..7541558821 100644 --- a/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch +++ b/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch @@ -9,8 +9,8 @@ diff --git a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java b/src index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java +++ b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java -@@ -0,0 +0,0 @@ import org.bukkit.Location; - import org.bukkit.entity.CreatureType; +@@ -0,0 +0,0 @@ package org.bukkit.event.entity; + import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; -import org.bukkit.event.Cancellable; @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public CreatureSpawnEvent(final LivingEntity spawnee, final SpawnReason spawnReason) { @@ -0,0 +0,0 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable { - spawnReason = reason; + this.spawnReason = spawnReason; } - public boolean isCancelled() { @@ -55,9 +55,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } - - /** - * Gets the type of creature being spawned. + * Gets the reason for why the creature is being spawned. * - * @return A CreatureType value detailing the type of creature being + * @return A SpawnReason value detailing the reason for the creature being @@ -0,0 +0,0 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable { return spawnReason; } diff --git a/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch b/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch index 87039fd82a..36f623cd28 100644 --- a/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch +++ b/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java @@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender { - * @return if the custom name is displayed + * @return whether the entity is glowing */ - public boolean isCustomNameVisible(); + boolean isGlowing(); + + // Spigot Start + public class Spigot diff --git a/CraftBukkit-Patches/0001-POM-Changes.patch b/CraftBukkit-Patches/0001-POM-Changes.patch index 2334b4c921..c601521472 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.8-R0.1-SNAPSHOT + 1.9-SNAPSHOT - CraftBukkit - http://www.bukkit.org + Spigot @@ -41,24 +41,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - org.bukkit - bukkit ++ org.spigotmc ++ spigot-api + ${project.version} + compile + +@@ -0,0 +0,0 @@ + 5.1.37 + compile + ++ + net.sf.trove4j + trove4j + 3.0.3 + -+ -+ org.spigotmc -+ spigot-api - ${project.version} - jar - compile + + + junit @@ -0,0 +0,0 @@ - - - -- clean install -+ install - - net.md-5 scriptus 0.2 diff --git a/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch b/CraftBukkit-Patches/0002-Skeleton-API-Implementations.patch similarity index 96% rename from CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch rename to CraftBukkit-Patches/0002-Skeleton-API-Implementations.patch index 69b68c8bdc..321ec3b76c 100644 --- a/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch +++ b/CraftBukkit-Patches/0002-Skeleton-API-Implementations.patch @@ -68,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - public void setOp(boolean value) { - perm.setOp(value); + public boolean isGlowing() { + return getHandle().glowing; } + + // Spigot start @@ -108,8 +108,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - PacketPlayOutTitle packetReset = new PacketPlayOutTitle(EnumTitleAction.RESET, null); - getHandle().playerConnection.sendPacket(packetReset); + getHandle().playerConnection.sendPacket(packetplayoutworldparticles); + } + + // Spigot start diff --git a/CraftBukkit-Patches/0002-mc-dev-imports.patch b/CraftBukkit-Patches/0003-mc-dev-imports.patch similarity index 69% rename from CraftBukkit-Patches/0002-mc-dev-imports.patch rename to CraftBukkit-Patches/0003-mc-dev-imports.patch index d610b0f0cf..942bd14f85 100644 --- a/CraftBukkit-Patches/0002-mc-dev-imports.patch +++ b/CraftBukkit-Patches/0003-mc-dev-imports.patch @@ -54,35 +54,50 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import com.google.common.base.Predicate; ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Logger; + +public class BlockAnvil extends BlockFalling { + -+ public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL); ++ public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING; + public static final BlockStateInteger DAMAGE = BlockStateInteger.of("damage", 0, 2); ++ protected static final AxisAlignedBB c = new AxisAlignedBB(0.0D, 0.0D, 0.125D, 1.0D, 1.0D, 0.875D); ++ protected static final AxisAlignedBB d = new AxisAlignedBB(0.125D, 0.0D, 0.0D, 0.875D, 1.0D, 1.0D); ++ protected static final Logger e = LogManager.getLogger(); + + protected BlockAnvil() { + super(Material.HEAVY); -+ this.j(this.blockStateList.getBlockData().set(BlockAnvil.FACING, EnumDirection.NORTH).set(BlockAnvil.DAMAGE, Integer.valueOf(0))); -+ this.e(0); ++ this.w(this.blockStateList.getBlockData().set(BlockAnvil.FACING, EnumDirection.NORTH).set(BlockAnvil.DAMAGE, Integer.valueOf(0))); ++ this.d(0); + this.a(CreativeModeTab.c); + } + -+ public boolean d() { ++ public boolean c(IBlockData iblockdata) { + return false; + } + -+ public boolean c() { ++ public boolean b(IBlockData iblockdata) { + return false; + } + + public IBlockData getPlacedState(World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2, int i, EntityLiving entityliving) { + EnumDirection enumdirection1 = entityliving.getDirection().e(); + -+ return super.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityliving).set(BlockAnvil.FACING, enumdirection1).set(BlockAnvil.DAMAGE, Integer.valueOf(i >> 2)); ++ try { ++ return super.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityliving).set(BlockAnvil.FACING, enumdirection1).set(BlockAnvil.DAMAGE, Integer.valueOf(i >> 2)); ++ } catch (IllegalArgumentException illegalargumentexception) { ++ if (!world.isClientSide) { ++ BlockAnvil.e.warn(String.format("Invalid damage property for anvil at %s. Found %d, must be in [0, 1, 2]", new Object[] { blockposition, Integer.valueOf(i >> 2)})); ++ if (entityliving instanceof EntityHuman) { ++ ((EntityHuman) entityliving).sendMessage(new ChatMessage("Invalid damage property. Please pick in [0, 1, 2]", new Object[0])); ++ } ++ } ++ ++ return super.getPlacedState(world, blockposition, enumdirection, f, f1, f2, 0, entityliving).set(BlockAnvil.FACING, enumdirection1).set(BlockAnvil.DAMAGE, Integer.valueOf(0)); ++ } + } + -+ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) { + if (!world.isClientSide) { + entityhuman.openTileEntity(new BlockAnvil.TileEntityContainerAnvil(world, blockposition)); + } @@ -94,15 +109,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return ((Integer) iblockdata.get(BlockAnvil.DAMAGE)).intValue(); + } + -+ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) { -+ EnumDirection enumdirection = (EnumDirection) iblockaccess.getType(blockposition).get(BlockAnvil.FACING); -+ -+ 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); -+ } ++ public AxisAlignedBB a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { ++ EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockAnvil.FACING); + ++ return enumdirection.k() == EnumDirection.EnumAxis.X ? BlockAnvil.c : BlockAnvil.d; + } + + protected void a(EntityFallingBlock entityfallingblock) { @@ -110,7 +120,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void a_(World world, BlockPosition blockposition) { -+ world.triggerEffect(1022, blockposition, 0); ++ world.triggerEffect(1031, blockposition, 0); + } + + public IBlockData fromLegacyData(int i) { @@ -119,12 +129,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public int toLegacyData(IBlockData iblockdata) { + byte b0 = 0; -+ int i = b0 | ((EnumDirection) iblockdata.get(BlockAnvil.FACING)).b(); ++ int i = b0 | ((EnumDirection) iblockdata.get(BlockAnvil.FACING)).get2DRotationValue(); + + i |= ((Integer) iblockdata.get(BlockAnvil.DAMAGE)).intValue() << 2; + return i; + } + ++ public IBlockData a(IBlockData iblockdata, EnumBlockRotation enumblockrotation) { ++ return iblockdata.getBlock() != this ? iblockdata : iblockdata.set(BlockAnvil.FACING, enumblockrotation.a((EnumDirection) iblockdata.get(BlockAnvil.FACING))); ++ } ++ + protected BlockStateList getStateList() { + return new BlockStateList(this, new IBlockState[] { BlockAnvil.FACING, BlockAnvil.DAMAGE}); + } @@ -171,47 +185,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.List; +import java.util.Random; + -+public class BlockBrewingStand extends BlockContainer { ++public class BlockBrewingStand extends BlockTileEntity { + + public static final BlockStateBoolean[] HAS_BOTTLE = new BlockStateBoolean[] { BlockStateBoolean.of("has_bottle_0"), BlockStateBoolean.of("has_bottle_1"), BlockStateBoolean.of("has_bottle_2")}; ++ protected static final AxisAlignedBB b = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.125D, 1.0D); ++ protected static final AxisAlignedBB c = new AxisAlignedBB(0.4375D, 0.0D, 0.4375D, 0.5625D, 0.875D, 0.5625D); + + 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))); ++ this.w(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() { ++ public boolean b(IBlockData iblockdata) { + return false; + } + -+ public int b() { -+ return 3; ++ public EnumRenderType a(IBlockData iblockdata) { ++ return EnumRenderType.MODEL; + } + + public TileEntity a(World world, int i) { + return new TileEntityBrewingStand(); + } + -+ public boolean d() { ++ public boolean c(IBlockData iblockdata) { + return false; + } + -+ 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.j(); -+ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ public void a(IBlockData iblockdata, World world, BlockPosition blockposition, AxisAlignedBB axisalignedbb, List list, Entity entity) { ++ a(blockposition, axisalignedbb, list, BlockBrewingStand.c); ++ a(blockposition, axisalignedbb, list, BlockBrewingStand.b); + } + -+ public void j() { -+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); ++ public AxisAlignedBB a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { ++ return BlockBrewingStand.b; + } + -+ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) { + if (world.isClientSide) { + return true; + } else { @@ -219,7 +233,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if (tileentity instanceof TileEntityBrewingStand) { + entityhuman.openContainer((TileEntityBrewingStand) tileentity); -+ entityhuman.b(StatisticList.M); ++ entityhuman.b(StatisticList.O); + } + + return true; @@ -251,11 +265,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return Items.BREWING_STAND; + } + -+ public boolean isComplexRedstone() { ++ public ItemStack a(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ return new ItemStack(Items.BREWING_STAND); ++ } ++ ++ public boolean isComplexRedstone(IBlockData iblockdata) { + return true; + } + -+ public int l(World world, BlockPosition blockposition) { ++ public int d(IBlockData iblockdata, World world, BlockPosition blockposition) { + return Container.a(world.getTileEntity(blockposition)); + } + @@ -285,444 +303,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.Random; -+ -+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", BlockFlowerPot.EnumFlowerPotContents.class); -+ -+ public BlockFlowerPot() { -+ super(Material.ORIENTABLE); -+ this.j(this.blockStateList.getBlockData().set(BlockFlowerPot.CONTENTS, BlockFlowerPot.EnumFlowerPotContents.EMPTY).set(BlockFlowerPot.LEGACY_DATA, Integer.valueOf(0))); -+ this.j(); -+ } -+ -+ public String getName() { -+ return LocaleI18n.get("item.flowerPot.name"); -+ } -+ -+ public void j() { -+ float f = 0.375F; -+ float f1 = f / 2.0F; -+ -+ this.a(0.5F - f1, 0.0F, 0.5F - f1, 0.5F + f1, f, 0.5F + f1); -+ } -+ -+ public boolean c() { -+ return false; -+ } -+ -+ public int b() { -+ return 3; -+ } -+ -+ public boolean d() { -+ return false; -+ } -+ -+ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { -+ ItemStack itemstack = entityhuman.inventory.getItemInHand(); -+ -+ if (itemstack != null && itemstack.getItem() instanceof ItemBlock) { -+ TileEntityFlowerPot tileentityflowerpot = this.f(world, blockposition); -+ -+ if (tileentityflowerpot == null) { -+ return false; -+ } else if (tileentityflowerpot.b() != null) { -+ return false; -+ } else { -+ Block block = Block.asBlock(itemstack.getItem()); -+ -+ if (!this.a(block, itemstack.getData())) { -+ return false; -+ } else { -+ 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); -+ } -+ -+ return true; -+ } -+ } -+ } else { -+ return false; -+ } -+ } -+ -+ 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 == BlockLongGrass.EnumTallGrassType.FERN.a() : true; -+ } -+ -+ public int getDropData(World world, BlockPosition blockposition) { -+ TileEntityFlowerPot tileentityflowerpot = this.f(world, blockposition); -+ -+ return tileentityflowerpot != null && tileentityflowerpot.b() != null ? tileentityflowerpot.c() : 0; -+ } -+ -+ public boolean canPlace(World world, BlockPosition blockposition) { -+ return super.canPlace(world, blockposition) && World.a((IBlockAccess) world, blockposition.down()); -+ } -+ -+ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { -+ if (!World.a((IBlockAccess) world, blockposition.down())) { -+ this.b(world, blockposition, iblockdata, 0); -+ world.setAir(blockposition); -+ } -+ -+ } -+ -+ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { -+ TileEntityFlowerPot tileentityflowerpot = this.f(world, blockposition); -+ -+ if (tileentityflowerpot != null && tileentityflowerpot.b() != null) { -+ a(world, blockposition, new ItemStack(tileentityflowerpot.b(), 1, tileentityflowerpot.c())); -+ } -+ -+ super.remove(world, blockposition, iblockdata); -+ } -+ -+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { -+ super.a(world, blockposition, iblockdata, entityhuman); -+ if (entityhuman.abilities.canInstantlyBuild) { -+ TileEntityFlowerPot tileentityflowerpot = this.f(world, blockposition); -+ -+ if (tileentityflowerpot != null) { -+ tileentityflowerpot.a((Item) null, 0); -+ } -+ } -+ -+ } -+ -+ public Item getDropType(IBlockData iblockdata, Random random, int i) { -+ return Items.FLOWER_POT; -+ } -+ -+ private TileEntityFlowerPot f(World world, BlockPosition blockposition) { -+ TileEntity tileentity = world.getTileEntity(blockposition); -+ -+ return tileentity instanceof TileEntityFlowerPot ? (TileEntityFlowerPot) tileentity : null; -+ } -+ -+ public TileEntity a(World world, int i) { -+ Object object = null; -+ int j = 0; -+ -+ switch (i) { -+ case 1: -+ object = Blocks.RED_FLOWER; -+ j = BlockFlowers.EnumFlowerVarient.POPPY.b(); -+ break; -+ -+ case 2: -+ object = Blocks.YELLOW_FLOWER; -+ break; -+ -+ case 3: -+ object = Blocks.SAPLING; -+ j = BlockWood.EnumLogVariant.OAK.a(); -+ break; -+ -+ case 4: -+ object = Blocks.SAPLING; -+ j = BlockWood.EnumLogVariant.SPRUCE.a(); -+ break; -+ -+ case 5: -+ object = Blocks.SAPLING; -+ j = BlockWood.EnumLogVariant.BIRCH.a(); -+ break; -+ -+ case 6: -+ object = Blocks.SAPLING; -+ j = BlockWood.EnumLogVariant.JUNGLE.a(); -+ break; -+ -+ case 7: -+ object = Blocks.RED_MUSHROOM; -+ break; -+ -+ case 8: -+ object = Blocks.BROWN_MUSHROOM; -+ break; -+ -+ case 9: -+ object = Blocks.CACTUS; -+ break; -+ -+ case 10: -+ object = Blocks.DEADBUSH; -+ break; -+ -+ case 11: -+ object = Blocks.TALLGRASS; -+ j = BlockLongGrass.EnumTallGrassType.FERN.a(); -+ break; -+ -+ case 12: -+ object = Blocks.SAPLING; -+ j = BlockWood.EnumLogVariant.ACACIA.a(); -+ break; -+ -+ case 13: -+ object = Blocks.SAPLING; -+ j = BlockWood.EnumLogVariant.DARK_OAK.a(); -+ } -+ -+ return new TileEntityFlowerPot(Item.getItemOf((Block) object), j); -+ } -+ -+ protected BlockStateList getStateList() { -+ return new BlockStateList(this, new IBlockState[] { BlockFlowerPot.CONTENTS, BlockFlowerPot.LEGACY_DATA}); -+ } -+ -+ public int toLegacyData(IBlockData iblockdata) { -+ return ((Integer) iblockdata.get(BlockFlowerPot.LEGACY_DATA)).intValue(); -+ } -+ -+ public IBlockData updateState(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { -+ BlockFlowerPot.EnumFlowerPotContents blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.EMPTY; -+ TileEntity tileentity = iblockaccess.getTileEntity(blockposition); -+ -+ if (tileentity instanceof TileEntityFlowerPot) { -+ TileEntityFlowerPot tileentityflowerpot = (TileEntityFlowerPot) tileentity; -+ Item item = tileentityflowerpot.b(); -+ -+ if (item instanceof ItemBlock) { -+ int i = tileentityflowerpot.c(); -+ Block block = Block.asBlock(item); -+ -+ if (block == Blocks.SAPLING) { -+ switch (BlockFlowerPot.SyntheticClass_1.a[BlockWood.EnumLogVariant.a(i).ordinal()]) { -+ case 1: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.OAK_SAPLING; -+ break; -+ -+ case 2: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.SPRUCE_SAPLING; -+ break; -+ -+ case 3: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.BIRCH_SAPLING; -+ break; -+ -+ case 4: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.JUNGLE_SAPLING; -+ break; -+ -+ case 5: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.ACACIA_SAPLING; -+ break; -+ -+ case 6: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.DARK_OAK_SAPLING; -+ break; -+ -+ default: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.EMPTY; -+ } -+ } else if (block == Blocks.TALLGRASS) { -+ switch (i) { -+ case 0: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.DEAD_BUSH; -+ break; -+ -+ case 2: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.FERN; -+ break; -+ -+ default: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.EMPTY; -+ } -+ } else if (block == Blocks.YELLOW_FLOWER) { -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.DANDELION; -+ } else if (block == Blocks.RED_FLOWER) { -+ switch (BlockFlowerPot.SyntheticClass_1.b[BlockFlowers.EnumFlowerVarient.a(BlockFlowers.EnumFlowerType.RED, i).ordinal()]) { -+ case 1: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.POPPY; -+ break; -+ -+ case 2: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.BLUE_ORCHID; -+ break; -+ -+ case 3: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.ALLIUM; -+ break; -+ -+ case 4: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.HOUSTONIA; -+ break; -+ -+ case 5: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.RED_TULIP; -+ break; -+ -+ case 6: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.ORANGE_TULIP; -+ break; -+ -+ case 7: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.WHITE_TULIP; -+ break; -+ -+ case 8: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.PINK_TULIP; -+ break; -+ -+ case 9: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.OXEYE_DAISY; -+ break; -+ -+ default: -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.EMPTY; -+ } -+ } else if (block == Blocks.RED_MUSHROOM) { -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.MUSHROOM_RED; -+ } else if (block == Blocks.BROWN_MUSHROOM) { -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.MUSHROOM_BROWN; -+ } else if (block == Blocks.DEADBUSH) { -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.DEAD_BUSH; -+ } else if (block == Blocks.CACTUS) { -+ blockflowerpot_enumflowerpotcontents = BlockFlowerPot.EnumFlowerPotContents.CACTUS; -+ } -+ } -+ } -+ -+ 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -734,7 +314,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.google.common.base.Predicate; +import java.util.List; + -+public class BlockHopper extends BlockContainer { ++public class BlockHopper extends BlockTileEntity { + + public static final BlockStateDirection FACING = BlockStateDirection.of("facing", new Predicate() { + public boolean a(EnumDirection enumdirection) { @@ -746,32 +326,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + }); + public static final BlockStateBoolean ENABLED = BlockStateBoolean.of("enabled"); ++ protected static final AxisAlignedBB c = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D); ++ protected static final AxisAlignedBB d = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D); ++ protected static final AxisAlignedBB e = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D); ++ protected static final AxisAlignedBB f = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); ++ protected static final AxisAlignedBB g = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D); + + public BlockHopper() { + super(Material.ORE, MaterialMapColor.m); -+ this.j(this.blockStateList.getBlockData().set(BlockHopper.FACING, EnumDirection.DOWN).set(BlockHopper.ENABLED, Boolean.valueOf(true))); ++ this.w(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); + } + -+ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) { -+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ public AxisAlignedBB a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { ++ return BlockHopper.j; + } + -+ 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; -+ -+ this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); -+ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); -+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); -+ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); -+ this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); -+ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); -+ this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); -+ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); -+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ public void a(IBlockData iblockdata, World world, BlockPosition blockposition, AxisAlignedBB axisalignedbb, List list, Entity entity) { ++ a(blockposition, axisalignedbb, list, BlockHopper.c); ++ a(blockposition, axisalignedbb, list, BlockHopper.g); ++ a(blockposition, axisalignedbb, list, BlockHopper.f); ++ a(blockposition, axisalignedbb, list, BlockHopper.d); ++ a(blockposition, axisalignedbb, list, BlockHopper.e); + } + + public IBlockData getPlacedState(World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2, int i, EntityLiving entityliving) { @@ -800,11 +376,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } + ++ public boolean k(IBlockData iblockdata) { ++ return true; ++ } ++ + public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { + this.e(world, blockposition, iblockdata); + } + -+ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) { + if (world.isClientSide) { + return true; + } else { @@ -812,7 +392,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if (tileentity instanceof TileEntityHopper) { + entityhuman.openContainer((TileEntityHopper) tileentity); -+ entityhuman.b(StatisticList.P); ++ entityhuman.b(StatisticList.R); + } + + return true; @@ -843,19 +423,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + super.remove(world, blockposition, iblockdata); + } + -+ public int b() { -+ return 3; ++ public EnumRenderType a(IBlockData iblockdata) { ++ return EnumRenderType.MODEL; + } + -+ public boolean d() { ++ public boolean c(IBlockData iblockdata) { + return false; + } + -+ public boolean c() { ++ public boolean b(IBlockData iblockdata) { + return false; + } + -+ public static EnumDirection b(int i) { ++ public static EnumDirection e(int i) { + return EnumDirection.fromType1(i & 7); + } + @@ -863,16 +443,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return (i & 8) != 8; + } + -+ public boolean isComplexRedstone() { ++ public boolean isComplexRedstone(IBlockData iblockdata) { + return true; + } + -+ public int l(World world, BlockPosition blockposition) { ++ public int d(IBlockData iblockdata, World world, BlockPosition blockposition) { + return Container.a(world.getTileEntity(blockposition)); + } + + public IBlockData fromLegacyData(int i) { -+ return this.getBlockData().set(BlockHopper.FACING, b(i)).set(BlockHopper.ENABLED, Boolean.valueOf(f(i))); ++ return this.getBlockData().set(BlockHopper.FACING, e(i)).set(BlockHopper.ENABLED, Boolean.valueOf(f(i))); + } + + public int toLegacyData(IBlockData iblockdata) { @@ -886,6 +466,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return i; + } + ++ public IBlockData a(IBlockData iblockdata, EnumBlockRotation enumblockrotation) { ++ return iblockdata.set(BlockHopper.FACING, enumblockrotation.a((EnumDirection) iblockdata.get(BlockHopper.FACING))); ++ } ++ ++ public IBlockData a(IBlockData iblockdata, EnumBlockMirror enumblockmirror) { ++ return iblockdata.a(enumblockmirror.a((EnumDirection) iblockdata.get(BlockHopper.FACING))); ++ } ++ + protected BlockStateList getStateList() { + return new BlockStateList(this, new IBlockState[] { BlockHopper.FACING, BlockHopper.ENABLED}); + } @@ -904,7 +492,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public BlockTNT() { + super(Material.TNT); -+ this.j(this.blockStateList.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(false))); ++ this.w(this.blockStateList.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(false))); + this.a(CreativeModeTab.d); + } + @@ -929,7 +517,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (!world.isClientSide) { + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); + -+ entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8; ++ entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8)); + world.addEntity(entitytntprimed); + } + } @@ -944,30 +532,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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); ++ world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gj, SoundCategory.BLOCKS, 1.0F, 1.0F); + } + + } + } + -+ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { -+ 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.bZ().damage(1, entityhuman); -+ } else if (!entityhuman.abilities.canInstantlyBuild) { -+ --entityhuman.bZ().count; -+ } -+ -+ return true; ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (itemstack != null && (itemstack.getItem() == Items.FLINT_AND_STEEL || itemstack.getItem() == Items.FIRE_CHARGE)) { ++ this.a(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true)), (EntityLiving) entityhuman); ++ world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11); ++ if (itemstack.getItem() == Items.FLINT_AND_STEEL) { ++ itemstack.damage(1, entityhuman); ++ } else if (!entityhuman.abilities.canInstantlyBuild) { ++ --itemstack.count; + } -+ } + -+ return super.interact(world, blockposition, iblockdata, entityhuman, enumdirection, f, f1, f2); ++ return true; ++ } else { ++ return super.interact(world, blockposition, iblockdata, entityhuman, enumhand, itemstack, enumdirection, f, f1, f2); ++ } + } + + public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) { @@ -1010,7 +594,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class CommandDispatcher extends CommandHandler implements ICommandDispatcher { + -+ public CommandDispatcher() { ++ private final MinecraftServer a; ++ ++ public CommandDispatcher(MinecraftServer minecraftserver) { ++ this.a = minecraftserver; + this.a((ICommand) (new CommandTime())); + this.a((ICommand) (new CommandGamemode())); + this.a((ICommand) (new CommandDifficulty())); @@ -1054,7 +641,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a((ICommand) (new CommandWorldBorder())); + this.a((ICommand) (new CommandTitle())); + this.a((ICommand) (new CommandEntityData())); -+ if (MinecraftServer.getServer().ae()) { ++ if (minecraftserver.aa()) { + this.a((ICommand) (new CommandOp())); + this.a((ICommand) (new CommandDeop())); + this.a((ICommand) (new CommandStop())); @@ -1079,7 +666,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public void a(ICommandListener icommandlistener, ICommand icommand, int i, String s, Object... aobject) { + boolean flag = true; -+ MinecraftServer minecraftserver = MinecraftServer.getServer(); ++ MinecraftServer minecraftserver = this.a; + + if (!icommandlistener.getSendCommandFeedback()) { + flag = false; @@ -1095,9 +682,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + while (iterator.hasNext()) { + EntityHuman entityhuman = (EntityHuman) iterator.next(); + -+ if (entityhuman != icommandlistener && minecraftserver.getPlayerList().isOp(entityhuman.getProfile()) && icommand.canUse(icommandlistener)) { -+ boolean flag1 = icommandlistener instanceof MinecraftServer && MinecraftServer.getServer().r(); -+ boolean flag2 = icommandlistener instanceof RemoteControlCommandListener && MinecraftServer.getServer().q(); ++ if (entityhuman != icommandlistener && minecraftserver.getPlayerList().isOp(entityhuman.getProfile()) && icommand.canUse(this.a, icommandlistener)) { ++ boolean flag1 = icommandlistener instanceof MinecraftServer && this.a.s(); ++ boolean flag2 = icommandlistener instanceof RemoteControlCommandListener && this.a.r(); + + if (flag1 || flag2 || !(icommandlistener instanceof RemoteControlCommandListener) && !(icommandlistener instanceof MinecraftServer)) { + entityhuman.sendMessage(chatmessage); @@ -1113,7 +700,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + boolean flag3 = minecraftserver.worldServer[0].getGameRules().getBoolean("sendCommandFeedback"); + + if (icommandlistener instanceof CommandBlockListenerAbstract) { -+ flag3 = ((CommandBlockListenerAbstract) icommandlistener).m(); ++ flag3 = ((CommandBlockListenerAbstract) icommandlistener).n(); + } + + if ((i & 1) != 1 && flag3 || icommandlistener instanceof MinecraftServer) { @@ -1121,372 +708,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + } -+} -diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; + -+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; -+import java.util.Map; -+import java.util.concurrent.locks.ReadWriteLock; -+import java.util.concurrent.locks.ReentrantReadWriteLock; -+import org.apache.commons.lang3.ObjectUtils; -+ -+public class DataWatcher { -+ -+ private final Entity a; -+ private boolean b = true; -+ private static final Map, Integer> c = Maps.newHashMap(); -+ private final Map d = Maps.newHashMap(); -+ private boolean e; -+ private ReadWriteLock f = new ReentrantReadWriteLock(); -+ -+ public DataWatcher(Entity entity) { -+ this.a = entity; -+ } -+ -+ public void a(int i, T t0) { -+ Integer integer = (Integer) DataWatcher.c.get(t0.getClass()); -+ -+ if (integer == null) { -+ 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 { -+ DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(integer.intValue(), i, t0); -+ -+ this.f.writeLock().lock(); -+ this.d.put(Integer.valueOf(i), datawatcher_watchableobject); -+ this.f.writeLock().unlock(); -+ this.b = false; -+ } -+ } -+ -+ public void add(int i, int j) { -+ DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(j, i, (Object) null); -+ -+ this.f.writeLock().lock(); -+ this.d.put(Integer.valueOf(i), datawatcher_watchableobject); -+ this.f.writeLock().unlock(); -+ this.b = false; -+ } -+ -+ public byte getByte(int i) { -+ return ((Byte) this.j(i).b()).byteValue(); -+ } -+ -+ public short getShort(int i) { -+ return ((Short) this.j(i).b()).shortValue(); -+ } -+ -+ public int getInt(int i) { -+ return ((Integer) this.j(i).b()).intValue(); -+ } -+ -+ public float getFloat(int i) { -+ return ((Float) this.j(i).b()).floatValue(); -+ } -+ -+ public String getString(int i) { -+ return (String) this.j(i).b(); -+ } -+ -+ public ItemStack getItemStack(int i) { -+ return (ItemStack) this.j(i).b(); -+ } -+ -+ private DataWatcher.WatchableObject j(int i) { -+ this.f.readLock().lock(); -+ -+ DataWatcher.WatchableObject datawatcher_watchableobject; -+ -+ try { -+ 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"); -+ -+ crashreportsystemdetails.a("Data ID", (Object) Integer.valueOf(i)); -+ throw new ReportedException(crashreport); -+ } -+ -+ this.f.readLock().unlock(); -+ return datawatcher_watchableobject; -+ } -+ -+ public Vector3f h(int i) { -+ return (Vector3f) this.j(i).b(); -+ } -+ -+ public void watch(int i, T t0) { -+ DataWatcher.WatchableObject datawatcher_watchableobject = this.j(i); -+ -+ if (ObjectUtils.notEqual(t0, datawatcher_watchableobject.b())) { -+ datawatcher_watchableobject.a(t0); -+ this.a.i(i); -+ datawatcher_watchableobject.a(true); -+ this.e = true; -+ } -+ -+ } -+ -+ public void update(int i) { -+ this.j(i).d = true; -+ this.e = true; -+ } -+ -+ public boolean a() { -+ return this.e; -+ } -+ -+ public static void a(List list, PacketDataSerializer packetdataserializer) throws IOException { -+ if (list != null) { -+ Iterator iterator = list.iterator(); -+ -+ while (iterator.hasNext()) { -+ DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); -+ -+ a(packetdataserializer, datawatcher_watchableobject); -+ } -+ } -+ -+ packetdataserializer.writeByte(127); -+ } -+ -+ public List b() { -+ ArrayList arraylist = null; -+ -+ if (this.e) { -+ this.f.readLock().lock(); -+ Iterator iterator = this.d.values().iterator(); -+ -+ while (iterator.hasNext()) { -+ DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); -+ -+ if (datawatcher_watchableobject.d()) { -+ datawatcher_watchableobject.a(false); -+ if (arraylist == null) { -+ arraylist = Lists.newArrayList(); -+ } -+ -+ arraylist.add(datawatcher_watchableobject); -+ } -+ } -+ -+ this.f.readLock().unlock(); -+ } -+ -+ this.e = false; -+ return arraylist; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.f.readLock().lock(); -+ Iterator iterator = this.d.values().iterator(); -+ -+ while (iterator.hasNext()) { -+ DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); -+ -+ a(packetdataserializer, datawatcher_watchableobject); -+ } -+ -+ this.f.readLock().unlock(); -+ packetdataserializer.writeByte(127); -+ } -+ -+ public List c() { -+ ArrayList arraylist = null; -+ -+ this.f.readLock().lock(); -+ -+ DataWatcher.WatchableObject datawatcher_watchableobject; -+ -+ 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(); -+ } -+ } -+ -+ this.f.readLock().unlock(); -+ return arraylist; -+ } -+ -+ 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 (datawatcher_watchableobject.c()) { -+ case 0: -+ packetdataserializer.writeByte(((Byte) datawatcher_watchableobject.b()).byteValue()); -+ break; -+ -+ case 1: -+ packetdataserializer.writeShort(((Short) datawatcher_watchableobject.b()).shortValue()); -+ break; -+ -+ case 2: -+ packetdataserializer.writeInt(((Integer) datawatcher_watchableobject.b()).intValue()); -+ break; -+ -+ case 3: -+ packetdataserializer.writeFloat(((Float) datawatcher_watchableobject.b()).floatValue()); -+ break; -+ -+ case 4: -+ packetdataserializer.a((String) datawatcher_watchableobject.b()); -+ break; -+ -+ case 5: -+ ItemStack itemstack = (ItemStack) datawatcher_watchableobject.b(); -+ -+ packetdataserializer.a(itemstack); -+ break; -+ -+ case 6: -+ BlockPosition blockposition = (BlockPosition) datawatcher_watchableobject.b(); -+ -+ packetdataserializer.writeInt(blockposition.getX()); -+ packetdataserializer.writeInt(blockposition.getY()); -+ packetdataserializer.writeInt(blockposition.getZ()); -+ break; -+ -+ case 7: -+ Vector3f vector3f = (Vector3f) datawatcher_watchableobject.b(); -+ -+ packetdataserializer.writeFloat(vector3f.getX()); -+ packetdataserializer.writeFloat(vector3f.getY()); -+ packetdataserializer.writeFloat(vector3f.getZ()); -+ } -+ -+ } -+ -+ public static List b(PacketDataSerializer packetdataserializer) throws IOException { -+ ArrayList arraylist = null; -+ -+ for (byte b0 = packetdataserializer.readByte(); b0 != 127; b0 = packetdataserializer.readByte()) { -+ if (arraylist == null) { -+ arraylist = Lists.newArrayList(); -+ } -+ -+ int i = (b0 & 224) >> 5; -+ int j = b0 & 31; -+ DataWatcher.WatchableObject datawatcher_watchableobject = null; -+ -+ switch (i) { -+ case 0: -+ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, Byte.valueOf(packetdataserializer.readByte())); -+ break; -+ -+ case 1: -+ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, Short.valueOf(packetdataserializer.readShort())); -+ break; -+ -+ case 2: -+ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, Integer.valueOf(packetdataserializer.readInt())); -+ break; -+ -+ case 3: -+ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, Float.valueOf(packetdataserializer.readFloat())); -+ break; -+ -+ case 4: -+ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, packetdataserializer.c(32767)); -+ break; -+ -+ case 5: -+ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, packetdataserializer.i()); -+ break; -+ -+ case 6: -+ int k = packetdataserializer.readInt(); -+ int l = packetdataserializer.readInt(); -+ int i1 = packetdataserializer.readInt(); -+ -+ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, new BlockPosition(k, l, i1)); -+ break; -+ -+ case 7: -+ float f = packetdataserializer.readFloat(); -+ float f1 = packetdataserializer.readFloat(); -+ float f2 = packetdataserializer.readFloat(); -+ -+ datawatcher_watchableobject = new DataWatcher.WatchableObject(i, j, new Vector3f(f, f1, f2)); -+ } -+ -+ arraylist.add(datawatcher_watchableobject); -+ } -+ -+ return arraylist; -+ } -+ -+ public boolean d() { -+ return this.b; -+ } -+ -+ public void e() { -+ this.e = false; -+ } -+ -+ static { -+ DataWatcher.c.put(Byte.class, Integer.valueOf(0)); -+ DataWatcher.c.put(Short.class, Integer.valueOf(1)); -+ DataWatcher.c.put(Integer.class, Integer.valueOf(2)); -+ DataWatcher.c.put(Float.class, Integer.valueOf(3)); -+ DataWatcher.c.put(String.class, Integer.valueOf(4)); -+ DataWatcher.c.put(ItemStack.class, Integer.valueOf(5)); -+ 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; -+ } ++ protected MinecraftServer a() { ++ return this.a; + } +} diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java @@ -1500,12 +724,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.ArrayList; -+import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; ++import java.util.Map.Entry; + +public class EnchantmentManager { + @@ -1515,7 +739,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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) { ++ public static int getEnchantmentLevel(Enchantment enchantment, ItemStack itemstack) { + if (itemstack == null) { + return 0; + } else { @@ -1524,12 +748,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (nbttaglist == null) { + return 0; + } else { -+ for (int j = 0; j < nbttaglist.size(); ++j) { -+ short short0 = nbttaglist.get(j).getShort("id"); -+ short short1 = nbttaglist.get(j).getShort("lvl"); ++ for (int i = 0; i < nbttaglist.size(); ++i) { ++ Enchantment enchantment1 = Enchantment.c(nbttaglist.get(i).getShort("id")); ++ short short0 = nbttaglist.get(i).getShort("lvl"); + -+ if (short0 == i) { -+ return short1; ++ if (enchantment1 == enchantment) { ++ return short0; + } + } + @@ -1538,73 +762,53 @@ 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(); + + if (nbttaglist != null) { + for (int i = 0; i < nbttaglist.size(); ++i) { -+ short short0 = nbttaglist.get(i).getShort("id"); -+ short short1 = nbttaglist.get(i).getShort("lvl"); ++ Enchantment enchantment = Enchantment.c(nbttaglist.get(i).getShort("id")); ++ short short0 = nbttaglist.get(i).getShort("lvl"); + -+ linkedhashmap.put(Integer.valueOf(short0), Integer.valueOf(short1)); ++ linkedhashmap.put(enchantment, Integer.valueOf(short0)); + } + } + + 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(); ++ Iterator iterator = map.entrySet().iterator(); + + while (iterator.hasNext()) { -+ int i = ((Integer) iterator.next()).intValue(); -+ Enchantment enchantment = Enchantment.getById(i); ++ Entry entry = (Entry) iterator.next(); ++ Enchantment enchantment = (Enchantment) entry.getKey(); + + if (enchantment != null) { ++ int i = ((Integer) entry.getValue()).intValue(); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + -+ nbttagcompound.setShort("id", (short) i); -+ nbttagcompound.setShort("lvl", (short) ((Integer) map.get(Integer.valueOf(i))).intValue()); ++ nbttagcompound.setShort("id", (short) Enchantment.getId(enchantment)); ++ nbttagcompound.setShort("lvl", (short) i); + nbttaglist.add(nbttagcompound); + if (itemstack.getItem() == Items.ENCHANTED_BOOK) { -+ Items.ENCHANTED_BOOK.a(itemstack, new WeightedRandomEnchant(enchantment, ((Integer) map.get(Integer.valueOf(i))).intValue())); ++ Items.ENCHANTED_BOOK.a(itemstack, new WeightedRandomEnchant(enchantment, i)); + } + } + } + -+ if (nbttaglist.size() > 0) { -+ if (itemstack.getItem() != Items.ENCHANTED_BOOK) { -+ itemstack.a("ench", (NBTBase) nbttaglist); ++ if (nbttaglist.isEmpty()) { ++ if (itemstack.hasTag()) { ++ itemstack.getTag().remove("ench"); + } -+ } else if (itemstack.hasTag()) { -+ itemstack.getTag().remove("ench"); ++ } else if (itemstack.getItem() != Items.ENCHANTED_BOOK) { ++ itemstack.a("ench", (NBTBase) nbttaglist); + } + + } + -+ public static int a(int i, ItemStack[] aitemstack) { -+ if (aitemstack == null) { -+ return 0; -+ } else { -+ int j = 0; -+ ItemStack[] aitemstack1 = aitemstack; -+ int k = aitemstack.length; -+ -+ for (int l = 0; l < k; ++l) { -+ ItemStack itemstack = aitemstack1[l]; -+ int i1 = getEnchantmentLevel(i, itemstack); -+ -+ if (i1 > j) { -+ j = i1; -+ } -+ } -+ -+ return j; -+ } -+ } -+ + private static void a(EnchantmentManager.EnchantmentModifier enchantmentmanager_enchantmentmodifier, ItemStack itemstack) { + if (itemstack != null) { + NBTTagList nbttaglist = itemstack.getEnchantments(); @@ -1614,8 +818,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + short short0 = nbttaglist.get(i).getShort("id"); + short short1 = nbttaglist.get(i).getShort("lvl"); + -+ if (Enchantment.getById(short0) != null) { -+ enchantmentmanager_enchantmentmodifier.a(Enchantment.getById(short0), short1); ++ if (Enchantment.c(short0) != null) { ++ enchantmentmanager_enchantmentmodifier.a(Enchantment.c(short0), short1); + } + } + @@ -1623,29 +827,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ private static void a(EnchantmentManager.EnchantmentModifier enchantmentmanager_enchantmentmodifier, ItemStack[] aitemstack) { -+ ItemStack[] aitemstack1 = aitemstack; -+ int i = aitemstack.length; ++ private static void a(EnchantmentManager.EnchantmentModifier enchantmentmanager_enchantmentmodifier, Iterable iterable) { ++ Iterator iterator = iterable.iterator(); + -+ for (int j = 0; j < i; ++j) { -+ ItemStack itemstack = aitemstack1[j]; ++ while (iterator.hasNext()) { ++ ItemStack itemstack = (ItemStack) iterator.next(); + + a(enchantmentmanager_enchantmentmodifier, itemstack); + } + + } + -+ public static int a(ItemStack[] aitemstack, DamageSource damagesource) { ++ public static int a(Iterable iterable, DamageSource damagesource) { + EnchantmentManager.b.a = 0; + EnchantmentManager.b.b = damagesource; -+ 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); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.b, iterable); ++ return EnchantmentManager.b.a; + } + + public static float a(ItemStack itemstack, EnumMonsterType enummonstertype) { @@ -1659,11 +856,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + EnchantmentManager.d.b = entity; + EnchantmentManager.d.a = entityliving; + if (entityliving != null) { -+ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.d, entityliving.getEquipment()); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.d, entityliving.aG()); + } + + if (entity instanceof EntityHuman) { -+ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.d, entityliving.bA()); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.d, entityliving.getItemInMainHand()); + } + + } @@ -1672,77 +869,97 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + EnchantmentManager.e.a = entityliving; + EnchantmentManager.e.b = entity; + if (entityliving != null) { -+ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.e, entityliving.getEquipment()); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.e, entityliving.aG()); + } + + if (entityliving instanceof EntityHuman) { -+ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.e, entityliving.bA()); ++ a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.e, entityliving.getItemInMainHand()); + } + + } + ++ public static int a(Enchantment enchantment, EntityLiving entityliving) { ++ Iterable iterable = enchantment.a(entityliving); ++ ++ if (iterable == null) { ++ return 0; ++ } else { ++ int i = 0; ++ Iterator iterator = iterable.iterator(); ++ ++ while (iterator.hasNext()) { ++ ItemStack itemstack = (ItemStack) iterator.next(); ++ int j = getEnchantmentLevel(enchantment, itemstack); ++ ++ if (j > i) { ++ i = j; ++ } ++ } ++ ++ return i; ++ } ++ } ++ + public static int a(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.KNOCKBACK.id, entityliving.bA()); ++ return a(Enchantments.KNOCKBACK, entityliving); + } + + public static int getFireAspectEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, entityliving.bA()); ++ return a(Enchantments.FIRE_ASPECT, entityliving); + } + -+ public static int getOxygenEnchantmentLevel(Entity entity) { -+ return a(Enchantment.OXYGEN.id, entity.getEquipment()); ++ public static int getOxygenEnchantmentLevel(EntityLiving entityliving) { ++ return a(Enchantments.OXYGEN, entityliving); + } + -+ public static int b(Entity entity) { -+ return a(Enchantment.DEPTH_STRIDER.id, entity.getEquipment()); ++ public static int d(EntityLiving entityliving) { ++ return a(Enchantments.DEPTH_STRIDER, entityliving); + } + + public static int getDigSpeedEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.DIG_SPEED.id, entityliving.bA()); ++ return a(Enchantments.DIG_SPEED, entityliving); + } + -+ public static boolean hasSilkTouchEnchantment(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, entityliving.bA()) > 0; -+ } -+ -+ public static int getBonusBlockLootEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, entityliving.bA()); ++ public static int f(EntityLiving entityliving) { ++ return a(Enchantments.LUCK, entityliving); + } + + public static int g(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LUCK.id, entityliving.bA()); ++ return a(Enchantments.LURE, entityliving); + } + + public static int h(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LURE.id, entityliving.bA()); ++ return a(Enchantments.LOOT_BONUS_MOBS, entityliving); + } + -+ public static int getBonusMonsterLootEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, entityliving.bA()); ++ public static boolean i(EntityLiving entityliving) { ++ return a(Enchantments.WATER_WORKER, entityliving) > 0; + } + -+ public static boolean j(EntityLiving entityliving) { -+ return a(Enchantment.WATER_WORKER.id, entityliving.getEquipment()) > 0; -+ } ++ public static ItemStack b(Enchantment enchantment, EntityLiving entityliving) { ++ Iterable iterable = enchantment.a(entityliving); + -+ public static ItemStack a(Enchantment enchantment, EntityLiving entityliving) { -+ ItemStack[] aitemstack = entityliving.getEquipment(); -+ int i = aitemstack.length; ++ if (iterable == null) { ++ return null; ++ } else { ++ ArrayList arraylist = Lists.newArrayList(); ++ Iterator iterator = iterable.iterator(); + -+ for (int j = 0; j < i; ++j) { -+ ItemStack itemstack = aitemstack[j]; ++ while (iterator.hasNext()) { ++ ItemStack itemstack = (ItemStack) iterator.next(); + -+ if (itemstack != null && getEnchantmentLevel(enchantment.id, itemstack) > 0) { -+ return itemstack; ++ if (itemstack != null && getEnchantmentLevel(enchantment, itemstack) > 0) { ++ arraylist.add(itemstack); ++ } + } -+ } + -+ return null; ++ return arraylist.isEmpty() ? null : (ItemStack) arraylist.get(entityliving.getRandom().nextInt(arraylist.size())); ++ } + } + + public static int a(Random random, int i, int j, ItemStack itemstack) { + Item item = itemstack.getItem(); -+ int k = item.b(); ++ int k = item.c(); + + if (k <= 0) { + return 0; @@ -1757,90 +974,54 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ public static ItemStack a(Random random, ItemStack itemstack, int i) { -+ List list = b(random, itemstack, i); -+ boolean flag = itemstack.getItem() == Items.BOOK; ++ public static ItemStack a(Random random, ItemStack itemstack, int i, boolean flag) { ++ boolean flag1 = itemstack.getItem() == Items.BOOK; ++ List list = b(random, itemstack, i, flag); + -+ if (flag) { ++ if (flag1) { + itemstack.setItem(Items.ENCHANTED_BOOK); + } + -+ if (list != null) { -+ Iterator iterator = list.iterator(); ++ Iterator iterator = list.iterator(); + -+ while (iterator.hasNext()) { -+ WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) iterator.next(); ++ while (iterator.hasNext()) { ++ WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) iterator.next(); + -+ if (flag) { -+ Items.ENCHANTED_BOOK.a(itemstack, weightedrandomenchant); -+ } else { -+ itemstack.addEnchantment(weightedrandomenchant.enchantment, weightedrandomenchant.level); -+ } ++ if (flag1) { ++ Items.ENCHANTED_BOOK.a(itemstack, weightedrandomenchant); ++ } else { ++ itemstack.addEnchantment(weightedrandomenchant.enchantment, weightedrandomenchant.level); + } + } + + return itemstack; + } + -+ public static List b(Random random, ItemStack itemstack, int i) { ++ public static List b(Random random, ItemStack itemstack, int i, boolean flag) { ++ ArrayList arraylist = Lists.newArrayList(); + Item item = itemstack.getItem(); -+ int j = item.b(); ++ int j = item.c(); + + if (j <= 0) { -+ return null; ++ return arraylist; + } else { -+ j /= 2; -+ j = 1 + random.nextInt((j >> 1) + 1) + random.nextInt((j >> 1) + 1); -+ int k = j + i; ++ i += 1 + random.nextInt(j / 4 + 1) + random.nextInt(j / 4 + 1); + float f = (random.nextFloat() + random.nextFloat() - 1.0F) * 0.15F; -+ int l = (int) ((float) k * (1.0F + f) + 0.5F); + -+ if (l < 1) { -+ l = 1; -+ } ++ i = MathHelper.clamp(Math.round((float) i + (float) i * f), 1, Integer.MAX_VALUE); ++ List list = a(i, itemstack, flag); + -+ ArrayList arraylist = null; -+ Map map = b(l, itemstack); ++ if (!list.isEmpty()) { ++ arraylist.add(WeightedRandom.a(random, list)); + -+ if (map != null && !map.isEmpty()) { -+ WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) WeightedRandom.a(random, map.values()); -+ -+ if (weightedrandomenchant != null) { -+ arraylist = Lists.newArrayList(); -+ arraylist.add(weightedrandomenchant); -+ -+ for (int i1 = l; random.nextInt(50) <= i1; i1 >>= 1) { -+ Iterator iterator = map.keySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ Integer integer = (Integer) iterator.next(); -+ boolean flag = true; -+ Iterator iterator1 = arraylist.iterator(); -+ -+ while (true) { -+ if (iterator1.hasNext()) { -+ WeightedRandomEnchant weightedrandomenchant1 = (WeightedRandomEnchant) iterator1.next(); -+ -+ if (weightedrandomenchant1.enchantment.a(Enchantment.getById(integer.intValue()))) { -+ continue; -+ } -+ -+ flag = false; -+ } -+ -+ if (!flag) { -+ iterator.remove(); -+ } -+ break; -+ } -+ } -+ -+ if (!map.isEmpty()) { -+ WeightedRandomEnchant weightedrandomenchant2 = (WeightedRandomEnchant) WeightedRandom.a(random, map.values()); -+ -+ arraylist.add(weightedrandomenchant2); -+ } ++ while (random.nextInt(50) <= i) { ++ a(list, (WeightedRandomEnchant) SystemUtils.a(arraylist)); ++ if (list.isEmpty()) { ++ break; + } ++ ++ arraylist.add(WeightedRandom.a(random, list)); ++ i /= 2; + } + } + @@ -1848,30 +1029,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ public static Map b(int i, ItemStack itemstack) { ++ public static void a(List list, WeightedRandomEnchant weightedrandomenchant) { ++ Iterator iterator = list.iterator(); ++ ++ while (iterator.hasNext()) { ++ if (!weightedrandomenchant.enchantment.a(((WeightedRandomEnchant) iterator.next()).enchantment)) { ++ iterator.remove(); ++ } ++ } ++ ++ } ++ ++ public static List a(int i, ItemStack itemstack, boolean flag) { ++ ArrayList arraylist = Lists.newArrayList(); + Item item = itemstack.getItem(); -+ HashMap hashmap = null; -+ boolean flag = itemstack.getItem() == Items.BOOK; -+ Enchantment[] aenchantment = Enchantment.b; -+ int j = aenchantment.length; ++ boolean flag1 = itemstack.getItem() == Items.BOOK; ++ Iterator iterator = Enchantment.enchantments.iterator(); + -+ for (int k = 0; k < j; ++k) { -+ Enchantment enchantment = aenchantment[k]; ++ while (iterator.hasNext()) { ++ Enchantment enchantment = (Enchantment) iterator.next(); + -+ if (enchantment != null && (enchantment.slot.canEnchant(item) || flag)) { -+ for (int l = enchantment.getStartLevel(); l <= enchantment.getMaxLevel(); ++l) { -+ if (i >= enchantment.a(l) && i <= enchantment.b(l)) { -+ if (hashmap == null) { -+ hashmap = Maps.newHashMap(); -+ } -+ -+ hashmap.put(Integer.valueOf(enchantment.id), new WeightedRandomEnchant(enchantment, l)); ++ if ((!enchantment.e() || flag) && (enchantment.itemTarget.canEnchant(item) || flag1)) { ++ for (int j = enchantment.getMaxLevel(); j > enchantment.getStartLevel() - 1; --j) { ++ if (i >= enchantment.a(j) && i <= enchantment.b(j)) { ++ arraylist.add(new WeightedRandomEnchant(enchantment, j)); ++ break; + } + } + } + } + -+ return hashmap; ++ return arraylist; + } + + static class SyntheticClass_1 { } @@ -2095,12 +1283,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class GenericAttributes { + -+ private static final Logger f = LogManager.getLogger(); ++ private static final Logger i = LogManager.getLogger(); + public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).a("Max Health").a(true); + public static final IAttribute FOLLOW_RANGE = (new AttributeRanged((IAttribute) null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); + public static final IAttribute c = (new AttributeRanged((IAttribute) null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); + public static final IAttribute MOVEMENT_SPEED = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).a("Movement Speed").a(true); + public static final IAttribute ATTACK_DAMAGE = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, 2048.0D); ++ public static final IAttribute f = (new AttributeRanged((IAttribute) null, "generic.attackSpeed", 4.0D, 0.0D, 1024.0D)).a(true); ++ public static final IAttribute g = (new AttributeRanged((IAttribute) null, "generic.armor", 0.0D, 0.0D, 30.0D)).a(true); ++ public static final IAttribute h = (new AttributeRanged((IAttribute) null, "generic.luck", 0.0D, -1024.0D, 1024.0D)).a(true); + + public static NBTTagList a(AttributeMapBase attributemapbase) { + NBTTagList nbttaglist = new NBTTagList(); @@ -2141,14 +1332,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return nbttagcompound; + } + -+ private static NBTTagCompound a(AttributeModifier attributemodifier) { ++ public static NBTTagCompound a(AttributeModifier attributemodifier) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + nbttagcompound.setString("Name", attributemodifier.b()); + nbttagcompound.setDouble("Amount", attributemodifier.d()); + nbttagcompound.setInt("Operation", attributemodifier.c()); -+ nbttagcompound.setLong("UUIDMost", attributemodifier.a().getMostSignificantBits()); -+ nbttagcompound.setLong("UUIDLeast", attributemodifier.a().getLeastSignificantBits()); ++ nbttagcompound.a("UUID", attributemodifier.a()); + return nbttagcompound; + } + @@ -2160,7 +1350,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (attributeinstance != null) { + a(attributeinstance, nbttagcompound); + } else { -+ GenericAttributes.f.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'"); ++ GenericAttributes.i.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'"); + } + } + @@ -2189,12 +1379,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public static AttributeModifier a(NBTTagCompound nbttagcompound) { -+ UUID uuid = new UUID(nbttagcompound.getLong("UUIDMost"), nbttagcompound.getLong("UUIDLeast")); ++ UUID uuid = nbttagcompound.a("UUID"); + + try { + return new AttributeModifier(uuid, nbttagcompound.getString("Name"), nbttagcompound.getDouble("Amount"), nbttagcompound.getInt("Operation")); + } catch (Exception exception) { -+ GenericAttributes.f.warn("Unable to create attribute: " + exception.getMessage()); ++ GenericAttributes.i.warn("Unable to create attribute: " + exception.getMessage()); + return null; + } + } @@ -2285,44 +1475,54 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a(CreativeModeTab.d); + } + -+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { ++ public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { + if (enumdirection != EnumDirection.UP) { -+ return false; ++ return EnumInteractionResult.FAIL; + } else { + IBlockData iblockdata = world.getType(blockposition); + Block block = iblockdata.getBlock(); + -+ if (!block.a(world, blockposition)) { ++ if (!block.a((IBlockAccess) world, blockposition)) { + blockposition = blockposition.shift(enumdirection); + } + -+ if (!entityhuman.a(blockposition, enumdirection, itemstack)) { -+ return false; -+ } else if (!this.a.canPlace(world, blockposition)) { -+ return false; -+ } else { -+ a(world, blockposition, EnumDirection.fromAngle((double) entityhuman.yaw), this.a); ++ if (entityhuman.a(blockposition, enumdirection, itemstack) && this.a.canPlace(world, blockposition)) { ++ EnumDirection enumdirection1 = EnumDirection.fromAngle((double) entityhuman.yaw); ++ int i = enumdirection1.getAdjacentX(); ++ int j = enumdirection1.getAdjacentZ(); ++ boolean flag = i < 0 && f2 < 0.5F || i > 0 && f2 > 0.5F || j < 0 && f > 0.5F || j > 0 && f < 0.5F; ++ ++ a(world, blockposition, enumdirection1, this.a, flag); ++ SoundEffectType soundeffecttype = this.a.w(); ++ ++ world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); + --itemstack.count; -+ return true; ++ return EnumInteractionResult.SUCCESS; ++ } else { ++ return EnumInteractionResult.FAIL; + } + } + } + -+ public static void a(World world, BlockPosition blockposition, EnumDirection enumdirection, Block block) { ++ public static void a(World world, BlockPosition blockposition, EnumDirection enumdirection, Block block, boolean flag) { + BlockPosition blockposition1 = blockposition.shift(enumdirection.e()); + BlockPosition blockposition2 = blockposition.shift(enumdirection.f()); -+ int i = (world.getType(blockposition2).getBlock().isOccluding() ? 1 : 0) + (world.getType(blockposition2.up()).getBlock().isOccluding() ? 1 : 0); -+ int j = (world.getType(blockposition1).getBlock().isOccluding() ? 1 : 0) + (world.getType(blockposition1.up()).getBlock().isOccluding() ? 1 : 0); -+ boolean flag = world.getType(blockposition2).getBlock() == block || world.getType(blockposition2.up()).getBlock() == block; -+ boolean flag1 = world.getType(blockposition1).getBlock() == block || world.getType(blockposition1.up()).getBlock() == block; -+ boolean flag2 = false; ++ int i = (world.getType(blockposition2).l() ? 1 : 0) + (world.getType(blockposition2.up()).l() ? 1 : 0); ++ int j = (world.getType(blockposition1).l() ? 1 : 0) + (world.getType(blockposition1.up()).l() ? 1 : 0); ++ boolean flag1 = world.getType(blockposition2).getBlock() == block || world.getType(blockposition2.up()).getBlock() == block; ++ boolean flag2 = world.getType(blockposition1).getBlock() == block || world.getType(blockposition1.up()).getBlock() == block; + -+ if (flag && !flag1 || j > i) { -+ flag2 = true; ++ if ((!flag1 || flag2) && j <= i) { ++ if (flag2 && !flag1 || j < i) { ++ flag = false; ++ } ++ } else { ++ flag = true; + } + + BlockPosition blockposition3 = blockposition.up(); -+ IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag2 ? BlockDoor.EnumDoorHinge.RIGHT : BlockDoor.EnumDoorHinge.LEFT); ++ boolean flag3 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition3); ++ IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag ? BlockDoor.EnumDoorHinge.RIGHT : BlockDoor.EnumDoorHinge.LEFT).set(BlockDoor.POWERED, Boolean.valueOf(flag3)).set(BlockDoor.OPEN, Boolean.valueOf(flag3)); + + world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); + world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); @@ -2343,7 +1543,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class ItemSkull extends Item { + -+ private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper"}; ++ private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper", "dragon"}; + + public ItemSkull() { + this.a(CreativeModeTab.c); @@ -2351,29 +1551,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a(true); + } + -+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { ++ public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { + if (enumdirection == EnumDirection.DOWN) { -+ return false; ++ return EnumInteractionResult.FAIL; + } else { + IBlockData iblockdata = world.getType(blockposition); + Block block = iblockdata.getBlock(); -+ boolean flag = block.a(world, blockposition); ++ boolean flag = block.a((IBlockAccess) world, blockposition); + + if (!flag) { -+ if (!world.getType(blockposition).getBlock().getMaterial().isBuildable()) { -+ return false; ++ if (!world.getType(blockposition).getMaterial().isBuildable()) { ++ return EnumInteractionResult.FAIL; + } + + blockposition = blockposition.shift(enumdirection); + } + -+ if (!entityhuman.a(blockposition, enumdirection, itemstack)) { -+ return false; -+ } else if (!Blocks.SKULL.canPlace(world, blockposition)) { -+ return false; -+ } else { -+ if (!world.isClientSide) { -+ world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 3); ++ if (entityhuman.a(blockposition, enumdirection, itemstack) && Blocks.SKULL.canPlace(world, blockposition)) { ++ if (world.isClientSide) { ++ return EnumInteractionResult.SUCCESS; ++ } else { ++ world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 11); + int i = 0; + + if (enumdirection == EnumDirection.UP) { @@ -2393,7 +1591,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if (nbttagcompound.hasKeyOfType("SkullOwner", 10)) { + gameprofile = GameProfileSerializer.deserialize(nbttagcompound.getCompound("SkullOwner")); -+ } else if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { ++ } else if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty()) { + gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); + } + } @@ -2408,9 +1606,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + --itemstack.count; ++ return EnumInteractionResult.SUCCESS; + } -+ -+ return true; ++ } else { ++ return EnumInteractionResult.FAIL; + } + } + } @@ -2419,7 +1618,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return i; + } + -+ public String e_(ItemStack itemstack) { ++ public String f_(ItemStack itemstack) { + int i = itemstack.getData(); + + if (i < 0 || i >= ItemSkull.a.length) { @@ -2449,7 +1648,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public boolean a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); -+ if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { ++ if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty()) { + GameProfile gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); + + gameprofile = TileEntitySkull.b(gameprofile); @@ -2934,7 +2133,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return i >> 1; + } + -+ public byte[] a() { ++ public byte[] asBytes() { + return this.a; + } +} @@ -3041,9 +2240,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + nbttagcompound1.setByte("Y", (byte) (l & 255)); + nbttagcompound1.setByteArray("Blocks", abyte); -+ nbttagcompound1.setByteArray("Data", nibblearray.a()); -+ nbttagcompound1.setByteArray("SkyLight", nibblearray1.a()); -+ nbttagcompound1.setByteArray("BlockLight", nibblearray2.a()); ++ nbttagcompound1.setByteArray("Data", nibblearray.asBytes()); ++ nbttagcompound1.setByteArray("SkyLight", nibblearray1.asBytes()); ++ nbttagcompound1.setByteArray("BlockLight", nibblearray2.asBytes()); + nbttaglist.add(nbttagcompound1); + } + } @@ -3055,7 +2254,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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); ++ abyte1[k << 4 | j] = (byte) (BiomeBase.a(worldchunkmanager.getBiome(blockposition_mutableblockposition, Biomes.b)) & 255); + } + } + @@ -3109,10 +2308,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public PacketHandshakingInSetProtocol() {} + + public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.e(); ++ this.a = packetdataserializer.g(); + this.hostname = packetdataserializer.c(255); + this.port = packetdataserializer.readUnsignedShort(); -+ this.d = EnumProtocol.a(packetdataserializer.e()); ++ this.d = EnumProtocol.a(packetdataserializer.g()); + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { @@ -3146,15 +2345,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class PacketPlayInArmAnimation implements Packet { + ++ private EnumHand a; ++ + public PacketPlayInArmAnimation() {} + -+ public void a(PacketDataSerializer packetdataserializer) throws IOException {} ++ public PacketPlayInArmAnimation(EnumHand enumhand) { ++ this.a = enumhand; ++ } + -+ public void b(PacketDataSerializer packetdataserializer) throws IOException {} ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = (EnumHand) packetdataserializer.a(EnumHand.class); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a((Enum) this.a); ++ } + + public void a(PacketListenerPlayIn packetlistenerplayin) { + packetlistenerplayin.a(this); + } ++ ++ public EnumHand a() { ++ return this.a; ++ } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java new file mode 100644 @@ -3196,6 +2409,50 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.a; + } +} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutChat implements Packet { ++ ++ private IChatBaseComponent a; ++ private byte b; ++ ++ public PacketPlayOutChat() {} ++ ++ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent) { ++ this(ichatbasecomponent, (byte) 1); ++ } ++ ++ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, byte b0) { ++ this.a = ichatbasecomponent; ++ this.b = b0; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.f(); ++ this.b = packetdataserializer.readByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(this.a); ++ packetdataserializer.writeByte(this.b); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++ public boolean b() { ++ return this.b == 1 || this.b == 2; ++ } ++} diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -3204,206 +2461,112 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import com.google.common.collect.Lists; ++import io.netty.buffer.ByteBuf; ++import io.netty.buffer.Unpooled; +import java.io.IOException; -+import java.util.ArrayList; -+import java.util.Iterator; + +public class PacketPlayOutMapChunk implements Packet { + + private int a; + private int b; -+ private PacketPlayOutMapChunk.ChunkMap c; -+ private boolean d; ++ private int c; ++ private byte[] d; ++ private boolean e; + + public PacketPlayOutMapChunk() {} + + public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i) { + this.a = chunk.locX; + this.b = chunk.locZ; -+ this.d = flag; -+ this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i); ++ this.e = flag; ++ boolean flag1 = !chunk.getWorld().worldProvider.m(); ++ ++ this.d = new byte[a(chunk, flag, flag1, i)]; ++ this.c = a(new PacketDataSerializer(this.f()), chunk, flag, flag1, i); + } + + public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.a = packetdataserializer.readInt(); + this.b = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readBoolean(); -+ this.c = new PacketPlayOutMapChunk.ChunkMap(); -+ this.c.b = packetdataserializer.readShort(); -+ this.c.a = packetdataserializer.a(); ++ this.e = packetdataserializer.readBoolean(); ++ this.c = packetdataserializer.g(); ++ int i = packetdataserializer.g(); ++ ++ if (i > 2097152) { ++ throw new RuntimeException("Chunk Packet trying to allocate too much memory on read."); ++ } else { ++ this.d = new byte[i]; ++ packetdataserializer.readBytes(this.d); ++ } + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.writeInt(this.a); + packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeBoolean(this.d); -+ packetdataserializer.writeShort((short) (this.c.b & '\uffff')); -+ packetdataserializer.a(this.c.a); ++ packetdataserializer.writeBoolean(this.e); ++ packetdataserializer.b(this.c); ++ packetdataserializer.b(this.d.length); ++ packetdataserializer.writeBytes(this.d); + } + + public void a(PacketListenerPlayOut packetlistenerplayout) { + packetlistenerplayout.a(this); + } + -+ protected static int a(int i, boolean flag, boolean flag1) { -+ int j = i * 2 * 16 * 16 * 16; -+ int k = i * 16 * 16 * 16 / 2; -+ int l = flag ? i * 16 * 16 * 16 / 2 : 0; -+ int i1 = flag1 ? 256 : 0; ++ private ByteBuf f() { ++ ByteBuf bytebuf = Unpooled.wrappedBuffer(this.d); + -+ return j + k + l + i1; ++ bytebuf.writerIndex(0); ++ return bytebuf; + } + -+ public static PacketPlayOutMapChunk.ChunkMap a(Chunk chunk, boolean flag, boolean flag1, int i) { ++ public static int a(PacketDataSerializer packetdataserializer, Chunk chunk, boolean flag, boolean flag1, int i) { ++ int j = 0; + ChunkSection[] achunksection = chunk.getSections(); -+ PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = new PacketPlayOutMapChunk.ChunkMap(); -+ ArrayList arraylist = Lists.newArrayList(); ++ int k = 0; + -+ int j; ++ for (int l = achunksection.length; k < l; ++k) { ++ ChunkSection chunksection = achunksection[k]; + -+ for (j = 0; j < achunksection.length; ++j) { -+ ChunkSection chunksection = achunksection[j]; -+ -+ if (chunksection != null && (!flag || !chunksection.a()) && (i & 1 << j) != 0) { -+ packetplayoutmapchunk_chunkmap.b |= 1 << j; -+ arraylist.add(chunksection); -+ } -+ } -+ -+ packetplayoutmapchunk_chunkmap.a = new byte[a(Integer.bitCount(packetplayoutmapchunk_chunkmap.b), flag1, flag)]; -+ j = 0; -+ Iterator iterator = arraylist.iterator(); -+ -+ ChunkSection chunksection1; -+ -+ while (iterator.hasNext()) { -+ chunksection1 = (ChunkSection) iterator.next(); -+ char[] achar = chunksection1.getIdArray(); -+ char[] achar1 = achar; -+ int k = achar.length; -+ -+ for (int l = 0; l < k; ++l) { -+ char c0 = achar1[l]; -+ -+ 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(), packetplayoutmapchunk_chunkmap.a, j)) { -+ chunksection1 = (ChunkSection) iterator.next(); -+ } -+ -+ if (flag1) { -+ for (iterator = arraylist.iterator(); iterator.hasNext(); j = a(chunksection1.getSkyLightArray().a(), packetplayoutmapchunk_chunkmap.a, j)) { -+ chunksection1 = (ChunkSection) iterator.next(); ++ if (chunksection != Chunk.a && (!flag || !chunksection.a()) && (i & 1 << k) != 0) { ++ j |= 1 << k; ++ chunksection.getBlocks().b(packetdataserializer); ++ packetdataserializer.writeBytes(chunksection.getEmittedLightArray().asBytes()); ++ if (flag1) { ++ packetdataserializer.writeBytes(chunksection.getSkyLightArray().asBytes()); ++ } + } + } + + if (flag) { -+ a(chunk.getBiomeIndex(), packetplayoutmapchunk_chunkmap.a, j); ++ packetdataserializer.writeBytes(chunk.getBiomeIndex()); + } + -+ return packetplayoutmapchunk_chunkmap; ++ return j; + } + -+ private static int a(byte[] abyte, byte[] abyte1, int i) { -+ System.arraycopy(abyte, 0, abyte1, i, abyte.length); -+ return i + abyte.length; -+ } ++ protected static int a(Chunk chunk, boolean flag, boolean flag1, int i) { ++ int j = 0; ++ ChunkSection[] achunksection = chunk.getSections(); ++ int k = 0; + -+ public static class ChunkMap { ++ for (int l = achunksection.length; k < l; ++k) { ++ ChunkSection chunksection = achunksection[k]; + -+ 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 -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+import java.util.List; -+ -+public class PacketPlayOutMapChunkBulk implements Packet { -+ -+ private int[] a; -+ private int[] b; -+ private PacketPlayOutMapChunk.ChunkMap[] c; -+ private boolean d; -+ -+ public PacketPlayOutMapChunkBulk() {} -+ -+ public PacketPlayOutMapChunkBulk(List list) { -+ int i = list.size(); -+ -+ this.a = new int[i]; -+ this.b = new int[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); -+ PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = PacketPlayOutMapChunk.a(chunk, true, this.d, '\uffff'); -+ -+ this.a[j] = chunk.locX; -+ this.b[j] = chunk.locZ; -+ this.c[j] = packetplayoutmapchunk_chunkmap; ++ if (chunksection != Chunk.a && (!flag || !chunksection.a()) && (i & 1 << k) != 0) { ++ j += chunksection.getBlocks().a(); ++ j += chunksection.getEmittedLightArray().asBytes().length; ++ if (flag1) { ++ j += chunksection.getSkyLightArray().asBytes().length; ++ } ++ } + } + -+ } -+ -+ 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 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 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)]; ++ if (flag) { ++ j += chunk.getBiomeIndex().length; + } + -+ for (j = 0; j < i; ++j) { -+ packetdataserializer.readBytes(this.c[j].a); -+ } -+ -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.writeBoolean(this.d); -+ packetdataserializer.b(this.c.length); -+ -+ int i; -+ -+ for (i = 0; i < this.a.length; ++i) { -+ packetdataserializer.writeInt(this.a[i]); -+ packetdataserializer.writeInt(this.b[i]); -+ packetdataserializer.writeShort((short) (this.c[i].b & '\uffff')); -+ } -+ -+ for (i = 0; i < this.a.length; ++i) { -+ packetdataserializer.writeBytes(this.c[i].a); -+ } -+ -+ } -+ -+ public void a(PacketListenerPlayOut packetlistenerplayout) { -+ packetlistenerplayout.a(this); ++ return j; + } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java @@ -3449,7 +2612,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.a = packetdataserializer.readUnsignedByte(); + this.b = packetdataserializer.c(32); -+ this.c = packetdataserializer.d(); ++ this.c = packetdataserializer.f(); + this.d = packetdataserializer.readUnsignedByte(); + if (this.b.equals("EntityHorse")) { + this.e = packetdataserializer.readInt(); @@ -3489,11 +2652,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean a() { + EntityLiving entityliving = this.a.getGoalTarget(); + -+ return this.a.cm() > 0 || entityliving != null && this.a.h(entityliving) < 9.0D; ++ return this.a.da() > 0 || entityliving != null && this.a.h(entityliving) < 9.0D; + } + + public void c() { -+ this.a.getNavigation().n(); ++ this.a.getNavigation().o(); + this.b = this.a.getGoalTarget(); + } + @@ -3685,9 +2848,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + while (iterator.hasNext()) { + String s1 = (String) iterator.next(); -+ short short0 = ((Short) this.d.get(s1)).shortValue(); + -+ nbttagcompound.setShort(s1, short0); ++ nbttagcompound.setShort(s1, ((Short) this.d.get(s1)).shortValue()); + } + + DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file)); @@ -3858,7 +3020,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Class oclass; + LazyInitVar lazyinitvar; + -+ if (Epoll.isAvailable() && this.f.ai()) { ++ if (Epoll.isAvailable() && this.f.ae()) { + oclass = EpollServerSocketChannel.class; + lazyinitvar = ServerConnection.b; + ServerConnection.e.info("Using epoll channel type"); @@ -3881,7 +3043,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + ServerConnection.this.h.add(networkmanager); + channel.pipeline().addLast("packet_handler", networkmanager); -+ networkmanager.a((PacketListener) (new HandshakeListener(ServerConnection.this.f, networkmanager))); ++ networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.f, networkmanager)); + } + }).group((EventLoopGroup) lazyinitvar.c()).localAddress(inetaddress, i)).bind().syncUninterruptibly()); + } @@ -3913,14 +3075,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + final NetworkManager networkmanager = (NetworkManager) iterator.next(); + + if (!networkmanager.h()) { -+ if (!networkmanager.g()) { -+ iterator.remove(); -+ networkmanager.l(); -+ } else { ++ if (networkmanager.isConnected()) { + try { + networkmanager.a(); + } catch (Exception exception) { -+ if (networkmanager.c()) { ++ if (networkmanager.isLocal()) { + CrashReport crashreport = CrashReport.a(exception, "Ticking memory connection"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Ticking connection"); + @@ -3939,13 +3098,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 GenericFutureListener() { ++ networkmanager.sendPacket(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener() { + public void operationComplete(Future future) throws Exception { + networkmanager.close(chatcomponenttext); + } + }, new GenericFutureListener[0]); -+ networkmanager.k(); ++ networkmanager.stopReading(); + } ++ } else { ++ iterator.remove(); ++ networkmanager.handleDisconnection(); + } + } + } @@ -4028,14 +3190,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.e.add(statistic); + if (statistic.d() && j == 0 && i > 0) { + this.g = true; -+ if (this.c.aB()) { ++ if (this.c.ax()) { + 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.aB()) { ++ if (this.c.ax()) { + this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement.taken", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()})); + } + } @@ -4138,7 +3300,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void a(EntityPlayer entityplayer) { -+ int i = this.c.at(); ++ int i = this.c.ap(); + HashMap hashmap = Maps.newHashMap(); + + if (this.g || i - this.f > 300) { @@ -4192,24 +3354,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public abstract class StructureGenerator extends WorldGenBase { + -+ private PersistentStructure d; -+ protected Map e = Maps.newHashMap(); ++ private PersistentStructure a; ++ protected Map c = Maps.newHashMap(); + + public StructureGenerator() {} + + public abstract String a(); + -+ protected final void a(World world, final int i, final int j, int k, int l, ChunkSnapshot chunksnapshot) { ++ protected final synchronized 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(); ++ if (!this.c.containsKey(Long.valueOf(ChunkCoordIntPair.a(i, j)))) { ++ this.f.nextInt(); + + try { + if (this.a(i, j)) { + StructureStart structurestart = this.b(i, j); + -+ this.e.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); -+ this.a(i, j, structurestart); ++ this.c.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); ++ if (structurestart.a()) { ++ this.a(i, j, structurestart); ++ } + } + + } catch (Throwable throwable) { @@ -4249,17 +3413,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ public boolean a(World world, Random random, ChunkCoordIntPair chunkcoordintpair) { ++ public synchronized boolean a(World world, Random random, ChunkCoordIntPair chunkcoordintpair) { + this.a(world); + int i = (chunkcoordintpair.x << 4) + 8; + int j = (chunkcoordintpair.z << 4) + 8; + boolean flag = false; -+ Iterator iterator = this.e.values().iterator(); ++ Iterator iterator = this.c.values().iterator(); + + while (iterator.hasNext()) { + StructureStart structurestart = (StructureStart) iterator.next(); + -+ if (structurestart.d() && structurestart.a(chunkcoordintpair) && structurestart.a().a(i, j, i + 15, j + 15)) { ++ if (structurestart.a() && structurestart.a(chunkcoordintpair) && structurestart.b().a(i, j, i + 15, j + 15)) { + structurestart.a(world, random, new StructureBoundingBox(i, j, i + 15, j + 15)); + structurestart.b(chunkcoordintpair); + flag = true; @@ -4271,18 +3435,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public boolean b(BlockPosition blockposition) { -+ this.a(this.c); ++ this.a(this.g); + return this.c(blockposition) != null; + } + + protected StructureStart c(BlockPosition blockposition) { -+ Iterator iterator = this.e.values().iterator(); ++ Iterator iterator = this.c.values().iterator(); + + while (iterator.hasNext()) { + StructureStart structurestart = (StructureStart) iterator.next(); + -+ if (structurestart.d() && structurestart.a().b((BaseBlockPosition) blockposition)) { -+ Iterator iterator1 = structurestart.b().iterator(); ++ if (structurestart.a() && structurestart.b().b((BaseBlockPosition) blockposition)) { ++ Iterator iterator1 = structurestart.c().iterator(); + + while (iterator1.hasNext()) { + StructurePiece structurepiece = (StructurePiece) iterator1.next(); @@ -4297,9 +3461,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + -+ public boolean a(World world, BlockPosition blockposition) { ++ public boolean b(World world, BlockPosition blockposition) { + this.a(world); -+ Iterator iterator = this.e.values().iterator(); ++ Iterator iterator = this.c.values().iterator(); + + StructureStart structurestart; + @@ -4309,25 +3473,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + structurestart = (StructureStart) iterator.next(); -+ } while (!structurestart.d() || !structurestart.a().b((BaseBlockPosition) blockposition)); ++ } while (!structurestart.a() || !structurestart.b().b((BaseBlockPosition) blockposition)); + + return true; + } + + public BlockPosition getNearestGeneratedFeature(World world, BlockPosition blockposition) { -+ this.c = world; ++ this.g = world; + this.a(world); -+ this.b.setSeed(world.getSeed()); -+ long i = this.b.nextLong(); -+ long j = this.b.nextLong(); ++ this.f.setSeed(world.getSeed()); ++ long i = this.f.nextLong(); ++ long j = this.f.nextLong(); + long k = (long) (blockposition.getX() >> 4) * i; + long l = (long) (blockposition.getZ() >> 4) * j; + -+ this.b.setSeed(k ^ l ^ world.getSeed()); ++ this.f.setSeed(k ^ l ^ world.getSeed()); + this.a(world, blockposition.getX() >> 4, blockposition.getZ() >> 4, 0, 0, (ChunkSnapshot) null); + double d0 = Double.MAX_VALUE; + BlockPosition blockposition1 = null; -+ Iterator iterator = this.e.values().iterator(); ++ Iterator iterator = this.c.values().iterator(); + + BlockPosition blockposition2; + double d1; @@ -4335,11 +3499,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + while (iterator.hasNext()) { + StructureStart structurestart = (StructureStart) iterator.next(); + -+ if (structurestart.d()) { -+ StructurePiece structurepiece = (StructurePiece) structurestart.b().get(0); ++ if (structurestart.a()) { ++ StructurePiece structurepiece = (StructurePiece) structurestart.c().get(0); + + blockposition2 = structurepiece.a(); -+ d1 = blockposition2.i(blockposition); ++ d1 = blockposition2.k(blockposition); + if (d1 < d0) { + d0 = d1; + blockposition1 = blockposition2; @@ -4350,7 +3514,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (blockposition1 != null) { + return blockposition1; + } else { -+ List list = this.z_(); ++ List list = this.E_(); + + if (list != null) { + BlockPosition blockposition3 = null; @@ -4358,7 +3522,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + while (iterator1.hasNext()) { + blockposition2 = (BlockPosition) iterator1.next(); -+ d1 = blockposition2.i(blockposition); ++ d1 = blockposition2.k(blockposition); + if (d1 < d0) { + d0 = d1; + blockposition3 = blockposition2; @@ -4372,18 +3536,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ protected List z_() { ++ protected List E_() { + return null; + } + -+ private void a(World world) { -+ if (this.d == null) { -+ this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a()); -+ if (this.d == null) { -+ this.d = new PersistentStructure(this.a()); -+ world.a(this.a(), (PersistentBase) this.d); ++ protected void a(World world) { ++ if (this.a == null) { ++ this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a()); ++ if (this.a == null) { ++ this.a = new PersistentStructure(this.a()); ++ world.a(this.a(), (PersistentBase) this.a); + } else { -+ NBTTagCompound nbttagcompound = this.d.a(); ++ NBTTagCompound nbttagcompound = this.a.a(); + Iterator iterator = nbttagcompound.c().iterator(); + + while (iterator.hasNext()) { @@ -4399,7 +3563,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + StructureStart structurestart = WorldGenFactory.a(nbttagcompound1, world); + + if (structurestart != null) { -+ this.e.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); ++ this.c.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); + } + } + } @@ -4410,8 +3574,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + private void a(int i, int j, StructureStart structurestart) { -+ this.d.a(structurestart.a(i, j), i, j); -+ this.d.c(); ++ this.a.a(structurestart.a(i, j), i, j); ++ this.a.c(); + } + + protected abstract boolean a(int i, int j); @@ -4475,7 +3639,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + k2 = k + j2; + BlockPosition blockposition2 = new BlockPosition(k1, k2, l1); -+ Material material = world.getType(blockposition2).getBlock().getMaterial(); ++ Material material = world.getType(blockposition2).getMaterial(); + + if (material == Material.AIR || material == Material.LEAVES) { + this.b(world, blockposition2); @@ -4594,9 +3758,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + private void a(World world, int i, int j, int k) { + BlockPosition blockposition = new BlockPosition(i, j, k); -+ Block block = world.getType(blockposition).getBlock(); ++ Material material = world.getType(blockposition).getMaterial(); + -+ if (block.getMaterial() == Material.AIR) { ++ if (material == Material.AIR) { + this.a(world, blockposition, WorldGenForestTree.b); + } + @@ -4620,16 +3784,16 @@ 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 int g; ++ private static final List a = Arrays.asList(new BiomeBase[] { Biomes.d, Biomes.s, Biomes.w, Biomes.x, Biomes.h, Biomes.n, Biomes.F}); ++ private List b; ++ private int d; + private int h; + + public WorldGenLargeFeature() { -+ this.f = Lists.newArrayList(); -+ this.g = 32; ++ this.b = Lists.newArrayList(); ++ this.d = 32; + this.h = 8; -+ this.f.add(new BiomeBase.BiomeMeta(EntityWitch.class, 1, 1, 1)); ++ this.b.add(new BiomeBase.BiomeMeta(EntityWitch.class, 1, 1, 1)); + } + + public WorldGenLargeFeature(Map map) { @@ -4640,7 +3804,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Entry entry = (Entry) iterator.next(); + + if (((String) entry.getKey()).equals("distance")) { -+ this.g = MathHelper.a((String) entry.getValue(), this.g, this.h + 1); ++ this.d = MathHelper.a((String) entry.getValue(), this.d, this.h + 1); + } + } + @@ -4655,29 +3819,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int l = j; + + if (i < 0) { -+ i -= this.g - 1; ++ i -= this.d - 1; + } + + if (j < 0) { -+ j -= this.g - 1; ++ j -= this.d - 1; + } + -+ int i1 = i / this.g; -+ int j1 = j / this.g; -+ Random random = this.c.a(i1, j1, 14357617); ++ int i1 = i / this.d; ++ int j1 = j / this.d; ++ Random random = this.g.a(i1, j1, 14357617); + -+ i1 *= this.g; -+ j1 *= this.g; -+ i1 += random.nextInt(this.g - this.h); -+ j1 += random.nextInt(this.g - this.h); ++ i1 *= this.d; ++ j1 *= this.d; ++ i1 += random.nextInt(this.d - this.h); ++ j1 += random.nextInt(this.d - this.h); + if (k == i1 && l == j1) { -+ BiomeBase biomebase = this.c.getWorldChunkManager().getBiome(new BlockPosition(k * 16 + 8, 0, l * 16 + 8)); ++ BiomeBase biomebase = this.g.getWorldChunkManager().getBiome(new BlockPosition(k * 16 + 8, 0, l * 16 + 8)); + + if (biomebase == null) { + return false; + } + -+ Iterator iterator = WorldGenLargeFeature.d.iterator(); ++ Iterator iterator = WorldGenLargeFeature.a.iterator(); + + while (iterator.hasNext()) { + BiomeBase biomebase1 = (BiomeBase) iterator.next(); @@ -4692,14 +3856,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + protected StructureStart b(int i, int j) { -+ return new WorldGenLargeFeature.WorldGenLargeFeatureStart(this.c, this.b, i, j); ++ return new WorldGenLargeFeature.WorldGenLargeFeatureStart(this.g, this.f, i, j); + } + + public boolean a(BlockPosition blockposition) { + StructureStart structurestart = this.c(blockposition); + + if (structurestart != null && structurestart instanceof WorldGenLargeFeature.WorldGenLargeFeatureStart && !structurestart.a.isEmpty()) { -+ StructurePiece structurepiece = (StructurePiece) structurestart.a.getFirst(); ++ StructurePiece structurepiece = (StructurePiece) structurestart.a.get(0); + + return structurepiece instanceof WorldGenRegistration.WorldGenWitchHut; + } else { @@ -4708,7 +3872,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public List b() { -+ return this.f; ++ return this.b; + } + + public static class WorldGenLargeFeatureStart extends StructureStart { @@ -4716,15 +3880,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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)); ++ this(world, random, i, j, world.getBiome(new BlockPosition(i * 16 + 8, 0, j * 16 + 8))); ++ } + -+ if (biomebase != BiomeBase.JUNGLE && biomebase != BiomeBase.JUNGLE_HILLS) { -+ if (biomebase == BiomeBase.SWAMPLAND) { ++ public WorldGenLargeFeatureStart(World world, Random random, int i, int j, BiomeBase biomebase) { ++ super(i, j); ++ if (biomebase != Biomes.w && biomebase != Biomes.x) { ++ if (biomebase == Biomes.h) { + 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) { ++ } else if (biomebase != Biomes.d && biomebase != Biomes.s) { ++ if (biomebase == Biomes.n || biomebase == Biomes.F) { ++ WorldGenRegistration.b worldgenregistration_b = new WorldGenRegistration.b(random, i * 16, j * 16); ++ ++ this.a.add(worldgenregistration_b); ++ } ++ } else { + WorldGenRegistration.WorldGenPyramidPiece worldgenregistration_worldgenpyramidpiece = new WorldGenRegistration.WorldGenPyramidPiece(random, i * 16, j * 16); + + this.a.add(worldgenregistration_worldgenpyramidpiece); @@ -4735,7 +3907,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a.add(worldgenregistration_worldgenjungletemple); + } + -+ this.c(); ++ this.d(); + } + } +} @@ -4784,15 +3956,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + float f2 = (float) MathHelper.a(j1) - 0.25F; + + if ((i1 == 0 && j1 == 0 || f1 * f1 + f2 * f2 <= f * f) && (i1 != -l && i1 != l && j1 != -l && j1 != l || random.nextFloat() <= 0.75F)) { -+ Block block = world.getType(blockposition.a(i1, k, j1)).getBlock(); ++ IBlockData iblockdata = world.getType(blockposition.a(i1, k, j1)); ++ Block block = iblockdata.getBlock(); + -+ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { ++ if (iblockdata.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.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) { ++ iblockdata = world.getType(blockposition.a(i1, -k, j1)); ++ block = iblockdata.getBlock(); ++ if (iblockdata.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { + this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData()); + } + } @@ -4821,9 +3995,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + while (true) { + if (blockposition1.getY() > 50) { -+ Block block1 = world.getType(blockposition1).getBlock(); ++ IBlockData iblockdata1 = world.getType(blockposition1); ++ Block block1 = iblockdata1.getBlock(); + -+ if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { ++ if (iblockdata1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { + this.a(world, blockposition1, Blocks.PACKED_ICE.getBlockData()); + blockposition1 = blockposition1.down(); + --l1; @@ -4862,13 +4037,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class WorldGenVillage extends StructureGenerator { + -+ public static final List d = Arrays.asList(new BiomeBase[] { BiomeBase.PLAINS, BiomeBase.DESERT, BiomeBase.SAVANNA}); -+ private int f; -+ private int g; ++ public static final List a = Arrays.asList(new BiomeBase[] { Biomes.c, Biomes.d, Biomes.K}); ++ private int b; ++ private int d; + private int h; + + public WorldGenVillage() { -+ this.g = 32; ++ this.d = 32; + this.h = 8; + } + @@ -4880,9 +4055,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Entry entry = (Entry) iterator.next(); + + if (((String) entry.getKey()).equals("size")) { -+ this.f = MathHelper.a((String) entry.getValue(), this.f, 0); ++ this.b = MathHelper.a((String) entry.getValue(), this.b, 0); + } else if (((String) entry.getKey()).equals("distance")) { -+ this.g = MathHelper.a((String) entry.getValue(), this.g, this.h + 1); ++ this.d = MathHelper.a((String) entry.getValue(), this.d, this.h + 1); + } + } + @@ -4897,23 +4072,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int l = j; + + if (i < 0) { -+ i -= this.g - 1; ++ i -= this.d - 1; + } + + if (j < 0) { -+ j -= this.g - 1; ++ j -= this.d - 1; + } + -+ int i1 = i / this.g; -+ int j1 = j / this.g; -+ Random random = this.c.a(i1, j1, 10387312); ++ int i1 = i / this.d; ++ int j1 = j / this.d; ++ Random random = this.g.a(i1, j1, 10387312); + -+ i1 *= this.g; -+ j1 *= this.g; -+ i1 += random.nextInt(this.g - this.h); -+ j1 += random.nextInt(this.g - this.h); ++ i1 *= this.d; ++ j1 *= this.d; ++ i1 += random.nextInt(this.d - this.h); ++ j1 += random.nextInt(this.d - this.h); + if (k == i1 && l == j1) { -+ boolean flag = this.c.getWorldChunkManager().a(k * 16 + 8, l * 16 + 8, 0, WorldGenVillage.d); ++ boolean flag = this.g.getWorldChunkManager().a(k * 16 + 8, l * 16 + 8, 0, WorldGenVillage.a); + + if (flag) { + return true; @@ -4924,7 +4099,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + protected StructureStart b(int i, int j) { -+ return new WorldGenVillage.WorldGenVillageStart(this.c, this.b, i, j, this.f); ++ return new WorldGenVillage.WorldGenVillageStart(this.g, this.f, i, j, this.b); + } + + public static class WorldGenVillageStart extends StructureStart { @@ -4939,7 +4114,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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); ++ worldgenvillagepieces_worldgenvillagestartpiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, this.a, random); + List list1 = worldgenvillagepieces_worldgenvillagestartpiece.g; + List list2 = worldgenvillagepieces_worldgenvillagestartpiece.f; + @@ -4951,15 +4126,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (list1.isEmpty()) { + l = random.nextInt(list2.size()); + structurepiece = (StructurePiece) list2.remove(l); -+ structurepiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, (List) this.a, random); ++ structurepiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, this.a, random); + } else { + l = random.nextInt(list1.size()); + structurepiece = (StructurePiece) list1.remove(l); -+ structurepiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, (List) this.a, random); ++ structurepiece.a((StructurePiece) worldgenvillagepieces_worldgenvillagestartpiece, this.a, random); + } + } + -+ this.c(); ++ this.d(); + l = 0; + Iterator iterator = this.a.iterator(); + @@ -4974,7 +4149,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.c = l > 2; + } + -+ public boolean d() { ++ public boolean a() { + return this.c; + } + @@ -4989,6 +4164,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} +diff --git a/src/main/java/net/minecraft/server/WorldGenVillagePieces.java b/src/main/java/net/minecraft/server/WorldGenVillagePieces.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/WorldGenVillagePieces.java ++++ b/src/main/java/net/minecraft/server/WorldGenVillagePieces.java +@@ -0,0 +0,0 @@ public class WorldGenVillagePieces { + + protected void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); +- nbttagcompound.setInt("CA", Block.REGISTRY.a(this.a)); +- nbttagcompound.setInt("CB", Block.REGISTRY.a(this.b)); +- nbttagcompound.setInt("CC", Block.REGISTRY.a(this.c)); +- nbttagcompound.setInt("CD", Block.REGISTRY.a(this.d)); ++ nbttagcompound.setInt("CA", Block.REGISTRY.a(this.a)); // Spigot - decompile error ++ nbttagcompound.setInt("CB", Block.REGISTRY.a(this.b)); // Spigot - decompile error ++ nbttagcompound.setInt("CC", Block.REGISTRY.a(this.c)); // Spigot - decompile error ++ nbttagcompound.setInt("CD", Block.REGISTRY.a(this.d)); // Spigot - decompile error + } + + protected void b(NBTTagCompound nbttagcompound) { +@@ -0,0 +0,0 @@ public class WorldGenVillagePieces { + + protected void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); +- nbttagcompound.setInt("CA", Block.REGISTRY.a(this.a)); +- nbttagcompound.setInt("CB", Block.REGISTRY.a(this.b)); ++ nbttagcompound.setInt("CA", Block.REGISTRY.a(this.a)); // Spigot - decompile error ++ nbttagcompound.setInt("CB", Block.REGISTRY.a(this.b)); // Spigot - decompile error + } + + protected void b(NBTTagCompound nbttagcompound) { +@@ -0,0 +0,0 @@ public class WorldGenVillagePieces { + entityvillager.setPositionRotation((double) j1 + 0.5D, (double) k1, (double) l1 + 0.5D, 0.0F, 0.0F); + entityvillager.prepare(world.D(new BlockPosition(entityvillager)), (GroupDataEntity) null); + entityvillager.setProfession(this.c(i1, entityvillager.getProfession())); +- world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason ++ world.addEntity(entityvillager); + } + + } diff --git a/src/main/java/org/spigotmc/SneakyThrow.java b/src/main/java/org/spigotmc/SneakyThrow.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch b/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch index 29c53fa366..06f4c64339 100644 --- a/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch +++ b/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch @@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot Start + public ServerConnection getServerConnection() + { -+ return this.q; ++ return this.p; + } + // Spigot End - public ServerConnection aq() { - return this.q; + public ServerConnection am() { + return this.p; } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0005-Spigot-Configuration.patch b/CraftBukkit-Patches/0005-Spigot-Configuration.patch index e974fc02a4..4533013c01 100644 --- a/CraftBukkit-Patches/0005-Spigot-Configuration.patch +++ b/CraftBukkit-Patches/0005-Spigot-Configuration.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - if (this.R() < 0) { + if (this.P() < 0) { this.setPort(this.propertyManager.getInt("server-port", 25565)); } + // Spigot start diff --git a/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch b/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch deleted file mode 100644 index d190494b76..0000000000 --- a/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch +++ /dev/null @@ -1,194 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 11 Jun 2013 12:56:02 +1000 -Subject: [PATCH] Better Chunk Tick Selection - -An optimized chunk ticking algorithm which better selects chunks around players which are active on the server. - -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 { - 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 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; - private int tickPosition; -+ -+ // Spigot start -+ protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList; -+ protected float growthOdds = 100; -+ protected float modifiedOdds = 100; -+ private final byte chunkTickRadius; -+ -+ public static long chunkToKey(int x, int z) -+ { -+ long k = ( ( ( (long) x ) & 0xFFFF0000L ) << 16 ) | ( ( ( (long) x ) & 0x0000FFFFL ) << 0 ); -+ k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 ); -+ return k; -+ } -+ -+ public static int keyToX(long k) -+ { -+ return (int) ( ( ( k >> 16 ) & 0xFFFF0000 ) | ( k & 0x0000FFFF ) ); -+ } -+ -+ public static int keyToZ(long k) -+ { -+ return (int) ( ( ( k >> 32 ) & 0xFFFF0000L ) | ( ( k >> 16 ) & 0x0000FFFF ) ); -+ } -+ // Spigot end -+ - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot - - public CraftWorld getWorld() { -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit - this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit - // CraftBukkit end -+ // Spigot start -+ this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 ); -+ 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.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; - -+ // Spigot start -+ int optimalChunks = spigotConfig.chunksPerTick; -+ // Quick conditions to allow us to exist early -+ if ( optimalChunks > 0 ) { -+ // Keep chunks with growth inside of the optimal chunk range -+ int chunksPerPlayer = Math.min( 200, Math.max( 1, (int) ( ( ( optimalChunks - players.size() ) / (double) players.size() ) + 0.5 ) ) ); -+ int randRange = 3 + chunksPerPlayer / 30; -+ // Limit to normal tick radius - including view distance -+ randRange = ( randRange > chunkTickRadius ) ? chunkTickRadius : randRange; -+ // odds of growth happening vs growth happening in vanilla -+ this.growthOdds = this.modifiedOdds = Math.max( 35, Math.min( 100, ( ( chunksPerPlayer + 1 ) * 100F ) / 15F ) ); -+ // Spigot end - for (i = 0; i < this.players.size(); ++i) { - entityhuman = (EntityHuman) this.players.get(i); - j = MathHelper.floor(entityhuman.locX / 16.0D); - k = MathHelper.floor(entityhuman.locZ / 16.0D); - l = this.q(); - -- for (int i1 = -l; i1 <= l; ++i1) { -- for (int j1 = -l; j1 <= l; ++j1) { -- this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(i1 + j, j1 + k)); -+ // Spigot start - Always update the chunk the player is on -+ long key = chunkToKey( j, k ); -+ int existingPlayers = Math.max( 0, chunkTickList.get( key ) ); // filter out -1 -+ chunkTickList.put( key, (short) ( existingPlayers + 1 ) ); -+ -+ // Check and see if we update the chunks surrounding the player this tick -+ for ( int chunk = 0; chunk < chunksPerPlayer; chunk++ ) -+ { -+ int dx = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange ); -+ int dz = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange ); -+ long hash = chunkToKey( dx + j, dz + k ); -+ if ( !chunkTickList.contains( hash ) && this.chunkProvider.isChunkLoaded(dx + j, dz + k ) ) -+ { -+ chunkTickList.put( hash, (short) -1 ); // no players - } - } - } -+ // Spigot End -+ } - - this.methodProfiler.b(); - if (this.L > 0) { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - protected void h() { - super.h(); - if (this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { -- Iterator iterator = this.chunkTickList.iterator(); -+ // Spigot start -+ gnu.trove.iterator.TLongShortIterator iterator = this.chunkTickList.iterator(); - - while (iterator.hasNext()) { -- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); -+ iterator.advance(); -+ long chunkCoord = iterator.key(); - -- this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z).b(false); -+ this.getChunkAt(World.keyToX( chunkCoord ), World.keyToZ( chunkCoord )).b(false); -+ // Spigot end - } - - } else { -@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - // ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) iterator1.next(); - // int k = chunkcoordintpair1.x * 16; - // int l = chunkcoordintpair1.z * 16; -- for (long chunkCoord : chunkTickList.popAll()) { -- int chunkX = LongHash.msw(chunkCoord); -- int chunkZ = LongHash.lsw(chunkCoord); -+ // Spigot start -+ for (gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext(); ) -+ { -+ iter.advance(); -+ long chunkCoord = iter.key(); -+ int chunkX = World.keyToX( chunkCoord ); -+ int chunkZ = World.keyToZ( chunkCoord ); -+ // If unloaded, or in procedd of being unloaded, drop it -+ if ( ( !this.chunkProvider.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) ) -+ { -+ iter.remove(); -+ continue; -+ } -+ // Spigot end -+ // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); - int k = chunkX * 16; - int l = chunkZ * 16; - -@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - } - - } -+ // Spigot Start -+ if ( spigotConfig.clearChunksOnTick ) -+ { -+ chunkTickList.clear(); -+ } -+ // Spigot End - } - - protected BlockPosition a(BlockPosition blockposition) { -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 - config.addDefault( "world-settings.default." + path, def ); - return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) ); - } -+ -+ public int chunksPerTick; -+ public boolean clearChunksOnTick; -+ private void chunksPerTick() -+ { -+ chunksPerTick = getInt( "chunks-per-tick", 650 ); -+ log( "Chunks to Grow per Tick: " + chunksPerTick ); -+ -+ clearChunksOnTick = getBoolean( "clear-tick-list", false ); -+ log( "Clear tick list: " + clearChunksOnTick ); -+ } - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch b/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch similarity index 70% rename from CraftBukkit-Patches/0007-Crop-Growth-Rates.patch rename to CraftBukkit-Patches/0006-Crop-Growth-Rates.patch index 45c15a1162..42a3328508 100644 --- a/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch +++ b/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch @@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block { - return 0; + private static void a(int i, String s, Block block) { + a(i, new MinecraftKey(s), block); } - // CraftBukkit end + + // Spigot start + public static float range(float min, float value, float max) { @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); - if (j == 15) { -+ if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot ++ if (j >= (byte) range(3, (world.spigotConfig.cactusModifier / 100 * 15) + 0.5F, 15)) { // Spigot // world.setTypeUpdate(blockposition1, this.getBlockData()); // CraftBukkit IBlockData iblockdata1 = iblockdata.set(BlockCactus.AGE, Integer.valueOf(0)); @@ -44,28 +44,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BlockCrops.java +++ b/src/main/java/net/minecraft/server/BlockCrops.java @@ -0,0 +0,0 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement - if (i < 7) { + if (i < this.g()) { float f = a((Block) this, world, blockposition); - if (random.nextInt((int) (25.0F / f) + 1) == 0) { -- // 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)); ++ if (random.nextInt((int) (world.spigotConfig.wheatModifier / 100 * (25.0F / f)) + 1) == 0) { // Spigot // CraftBukkit start + // CraftBukkit start + IBlockData data = this.setAge(i + 1); 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 ---- a/src/main/java/net/minecraft/server/BlockGrass.java -+++ b/src/main/java/net/minecraft/server/BlockGrass.java -@@ -0,0 +0,0 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement { - // CraftBukkit end - } else { - if (world.getLightLevel(blockposition.up()) >= 9) { -- for (int i = 0; i < 4; ++i) { -+ for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot - BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); - Block block = world.getType(blockposition1.up()).getBlock(); - IBlockData iblockdata1 = world.getType(blockposition1); diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockMushroom.java @@ -75,23 +61,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { final int sourceX = blockposition.getX(), sourceY = blockposition.getY(), sourceZ = blockposition.getZ(); // CraftBukkit - if (random.nextInt(25) == 0) { -+ if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot int i = 5; ++ if (random.nextInt(Math.max(1, (int) world.spigotConfig.mushroomModifier / 100 * 25)) == 0) { // Spigot int i = 5; boolean flag = true; Iterator iterator = BlockPosition.b(blockposition.a(-4, -1, -4), blockposition.a(4, 1, 4)).iterator(); -diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockMycel.java -+++ b/src/main/java/net/minecraft/server/BlockMycel.java -@@ -0,0 +0,0 @@ public class BlockMycel extends Block { - // CraftBukkit end - } else { - if (world.getLightLevel(blockposition.up()) >= 9) { -- for (int i = 0; i < 4; ++i) { -+ for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot - BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); - IBlockData iblockdata1 = world.getType(blockposition1); - Block block = world.getType(blockposition1.up()).getBlock(); diff --git a/src/main/java/net/minecraft/server/BlockNetherWart.java b/src/main/java/net/minecraft/server/BlockNetherWart.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockNetherWart.java @@ -101,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i = ((Integer) iblockdata.get(BlockNetherWart.AGE)).intValue(); - if (i < 3 && random.nextInt(10) == 0) { -+ if (i < 3 && random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.wartModifier * 10)) == 0) { // Spigot ++ if (i < 3 && random.nextInt(Math.max(1, (int) world.spigotConfig.wartModifier / 100 * 10)) == 0) { // Spigot iblockdata = iblockdata.set(BlockNetherWart.AGE, Integer.valueOf(i + 1)); // world.setTypeAndData(blockposition, iblockdata, 2); // CraftBukkit org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(iblockdata)); // CraftBukkit @@ -114,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); - if (j == 15) { -+ if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot ++ if (j >= (byte) range(3, (world.spigotConfig.caneModifier /100 * 15) + 0.5F, 15)) { // Spigot // CraftBukkit start // world.setTypeUpdate(blockposition.up(), this.getBlockData()); // CraftBukkit BlockPosition upPos = blockposition.up(); @@ -127,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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) { ++ if (world.getLightLevel(blockposition.up()) >= 9 && (random.nextInt(Math.max(2, (int) ((world.spigotConfig.saplingModifier / 100 * 7) + 0.5F))) == 0)) { // Spigot) { // CraftBukkit start world.captureTreeGeneration = true; // CraftBukkit end @@ -140,7 +113,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 float f = BlockCrops.a((Block) this, world, blockposition); - if (random.nextInt((int) (25.0F / f) + 1) == 0) { -+ if (random.nextInt((int) (world.growthOdds / (this == Blocks.PUMPKIN_STEM? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot ++ if (random.nextInt((int) ((this == Blocks.PUMPKIN_STEM? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / 100 * (25.0F / f)) + 1) == 0) { // Spigot int i = ((Integer) iblockdata.get(BlockStem.AGE)).intValue(); if (i < 7) { @@ -149,8 +122,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -0,0 +0,0 @@ public class SpigotWorldConfig - clearChunksOnTick = getBoolean( "clear-tick-list", false ); - log( "Clear tick list: " + clearChunksOnTick ); + config.addDefault( "world-settings.default." + path, def ); + return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) ); } + + // Crop growth rates diff --git a/CraftBukkit-Patches/0008-Merge-tweaks-and-configuration.patch b/CraftBukkit-Patches/0007-Merge-tweaks-and-configuration.patch similarity index 99% rename from CraftBukkit-Patches/0008-Merge-tweaks-and-configuration.patch rename to CraftBukkit-Patches/0007-Merge-tweaks-and-configuration.patch index d9015ca57a..801d062c57 100644 --- a/CraftBukkit-Patches/0008-Merge-tweaks-and-configuration.patch +++ b/CraftBukkit-Patches/0007-Merge-tweaks-and-configuration.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityItem extends Entity { } - private void w() { + private void x() { - Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(0.5D, 0.0D, 0.5D)).iterator(); + // Spigot start + double radius = world.spigotConfig.itemMerge; diff --git a/CraftBukkit-Patches/0009-Async-Operation-Catching.patch b/CraftBukkit-Patches/0008-Async-Operation-Catching.patch similarity index 96% rename from CraftBukkit-Patches/0009-Async-Operation-Catching.patch rename to CraftBukkit-Patches/0008-Async-Operation-Catching.patch index 228d97bf87..a3fc988f95 100644 --- a/CraftBukkit-Patches/0009-Async-Operation-Catching.patch +++ b/CraftBukkit-Patches/0008-Async-Operation-Catching.patch @@ -46,9 +46,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; - } + try { + if (this.trackedEntities.b(entity.getId())) { + throw new IllegalStateException("Entity is already tracked!"); @@ -0,0 +0,0 @@ public class EntityTracker { } @@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc.AsyncCatcher.catchOp( "player tracker clear"); // Spigot if (this.trackedPlayers.contains(entityplayer)) { this.trackedPlayers.remove(entityplayer); - entityplayer.d(this.tracker); + this.tracker.c(entityplayer); 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 @@ -94,13 +94,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void removeEntity(Entity entity) { + org.spigotmc.AsyncCatcher.catchOp( "entity remove"); // Spigot + entity.b(false); entity.die(); if (entity instanceof EntityHuman) { - this.players.remove(entity); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { } - public void b(Collection collection) { + public void a(Collection collection) { + org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot // CraftBukkit start // this.entityList.addAll(collection); diff --git a/CraftBukkit-Patches/0010-View-Distance.patch b/CraftBukkit-Patches/0009-View-Distance.patch similarity index 89% rename from CraftBukkit-Patches/0010-View-Distance.patch rename to CraftBukkit-Patches/0009-View-Distance.patch index b1bf82310d..ee81aa3b5a 100644 --- a/CraftBukkit-Patches/0010-View-Distance.patch +++ b/CraftBukkit-Patches/0009-View-Distance.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap { - private final int[][] i = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}}; + private boolean m = true; private boolean wasNotEmpty; // CraftBukkit - add field - public PlayerChunkMap(WorldServer worldserver) { @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a(viewDistance); // Spigot } - public WorldServer a() { + public WorldServer getWorld() { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java @@ -31,9 +31,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.tracker = new EntityTracker(this); - this.manager = new PlayerChunkMap(this); + this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot - this.worldProvider.a(this); - this.chunkProvider = this.k(); - this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit + this.worldProvider.a((World) this); + this.chunkProvider = this.n(); + this.portalTravelAgent = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit 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/0011-Spigot-Timings.patch b/CraftBukkit-Patches/0010-Spigot-Timings.patch similarity index 90% rename from CraftBukkit-Patches/0011-Spigot-Timings.patch rename to CraftBukkit-Patches/0010-Spigot-Timings.patch index b4b5a44c4d..1529d37a70 100644 --- a/CraftBukkit-Patches/0011-Spigot-Timings.patch +++ b/CraftBukkit-Patches/0010-Spigot-Timings.patch @@ -12,19 +12,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Chunk { } - public void loadNearby(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) { + public void loadNearby(IChunkProvider ichunkprovider, ChunkGenerator chunkgenerator) { + world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot - boolean flag = ichunkprovider.isChunkLoaded(i, j - 1); - boolean flag1 = ichunkprovider.isChunkLoaded(i + 1, j); - boolean flag2 = ichunkprovider.isChunkLoaded(i, j + 1); + Chunk chunk = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ - 1); + Chunk chunk1 = ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ); + Chunk chunk2 = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ + 1); @@ -0,0 +0,0 @@ public class Chunk { - } + this.e(); } + world.timings.syncChunkLoadPostTimer.stopTiming(); // Spigot } - public BlockPosition h(BlockPosition blockposition) { + public BlockPosition f(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -34,27 +34,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (chunk == null) { + world.timings.syncChunkLoadTimer.startTiming(); // Spigot + long k = ChunkCoordIntPair.a(i, j); + chunk = this.loadChunk(i, j); - if (chunk == null) { - if (this.chunkProvider == null) { @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { } // CraftBukkit end - chunk.loadNearby(this, this, i, j); + chunk.loadNearby(this, this.chunkGenerator); + world.timings.syncChunkLoadTimer.stopTiming(); // Spigot } return chunk; -@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { - if (chunk != null) { - chunk.setLastSaved(this.world.getTime()); - if (this.chunkProvider != null) { -+ world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot - this.chunkProvider.recreateStructures(chunk, i, j); -+ world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot - } - } - diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -79,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (nbttaglist1 != null) { @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - } + chunk.g(true); } } - @@ -120,10 +110,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } - public void aO() { + public void aL() { + SpigotTimings.serverCommandTimer.startTiming(); // Spigot - while (!this.l.isEmpty()) { - ServerCommand servercommand = (ServerCommand) this.l.remove(0); + while (!this.serverCommandQueue.isEmpty()) { + ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer // CraftBukkit end @@ -132,28 +122,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + SpigotTimings.serverCommandTimer.stopTiming(); // Spigot } - public boolean ae() { + public boolean aa() { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ import org.bukkit.entity.Hanging; +@@ -0,0 +0,0 @@ import org.bukkit.block.BlockFace; + import org.bukkit.entity.Hanging; import org.bukkit.entity.LivingEntity; - import org.bukkit.entity.Painting; import org.bukkit.entity.Vehicle; +import org.spigotmc.CustomTimingsHandler; // Spigot import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; - import org.bukkit.event.painting.PaintingBreakByEntityEvent; + import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { + public boolean valid; // CraftBukkit public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949 - + public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot -+ - public int getId() { - return this.id; - } + + public Entity(World world) { + this.id = Entity.entityCount++; @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { } @@ -169,13 +158,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot } - private void recalcPosition() { + public void recalcPosition() { 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 @@ import org.bukkit.event.entity.EntityRegainHealthEvent; - import org.bukkit.event.vehicle.VehicleExitEvent; + import org.bukkit.event.player.PlayerItemConsumeEvent; // CraftBukkit end +import org.bukkit.craftbukkit.SpigotTimings; // Spigot @@ -186,25 +175,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } - public void t_() { + public void m() { + SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot - super.t_(); + super.m(); + this.cu(); if (!this.world.isClientSide) { - int i = this.bv(); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } } + SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot - this.m(); + this.n(); + SpigotTimings.timerEntityTickRest.startTiming(); // Spigot double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f = (float) (d0 * d0 + d1 * d1); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + this.bo = 0; + } - this.world.methodProfiler.b(); - this.aT += f2; + SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } @@ -214,9 +203,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.methodProfiler.a("ai"); + SpigotTimings.timerEntityAI.startTiming(); // Spigot - if (this.bD()) { - this.aY = false; - this.aZ = 0.0F; + if (this.cf()) { + this.bc = false; + this.bd = 0.0F; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.doTick(); this.world.methodProfiler.b(); @@ -226,37 +215,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.methodProfiler.b(); this.world.methodProfiler.a("jump"); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.aZ *= 0.98F; - this.ba *= 0.98F; - this.bb *= 0.9F; + this.be *= 0.98F; + this.bf *= 0.9F; + this.r(); + SpigotTimings.timerEntityAIMove.startTiming(); // Spigot - this.g(this.aZ, this.ba); + this.g(this.bd, this.be); + SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot this.world.methodProfiler.b(); this.world.methodProfiler.a("push"); - if (!this.world.isClientSide) { -+ SpigotTimings.timerEntityAICollision.startTiming(); // Spigot - this.bL(); -+ SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot - } - ++ SpigotTimings.timerEntityAICollision.startTiming(); // Spigot + this.cn(); ++ SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot this.world.methodProfiler.b(); + } + 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 @@ import jline.console.ConsoleReader; - import joptsimple.OptionSet; +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.Main; -+import org.bukkit.craftbukkit.SpigotTimings; // Spigot + // CraftBukkit start // CraftBukkit end ++import org.bukkit.craftbukkit.SpigotTimings; // Spigot public abstract class MinecraftServer implements Runnable, ICommandListener, IAsyncTaskHandler, IMojangStatistics { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - protected void z() {} - protected void A() throws ExceptionWorldConflict { // CraftBukkit - added throws +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + protected void B() {} + + protected void C() throws ExceptionWorldConflict { // CraftBukkit - added throws + SpigotTimings.serverTickTimer.startTiming(); // Spigot long i = System.nanoTime(); @@ -282,7 +270,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc.CustomTimingsHandler.tick(); // Spigot } - public void B() { + public void D() { @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.methodProfiler.c("levels"); @@ -350,7 +338,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.c("connection"); + SpigotTimings.connectionTimer.startTiming(); // Spigot - this.aq().c(); + this.am().c(); + SpigotTimings.connectionTimer.stopTiming(); // Spigot this.methodProfiler.c("players"); + SpigotTimings.playerListTimer.startTiming(); // Spigot @@ -359,8 +347,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.c("tickables"); + SpigotTimings.tickablesTimer.startTiming(); // Spigot - for (i = 0; i < this.p.size(); ++i) { - ((IUpdatePlayerListBox) this.p.get(i)).c(); + for (i = 0; i < this.o.size(); ++i) { + ((ITickable) this.o.get(i)).c(); } + SpigotTimings.tickablesTimer.stopTiming(); // Spigot @@ -370,15 +358,15 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- 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 +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { // CraftBukkit end 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); + this.LOGGER.info(this.player.getName() + " issued server command: " + s); -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { this.server.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -422,16 +410,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.Bukkit; +@@ -0,0 +0,0 @@ import com.google.common.collect.Maps; + import java.util.Map; + import org.bukkit.Bukkit; import org.bukkit.block.BlockState; - import org.bukkit.craftbukkit.util.CraftMagicNumbers; - import org.bukkit.craftbukkit.util.LongHashSet; +import org.bukkit.craftbukkit.SpigotTimings; // Spigot - import org.bukkit.generator.ChunkGenerator; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; + import org.bukkit.craftbukkit.event.CraftEventFactory; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - + private int tickPosition; public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + public final SpigotTimings.WorldTimingsHandler timings; // Spigot @@ -440,16 +428,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.world; } @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - }); - this.getServer().addWorld(this.world); - // CraftBukkit end -+ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings + this.isClientSide = flag; + this.N = worldprovider.getWorldBorder(); + this.getServer().addWorld(this.world); // CraftBukkit ++ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings } public World b() { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.g.clear(); - this.methodProfiler.c("regular"); + CrashReportSystemDetails crashreportsystemdetails1; + CrashReport crashreport1; + timings.entityTick.startTiming(); // Spigot // CraftBukkit start - Use field for loop variable @@ -457,32 +445,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity = (Entity) this.entityList.get(this.tickPosition); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { this.methodProfiler.a("tick"); - if (!entity.dead) { + if (!entity.dead && !(entity instanceof EntityPlayer)) { try { + SpigotTimings.tickEntityTimer.startTiming(); // Spigot this.g(entity); + SpigotTimings.tickEntityTimer.stopTiming(); // Spigot } catch (Throwable throwable1) { - crashreport = CrashReport.a(throwable1, "Ticking entity"); - crashreportsystemdetails = crashreport.a("Entity being ticked"); + crashreport1 = CrashReport.a(throwable1, "Ticking entity"); + crashreportsystemdetails1 = crashreport1.a("Entity being ticked"); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { this.methodProfiler.b(); } + timings.entityTick.stopTiming(); // Spigot this.methodProfiler.c("blockEntities"); -+ timings.tileEntityTick.startTiming(); // Spigot this.M = true; // CraftBukkit start - From below, clean up tile entities before ticking them - if (!this.c.isEmpty()) { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - if (this.isLoaded(blockposition) && this.N.a(blockposition)) { try { + this.methodProfiler.a(tileentity.getClass().getSimpleName()); + tileentity.tickTimer.startTiming(); // Spigot - ((IUpdatePlayerListBox) tileentity).c(); + ((ITickable) tileentity).c(); + this.methodProfiler.b(); } catch (Throwable throwable2) { - CrashReport crashreport1 = CrashReport.a(throwable2, "Ticking block entity"); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { tileentity.a(crashreportsystemdetails1); throw new ReportedException(crashreport1); @@ -503,7 +489,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + timings.tileEntityPending.startTiming(); // Spigot this.M = false; /* CraftBukkit start - Moved up - if (!this.c.isEmpty()) { + if (!this.tileEntityListUnload.isEmpty()) { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { this.b.clear(); } @@ -518,8 +504,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { + entity.tickTimer.startTiming(); // Spigot // CraftBukkit end - entity.P = entity.locX; - entity.Q = entity.locY; + entity.M = entity.locX; + entity.N = entity.locY; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { } } @@ -537,12 +523,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 long time = this.worldData.getTime(); if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) { + timings.mobSpawn.startTiming(); // Spigot - this.R.a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L); + this.spawnerCreature.a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L); + timings.mobSpawn.stopTiming(); // Spigot // CraftBukkit end } -- -+ // CraftBukkit end + + timings.doChunkUnload.startTiming(); // Spigot this.methodProfiler.c("chunkSource"); this.chunkProvider.unloadChunks(); @@ -558,7 +543,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + timings.doTickPending.stopTiming(); // Spigot this.methodProfiler.c("tickBlocks"); + timings.doTickTiles.startTiming(); // Spigot - this.h(); + this.j(); + timings.doTickTiles.stopTiming(); // Spigot this.methodProfiler.c("chunkMap"); + timings.doChunkMap.startTiming(); // Spigot @@ -571,11 +556,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + timings.doVillages.stopTiming(); // Spigot this.methodProfiler.c("portalForcer"); + timings.doPortalForcer.startTiming(); // Spigot - this.Q.a(this.getTime()); + this.portalTravelAgent.a(this.getTime()); + timings.doPortalForcer.stopTiming(); // Spigot this.methodProfiler.b(); + timings.doSounds.startTiming(); // Spigot - this.ak(); + this.ao(); ++ timings.doSounds.stopTiming(); // Spigot this.getWorld().processChunkGC(); // CraftBukkit + timings.doChunkGC.stopTiming(); // Spigot @@ -603,13 +589,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { - net.minecraft.server.Chunk chunk = world.chunkProviderServer.chunks.get(LongHash.toLong(x, z)); + net.minecraft.server.Chunk chunk = world.getChunkProviderServer().chunks.get(LongHash.toLong(x, z)); if (chunk == null) { + world.timings.syncChunkLoadTimer.startTiming(); // Spigot - chunk = world.chunkProviderServer.loadChunk(x, z); - - chunkLoadPostProcess(chunk, x, z); + chunk = world.getChunkProviderServer().getOrLoadChunkAt(x, z); + world.timings.syncChunkLoadTimer.stopTiming(); // Spigot } return chunk != null; @@ -797,9 +781,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider w; + private long v; + private int w; + private ConcurrentLinkedQueue x; + 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 private int neighbors = 0x1 << 12; @@ -0,0 +0,0 @@ public class Chunk { - entity.af = k; - entity.ag = this.locZ; + entity.ac = k; + entity.ad = this.locZ; this.entitySlices[k].add(entity); + // Spigot start - increment creature type count + // Keep this synced up with World.a(Class) @@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot end } - public boolean d(BlockPosition blockposition) { + public boolean c(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -83,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Long coord = it.next(); + int x = LongHash.msw( coord ); + int z = LongHash.lsw( coord ); -+ if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) ) ++ if ( !((ChunkProviderServer)server.chunkProvider).unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) ) + { + i += server.getChunkAt( x, z ).entityCount.get( oClass ); + } @@ -120,29 +120,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (k <= l1) { + if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 256) { + BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); Iterator iterator1 = this.b.iterator(); + int moblimit = (limit * i / 256) - mobcnt + 1; // Spigot - up to 1 more than limit - label115: + label120: - while (iterator1.hasNext()) { + while (iterator1.hasNext() && (moblimit > 0)) { // Spigot - while more allowed // CraftBukkit start = use LongHash and LongObjectHashMap long key = ((Long) iterator1.next()).longValue(); BlockPosition blockposition1 = getRandomPosition(worldserver, LongHash.msw(key), LongHash.lsw(key)); @@ -0,0 +0,0 @@ public final class SpawnerCreature { - worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); // CraftBukkit - Added a reason for spawning this creature + entityinsentient.die(); } +- if (l2 >= entityinsentient.cJ()) { + // Spigot start -+ if ( --moblimit <= 0 ) -+ { ++ if ( --moblimit <= 0 ) { + // If we're past limit, stop spawn -+ continue label115; -+ } -+ // Spigot end - if (l2 >= entityinsentient.bV()) { - continue label115; ++ // Spigot end + continue label120; } + } 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/0013-Handle-Null-Tile-Entities.patch b/CraftBukkit-Patches/0012-Handle-Null-Tile-Entities.patch similarity index 100% rename from CraftBukkit-Patches/0013-Handle-Null-Tile-Entities.patch rename to CraftBukkit-Patches/0012-Handle-Null-Tile-Entities.patch diff --git a/CraftBukkit-Patches/0043-Item-Despawn-Rate.patch b/CraftBukkit-Patches/0013-Item-Despawn-Rate.patch similarity index 88% rename from CraftBukkit-Patches/0043-Item-Despawn-Rate.patch rename to CraftBukkit-Patches/0013-Item-Despawn-Rate.patch index 3d10c4d226..8d6219ddec 100644 --- a/CraftBukkit-Patches/0043-Item-Despawn-Rate.patch +++ b/CraftBukkit-Patches/0013-Item-Despawn-Rate.patch @@ -9,9 +9,9 @@ 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(); + this.aj(); - if (!this.world.isClientSide && this.age >= 6000) { + if (!this.world.isClientSide && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot // CraftBukkit start - fire ItemDespawnEvent @@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -0,0 +0,0 @@ public class SpigotWorldConfig - log( "*** WARNING *** Please use this option with caution, SpigotMC is not responsible for any issues this option may cause in the future!" ); - } + mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 ); + log( "Mob Spawn Range: " + mobSpawnRange ); } + + public int itemDespawnRate; diff --git a/CraftBukkit-Patches/0014-Entity-Activation-Range.patch b/CraftBukkit-Patches/0014-Entity-Activation-Range.patch index c1ce3f8ef0..fe8a476590 100644 --- a/CraftBukkit-Patches/0014-Entity-Activation-Range.patch +++ b/CraftBukkit-Patches/0014-Entity-Activation-Range.patch @@ -16,37 +16,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int ticksLived; public int maxFireTicks; public int fireTicks; -- protected boolean inWater; +- public boolean inWater; + public boolean inWater; // Spigot - protected -> public // PAIL public int noDamageTicks; protected boolean justCreated; protected boolean fireProof; - protected DataWatcher datawatcher; - private double ar; - private double as; -- public boolean ad; -+ public boolean ad; public boolean isAddedToChunk() { return ad; } // Spigot // PAIL - public int ae; - public int af; - public int ag; @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949 - -+ // Spigot start public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot ++ // Spigot start + public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); + public final boolean defaultActivationState; + public long activatedTick = Integer.MIN_VALUE; + public void inactiveTick() { } + // Spigot end - public int getId() { - return this.id; + public Entity(World world) { + this.id = Entity.entityCount++; @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { this.setPosition(0.0D, 0.0D, 0.0D); if (world != null) { - this.dimension = world.worldProvider.getDimension(); + this.dimension = world.worldProvider.getDimensionManager().getDimensionID(); + // Spigot start + this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, world.spigotConfig); + } else { @@ -55,14 +46,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot end this.datawatcher = new DataWatcher(this); - this.datawatcher.a(0, Byte.valueOf((byte) 0)); + this.datawatcher.register(Entity.ax, Byte.valueOf((byte) 0)); diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- 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 bn; - public boolean ageLocked = false; // CraftBukkit + private float bx; + public boolean ageLocked; // CraftBukkit + // Spigot start + @Override @@ -96,17 +87,17 @@ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { - private int f = -1; - private Block g; - private int h; -- private boolean inGround; -+ public boolean inGround = false; // Spigot - private -> public - public int fromPlayer; +@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile { + private int at; + private Block au; + private int av; +- protected boolean inGround; ++ public boolean inGround; // Spigot - protected -> public + protected int b; + public EntityArrow.PickupStatus fromPlayer; public int shake; - public Entity shooter; -@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { - private double damage = 2.0D; +@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile { + private double damage; public int knockbackStrength; + // Spigot Start @@ -115,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + if ( this.inGround ) + { -+ this.ar += 1; // Despawn counter. First int after shooter ++ this.aw += 1; // Despawn counter. First int after shooter + } + super.inactiveTick(); + } @@ -123,27 +114,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public EntityArrow(World world) { super(world); - this.j = 10.0D; + this.h = -1; diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityFireworks.java +++ b/src/main/java/net/minecraft/server/EntityFireworks.java @@ -0,0 +0,0 @@ public class EntityFireworks extends Entity { - private int ticksFlown; - public int expectedLifespan; + this.setSize(0.25F, 0.25F); + } + // Spigot Start + @Override -+ public void inactiveTick() -+ { ++ public void inactiveTick() { + this.ticksFlown += 1; + super.inactiveTick(); + } + // Spigot End + - public EntityFireworks(World world) { - super(world); - this.setSize(0.25F, 0.25F); + protected void i() { + this.datawatcher.register(EntityFireworks.FIREWORK_ITEM, Optional.absent()); + } 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 @@ -174,7 +164,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end + - private void w() { + private void x() { // Spigot start double radius = world.spigotConfig.itemMerge; diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java @@ -182,8 +172,8 @@ 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 { - public int maxAirTicks = 300; - ArrayList drops = null; + ArrayList drops; + public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes; // CraftBukkit end + // Spigot start + public void inactiveTick() @@ -193,15 +183,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end - public void G() { + public void Q() { this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE); 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 { - this.g.clear(); - this.methodProfiler.c("regular"); + CrashReportSystemDetails crashreportsystemdetails1; + CrashReport crashreport1; + org.spigotmc.ActivationRange.activateEntities(this); // Spigot timings.entityTick.startTiming(); // Spigot @@ -221,7 +211,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } else { entity.tickTimer.startTiming(); // Spigot // CraftBukkit end - entity.P = entity.locX; + entity.M = entity.locX; diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java @@ -244,8 +234,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package org.spigotmc; + -+import java.util.ArrayList; -+import java.util.List; +import java.util.Set; +import net.minecraft.server.AxisAlignedBB; +import net.minecraft.server.Chunk; @@ -275,15 +263,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.World; +import org.bukkit.craftbukkit.SpigotTimings; -+import org.bukkit.entity.Creeper; + +public class ActivationRange +{ + -+ static AxisAlignedBB maxBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 ); -+ static AxisAlignedBB miscBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 ); -+ static AxisAlignedBB animalBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 ); -+ static AxisAlignedBB monsterBB = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 ); ++ static AxisAlignedBB maxBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); ++ static AxisAlignedBB miscBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); ++ static AxisAlignedBB animalBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); ++ static AxisAlignedBB monsterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); + + /** + * Initializes an entities type on construction to specify what group this @@ -352,7 +339,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + maxRange = Math.max( maxRange, miscActivationRange ); + maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange ); + -+ for ( Entity player : (List) world.players ) ++ for ( EntityHuman player : world.players ) + { + + player.activatedTick = MinecraftServer.currentTick; @@ -434,14 +421,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static boolean checkEntityImmunities(Entity entity) + { + // quick checks. -+ if ( entity.inWater /* isInWater */ || entity.fireTicks > 0 ) ++ if ( entity.inWater || entity.fireTicks > 0 ) + { + return true; + } + if ( !( entity instanceof EntityArrow ) ) + { -+ if ( !entity.onGround || entity.passenger != null -+ || entity.vehicle != null ) ++ if ( !entity.onGround || !entity.passengers.isEmpty() || entity.getVehicle()!= null ) + { + return true; + } @@ -461,14 +447,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + return true; + } -+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).ck() /* Getter for first boolean */ ) ++ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).da() /* 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; + } @@ -477,7 +463,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return true; + } + } -+ if (entity instanceof EntityCreeper && ((EntityCreeper) entity).cn()) { // isExplosive ++ if (entity instanceof EntityCreeper && ((EntityCreeper) entity).isIgnited()) { // isExplosive + return true; + } + } @@ -494,7 +480,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + SpigotTimings.checkIfActiveTimer.startTiming(); + // Never safe to skip fireworks or entities not yet added to chunk -+ if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { ++ // PAIL: inChunk ++ if ( !entity.aa || entity instanceof EntityFireworks ) { + SpigotTimings.checkIfActiveTimer.stopTiming(); + return true; + } @@ -536,8 +523,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -0,0 +0,0 @@ public class SpigotWorldConfig - mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 ); - log( "Mob Spawn Range: " + mobSpawnRange ); + itemDespawnRate = getInt( "item-despawn-rate", 6000 ); + log( "Item Despawn Rate: " + itemDespawnRate ); } + + public int animalActivationRange = 32; diff --git a/CraftBukkit-Patches/0016-PlayerItemDamageEvent.patch b/CraftBukkit-Patches/0016-PlayerItemDamageEvent.patch index 9297b7815d..d19d0e67b1 100644 --- a/CraftBukkit-Patches/0016-PlayerItemDamageEvent.patch +++ b/CraftBukkit-Patches/0016-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.bc())) { -+ if (this.isDamaged(i, entityliving.bc(), entityliving)) { // Spigot +- if (this.isDamaged(i, entityliving.getRandom())) { ++ if (this.isDamaged(i, entityliving.getRandom(), entityliving)) { // Spigot entityliving.b(this); --this.count; if (entityliving instanceof EntityHuman) { diff --git a/CraftBukkit-Patches/0018-Entity-Tracking-Ranges.patch b/CraftBukkit-Patches/0018-Entity-Tracking-Ranges.patch index 9eb173ab02..bba70d1116 100644 --- a/CraftBukkit-Patches/0018-Entity-Tracking-Ranges.patch +++ b/CraftBukkit-Patches/0018-Entity-Tracking-Ranges.patch @@ -20,48 +20,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; - } + try { + if (this.trackedEntities.b(entity.getId())) { + throw new IllegalStateException("Entity is already tracked!"); 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/0023-Implement-Arrow-API.patch b/CraftBukkit-Patches/0023-Implement-Arrow-API.patch index 1b1f9ce81f..f96d464c19 100644 --- a/CraftBukkit-Patches/0023-Implement-Arrow-API.patch +++ b/CraftBukkit-Patches/0023-Implement-Arrow-API.patch @@ -15,13 +15,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public double getDamage() + { -+ return getHandle().j(); ++ return getHandle().k(); + } + + @Override + public void setDamage(double damage) + { -+ getHandle().b( damage ); ++ getHandle().c( damage ); + } }; diff --git a/CraftBukkit-Patches/0024-Hopper-Customisations.patch b/CraftBukkit-Patches/0024-Hopper-Customisations.patch index 5d71517891..895f78358f 100644 --- a/CraftBukkit-Patches/0024-Hopper-Customisations.patch +++ b/CraftBukkit-Patches/0024-Hopper-Customisations.patch @@ -9,12 +9,12 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main 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 +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi } if (flag) { -- this.d(8); -+ this.d(world.spigotConfig.hopperTransfer); // Spigot +- this.setCooldown(8); ++ this.setCooldown(world.spigotConfig.hopperTransfer); // Spigot this.update(); return true; } @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return false; } else { return false; -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi // ItemStack itemstack1 = addItem(iinventory, this.splitStack(i, 1), enumdirection); // CraftBukkit start - Call event when pushing items into other inventories @@ -32,19 +32,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Inventory destinationInventory; // Have to special case large chests as they work oddly -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi this.getWorld().getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { this.setItem(i, itemstack); -- this.d(8); // Delay hopper checks -+ this.d(world.spigotConfig.hopperTransfer); // Spigot +- this.setCooldown(8); // Delay hopper checks ++ this.setCooldown(world.spigotConfig.hopperTransfer); // Spigot return false; } + int origCount = event.getItem().getAmount(); // Spigot ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection); if (itemstack1 == null || itemstack1.count == 0) { -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi // CraftBukkit end return true; } @@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setItem(i, itemstack); } } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi ItemStack itemstack1 = itemstack.cloneItemStack(); // ItemStack itemstack2 = addItem(ihopper, iinventory.splitStack(i, 1), (EnumDirection) null); // CraftBukkit start - Call event on collection of items from inventories into the hopper @@ -62,15 +62,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Inventory sourceInventory; // Have to special case large chests as they work oddly -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi iinventory.setItem(i, itemstack1); if (ihopper instanceof TileEntityHopper) { -- ((TileEntityHopper) ihopper).d(8); // Delay hopper checks -+ ((TileEntityHopper) ihopper).d(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot +- ((TileEntityHopper) ihopper).setCooldown(8); // Delay hopper checks ++ ((TileEntityHopper) ihopper).setCooldown(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot } else if (ihopper instanceof EntityMinecartHopper) { -- ((EntityMinecartHopper) ihopper).m(4); // Delay hopper minecart checks -+ ((EntityMinecartHopper) ihopper).m(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot +- ((EntityMinecartHopper) ihopper).setCooldown(4); // Delay hopper minecart checks ++ ((EntityMinecartHopper) ihopper).setCooldown(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot } - return false; @@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), null); if (itemstack2 == null || itemstack2.count == 0) { -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi // CraftBukkit end return true; } @@ -87,12 +87,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 iinventory.setItem(i, itemstack1); } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi TileEntityHopper tileentityhopper = (TileEntityHopper) iinventory; - if (tileentityhopper.o()) { -- tileentityhopper.d(8); -+ tileentityhopper.d(tileentityhopper.world.spigotConfig.hopperTransfer); // Spigot + if (tileentityhopper.p()) { +- tileentityhopper.setCooldown(8); ++ tileentityhopper.setCooldown(tileentityhopper.world.spigotConfig.hopperTransfer); // Spigot } iinventory.update(); diff --git a/CraftBukkit-Patches/0026-Firework-Meta-Crash-Fix.patch b/CraftBukkit-Patches/0025-Firework-Meta-Crash-Fix.patch similarity index 100% rename from CraftBukkit-Patches/0026-Firework-Meta-Crash-Fix.patch rename to CraftBukkit-Patches/0025-Firework-Meta-Crash-Fix.patch diff --git a/CraftBukkit-Patches/0025-Implement-SpawnerSpawnEvent.patch b/CraftBukkit-Patches/0025-Implement-SpawnerSpawnEvent.patch deleted file mode 100644 index 5c4831da56..0000000000 --- a/CraftBukkit-Patches/0025-Implement-SpawnerSpawnEvent.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Andy Shulman -Date: Mon, 15 Apr 2013 20:06:37 -0500 -Subject: [PATCH] Implement SpawnerSpawnEvent. - -Adds BUKKIT-267 - -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -0,0 +0,0 @@ import com.google.common.collect.Lists; - import java.util.Iterator; - import java.util.List; - --import org.bukkit.event.entity.CreatureSpawnEvent; // CraftBukkit -+// CraftBukkit start -+import org.bukkit.craftbukkit.event.CraftEventFactory; -+import org.bukkit.event.entity.CreatureSpawnEvent; -+import org.bukkit.event.entity.SpawnerSpawnEvent; -+// CraftBukkit end - - public abstract class MobSpawnerAbstract { - -@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - - entity.f(nbttagcompound); - if (entity.world != null && flag) { -- entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit -+ // CraftBukkit start - call SpawnerSpawnEvent, abort if cancelled -+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); -+ if (!event.isCancelled()) { -+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit -+ } -+ // CraftBukkit end - } - - NBTTagCompound nbttagcompound1; -@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - - entity2.f(nbttagcompound2); - entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch); -+ // CraftBukkit start - call SpawnerSpawnEvent, skip if cancelled -+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity2, this.b().getX(), this.b().getY(), this.b().getZ()); -+ if (event.isCancelled()) { -+ continue; -+ } - if (entity.world != null && flag) { - 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); - } -- -- 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()); -+ if (!event.isCancelled()) { -+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit -+ } -+ // Spigot end - } - - return entity; -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -0,0 +0,0 @@ import org.bukkit.Statistic.Type; - import org.bukkit.block.Block; - import org.bukkit.block.BlockFace; - import org.bukkit.block.BlockState; -+import org.bukkit.block.CreatureSpawner; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.CraftStatistic; - import org.bukkit.craftbukkit.CraftWorld; -@@ -0,0 +0,0 @@ public class CraftEventFactory { - } - - /** -+ * Mob spawner event -+ */ -+ public static SpawnerSpawnEvent callSpawnerSpawnEvent(Entity spawnee, int spawnerX, int spawnerY, int spawnerZ) { -+ org.bukkit.craftbukkit.entity.CraftEntity entity = spawnee.getBukkitEntity(); -+ BlockState state = entity.getWorld().getBlockAt(spawnerX, spawnerY, spawnerZ).getState(); -+ -+ if (!(state instanceof CreatureSpawner)) { -+ state = null; -+ } -+ -+ SpawnerSpawnEvent event = new SpawnerSpawnEvent(entity, (CreatureSpawner) state); -+ entity.getServer().getPluginManager().callEvent(event); -+ return event; -+ } -+ -+ /** - * Bucket methods - */ - public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, EnumDirection clickedFace, ItemStack itemInHand) { --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0027-Allow-Disabling-of-Command-Logging.patch b/CraftBukkit-Patches/0026-Allow-Disabling-of-Command-Logging.patch similarity index 93% rename from CraftBukkit-Patches/0027-Allow-Disabling-of-Command-Logging.patch rename to CraftBukkit-Patches/0026-Allow-Disabling-of-Command-Logging.patch index 3b1e99d085..6f88f4e145 100644 --- a/CraftBukkit-Patches/0027-Allow-Disabling-of-Command-Logging.patch +++ b/CraftBukkit-Patches/0026-Allow-Disabling-of-Command-Logging.patch @@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- 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 +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { 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); + this.LOGGER.info(this.player.getName() + " issued server command: " + s); CraftPlayer player = this.getPlayer(); diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-TabComplete.patch b/CraftBukkit-Patches/0027-Allow-Disabling-of-Command-TabComplete.patch similarity index 100% rename from CraftBukkit-Patches/0028-Allow-Disabling-of-Command-TabComplete.patch rename to CraftBukkit-Patches/0027-Allow-Disabling-of-Command-TabComplete.patch diff --git a/CraftBukkit-Patches/0029-Configurable-Messages.patch b/CraftBukkit-Patches/0028-Configurable-Messages.patch similarity index 92% rename from CraftBukkit-Patches/0029-Configurable-Messages.patch rename to CraftBukkit-Patches/0028-Configurable-Messages.patch index fc1287459e..659e0604b2 100644 --- a/CraftBukkit-Patches/0029-Configurable-Messages.patch +++ b/CraftBukkit-Patches/0028-Configurable-Messages.patch @@ -11,15 +11,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { // CraftBukkit end - if (packethandshakinginsetprotocol.b() > 47) { -- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.8"); -+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), "1.8.8" ) ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); + if (packethandshakinginsetprotocol.b() > 107) { +- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.9"); ++ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), "1.9" ) ); // Spigot + this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext)); this.b.close(chatcomponenttext); - } else if (packethandshakinginsetprotocol.b() < 47) { -- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8.8"); -+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), "1.8.8" ) ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); + } else if (packethandshakinginsetprotocol.b() < 107) { +- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.9"); ++ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), "1.9" ) ); // Spigot + this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext)); this.b.close(chatcomponenttext); } else { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/CraftBukkit-Patches/0030-Allow-Disabling-of-Random-Lighting-Updates.patch b/CraftBukkit-Patches/0029-Allow-Disabling-of-Random-Lighting-Updates.patch similarity index 74% rename from CraftBukkit-Patches/0030-Allow-Disabling-of-Random-Lighting-Updates.patch rename to CraftBukkit-Patches/0029-Allow-Disabling-of-Random-Lighting-Updates.patch index 4258f77e51..5d21fb858b 100644 --- a/CraftBukkit-Patches/0030-Allow-Disabling-of-Random-Lighting-Updates.patch +++ b/CraftBukkit-Patches/0029-Allow-Disabling-of-Random-Lighting-Updates.patch @@ -11,25 +11,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Chunk { } - this.p = true; + this.q = true; - if (!this.lit && this.done) { + if (!this.lit && this.done && this.world.spigotConfig.randomLightUpdates) { // Spigot - also use random light updates setting to determine if we should relight - this.n(); + this.o(); } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.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 { - } +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + protected void i() { this.methodProfiler.a("playerCheckLight"); - if (!this.players.isEmpty()) { + if (spigotConfig.randomLightUpdates && !this.players.isEmpty()) { // Spigot - i = this.random.nextInt(this.players.size()); - entityhuman = (EntityHuman) this.players.get(i); - j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5; + int i = this.random.nextInt(this.players.size()); + EntityHuman entityhuman = (EntityHuman) this.players.get(i); + int j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5; 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/0031-Properly-Close-Inventories.patch b/CraftBukkit-Patches/0030-Properly-Close-Inventories.patch similarity index 75% rename from CraftBukkit-Patches/0031-Properly-Close-Inventories.patch rename to CraftBukkit-Patches/0030-Properly-Close-Inventories.patch index df246c139e..e50910d448 100644 --- a/CraftBukkit-Patches/0031-Properly-Close-Inventories.patch +++ b/CraftBukkit-Patches/0030-Properly-Close-Inventories.patch @@ -47,21 +47,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Do not pass along players, as doing so can get them stuck outside of time. // (which for example disables inventory icon updates and prevents block breaking) -diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp - } - - public void c(int i) { -+ // Spigot Start -+ for ( HumanEntity human : new java.util.ArrayList( transaction ) ) -+ { -+ human.closeInventory(); -+ } -+ // Spigot End - this.b = false; - super.c(i); - } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0032-Disallow-Interaction-With-Self.patch b/CraftBukkit-Patches/0031-Disallow-Interaction-With-Self.patch similarity index 89% rename from CraftBukkit-Patches/0032-Disallow-Interaction-With-Self.patch rename to CraftBukkit-Patches/0031-Disallow-Interaction-With-Self.patch index ef24c69299..4d9f7472dc 100644 --- a/CraftBukkit-Patches/0032-Disallow-Interaction-With-Self.patch +++ b/CraftBukkit-Patches/0031-Disallow-Interaction-With-Self.patch @@ -8,8 +8,8 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- 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 - PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u()); +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + if (this.player.dead) return; // CraftBukkit WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); + // Spigot Start diff --git a/CraftBukkit-Patches/0032-Entity-Mount-and-Dismount-Events.patch b/CraftBukkit-Patches/0032-Entity-Mount-and-Dismount-Events.patch new file mode 100644 index 0000000000..3709f3ebcf --- /dev/null +++ b/CraftBukkit-Patches/0032-Entity-Mount-and-Dismount-Events.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Sat, 27 Feb 2016 10:07:58 +1100 +Subject: [PATCH] Entity Mount and Dismount Events + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { + } + } + // CraftBukkit end ++ // Spigot start ++ org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent(this.getBukkitEntity(), entity.getBukkitEntity()); ++ Bukkit.getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ return; ++ } ++ // Spigot end + if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bt() instanceof EntityHuman)) { + this.passengers.add(0, entity); + } else { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { + } + } + // CraftBukkit end ++ Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), entity.getBukkitEntity() ) ); // Spigot + this.passengers.remove(entity); + entity.j = 60; + } +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0033-Entity-Mount-and-Dismount-Events.patch b/CraftBukkit-Patches/0033-Entity-Mount-and-Dismount-Events.patch deleted file mode 100644 index 50ac33433d..0000000000 --- a/CraftBukkit-Patches/0033-Entity-Mount-and-Dismount-Events.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 2 Jul 2013 20:32:49 +1000 -Subject: [PATCH] Entity Mount and Dismount Events - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { - } - } - // CraftBukkit end -+ pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot - this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch); - this.vehicle.passenger = null; - } -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { - } - } - // CraftBukkit end -+ // Spigot Start -+ if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4, true ) ) -+ { -+ org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent( this.getBukkitEntity(), entity.getBukkitEntity() ); -+ pluginManager.callEvent( event ); -+ if ( event.isCancelled() ) -+ { -+ return; -+ } -+ } -+ // Spigot End -+ - if (this.vehicle != null) { - this.vehicle.passenger = null; - } -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 { - } - } - // CraftBukkit end -+ org.bukkit.Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot - - if (!this.world.isClientSide) { - this.q(this.vehicle); --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0034-Prevent-Ghost-Players-Caused-by-Plugins.patch b/CraftBukkit-Patches/0033-Prevent-Ghost-Players-Caused-by-Plugins.patch similarity index 100% rename from CraftBukkit-Patches/0034-Prevent-Ghost-Players-Caused-by-Plugins.patch rename to CraftBukkit-Patches/0033-Prevent-Ghost-Players-Caused-by-Plugins.patch diff --git a/CraftBukkit-Patches/0035-Plug-World-Unload-Memory-Leak.patch b/CraftBukkit-Patches/0034-Plug-World-Unload-Memory-Leak.patch similarity index 91% rename from CraftBukkit-Patches/0035-Plug-World-Unload-Memory-Leak.patch rename to CraftBukkit-Patches/0034-Plug-World-Unload-Memory-Leak.patch index f2111747fb..91746a5bb7 100644 --- a/CraftBukkit-Patches/0035-Plug-World-Unload-Memory-Leak.patch +++ b/CraftBukkit-Patches/0034-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> g = Maps.newHashMap(); ++ private static Map> g = new java.util.WeakHashMap(); // Spigot private final boolean isOn; private boolean a(World world, BlockPosition blockposition, boolean flag) { diff --git a/CraftBukkit-Patches/0036-Player-Collision-API.patch b/CraftBukkit-Patches/0035-Player-Collision-API.patch similarity index 79% rename from CraftBukkit-Patches/0036-Player-Collision-API.patch rename to CraftBukkit-Patches/0035-Player-Collision-API.patch index d05a0010e1..d04bd693d9 100644 --- a/CraftBukkit-Patches/0036-Player-Collision-API.patch +++ b/CraftBukkit-Patches/0035-Player-Collision-API.patch @@ -12,12 +12,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 List list = this.world.getEntities(this, axisalignedbb); -+ if (this.ae()) { // Spigot: Add this.ae() condition (second !this.isDead near bottom of EntityLiving) ++ if (this.isCollidable()) { // Spigot: Add isCollidable() condition (second !this.isDead near bottom of EntityLiving) for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - this.d(entity); + this.c(entity); } } + } // Spigot @@ -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 cn() { + List list = this.world.a((Entity) this, this.getBoundingBox(), IEntitySelector.a(this)); - if (!list.isEmpty()) { -+ if (this.ad() && !list.isEmpty()) { // Spigot: Add this.ad() condition ++ if (this.isInteractable() && !list.isEmpty()) { // Spigot: Add isInteractable() condition for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); - + // TODO better check now? 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 @@ -49,15 +49,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean collidesWithEntities = true; + + @Override -+ public boolean ad() ++ public boolean isInteractable() + { -+ return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) ++ return this.collidesWithEntities && super.isInteractable(); // (first !this.isDead near bottom of EntityLiving) + } + + @Override -+ public boolean ae() ++ public boolean isCollidable() + { -+ return this.collidesWithEntities && super.ae(); // (second !this.isDead near bottom of EntityLiving) ++ return this.collidesWithEntities && super.isCollidable(); // (second !this.isDead near bottom of EntityLiving) + } + // Spigot end @@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void setCollidesWithEntities(boolean collides) + { + getHandle().collidesWithEntities = collides; -+ getHandle().k = collides; // First boolean of Entity ++ getHandle().i = collides; // First boolean of Entity + } }; diff --git a/CraftBukkit-Patches/0037-Fully-Disable-Snooper-When-Not-Required.patch b/CraftBukkit-Patches/0036-Fully-Disable-Snooper-When-Not-Required.patch similarity index 85% rename from CraftBukkit-Patches/0037-Fully-Disable-Snooper-When-Not-Required.patch rename to CraftBukkit-Patches/0036-Fully-Disable-Snooper-When-Not-Required.patch index 39d3cba250..bcbbcaba36 100644 --- a/CraftBukkit-Patches/0037-Fully-Disable-Snooper-When-Not-Required.patch +++ b/CraftBukkit-Patches/0036-Fully-Disable-Snooper-When-Not-Required.patch @@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.h[this.ticks % 100] = System.nanoTime() - i; this.methodProfiler.b(); this.methodProfiler.a("snooper"); -- if (!this.n.d() && this.ticks > 100) { -+ if (getSnooperEnabled() && !this.n.d() && this.ticks > 100) { // Spigot - this.n.a(); +- if (!this.m.d() && this.ticks > 100) { ++ if (getSnooperEnabled() && !this.m.d() && this.ticks > 100) { // Spigot + this.m.a(); } - if (this.ticks % 6000 == 0) { + if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot - this.n.b(); + this.m.b(); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0038-Add-Getter-for-Entity-Invulnerability.patch b/CraftBukkit-Patches/0037-Add-Getter-for-Entity-Invulnerability.patch similarity index 100% rename from CraftBukkit-Patches/0038-Add-Getter-for-Entity-Invulnerability.patch rename to CraftBukkit-Patches/0037-Add-Getter-for-Entity-Invulnerability.patch diff --git a/CraftBukkit-Patches/0039-Cap-Minimum-Player-Speed.patch b/CraftBukkit-Patches/0038-Cap-Minimum-Player-Speed.patch similarity index 100% rename from CraftBukkit-Patches/0039-Cap-Minimum-Player-Speed.patch rename to CraftBukkit-Patches/0038-Cap-Minimum-Player-Speed.patch diff --git a/CraftBukkit-Patches/0041-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch b/CraftBukkit-Patches/0039-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch similarity index 100% rename from CraftBukkit-Patches/0041-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch rename to CraftBukkit-Patches/0039-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch diff --git a/CraftBukkit-Patches/0042-Allow-Disabling-of-1.6.3-Structure-Saving.patch b/CraftBukkit-Patches/0040-Allow-Disabling-of-1.6.3-Structure-Saving.patch similarity index 77% rename from CraftBukkit-Patches/0042-Allow-Disabling-of-1.6.3-Structure-Saving.patch rename to CraftBukkit-Patches/0040-Allow-Disabling-of-1.6.3-Structure-Saving.patch index 4a233fabe2..6e21a0275d 100644 --- a/CraftBukkit-Patches/0042-Allow-Disabling-of-1.6.3-Structure-Saving.patch +++ b/CraftBukkit-Patches/0040-Allow-Disabling-of-1.6.3-Structure-Saving.patch @@ -10,20 +10,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/StructureGenerator.java @@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { - private void a(World world) { - if (this.d == null) { + protected void a(World world) { + if (this.a == null) { +- this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a()); + // Spigot Start -+ if ( world.spigotConfig.saveStructureInfo ) -+ { - this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a()); -+ } else -+ { -+ this.d = new PersistentStructure( this.a() ); ++ if (world.spigotConfig.saveStructureInfo) { ++ this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a()); ++ } else { ++ this.a = new PersistentStructure(this.a()); + } + // Spigot End - if (this.d == null) { - this.d = new PersistentStructure(this.a()); - world.a(this.a(), (PersistentBase) this.d); + if (this.a == null) { + this.a = new PersistentStructure(this.a()); + world.a(this.a(), (PersistentBase) this.a); 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/0040-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch b/CraftBukkit-Patches/0040-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch deleted file mode 100644 index eafbae098a..0000000000 --- a/CraftBukkit-Patches/0040-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 14 Sep 2013 10:16:38 +1000 -Subject: [PATCH] Update Inventory and Health for PlayerConsumeItemEvent - - -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - // Update client - if (this instanceof EntityPlayer) { - ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.getSlot((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.g)); -+ // Spigot Start -+ ((EntityPlayer) this).getBukkitEntity().updateInventory(); -+ ((EntityPlayer) this).getBukkitEntity().updateScaledHealth(); -+ // Spigot End - } - return; - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0044-Don-t-Special-Case-X-Move-Value.patch b/CraftBukkit-Patches/0041-Don-t-Special-Case-X-Move-Value.patch similarity index 95% rename from CraftBukkit-Patches/0044-Don-t-Special-Case-X-Move-Value.patch rename to CraftBukkit-Patches/0041-Don-t-Special-Case-X-Move-Value.patch index 0302b20e92..58ec645727 100644 --- a/CraftBukkit-Patches/0044-Don-t-Special-Case-X-Move-Value.patch +++ b/CraftBukkit-Patches/0041-Don-t-Special-Case-X-Move-Value.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- 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 +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { private float lastPitch = Float.MAX_VALUE; private float lastYaw = Float.MAX_VALUE; private boolean justTeleported = false; @@ -16,8 +16,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public CraftPlayer getPlayer() { return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity(); -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList - } +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + // CraftBukkit start - fire PlayerMoveEvent Player player = this.getPlayer(); + // Spigot Start @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. Location to = player.getLocation().clone(); // Start off the To location as the Players current location. -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { this.lastPitch = to.getPitch(); // Skip the first time we do this diff --git a/CraftBukkit-Patches/0045-Implement-respawn-API.patch b/CraftBukkit-Patches/0042-Implement-respawn-API.patch similarity index 94% rename from CraftBukkit-Patches/0045-Implement-respawn-API.patch rename to CraftBukkit-Patches/0042-Implement-respawn-API.patch index 28876a3151..e5ff2c7e8d 100644 --- a/CraftBukkit-Patches/0045-Implement-respawn-API.patch +++ b/CraftBukkit-Patches/0042-Implement-respawn-API.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { getHandle().collidesWithEntities = collides; - getHandle().k = collides; // First boolean of Entity + getHandle().i = collides; // First boolean of Entity } + + @Override diff --git a/CraftBukkit-Patches/0046-Arrow-Despawn-Rate.patch b/CraftBukkit-Patches/0043-Arrow-Despawn-Rate.patch similarity index 73% rename from CraftBukkit-Patches/0046-Arrow-Despawn-Rate.patch rename to CraftBukkit-Patches/0043-Arrow-Despawn-Rate.patch index 62d53baed0..5fda9204db 100644 --- a/CraftBukkit-Patches/0046-Arrow-Despawn-Rate.patch +++ b/CraftBukkit-Patches/0043-Arrow-Despawn-Rate.patch @@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { +@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile { - if (block == this.g && i == this.h) { - ++this.ar; -- if (this.ar >= 1200) { -+ if (this.ar >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter + if (block == this.au && i == this.av) { + ++this.aw; +- if (this.aw >= 1200) { ++ if (this.aw >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter this.die(); } } else { @@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -0,0 +0,0 @@ public class SpigotWorldConfig - itemDespawnRate = getInt( "item-despawn-rate", 6000 ); - log( "Item Despawn Rate: " + itemDespawnRate ); + log( "*** WARNING *** Please use this option with caution, SpigotMC is not responsible for any issues this option may cause in the future!" ); + } } + + public int arrowDespawnRate; diff --git a/CraftBukkit-Patches/0048-Watchdog-Thread.patch b/CraftBukkit-Patches/0044-Watchdog-Thread.patch similarity index 99% rename from CraftBukkit-Patches/0048-Watchdog-Thread.patch rename to CraftBukkit-Patches/0044-Watchdog-Thread.patch index 926eda55c6..280720cad9 100644 --- a/CraftBukkit-Patches/0048-Watchdog-Thread.patch +++ b/CraftBukkit-Patches/0044-Watchdog-Thread.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end -- if (this.aS() > 0L) { -+ if (false && this.aS() > 0L) { // Spigot - disable +- if (this.aP() > 0L) { ++ if (false && this.aP() > 0L) { // Spigot - disable Thread thread1 = new Thread(new ThreadWatchdog(this)); thread1.setName("Server Watchdog"); diff --git a/CraftBukkit-Patches/0050-Fix-some-chunks-not-being-sent-to-the-client.patch b/CraftBukkit-Patches/0045-Fix-some-chunks-not-being-sent-to-the-client.patch similarity index 93% rename from CraftBukkit-Patches/0050-Fix-some-chunks-not-being-sent-to-the-client.patch rename to CraftBukkit-Patches/0045-Fix-some-chunks-not-being-sent-to-the-client.patch index 7d7759ba9b..168511c46a 100644 --- a/CraftBukkit-Patches/0050-Fix-some-chunks-not-being-sent-to-the-client.patch +++ b/CraftBukkit-Patches/0045-Fix-some-chunks-not-being-sent-to-the-client.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public boolean isReady() { -- return this.p && this.done && this.lit; +- return this.q && this.done && this.lit; + // Spigot Start + /* + * As of 1.7, Mojang added a check to make sure that only chunks which have been lit are sent to the client. @@ -24,5 +24,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot End } - public ChunkCoordIntPair j() { + public boolean j() { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0051-Fix-Broken-Async-Chat.patch b/CraftBukkit-Patches/0046-Fix-Broken-Async-Chat.patch similarity index 100% rename from CraftBukkit-Patches/0051-Fix-Broken-Async-Chat.patch rename to CraftBukkit-Patches/0046-Fix-Broken-Async-Chat.patch diff --git a/CraftBukkit-Patches/0054-Fire-PreLogin-Events-in-Offline-Mode.patch b/CraftBukkit-Patches/0047-Fire-PreLogin-Events-in-Offline-Mode.patch similarity index 84% rename from CraftBukkit-Patches/0054-Fire-PreLogin-Events-in-Offline-Mode.patch rename to CraftBukkit-Patches/0047-Fire-PreLogin-Events-in-Offline-Mode.patch index 4f2096715d..0f4d66aa56 100644 --- a/CraftBukkit-Patches/0054-Fire-PreLogin-Events-in-Offline-Mode.patch +++ b/CraftBukkit-Patches/0047-Fire-PreLogin-Events-in-Offline-Mode.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { } @@ -40,29 +40,36 @@ 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 +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { this.g = LoginListener.EnumProtocolState.KEY; - this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.Q().getPublic(), this.e)); + this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin(this.j, this.server.O().getPublic(), this.e)); } else { - this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; + // Spigot start -+ try { -+ initUUID(); -+ 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); -+ } ++ new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) { ++ ++ @Override ++ public void run() { ++ try { ++ initUUID(); ++ new LoginHandler().fireEvents(); ++ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; ++ } catch (Exception ex) { ++ disconnect("Failed to verify username!"); ++ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex); ++ } ++ } ++ }.start(); + // Spigot end } } -@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { return; } + new LoginHandler().fireEvents(); -+ } else if (LoginListener.this.server.T()) { ++ } else if (LoginListener.this.server.R()) { + 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; @@ -71,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer + } + } catch (AuthenticationUnavailableException authenticationunavailableexception) { -+ if (LoginListener.this.server.T()) { ++ if (LoginListener.this.server.R()) { + 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; @@ -85,7 +92,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception); + // CraftBukkit end + } -+ + } + }).start(); + } @@ -98,11 +104,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { // 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.T()) { +- } else if (LoginListener.this.server.R()) { - 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; @@ -111,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer - } - } catch (AuthenticationUnavailableException authenticationunavailableexception) { -- if (LoginListener.this.server.T()) { +- if (LoginListener.this.server.R()) { - 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; @@ -126,10 +132,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - // CraftBukkit end - } - -- } + } - }).start(); } - } +- } + // Spigot end protected GameProfile a(GameProfile gameprofile) { diff --git a/CraftBukkit-Patches/0047-Fix-packed-ice-generation.patch b/CraftBukkit-Patches/0047-Fix-packed-ice-generation.patch deleted file mode 100644 index 4f2fb7f8f0..0000000000 --- a/CraftBukkit-Patches/0047-Fix-packed-ice-generation.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 1 Dec 2013 17:52:14 +1100 -Subject: [PATCH] Fix packed ice generation - - -diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java -+++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java -@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator { - 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.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.getBlockData()); -+ world.setTypeUpdate(blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot - } - } - } -@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator { - 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.getBlockData()); -+ world.setTypeUpdate(blockposition1, Blocks.PACKED_ICE.getBlockData()); // Spigot - blockposition1 = blockposition1.down(); - --l1; - if (l1 <= 0) { --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0055-BungeeCord-Support.patch b/CraftBukkit-Patches/0048-BungeeCord-Support.patch similarity index 84% rename from CraftBukkit-Patches/0055-BungeeCord-Support.patch rename to CraftBukkit-Patches/0048-BungeeCord-Support.patch index 7740cd730b..15503dc5b1 100644 --- a/CraftBukkit-Patches/0055-BungeeCord-Support.patch +++ b/CraftBukkit-Patches/0048-BungeeCord-Support.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { this.b.close(chatcomponenttext); } else { - this.b.a((PacketListener) (new LoginListener(this.a, this.b))); + this.b.setPacketListener(new LoginListener(this.a, this.b)); + // Spigot Start + if (org.spigotmc.SpigotConfig.bungee) { + String[] split = packethandshakinginsetprotocol.hostname.split("\00"); @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } else + { + chatcomponenttext = new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!"); -+ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); ++ this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext)); + this.b.close(chatcomponenttext); + return; + } @@ -41,14 +41,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + // Spigot End - ((LoginListener) this.b.getPacketListener()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname + ((LoginListener) this.b.i()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname } break; diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java 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 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { // Spigot start public void initUUID() { @@ -74,38 +74,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Spigot end -@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo - this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.Q().getPublic(), this.e)); - } else { - // Spigot start -- try { -- initUUID(); -- 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); -- } -+ initUUID(); -+ new Thread(new Runnable() { -+ -+ @Override -+ public void run() { -+ 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); -+ } -+ } -+ }).start(); - // Spigot end - } - diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java 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> { private final Queue i = Queues.newConcurrentLinkedQueue(); private final ReentrantReadWriteLock j = new ReentrantReadWriteLock(); public Channel channel; @@ -118,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private PacketListener m; private IChatBaseComponent n; private boolean o; -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { this.b = agenericfuturelistener; } } @@ -137,11 +110,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet -Date: Tue, 3 Dec 2013 11:07:48 +1100 -Subject: [PATCH] Clear Flower Pot on Drop - - -diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowerPot.java -+++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java -@@ -0,0 +0,0 @@ public class BlockFlowerPot extends BlockContainer { - - if (tileentityflowerpot != null && tileentityflowerpot.b() != null) { - a(world, blockposition, new ItemStack(tileentityflowerpot.b(), 1, tileentityflowerpot.c())); -+ tileentityflowerpot.a( null, 0 ); // Spigot - } - - super.remove(world, blockposition, iblockdata); --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0057-Configurable-Amount-of-Netty-Threads.patch b/CraftBukkit-Patches/0050-Configurable-Amount-of-Netty-Threads.patch similarity index 75% rename from CraftBukkit-Patches/0057-Configurable-Amount-of-Netty-Threads.patch rename to CraftBukkit-Patches/0050-Configurable-Amount-of-Netty-Threads.patch index 8b588e2d3d..45cf4674a6 100644 --- a/CraftBukkit-Patches/0057-Configurable-Amount-of-Netty-Threads.patch +++ b/CraftBukkit-Patches/0050-Configurable-Amount-of-Netty-Threads.patch @@ -10,32 +10,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 Runnable, ICommandListener, IAs - private final List p = Lists.newArrayList(); + private final List o = 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; +- private final ServerConnection p; ++ private ServerConnection p; // Spigot + private final ServerPing q = new ServerPing(); + private final Random r = new Random(); + private final DataConverterManager dataConverterManager; @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.e = proxy; - MinecraftServer.l = this; + this.W = gameprofilerepository; + this.X = usercache; // this.universe = file; // CraftBukkit -- this.q = new ServerConnection(this); -+ // this.q = new ServerConnection(this); // Spigot - this.Z = new UserCache(this, file1); - this.b = this.h(); +- this.p = new ServerConnection(this); ++ // this.p = new ServerConnection(this); // Spigot + this.b = this.i(); // this.convertable = new WorldLoaderServer(file); // CraftBukkit - moved to DedicatedServer.init + this.dataConverterManager = dataconvertermanager; @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs } // Spigot End - public ServerConnection aq() { -- return this.q; -+ return this.q == null ? this.q = new ServerConnection(this) : this.q; // Spigot + public ServerConnection am() { +- return this.p; ++ return this.p == null ? this.p = new ServerConnection(this) : this.p; // Spigot } - public boolean as() { + public boolean ao() { 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/0058-Prevent-Mineshaft-Saving.patch b/CraftBukkit-Patches/0051-Prevent-Mineshaft-Saving.patch similarity index 62% rename from CraftBukkit-Patches/0058-Prevent-Mineshaft-Saving.patch rename to CraftBukkit-Patches/0051-Prevent-Mineshaft-Saving.patch index 87b4e41195..cc8fe8b5fc 100644 --- a/CraftBukkit-Patches/0058-Prevent-Mineshaft-Saving.patch +++ b/CraftBukkit-Patches/0051-Prevent-Mineshaft-Saving.patch @@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/StructureGenerator.java +++ b/src/main/java/net/minecraft/server/StructureGenerator.java @@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { - private void a(World world) { - if (this.d == null) { + protected void a(World world) { + if (this.a == null) { // Spigot Start -- if ( world.spigotConfig.saveStructureInfo ) -+ if ( world.spigotConfig.saveStructureInfo && !this.a().equals( "Mineshaft" ) ) - { - this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a()); - } else +- if (world.spigotConfig.saveStructureInfo) { ++ if (world.spigotConfig.saveStructureInfo && !this.a().equals( "Mineshaft" )) { + this.a = (PersistentStructure) world.a(PersistentStructure.class, this.a()); + } else { + this.a = new PersistentStructure(this.a()); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0059-Log-Cause-of-Unexpected-Exceptions.patch b/CraftBukkit-Patches/0052-Log-Cause-of-Unexpected-Exceptions.patch similarity index 100% rename from CraftBukkit-Patches/0059-Log-Cause-of-Unexpected-Exceptions.patch rename to CraftBukkit-Patches/0052-Log-Cause-of-Unexpected-Exceptions.patch diff --git a/CraftBukkit-Patches/0052-Orebfuscator.patch b/CraftBukkit-Patches/0052-Orebfuscator.patch deleted file mode 100644 index 41dfdb4faf..0000000000 --- a/CraftBukkit-Patches/0052-Orebfuscator.patch +++ /dev/null @@ -1,412 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 16 May 2013 18:51:05 +1000 -Subject: [PATCH] Orebfuscator - - -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { - blockposition = new BlockPosition(this); - 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.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); -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 -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -0,0 +0,0 @@ public class Explosion { - blockposition = (BlockPosition) iterator.next(); - Block block = this.world.getType(blockposition).getBlock(); - -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot - if (flag) { - double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat()); - double d1 = (double) ((float) blockposition.getY() + this.world.random.nextFloat()); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -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 { - 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) 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 - private int[] b; - private PacketPlayOutMapChunk.ChunkMap[] c; - private boolean d; -+ private World world; // Spigot - - public PacketPlayOutMapChunkBulk() {} - -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet - this.b[j] = chunk.locZ; - this.c[j] = packetplayoutmapchunk_chunkmap; - } -- -+ -+ world = ((Chunk) list.get(0)).getWorld(); // Spigot - } - - public void a(PacketDataSerializer packetdataserializer) throws IOException { -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet - } - - for (i = 0; i < this.a.length; ++i) { -+ world.spigotConfig.antiXrayInstance.obfuscate(this.a[i], this.b[i], this.c[i].b, this.c[i].a, world); // Spigot - packetdataserializer.writeBytes(this.c[i].a); - } - -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -0,0 +0,0 @@ public class PlayerInteractManager { - } - - } -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot - } - - public void a(BlockPosition blockposition) { -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 { - this.d(blockposition.up(), block); - this.d(blockposition.north(), block); - this.d(blockposition.south(), block); -+ spigotConfig.antiXrayInstance.updateNearbyBlocks(this, blockposition); // Spigot - } - - public void a(BlockPosition blockposition, Block block, EnumDirection enumdirection) { -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - return this.worldProvider.p()[this.getLightLevel(blockposition)]; - } - -- public IBlockData getType(BlockPosition blockposition) { -+ // Spigot start -+ public IBlockData getType(BlockPosition blockposition) -+ { -+ return getType( blockposition, true ); -+ } -+ -+ public IBlockData getType(BlockPosition blockposition, boolean useCaptured) { - // CraftBukkit start - tree generation -- if (captureTreeGeneration) { -+ if (captureTreeGeneration && useCaptured) { -+ // Spigot end - Iterator it = capturedBlockStates.iterator(); - while (it.hasNext()) { - BlockState previous = it.next(); -diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/spigotmc/AntiXray.java -@@ -0,0 +0,0 @@ -+package org.spigotmc; -+ -+import gnu.trove.set.TByteSet; -+import gnu.trove.set.hash.TByteHashSet; -+import net.minecraft.server.Block; -+import net.minecraft.server.BlockPosition; -+import net.minecraft.server.Blocks; -+import net.minecraft.server.World; -+import org.bukkit.craftbukkit.util.CraftMagicNumbers; -+ -+public class AntiXray -+{ -+ -+ private static final CustomTimingsHandler update = new CustomTimingsHandler( "xray - update" ); -+ private static final CustomTimingsHandler obfuscate = new CustomTimingsHandler( "xray - obfuscate" ); -+ /*========================================================================*/ -+ // Used to keep track of which blocks to obfuscate -+ private final boolean[] obfuscateBlocks = new boolean[ Short.MAX_VALUE ]; -+ // Used to select a random replacement ore -+ private final byte[] replacementOres; -+ -+ public AntiXray(SpigotWorldConfig config) -+ { -+ // Set all listed blocks as true to be obfuscated -+ for ( int id : ( config.engineMode == 1 ) ? config.hiddenBlocks : config.replaceBlocks ) -+ { -+ obfuscateBlocks[id] = true; -+ } -+ -+ // For every block -+ TByteSet blocks = new TByteHashSet(); -+ for ( Integer i : config.hiddenBlocks ) -+ { -+ Block block = Block.getById( i ); -+ // Check it exists and is not a tile entity -+ if ( block != null && !block.isTileEntity() ) -+ { -+ // Add it to the set of replacement blocks -+ blocks.add( (byte) (int) i ); -+ } -+ } -+ // Bake it to a flat array of replacements -+ replacementOres = blocks.toArray(); -+ } -+ -+ /** -+ * Starts the timings handler, then updates all blocks within the set radius -+ * of the given coordinate, revealing them if they are hidden ores. -+ */ -+ public void updateNearbyBlocks(World world, BlockPosition position) -+ { -+ if ( world.spigotConfig.antiXray ) -+ { -+ update.startTiming(); -+ updateNearbyBlocks( world, position, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower -+ update.stopTiming(); -+ } -+ } -+ -+ /** -+ * Starts the timings handler, and then removes all non exposed ores from -+ * the chunk buffer. -+ */ -+ public void obfuscateSync(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) -+ { -+ if ( world.spigotConfig.antiXray ) -+ { -+ obfuscate.startTiming(); -+ obfuscate( chunkX, chunkY, bitmask, buffer, world ); -+ obfuscate.stopTiming(); -+ } -+ } -+ -+ /** -+ * Removes all non exposed ores from the chunk buffer. -+ */ -+ public void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) -+ { -+ // If the world is marked as obfuscated -+ if ( world.spigotConfig.antiXray ) -+ { -+ // Initial radius to search around for air -+ int initialRadius = 1; -+ // Which block in the buffer we are looking at, anywhere from 0 to 16^4 -+ int index = 0; -+ // The iterator marking which random ore we should use next -+ int randomOre = 0; -+ -+ // Chunk corner X and Z blocks -+ int startX = chunkX << 4; -+ int startZ = chunkY << 4; -+ -+ byte replaceWithTypeId; -+ switch ( world.getWorld().getEnvironment() ) -+ { -+ case NETHER: -+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.NETHERRACK); -+ break; -+ case THE_END: -+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.END_STONE); -+ break; -+ default: -+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.STONE); -+ break; -+ } -+ -+ // Chunks can have up to 16 sections -+ for ( int i = 0; i < 16; i++ ) -+ { -+ // If the bitmask indicates this chunk is sent... -+ if ( ( bitmask & 1 << i ) != 0 ) -+ { -+ // Work through all blocks in the chunk, y,z,x -+ for ( int y = 0; y < 16; y++ ) -+ { -+ for ( int z = 0; z < 16; z++ ) -+ { -+ for ( int x = 0; x < 16; x++ ) -+ { -+ // For some reason we can get too far ahead of ourselves (concurrent modification on bulk chunks?) so if we do, just abort and move on -+ if ( index >= buffer.length ) -+ { -+ index++; -+ continue; -+ } -+ // Grab the block ID in the buffer. -+ // TODO: extended IDs are not yet supported -+ int blockId = (buffer[index << 1] & 0xFF) -+ | ((buffer[(index << 1) + 1] & 0xFF) << 8); -+ blockId >>>= 4; -+ // Check if the block should be obfuscated -+ if ( obfuscateBlocks[blockId] ) -+ { -+ // The world isn't loaded, bail out -+ if ( !isLoaded( world, new BlockPosition( startX + x, ( i << 4 ) + y, startZ + z ), initialRadius ) ) -+ { -+ index++; -+ continue; -+ } -+ // On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate -+ if ( !hasTransparentBlockAdjacent( world, new BlockPosition( startX + x, ( i << 4 ) + y, startZ + z ), initialRadius ) ) -+ { -+ int newId = blockId; -+ switch ( world.spigotConfig.engineMode ) -+ { -+ case 1: -+ // Replace with replacement material -+ newId = replaceWithTypeId & 0xFF; -+ break; -+ case 2: -+ // Replace with random ore. -+ if ( randomOre >= replacementOres.length ) -+ { -+ randomOre = 0; -+ } -+ newId = replacementOres[randomOre++] & 0xFF; -+ break; -+ } -+ newId <<= 4; -+ buffer[index << 1] = (byte) (newId & 0xFF); -+ buffer[(index << 1) + 1] = (byte) ((newId >> 8) & 0xFF); -+ } -+ } -+ -+ index++; -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ -+ private void updateNearbyBlocks(World world, BlockPosition position, int radius, boolean updateSelf) -+ { -+ // If the block in question is loaded -+ if ( world.isLoaded( position ) ) -+ { -+ // Get block id -+ Block block = world.getType(position).getBlock(); -+ -+ // See if it needs update -+ if ( updateSelf && obfuscateBlocks[Block.getId( block )] ) -+ { -+ // Send the update -+ world.notify( position ); -+ } -+ -+ // Check other blocks for updates -+ if ( radius > 0 ) -+ { -+ updateNearbyBlocks( world, position.east(), radius - 1, true ); -+ updateNearbyBlocks( world, position.west(), radius - 1, true ); -+ updateNearbyBlocks( world, position.up(), radius - 1, true ); -+ updateNearbyBlocks( world, position.down(), radius - 1, true ); -+ updateNearbyBlocks( world, position.south(), radius - 1, true ); -+ updateNearbyBlocks( world, position.north(), radius - 1, true ); -+ } -+ } -+ } -+ -+ private static boolean isLoaded(World world, BlockPosition position, int radius) -+ { -+ return world.isLoaded( position ) -+ && ( radius == 0 || -+ ( isLoaded( world, position.east(), radius - 1 ) -+ && isLoaded( world, position.west(), radius - 1 ) -+ && isLoaded( world, position.up(), radius - 1 ) -+ && isLoaded( world, position.down(), radius - 1 ) -+ && isLoaded( world, position.south(), radius - 1 ) -+ && isLoaded( world, position.north(), radius - 1 ) ) ); -+ } -+ -+ private static boolean hasTransparentBlockAdjacent(World world, BlockPosition position, int radius) -+ { -+ return !isSolidBlock(world.getType(position, false).getBlock()) /* isSolidBlock */ -+ || ( radius > 0 -+ && ( hasTransparentBlockAdjacent( world, position.east(), radius - 1 ) -+ || hasTransparentBlockAdjacent( world, position.west(), radius - 1 ) -+ || hasTransparentBlockAdjacent( world, position.up(), radius - 1 ) -+ || hasTransparentBlockAdjacent( world, position.down(), radius - 1 ) -+ || hasTransparentBlockAdjacent( world, position.south(), radius - 1 ) -+ || hasTransparentBlockAdjacent( world, position.north(), radius - 1 ) ) ); -+ } -+ -+ private static boolean isSolidBlock(Block block) { -+ // Mob spawners are treated as solid blocks as far as the -+ // game is concerned for lighting and other tasks but for -+ // rendering they can be seen through therefor we special -+ // case them so that the antixray doesn't show the fake -+ // blocks around them. -+ return block.isOccluding() && block != Blocks.MOB_SPAWNER && block != Blocks.BARRIER; -+ } -+} -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 @@ - package org.spigotmc; - -+import java.util.Arrays; - import java.util.List; - import org.bukkit.Bukkit; - import org.bukkit.configuration.file.YamlConfiguration; -@@ -0,0 +0,0 @@ public class SpigotWorldConfig - arrowDespawnRate = getInt( "arrow-despawn-rate", 1200 ); - log( "Arrow Despawn Rate: " + arrowDespawnRate ); - } -+ -+ public boolean antiXray; -+ public int engineMode; -+ public List hiddenBlocks; -+ public List replaceBlocks; -+ public AntiXray antiXrayInstance; -+ private void antiXray() -+ { -+ antiXray = getBoolean( "anti-xray.enabled", true ); -+ log( "Anti X-Ray: " + antiXray ); -+ -+ engineMode = getInt( "anti-xray.engine-mode", 1 ); -+ log( "\tEngine Mode: " + engineMode ); -+ -+ if ( SpigotConfig.version < 5 ) -+ { -+ set( "anti-xray.blocks", null ); -+ } -+ hiddenBlocks = getList( "anti-xray.hide-blocks", Arrays.asList( new Integer[] -+ { -+ 14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130 -+ } ) ); -+ log( "\tHidden Blocks: " + hiddenBlocks ); -+ -+ replaceBlocks = getList( "anti-xray.replace-blocks", Arrays.asList( new Integer[] -+ { -+ 1, 5 -+ } ) ); -+ log( "\tReplace Blocks: " + replaceBlocks ); -+ -+ antiXrayInstance = new AntiXray( this ); -+ } - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0053-Optimize-DataWatcher.patch b/CraftBukkit-Patches/0053-Optimize-DataWatcher.patch deleted file mode 100644 index 7dce3137f2..0000000000 --- a/CraftBukkit-Patches/0053-Optimize-DataWatcher.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 13 Dec 2013 11:45:47 +1100 -Subject: [PATCH] Optimize DataWatcher - -Use primitive orientated collections, as well as more effective copies across collections. - -diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataWatcher.java -+++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -0,0 +0,0 @@ public class DataWatcher { - - private final Entity a; - private boolean b = true; -- 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, 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(); - -@@ -0,0 +0,0 @@ public class DataWatcher { - } - - 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: " + 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 { -- 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), datawatcher_watchableobject); -+ this.dataValues.put(i, datawatcher_watchableobject); // Spigot - this.f.writeLock().unlock(); - this.b = false; - } -@@ -0,0 +0,0 @@ public class DataWatcher { - DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(j, i, (Object) null); - - this.f.writeLock().lock(); -- 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 { - DataWatcher.WatchableObject datawatcher_watchableobject; - - try { -- 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"); -@@ -0,0 +0,0 @@ public class DataWatcher { - - if (this.e) { - this.f.readLock().lock(); -- Iterator iterator = this.d.values().iterator(); -+ Iterator iterator = this.dataValues.valueCollection().iterator(); // Spigot - - while (iterator.hasNext()) { - DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); -@@ -0,0 +0,0 @@ public class DataWatcher { - - 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()) { - DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next(); -@@ -0,0 +0,0 @@ public class DataWatcher { - } - - public List c() { -- ArrayList arraylist = null; -+ ArrayList arraylist = Lists.newArrayList(); // Spigot - - this.f.readLock().lock(); - -- DataWatcher.WatchableObject datawatcher_watchableobject; -- -- 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(); -- } -- } -+ arraylist.addAll(this.dataValues.valueCollection()); // Spigot - - this.f.readLock().unlock(); - return arraylist; -@@ -0,0 +0,0 @@ public class DataWatcher { - } - - static { -- DataWatcher.c.put(Byte.class, Integer.valueOf(0)); -- DataWatcher.c.put(Short.class, Integer.valueOf(1)); -- DataWatcher.c.put(Integer.class, Integer.valueOf(2)); -- DataWatcher.c.put(Float.class, Integer.valueOf(3)); -- DataWatcher.c.put(String.class, Integer.valueOf(4)); -- DataWatcher.c.put(ItemStack.class, Integer.valueOf(5)); -- DataWatcher.c.put(BlockPosition.class, Integer.valueOf(6)); -- DataWatcher.c.put(Vector3f.class, Integer.valueOf(7)); -+ // Spigot Start - remove valueOf -+ classToId.put(Byte.class, 0); -+ classToId.put(Short.class, 1); -+ classToId.put(Integer.class, 2); -+ classToId.put(Float.class, 3); -+ classToId.put(String.class, 4); -+ classToId.put(ItemStack.class, 5); -+ classToId.put(BlockPosition.class, 6); -+ classToId.put(Vector3f.class, 7); -+ // Spigot End - } - - public static class WatchableObject { --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0060-Particle-API.patch b/CraftBukkit-Patches/0053-Particle-API.patch similarity index 100% rename from CraftBukkit-Patches/0060-Particle-API.patch rename to CraftBukkit-Patches/0053-Particle-API.patch diff --git a/CraftBukkit-Patches/0061-Save-ticks-lived-to-nbttag.patch b/CraftBukkit-Patches/0054-Save-ticks-lived-to-nbttag.patch similarity index 95% rename from CraftBukkit-Patches/0061-Save-ticks-lived-to-nbttag.patch rename to CraftBukkit-Patches/0054-Save-ticks-lived-to-nbttag.patch index 2bfc537e22..28c72ffa2d 100644 --- a/CraftBukkit-Patches/0061-Save-ticks-lived-to-nbttag.patch +++ b/CraftBukkit-Patches/0054-Save-ticks-lived-to-nbttag.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL); + nbttagcompound.setInt("Spigot.ticksLived", this.ticksLived); // CraftBukkit end - if (this.getCustomName() != null && this.getCustomName().length() > 0) { + if (this.getCustomName() != null && !this.getCustomName().isEmpty()) { nbttagcompound.setString("CustomName", this.getCustomName()); @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { if (this instanceof EntityLiving) { diff --git a/CraftBukkit-Patches/0063-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch b/CraftBukkit-Patches/0055-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch similarity index 74% rename from CraftBukkit-Patches/0063-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch rename to CraftBukkit-Patches/0055-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch index a718ac17c9..917f61bb05 100644 --- a/CraftBukkit-Patches/0063-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch +++ b/CraftBukkit-Patches/0055-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { this.world.methodProfiler.a("checkDespawn"); - this.D(); + this.L(); this.world.methodProfiler.b(); + // Spigot Start + if ( this.fromMobSpawner ) @@ -31,38 +31,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot End this.world.methodProfiler.a("sensing"); - this.bk.a(); + this.bu.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 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); - if (!event.isCancelled()) { - entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit -+ // Spigot Start -+ if ( entity.world.spigotConfig.nerfSpawnerMobs ) -+ { -+ entity.fromMobSpawner = true; -+ } -+ // Spigot End - } - // CraftBukkit end - } -@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); - if (!event.isCancelled()) { - entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) { + ((EntityInsentient) entity).prepare(world.D(new BlockPosition(entity)), (GroupDataEntity) null); + } +- + // Spigot Start + if ( entity.world.spigotConfig.nerfSpawnerMobs ) + { + entity.fromMobSpawner = true; + } + // Spigot End - } - // Spigot end - } + ChunkRegionLoader.a(entity, world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + world.triggerEffect(2004, blockposition, 0); + if (entityinsentient != null) { 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/0064-Warn-if-PermGen-may-be-insufficient.patch b/CraftBukkit-Patches/0056-Warn-if-PermGen-may-be-insufficient.patch similarity index 100% rename from CraftBukkit-Patches/0064-Warn-if-PermGen-may-be-insufficient.patch rename to CraftBukkit-Patches/0056-Warn-if-PermGen-may-be-insufficient.patch diff --git a/CraftBukkit-Patches/0065-Disable-Connected-Check-on-setScoreboard.patch b/CraftBukkit-Patches/0057-Disable-Connected-Check-on-setScoreboard.patch similarity index 100% rename from CraftBukkit-Patches/0065-Disable-Connected-Check-on-setScoreboard.patch rename to CraftBukkit-Patches/0057-Disable-Connected-Check-on-setScoreboard.patch diff --git a/CraftBukkit-Patches/0066-Add-Late-Bind-Option.patch b/CraftBukkit-Patches/0058-Add-Late-Bind-Option.patch similarity index 91% rename from CraftBukkit-Patches/0066-Add-Late-Bind-Option.patch rename to CraftBukkit-Patches/0058-Add-Late-Bind-Option.patch index 917f8ab5d1..70cd21f875 100644 --- a/CraftBukkit-Patches/0066-Add-Late-Bind-Option.patch +++ b/CraftBukkit-Patches/0058-Add-Late-Bind-Option.patch @@ -11,11 +11,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer this.a(MinecraftEncryption.b()); - DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.R()); + DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().isEmpty() ? "*" : this.getServerIp()) + ":" + this.P()); + if (!org.spigotmc.SpigotConfig.lateBind) { try { - this.aq().a(inetaddress, this.R()); + this.am().a(inetaddress, this.P()); } 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?"); @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (org.spigotmc.SpigotConfig.lateBind) { + try { -+ this.aq().a(inetaddress, this.R()); ++ this.am().a(inetaddress, this.P()); + } catch (IOException ioexception) { + DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); + DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()}); @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + - if (false && this.aS() > 0L) { // Spigot - disable + if (false && this.aP() > 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 diff --git a/CraftBukkit-Patches/0067-Allow-statistics-to-be-disabled-forced.patch b/CraftBukkit-Patches/0059-Allow-statistics-to-be-disabled-forced.patch similarity index 100% rename from CraftBukkit-Patches/0067-Allow-statistics-to-be-disabled-forced.patch rename to CraftBukkit-Patches/0059-Allow-statistics-to-be-disabled-forced.patch diff --git a/CraftBukkit-Patches/0068-Fix-ItemStack-Unbreakable-Code.patch b/CraftBukkit-Patches/0060-Fix-ItemStack-Unbreakable-Code.patch similarity index 100% rename from CraftBukkit-Patches/0068-Fix-ItemStack-Unbreakable-Code.patch rename to CraftBukkit-Patches/0060-Fix-ItemStack-Unbreakable-Code.patch diff --git a/CraftBukkit-Patches/0069-Try-and-Debug-Crash-Reports-Crashing.patch b/CraftBukkit-Patches/0061-Try-and-Debug-Crash-Reports-Crashing.patch similarity index 100% rename from CraftBukkit-Patches/0069-Try-and-Debug-Crash-Reports-Crashing.patch rename to CraftBukkit-Patches/0061-Try-and-Debug-Crash-Reports-Crashing.patch diff --git a/CraftBukkit-Patches/0070-Improve-AutoSave-Mechanism.patch b/CraftBukkit-Patches/0062-Improve-AutoSave-Mechanism.patch similarity index 95% rename from CraftBukkit-Patches/0070-Improve-AutoSave-Mechanism.patch rename to CraftBukkit-Patches/0062-Improve-AutoSave-Mechanism.patch index d3f96b5496..2fb8a1aecd 100644 --- a/CraftBukkit-Patches/0070-Improve-AutoSave-Mechanism.patch +++ b/CraftBukkit-Patches/0062-Improve-AutoSave-Mechanism.patch @@ -15,11 +15,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 { - if (this.r && this.world.getTime() != this.lastSaved || this.q) { + if (this.s && this.world.getTime() != this.lastSaved || this.r) { return true; } -- } else if (this.r && this.world.getTime() >= this.lastSaved + 600L) { -+ } else if (this.r && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // Spigot - Only save if we've passed 2 auto save intervals without modification +- } else if (this.s && this.world.getTime() >= this.lastSaved + 600L) { ++ } else if (this.s && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // Spigot - Only save if we've passed 2 auto save intervals without modification return true; } diff --git a/CraftBukkit-Patches/0062-More-Efficient-GetCubes.patch b/CraftBukkit-Patches/0062-More-Efficient-GetCubes.patch deleted file mode 100644 index 1938279273..0000000000 --- a/CraftBukkit-Patches/0062-More-Efficient-GetCubes.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 11 Jun 2013 12:17:37 +1000 -Subject: [PATCH] More Efficient GetCubes - - -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 { - 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(blockposition_mutableblockposition.c(k1, 64, l1))) { -- for (int i2 = k - 1; i2 < l; ++i2) { -- 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++ ) -+ { -+ int cx = chunkx << 4; -+ for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ ) -+ { -+ if ( !this.isChunkLoaded( chunkx, chunkz, true ) ) -+ { -+ continue; -+ } -+ int cz = chunkz << 4; -+ Chunk chunk = this.getChunkAt( chunkx, chunkz ); -+ // Compute ranges within chunk -+ int xstart = ( i < cx ) ? cx : i; -+ int xend = ( j < ( cx + 16 ) ) ? j : ( cx + 16 ); -+ int zstart = ( i1 < cz ) ? cz : i1; -+ int zend = ( j1 < ( cz + 16 ) ) ? j1 : ( cz + 16 ); -+ // Loop through blocks within chunk -+ for ( int x = xstart; x < xend; x++ ) -+ { -+ for ( int z = zstart; z < zend; z++ ) -+ { -+ for ( int y = ystart; y < l; y++ ) -+ { -+ BlockPosition blockposition = new BlockPosition( x, y, z ); -+ -+ if (flag && flag1) { -+ entity.h(false); -+ } else if (!flag && !flag1) { -+ entity.h(true); -+ } - -- if (worldborder.a((BlockPosition) blockposition_mutableblockposition) || !flag1) { -- iblockdata1 = this.getType(blockposition_mutableblockposition); -+ IBlockData block; -+ if (!this.getWorldBorder().a(blockposition) && flag1) { -+ block = Blocks.STONE.getBlockData(); -+ } else -+ { -+ block = chunk.getBlockData( blockposition ); -+ } -+ if ( block != null ) -+ { -+ block.getBlock().a(this, blockposition, block, axisalignedbb, arraylist, entity); -+ } - } -- -- iblockdata1.getBlock().a(this, blockposition_mutableblockposition, iblockdata1, axisalignedbb, arraylist, entity); - } - } - } - } -+ // Spigot end - - double d0 = 0.25D; - List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0)); --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0071-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch b/CraftBukkit-Patches/0063-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch similarity index 100% rename from CraftBukkit-Patches/0071-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch rename to CraftBukkit-Patches/0063-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch diff --git a/CraftBukkit-Patches/0072-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch b/CraftBukkit-Patches/0064-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch similarity index 100% rename from CraftBukkit-Patches/0072-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch rename to CraftBukkit-Patches/0064-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch diff --git a/CraftBukkit-Patches/0073-Highly-Optimized-Tick-Loop.patch b/CraftBukkit-Patches/0065-Highly-Optimized-Tick-Loop.patch similarity index 89% rename from CraftBukkit-Patches/0073-Highly-Optimized-Tick-Loop.patch rename to CraftBukkit-Patches/0065-Highly-Optimized-Tick-Loop.patch index 28fbe89ec2..bec0a38302 100644 --- a/CraftBukkit-Patches/0073-Highly-Optimized-Tick-Loop.patch +++ b/CraftBukkit-Patches/0065-Highly-Optimized-Tick-Loop.patch @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public final double[] recentTps = new double[ 3 ]; + // Spigot end - public MinecraftServer(OptionSet options, Proxy proxy, File file1) { + public MinecraftServer(OptionSet options, Proxy proxy, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { this.e = proxy; @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.isRunning = false; @@ -36,21 +36,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 try { if (this.init()) { @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.r.setServerInfo(new ServerPing.ServerData("1.8.8", 47)); - this.a(this.r); + this.q.setServerInfo(new ServerPing.ServerData("1.9", 107)); + this.a(this.q); + // Spigot start + Arrays.fill( recentTps, 20 ); + long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; while (this.isRunning) { -- long j = az(); -- long k = j - this.ab; +- long j = av(); +- long k = j - this.aa; - -- if (k > 2000L && this.ab - this.R >= 15000L) { +- if (k > 2000L && this.aa - this.Q >= 15000L) { - if (server.getWarnOnOverload()) // CraftBukkit - MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)}); - k = 2000L; -- this.R = this.ab; +- this.Q = this.aa; - } - - if (k < 0L) { @@ -67,15 +67,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - i += k; -- this.ab = j; +- this.aa = j; - if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit -- this.A(); +- this.C(); - i = 0L; - } else { - while (i > 50L) { - MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit - i -= 50L; -- this.A(); +- this.C(); - } + if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) + { @@ -88,8 +88,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + lastTick = curTime; - Thread.sleep(Math.max(1L, 50L - i)); -+ this.A(); - this.Q = true; ++ this.C(); + this.P = true; } + // Spigot end } else { diff --git a/CraftBukkit-Patches/0074-Configurable-Ping-Sample-Size.patch b/CraftBukkit-Patches/0066-Configurable-Ping-Sample-Size.patch similarity index 63% rename from CraftBukkit-Patches/0074-Configurable-Ping-Sample-Size.patch rename to CraftBukkit-Patches/0066-Configurable-Ping-Sample-Size.patch index be99278f00..6a75e8400e 100644 --- a/CraftBukkit-Patches/0074-Configurable-Ping-Sample-Size.patch +++ b/CraftBukkit-Patches/0066-Configurable-Ping-Sample-Size.patch @@ -9,19 +9,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/PacketStatusListener.java +++ b/src/main/java/net/minecraft/server/PacketStatusListener.java @@ -0,0 +0,0 @@ public class PacketStatusListener implements PacketStatusInListener { - } + } - ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size()); -+ // Spigot Start -+ if ( !profiles.isEmpty() ) -+ { -+ java.util.Collections.shuffle( profiles ); // This sucks, its inefficient but we have no simple way of doing it differently -+ profiles = profiles.subList( 0, Math.min( profiles.size(), org.spigotmc.SpigotConfig.playerSample ) ); // Cap the sample to n (or less) displayed players, ie: Vanilla behaviour -+ } -+ // Spigot End - playerSample.a(profiles.toArray(new GameProfile[profiles.size()])); + ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size()); ++ // Spigot Start ++ if ( !profiles.isEmpty() ) ++ { ++ java.util.Collections.shuffle( profiles ); // This sucks, its inefficient but we have no simple way of doing it differently ++ profiles = profiles.subList( 0, Math.min( profiles.size(), org.spigotmc.SpigotConfig.playerSample ) ); // Cap the sample to n (or less) displayed players, ie: Vanilla behaviour ++ } ++ // Spigot End + playerSample.a(profiles.toArray(new GameProfile[profiles.size()])); - ServerPing ping = new ServerPing(); + ServerPing ping = new ServerPing(); 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/0075-Add-Optional-Tick-Shuffling.patch b/CraftBukkit-Patches/0067-Add-Optional-Tick-Shuffling.patch similarity index 100% rename from CraftBukkit-Patches/0075-Add-Optional-Tick-Shuffling.patch rename to CraftBukkit-Patches/0067-Add-Optional-Tick-Shuffling.patch diff --git a/CraftBukkit-Patches/0077-Implement-Locale-Getter-for-Players.patch b/CraftBukkit-Patches/0068-Implement-Locale-Getter-for-Players.patch similarity index 92% rename from CraftBukkit-Patches/0077-Implement-Locale-Getter-for-Players.patch rename to CraftBukkit-Patches/0068-Implement-Locale-Getter-for-Players.patch index 21d20c13b2..8dd93dc243 100644 --- a/CraftBukkit-Patches/0077-Implement-Locale-Getter-for-Players.patch +++ b/CraftBukkit-Patches/0068-Implement-Locale-Getter-for-Players.patch @@ -11,9 +11,9 @@ 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 bH = LogManager.getLogger(); + private static final Logger bQ = LogManager.getLogger(); - private String locale = "en_US"; -+ public String locale = "en_US"; // Spigot ++ public String locale = "en_US"; // Spigot private -> public public PlayerConnection playerConnection; public final MinecraftServer server; public final PlayerInteractManager playerInteractManager; diff --git a/CraftBukkit-Patches/0078-Cap-Entity-Collisions.patch b/CraftBukkit-Patches/0069-Cap-Entity-Collisions.patch similarity index 67% rename from CraftBukkit-Patches/0078-Cap-Entity-Collisions.patch rename to CraftBukkit-Patches/0069-Cap-Entity-Collisions.patch index 007edf4b44..941dbd8175 100644 --- a/CraftBukkit-Patches/0078-Cap-Entity-Collisions.patch +++ b/CraftBukkit-Patches/0069-Cap-Entity-Collisions.patch @@ -11,46 +11,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { + public long activatedTick = Integer.MIN_VALUE; + public boolean fromMobSpawner; + public void inactiveTick() { } ++ protected int numCollisions = 0; + // Spigot end - public void d(EntityHuman entityhuman) {} - -+ int numCollisions = 0; // Spigot - public void collide(Entity entity) { - if (entity.passenger != this && entity.vehicle != this) { - if (!entity.noclip && !this.noclip) { + public Entity(World world) { 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.a((Entity) this, this.getBoundingBox(), IEntitySelector.a(this)); - 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 + if (this.isInteractable() && !list.isEmpty()) { // Spigot: Add isInteractable() condition +- for (int i = 0; i < list.size(); ++i) { ++ numCollisions -= world.spigotConfig.maxCollisionsPerEntity; // Spigot ++ for (int i = 0; i < list.size() && numCollisions < world.spigotConfig.maxCollisionsPerEntity; ++i) { Entity entity = (Entity) list.get(i); - // TODO better check now? + // CraftBukkit start - Only handle mob (non-player) collisions every other tick @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } // CraftBukkit end +- + entity.numCollisions++; // Spigot + numCollisions++; // Spigot - this.s(entity); + this.C(entity); } -+ numCollisions = 0; // Spigot } - - } 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 - maxBulkChunk = getInt( "max-bulk-chunks", 10 ); - log( "Sending up to " + maxBulkChunk + " chunks per packet" ); + enableZombiePigmenPortalSpawns = getBoolean( "enable-zombie-pigmen-portal-spawns", true ); + log( "Allow Zombie Pigmen to spawn from portal blocks: " + enableZombiePigmenPortalSpawns ); } + + public int maxCollisionsPerEntity; diff --git a/CraftBukkit-Patches/0079-Fix-dispensing-bone-meal-not-having-the-correct-data.patch b/CraftBukkit-Patches/0070-Fix-dispensing-bone-meal-not-having-the-correct-data.patch similarity index 100% rename from CraftBukkit-Patches/0079-Fix-dispensing-bone-meal-not-having-the-correct-data.patch rename to CraftBukkit-Patches/0070-Fix-dispensing-bone-meal-not-having-the-correct-data.patch diff --git a/CraftBukkit-Patches/0080-Spam-Filter-Exclusions.patch b/CraftBukkit-Patches/0071-Spam-Filter-Exclusions.patch similarity index 98% rename from CraftBukkit-Patches/0080-Spam-Filter-Exclusions.patch rename to CraftBukkit-Patches/0071-Spam-Filter-Exclusions.patch index 58ec815e8d..347015424c 100644 --- a/CraftBukkit-Patches/0080-Spam-Filter-Exclusions.patch +++ b/CraftBukkit-Patches/0071-Spam-Filter-Exclusions.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- 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 +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { this.minecraftServer.getPlayerList().sendMessage(chatmessage1, false); } diff --git a/CraftBukkit-Patches/0081-Add-Option-to-Silence-CommandBlock-Console.patch b/CraftBukkit-Patches/0072-Add-Option-to-Silence-CommandBlock-Console.patch similarity index 100% rename from CraftBukkit-Patches/0081-Add-Option-to-Silence-CommandBlock-Console.patch rename to CraftBukkit-Patches/0072-Add-Option-to-Silence-CommandBlock-Console.patch diff --git a/CraftBukkit-Patches/0082-Add-support-for-fetching-hidden-players.patch b/CraftBukkit-Patches/0073-Add-support-for-fetching-hidden-players.patch similarity index 100% rename from CraftBukkit-Patches/0082-Add-support-for-fetching-hidden-players.patch rename to CraftBukkit-Patches/0073-Add-support-for-fetching-hidden-players.patch diff --git a/CraftBukkit-Patches/0083-Allow-Disabling-Creative-Item-Filter.patch b/CraftBukkit-Patches/0074-Allow-Disabling-Creative-Item-Filter.patch similarity index 95% rename from CraftBukkit-Patches/0083-Allow-Disabling-Creative-Item-Filter.patch rename to CraftBukkit-Patches/0074-Allow-Disabling-Creative-Item-Filter.patch index dcdbd5827a..ee19cbf756 100644 --- a/CraftBukkit-Patches/0083-Allow-Disabling-Creative-Item-Filter.patch +++ b/CraftBukkit-Patches/0074-Allow-Disabling-Creative-Item-Filter.patch @@ -8,9 +8,9 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- 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 +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize(); + boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45; // CraftBukkit - Add invalidItems check - 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 diff --git a/CraftBukkit-Patches/0084-Cap-Channel-Registrations.patch b/CraftBukkit-Patches/0075-Cap-Channel-Registrations.patch similarity index 100% rename from CraftBukkit-Patches/0084-Cap-Channel-Registrations.patch rename to CraftBukkit-Patches/0075-Cap-Channel-Registrations.patch diff --git a/CraftBukkit-Patches/0076-Allow-Configuring-Chunks-per-Packet.patch b/CraftBukkit-Patches/0076-Allow-Configuring-Chunks-per-Packet.patch deleted file mode 100644 index eff6b3b0d9..0000000000 --- a/CraftBukkit-Patches/0076-Allow-Configuring-Chunks-per-Packet.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 28 Jan 2014 20:35:35 +1100 -Subject: [PATCH] Allow Configuring Chunks per Packet - - -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 -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - Chunk chunk; - -- while (iterator1.hasNext() && arraylist.size() < 10) { -+ while (iterator1.hasNext() && arraylist.size() < this.world.spigotConfig.maxBulkChunk) { // Spigot - ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator1.next(); - - if (chunkcoordintpair != null) { -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 - enableZombiePigmenPortalSpawns = getBoolean( "enable-zombie-pigmen-portal-spawns", true ); - log( "Allow Zombie Pigmen to spawn from portal blocks: " + enableZombiePigmenPortalSpawns ); - } -+ -+ public int maxBulkChunk; -+ private void bulkChunkCount() -+ { -+ maxBulkChunk = getInt( "max-bulk-chunks", 10 ); -+ log( "Sending up to " + maxBulkChunk + " chunks per packet" ); -+ } - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0085-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch b/CraftBukkit-Patches/0076-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch similarity index 99% rename from CraftBukkit-Patches/0085-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch rename to CraftBukkit-Patches/0076-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch index b97a831736..817bb4e251 100644 --- a/CraftBukkit-Patches/0085-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch +++ b/CraftBukkit-Patches/0076-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private void setVanillaCommands() { + private void setVanillaCommands(boolean first) { // Spigot - Map commands = new CommandDispatcher().getCommands(); + Map commands = new CommandDispatcher(console).getCommands(); for (ICommand cmd : commands.values()) { - commandMap.register("minecraft", new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null)))); + // Spigot start diff --git a/CraftBukkit-Patches/0087-Implement-Silenceable-Lightning-API.patch b/CraftBukkit-Patches/0077-Implement-Silenceable-Lightning-API.patch similarity index 88% rename from CraftBukkit-Patches/0087-Implement-Silenceable-Lightning-API.patch rename to CraftBukkit-Patches/0077-Implement-Silenceable-Lightning-API.patch index 05f311cefc..eb1553e7f3 100644 --- a/CraftBukkit-Patches/0087-Implement-Silenceable-Lightning-API.patch +++ b/CraftBukkit-Patches/0077-Implement-Silenceable-Lightning-API.patch @@ -9,34 +9,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityLightning.java +++ b/src/main/java/net/minecraft/server/EntityLightning.java @@ -0,0 +0,0 @@ public class EntityLightning extends EntityWeather { - // CraftBukkit start - public boolean isEffect = false; - + private int c; + private final boolean d; + public boolean isEffect; // CraftBukkit + public boolean isSilent = false; // Spigot -+ - public EntityLightning(World world, double d0, double d1, double d2) { - this(world, d0, d1, d2, false); - } + + public EntityLightning(World world, double d0, double d1, double d2, boolean flag) { + super(world); @@ -0,0 +0,0 @@ public class EntityLightning extends EntityWeather { - } - } - } -+ } + + } + // Spigot start + public EntityLightning(World world, double d0, double d1, double d2, boolean isEffect, boolean isSilent) + { + this( world, d0, d1, d2, isEffect ); + this.isSilent = isSilent; - } ++ } + // Spigot end ++ + public SoundCategory bz() { + return SoundCategory.WEATHER; + } - public void t_() { - super.t_(); + public void m() { + super.m(); - if (this.lifeTicks == 2) { + if (!isSilent && this.lifeTicks == 2) { // Spigot // CraftBukkit start - Use relative location for far away sounds - //this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); + // this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dc, SoundCategory.d, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); float pitch = 0.8F + this.random.nextFloat() * 0.2F; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/CraftBukkit-Patches/0088-Use-one-PermissibleBase-for-all-Command-Blocks.patch b/CraftBukkit-Patches/0078-Use-one-PermissibleBase-for-all-Command-Blocks.patch similarity index 100% rename from CraftBukkit-Patches/0088-Use-one-PermissibleBase-for-all-Command-Blocks.patch rename to CraftBukkit-Patches/0078-Use-one-PermissibleBase-for-all-Command-Blocks.patch diff --git a/CraftBukkit-Patches/0089-Prevent-hoppers-from-loading-chunks.patch b/CraftBukkit-Patches/0079-Prevent-hoppers-from-loading-chunks.patch similarity index 96% rename from CraftBukkit-Patches/0089-Prevent-hoppers-from-loading-chunks.patch rename to CraftBukkit-Patches/0079-Prevent-hoppers-from-loading-chunks.patch index 96e7be1428..ecae7f9e18 100644 --- a/CraftBukkit-Patches/0089-Prevent-hoppers-from-loading-chunks.patch +++ b/CraftBukkit-Patches/0079-Prevent-hoppers-from-loading-chunks.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main 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 +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi int j = MathHelper.floor(d1); int k = MathHelper.floor(d2); BlockPosition blockposition = new BlockPosition(i, j, k); diff --git a/CraftBukkit-Patches/0090-Guard-Entity-List.patch b/CraftBukkit-Patches/0080-Guard-Entity-List.patch similarity index 82% rename from CraftBukkit-Patches/0090-Guard-Entity-List.patch rename to CraftBukkit-Patches/0080-Guard-Entity-List.patch index f3b425930a..323a81edc7 100644 --- a/CraftBukkit-Patches/0090-Guard-Entity-List.patch +++ b/CraftBukkit-Patches/0080-Guard-Entity-List.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { private int a = 63; - protected boolean e; + protected boolean d; - public final List entityList = Lists.newArrayList(); + // Spigot start - guard entity list from removals + public final List entityList = new java.util.ArrayList() @@ -39,17 +39,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + }; + // Spigot end - protected final List g = Lists.newArrayList(); - public final List h = Lists.newArrayList(); + protected final List f = Lists.newArrayList(); public final List tileEntityList = Lists.newArrayList(); + public final List tileEntityListTick = Lists.newArrayList(); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - private int tickPosition; + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot - // Spigot start -+ private boolean guardEntityList; - protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList; - protected float growthOdds = 100; - protected float modifiedOdds = 100; + public final SpigotTimings.WorldTimingsHandler timings; // Spigot ++ private boolean guardEntityList; // Spigot + + public CraftWorld getWorld() { + return this.world; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { org.spigotmc.ActivationRange.activateEntities(this); // Spigot @@ -59,13 +59,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) { entity = (Entity) this.entityList.get(this.tickPosition); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.getChunkAt(j, k).b(entity); + this.getChunkAt(j, l).b(entity); } + guardEntityList = false; // Spigot this.entityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable + guardEntityList = true; // Spigot - this.b(entity); + this.c(entity); } this.methodProfiler.b(); diff --git a/CraftBukkit-Patches/0091-Fix-ConcurrentModificationException-while-being-idle.patch b/CraftBukkit-Patches/0081-Fix-ConcurrentModificationException-while-being-idle.patch similarity index 79% rename from CraftBukkit-Patches/0091-Fix-ConcurrentModificationException-while-being-idle.patch rename to CraftBukkit-Patches/0081-Fix-ConcurrentModificationException-while-being-idle.patch index 86e7a3ca71..2abb7a0d1e 100644 --- a/CraftBukkit-Patches/0091-Fix-ConcurrentModificationException-while-being-idle.patch +++ b/CraftBukkit-Patches/0081-Fix-ConcurrentModificationException-while-being-idle.patch @@ -9,20 +9,26 @@ 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 @@ +-package net.minecraft.server; ++ package net.minecraft.server; + + import com.google.common.base.Function; + import com.google.common.base.Objects; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { this.everyoneSleeping(); } + if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking - int i = entity.ae; - int j = entity.ag; + int i = entity.ab; + int j = entity.ad; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { this.entityList.remove(index); } // CraftBukkit end + } // Spigot - this.b(entity); + this.c(entity); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0092-Cancellable-WitherSkull-potion-effect.patch b/CraftBukkit-Patches/0082-Cancellable-WitherSkull-potion-effect.patch similarity index 100% rename from CraftBukkit-Patches/0092-Cancellable-WitherSkull-potion-effect.patch rename to CraftBukkit-Patches/0082-Cancellable-WitherSkull-potion-effect.patch diff --git a/CraftBukkit-Patches/0093-Descriptive-kick-reasons-instead-of-Nope.patch b/CraftBukkit-Patches/0083-Descriptive-kick-reasons-instead-of-Nope.patch similarity index 94% rename from CraftBukkit-Patches/0093-Descriptive-kick-reasons-instead-of-Nope.patch rename to CraftBukkit-Patches/0083-Descriptive-kick-reasons-instead-of-Nope.patch index b729ec892c..6c150a35db 100644 --- a/CraftBukkit-Patches/0093-Descriptive-kick-reasons-instead-of-Nope.patch +++ b/CraftBukkit-Patches/0083-Descriptive-kick-reasons-instead-of-Nope.patch @@ -30,10 +30,10 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- 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 +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { this.player.resetIdleTimer(); } else { - PlayerConnection.c.warn(this.player.getName() + " tried to set an invalid carried item"); + PlayerConnection.LOGGER.warn(this.player.getName() + " tried to set an invalid carried item"); - this.disconnect("Nope!"); // CraftBukkit + this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit //Spigot "Nope" -> Descriptive reason } diff --git a/CraftBukkit-Patches/0094-Configurable-dragon-death-and-wither-spawn-sounds.patch b/CraftBukkit-Patches/0084-Configurable-dragon-death-and-wither-spawn-sounds.patch similarity index 66% rename from CraftBukkit-Patches/0094-Configurable-dragon-death-and-wither-spawn-sounds.patch rename to CraftBukkit-Patches/0084-Configurable-dragon-death-and-wither-spawn-sounds.patch index 7b30949a63..844112a3cb 100644 --- a/CraftBukkit-Patches/0094-Configurable-dragon-death-and-wither-spawn-sounds.patch +++ b/CraftBukkit-Patches/0084-Configurable-dragon-death-and-wither-spawn-sounds.patch @@ -9,13 +9,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - double deltaX = this.locX - player.locX; - double deltaZ = this.locZ - player.locZ; - double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; + } + + if (this.bF == 1) { +- this.world.a(1028, new BlockPosition(this), 0); ++ // CraftBukkit start - Use relative location for far away sounds ++ // this.world.a(1028, new BlockPosition(this), 0); ++ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; ++ for (EntityPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { ++ double deltaX = this.locX - player.locX; ++ double deltaZ = this.locZ - player.locZ; ++ double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; + if ( world.spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > world.spigotConfig.dragonDeathSoundRadius * world.spigotConfig.dragonDeathSoundRadius ) continue; // Spigot - if (distanceSquared > viewDistance * viewDistance) { - double deltaLength = Math.sqrt(distanceSquared); - double relativeX = player.locX + (deltaX / deltaLength) * viewDistance; ++ if (distanceSquared > viewDistance * viewDistance) { ++ double deltaLength = Math.sqrt(distanceSquared); ++ double relativeX = player.locX + (deltaX / deltaLength) * viewDistance; ++ double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance; ++ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1028, new BlockPosition((int) relativeX, (int) this.locY, (int) relativeZ), 0, true)); ++ } else { ++ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1028, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0, true)); ++ } ++ } ++ // CraftBukkit end + } + } + diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityWither.java diff --git a/CraftBukkit-Patches/0095-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch b/CraftBukkit-Patches/0085-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch similarity index 100% rename from CraftBukkit-Patches/0095-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch rename to CraftBukkit-Patches/0085-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch diff --git a/CraftBukkit-Patches/0096-Treat-Bungee-as-Online-Mode.patch b/CraftBukkit-Patches/0086-Treat-Bungee-as-Online-Mode.patch similarity index 100% rename from CraftBukkit-Patches/0096-Treat-Bungee-as-Online-Mode.patch rename to CraftBukkit-Patches/0086-Treat-Bungee-as-Online-Mode.patch diff --git a/CraftBukkit-Patches/0086-Unfinalize-the-isDisconnected-method-by-bukkit.patch b/CraftBukkit-Patches/0086-Unfinalize-the-isDisconnected-method-by-bukkit.patch deleted file mode 100644 index 6148066957..0000000000 --- a/CraftBukkit-Patches/0086-Unfinalize-the-isDisconnected-method-by-bukkit.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: hcherndon -Date: Sat, 15 Feb 2014 01:51:20 -0600 -Subject: [PATCH] Unfinalize the isDisconnected() method by bukkit. - -This would literally mean the world to me. You have no idea how much this method being final is fucking me over right now. (Working with NPC's and what not.) - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- 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 - } - - // CraftBukkit start - Add "isDisconnected" method -- public final boolean isDisconnected() { -+ public boolean isDisconnected() { // Spigot - return !this.player.joining && !this.networkManager.channel.config().isAutoRead(); - } - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0097-Add-Conversion-Message.patch b/CraftBukkit-Patches/0087-Add-Conversion-Message.patch similarity index 96% rename from CraftBukkit-Patches/0097-Add-Conversion-Message.patch rename to CraftBukkit-Patches/0087-Add-Conversion-Message.patch index 9fd22a01a9..3152bd725b 100644 --- a/CraftBukkit-Patches/0097-Add-Conversion-Message.patch +++ b/CraftBukkit-Patches/0087-Add-Conversion-Message.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } - protected boolean aR() { + protected boolean aO() { + 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/0098-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch b/CraftBukkit-Patches/0088-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch similarity index 92% rename from CraftBukkit-Patches/0098-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch rename to CraftBukkit-Patches/0088-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch index 5020baf998..95f8bcdaea 100644 --- a/CraftBukkit-Patches/0098-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch +++ b/CraftBukkit-Patches/0088-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (playerFishEvent.isCancelled()) { + entityhuman.hookedFish = null; - return itemstack; + return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); } // CraftBukkit end -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0099-Print-Stack-on-InternalException.patch b/CraftBukkit-Patches/0089-Print-Stack-on-InternalException.patch similarity index 87% rename from CraftBukkit-Patches/0099-Print-Stack-on-InternalException.patch rename to CraftBukkit-Patches/0089-Print-Stack-on-InternalException.patch index c5663fa67d..16db367ced 100644 --- a/CraftBukkit-Patches/0099-Print-Stack-on-InternalException.patch +++ b/CraftBukkit-Patches/0089-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 { - } +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { + NetworkManager.g.debug(throwable); this.close(chatmessage); + if (MinecraftServer.getServer().isDebugging()) throwable.printStackTrace(); // Spigot } - protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) throws Exception { + protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) throws Exception { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0100-Use-Offline-Player-Data-Once-if-Required.patch b/CraftBukkit-Patches/0090-Use-Offline-Player-Data-Once-if-Required.patch similarity index 96% rename from CraftBukkit-Patches/0100-Use-Offline-Player-Data-Once-if-Required.patch rename to CraftBukkit-Patches/0090-Use-Offline-Player-Data-Once-if-Required.patch index 4b88aae57c..488db91b3b 100644 --- a/CraftBukkit-Patches/0100-Use-Offline-Player-Data-Once-if-Required.patch +++ b/CraftBukkit-Patches/0090-Use-Offline-Player-Data-Once-if-Required.patch @@ -36,6 +36,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot End } catch (Exception exception) { - WorldNBTStorage.a.warn("Failed to load player data for " + entityhuman.getName()); + WorldNBTStorage.b.warn("Failed to load player data for " + entityhuman.getName()); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0101-Use-Provided-Case-for-Non-Existent-Offline-Players.patch b/CraftBukkit-Patches/0091-Use-Provided-Case-for-Non-Existent-Offline-Players.patch similarity index 78% rename from CraftBukkit-Patches/0101-Use-Provided-Case-for-Non-Existent-Offline-Players.patch rename to CraftBukkit-Patches/0091-Use-Provided-Case-for-Non-Existent-Offline-Players.patch index 8bb8218dc7..103cf20872 100644 --- a/CraftBukkit-Patches/0101-Use-Provided-Case-for-Non-Existent-Offline-Players.patch +++ b/CraftBukkit-Patches/0091-Use-Provided-Case-for-Non-Existent-Offline-Players.patch @@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { - this.e.remove(gameprofile); - this.e.addFirst(gameprofile); + this.f.remove(gameprofile); + this.f.addFirst(gameprofile); } else { -- gameprofile = a(this.f, s1); -+ gameprofile = a(this.f, s); // Spigot - use correct case for offline players +- gameprofile = a(this.g, s1); ++ gameprofile = a(this.g, s); // Spigot - use correct case for offline players if (gameprofile != null) { this.a(gameprofile); - usercache_usercacheentry = (UserCache.UserCacheEntry) this.c.get(s1); + usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(s1); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0102-Check-for-blank-OfflinePlayer-Names.patch b/CraftBukkit-Patches/0092-Check-for-blank-OfflinePlayer-Names.patch similarity index 100% rename from CraftBukkit-Patches/0102-Check-for-blank-OfflinePlayer-Names.patch rename to CraftBukkit-Patches/0092-Check-for-blank-OfflinePlayer-Names.patch diff --git a/CraftBukkit-Patches/0103-Fix-Player-Banning.patch b/CraftBukkit-Patches/0093-Fix-Player-Banning.patch similarity index 100% rename from CraftBukkit-Patches/0103-Fix-Player-Banning.patch rename to CraftBukkit-Patches/0093-Fix-Player-Banning.patch diff --git a/CraftBukkit-Patches/0104-Fix-ban-expire-dates.patch b/CraftBukkit-Patches/0094-Fix-ban-expire-dates.patch similarity index 100% rename from CraftBukkit-Patches/0104-Fix-ban-expire-dates.patch rename to CraftBukkit-Patches/0094-Fix-ban-expire-dates.patch diff --git a/CraftBukkit-Patches/0105-Correct-Ban-Expiration.patch b/CraftBukkit-Patches/0095-Correct-Ban-Expiration.patch similarity index 100% rename from CraftBukkit-Patches/0105-Correct-Ban-Expiration.patch rename to CraftBukkit-Patches/0095-Correct-Ban-Expiration.patch diff --git a/CraftBukkit-Patches/0106-Convert-Horses-owner-to-UUID.patch b/CraftBukkit-Patches/0096-Convert-Horses-owner-to-UUID.patch similarity index 92% rename from CraftBukkit-Patches/0106-Convert-Horses-owner-to-UUID.patch rename to CraftBukkit-Patches/0096-Convert-Horses-owner-to-UUID.patch index 62023c185d..3dcddaed3e 100644 --- a/CraftBukkit-Patches/0106-Convert-Horses-owner-to-UUID.patch +++ b/CraftBukkit-Patches/0096-Convert-Horses-owner-to-UUID.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityHorse.java +++ b/src/main/java/net/minecraft/server/EntityHorse.java -@@ -0,0 +0,0 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { +@@ -0,0 +0,0 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener, IJu s = nbttagcompound.getString("OwnerUUID"); } else { String s1 = nbttagcompound.getString("Owner"); @@ -24,6 +24,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end - s = NameReferencingFileConverter.a(s1); + s = NameReferencingFileConverter.a(this.h(), s1); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0107-Add-Score.isScoreSet-Z-API.patch b/CraftBukkit-Patches/0097-Add-Score.isScoreSet-Z-API.patch similarity index 100% rename from CraftBukkit-Patches/0107-Add-Score.isScoreSet-Z-API.patch rename to CraftBukkit-Patches/0097-Add-Score.isScoreSet-Z-API.patch diff --git a/CraftBukkit-Patches/0108-Log-null-TileEntity-Owner.patch b/CraftBukkit-Patches/0098-Log-null-TileEntity-Owner.patch similarity index 100% rename from CraftBukkit-Patches/0108-Log-null-TileEntity-Owner.patch rename to CraftBukkit-Patches/0098-Log-null-TileEntity-Owner.patch diff --git a/CraftBukkit-Patches/0109-Don-t-special-case-invalid-usernames-for-UUIDs.patch b/CraftBukkit-Patches/0099-Don-t-special-case-invalid-usernames-for-UUIDs.patch similarity index 100% rename from CraftBukkit-Patches/0109-Don-t-special-case-invalid-usernames-for-UUIDs.patch rename to CraftBukkit-Patches/0099-Don-t-special-case-invalid-usernames-for-UUIDs.patch diff --git a/CraftBukkit-Patches/0110-Convert-player-skulls-async.patch b/CraftBukkit-Patches/0100-Convert-player-skulls-async.patch similarity index 90% rename from CraftBukkit-Patches/0110-Convert-player-skulls-async.patch rename to CraftBukkit-Patches/0100-Convert-player-skulls-async.patch index 8ee90c0264..05df51fc33 100644 --- a/CraftBukkit-Patches/0110-Convert-player-skulls-async.patch +++ b/CraftBukkit-Patches/0100-Convert-player-skulls-async.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public boolean a(NBTTagCompound nbttagcompound) { + public boolean a(final NBTTagCompound nbttagcompound) { // Spigot - make final super.a(nbttagcompound); - if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { + if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty()) { GameProfile gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); - gameprofile = TileEntitySkull.b(gameprofile); @@ -37,7 +37,7 @@ diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntitySkull.java +++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -0,0 +0,0 @@ import com.mojang.authlib.GameProfile; +@@ -0,0 +0,0 @@ import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.properties.Property; import java.util.UUID; @@ -55,11 +55,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.mojang.authlib.ProfileLookupCallback; +// Spigot end + - public class TileEntitySkull extends TileEntity { + public class TileEntitySkull extends TileEntity implements ITickable { private int a; - private int rotation; - private GameProfile g = null; +@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity implements ITickable { + private boolean i; + private static UserCache j; + private static MinecraftSessionService k; + // Spigot start + public static final Executor executor = Executors.newFixedThreadPool(3, + new ThreadFactoryBuilder() @@ -103,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if ( property == null ) + { -+ profile = MinecraftServer.getServer().aD().fillProfileProperties( profile, true ); ++ profile = MinecraftServer.getServer().ay().fillProfileProperties( profile, true ); + } + } + @@ -111,15 +113,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return profile; + } + } ); -+ + // Spigot end public TileEntitySkull() {} -@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity { +@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity implements ITickable { } - private void e() { + private void g() { - this.g = b(this.g); - this.update(); + // Spigot start @@ -133,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + g = input; + update(); + if (world != null) { -+ world.notify(position); ++ world.m(position); // PAIL: notify + } + return false; + } @@ -147,15 +148,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (gameprofile != null && !UtilColor.b(gameprofile.getName())) { if (gameprofile.isComplete() && gameprofile.getProperties().containsKey("textures")) { - return gameprofile; -+ callback.apply(gameprofile); - } else if (MinecraftServer.getServer() == null) { -- return gameprofile; -+ callback.apply(gameprofile); - } else { -- GameProfile gameprofile1 = MinecraftServer.getServer().getUserCache().getProfile(gameprofile.getName()); +- } else if (TileEntitySkull.j != null && TileEntitySkull.k != null) { +- GameProfile gameprofile1 = TileEntitySkull.j.getProfile(gameprofile.getName()); - - if (gameprofile1 == null) { - return gameprofile; ++ callback.apply(gameprofile); ++ } else if (MinecraftServer.getServer() == null) { ++ callback.apply(gameprofile); ++ } else { + GameProfile profile = skinCache.getIfPresent(gameprofile.getName()); + if (profile != null && Iterables.getFirst(profile.getProperties().get("textures"), (Object) null) != null) { + callback.apply(profile); @@ -163,7 +164,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - Property property = (Property) Iterables.getFirst(gameprofile1.getProperties().get("textures"), (Object) null); - - if (property == null) { -- gameprofile1 = MinecraftServer.getServer().aD().fillProfileProperties(gameprofile1, true); +- gameprofile1 = TileEntitySkull.k.fillProfileProperties(gameprofile1, true); - } - - return gameprofile1; @@ -184,13 +185,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + }); } +- } else { +- return gameprofile; } } else { - return gameprofile; + callback.apply(gameprofile); } } -+ // Spigot end ++ // Spigot end public int getSkullType() { return this.a; diff --git a/CraftBukkit-Patches/0111-Prevent-NoClassDefError-crash-and-notify-on-crash.patch b/CraftBukkit-Patches/0101-Prevent-NoClassDefError-crash-and-notify-on-crash.patch similarity index 93% rename from CraftBukkit-Patches/0111-Prevent-NoClassDefError-crash-and-notify-on-crash.patch rename to CraftBukkit-Patches/0101-Prevent-NoClassDefError-crash-and-notify-on-crash.patch index 23c5f49ac4..dbe3731c1a 100644 --- a/CraftBukkit-Patches/0111-Prevent-NoClassDefError-crash-and-notify-on-crash.patch +++ b/CraftBukkit-Patches/0101-Prevent-NoClassDefError-crash-and-notify-on-crash.patch @@ -9,14 +9,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 { - protected float growthOdds = 100; - protected float modifiedOdds = 100; - private final byte chunkTickRadius; + + public final SpigotTimings.WorldTimingsHandler timings; // Spigot + private boolean guardEntityList; // Spigot + public static boolean haveWeSilencedAPhysicsCrash; + public static String blockLocation; - public static long chunkToKey(int x, int z) - { + public CraftWorld getWorld() { + return this.world; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { } // CraftBukkit end diff --git a/CraftBukkit-Patches/0112-Check-Skull-canPlace.patch b/CraftBukkit-Patches/0102-Check-Skull-canPlace.patch similarity index 76% rename from CraftBukkit-Patches/0112-Check-Skull-canPlace.patch rename to CraftBukkit-Patches/0102-Check-Skull-canPlace.patch index 0f3826bfe2..dd99d94acd 100644 --- a/CraftBukkit-Patches/0112-Check-Skull-canPlace.patch +++ b/CraftBukkit-Patches/0102-Check-Skull-canPlace.patch @@ -9,16 +9,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ItemSkull.java +++ b/src/main/java/net/minecraft/server/ItemSkull.java @@ -0,0 +0,0 @@ public class ItemSkull extends Item { - return false; - } else { - if (!world.isClientSide) { + if (world.isClientSide) { + return EnumInteractionResult.SUCCESS; + } else { + // Spigot Start + if ( !Blocks.SKULL.canPlace( world, blockposition ) ) + { -+ return false; ++ return EnumInteractionResult.FAIL; + } + // Spigot End - world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 3); + world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 11); int i = 0; -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0113-Fix-race-condition-that-could-kill-connections-befor.patch b/CraftBukkit-Patches/0103-Fix-race-condition-that-could-kill-connections-befor.patch similarity index 89% rename from CraftBukkit-Patches/0113-Fix-race-condition-that-could-kill-connections-befor.patch rename to CraftBukkit-Patches/0103-Fix-race-condition-that-could-kill-connections-befor.patch index de06a08f69..f57971fb08 100644 --- a/CraftBukkit-Patches/0113-Fix-race-condition-that-could-kill-connections-befor.patch +++ b/CraftBukkit-Patches/0103-Fix-race-condition-that-could-kill-connections-befor.patch @@ -15,7 +15,7 @@ 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 SocketAddress l; public java.util.UUID spoofedUUID; public com.mojang.authlib.properties.Property[] spoofedProfile; @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Spigot End private PacketListener m; private IChatBaseComponent n; -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { super.channelActive(channelhandlercontext); this.channel = channelhandlercontext.channel(); this.l = this.channel.remoteAddress(); @@ -32,8 +32,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot End try { - this.a(EnumProtocol.HANDSHAKING); -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { + this.setProtocol(EnumProtocol.HANDSHAKING); +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } public void close(IChatBaseComponent ichatbasecomponent) { @@ -48,14 +48,14 @@ 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 { - - if (!networkmanager.h()) { - if (!networkmanager.g()) { + networkmanager.stopReading(); + } + } else { + // Spigot Start + // Fix a race condition where a NetworkManager could be unregistered just before connection. + if (networkmanager.preparing) continue; + // Spigot End iterator.remove(); - networkmanager.l(); - } else { + networkmanager.handleDisconnection(); + } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0114-Configurable-UserCache-cap.patch b/CraftBukkit-Patches/0104-Configurable-UserCache-cap.patch similarity index 100% rename from CraftBukkit-Patches/0114-Configurable-UserCache-cap.patch rename to CraftBukkit-Patches/0104-Configurable-UserCache-cap.patch diff --git a/CraftBukkit-Patches/0115-Implement-PlayerSpawnLocationEvent.patch b/CraftBukkit-Patches/0105-Implement-PlayerSpawnLocationEvent.patch similarity index 100% rename from CraftBukkit-Patches/0115-Implement-PlayerSpawnLocationEvent.patch rename to CraftBukkit-Patches/0105-Implement-PlayerSpawnLocationEvent.patch diff --git a/CraftBukkit-Patches/0116-Cap-Objective-Score-Length.patch b/CraftBukkit-Patches/0106-Cap-Objective-Score-Length.patch similarity index 100% rename from CraftBukkit-Patches/0116-Cap-Objective-Score-Length.patch rename to CraftBukkit-Patches/0106-Cap-Objective-Score-Length.patch diff --git a/CraftBukkit-Patches/0117-Process-conversation-input-on-the-main-thread.-Fixes.patch b/CraftBukkit-Patches/0107-Process-conversation-input-on-the-main-thread.-Fixes.patch similarity index 92% rename from CraftBukkit-Patches/0117-Process-conversation-input-on-the-main-thread.-Fixes.patch rename to CraftBukkit-Patches/0107-Process-conversation-input-on-the-main-thread.-Fixes.patch index 5434044b63..8a4fe98fff 100644 --- a/CraftBukkit-Patches/0117-Process-conversation-input-on-the-main-thread.-Fixes.patch +++ b/CraftBukkit-Patches/0107-Process-conversation-input-on-the-main-thread.-Fixes.patch @@ -9,9 +9,9 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- 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 +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } else if (s.isEmpty()) { - c.warn(this.player.getName() + " tried to send an empty message"); + LOGGER.warn(this.player.getName() + " tried to send an empty message"); } else if (getPlayer().isConversing()) { - getPlayer().acceptConversationInput(s); + // Spigot start diff --git a/CraftBukkit-Patches/0118-Configurable-save-on-stop-only-for-UserCache.patch b/CraftBukkit-Patches/0108-Configurable-save-on-stop-only-for-UserCache.patch similarity index 82% rename from CraftBukkit-Patches/0118-Configurable-save-on-stop-only-for-UserCache.patch rename to CraftBukkit-Patches/0108-Configurable-save-on-stop-only-for-UserCache.patch index 627a1a40bb..64fa8320a9 100644 --- a/CraftBukkit-Patches/0118-Configurable-save-on-stop-only-for-UserCache.patch +++ b/CraftBukkit-Patches/0108-Configurable-save-on-stop-only-for-UserCache.patch @@ -9,28 +9,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 Runnable, ICommandListener, IAs - if (this.n.d()) { - this.n.e(); - } -- -+ // Spigot start -+ if( org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) -+ { -+ LOGGER.info("Saving usercache.json"); -+ this.Z.c(); -+ } -+ //Spigot end + this.m.e(); } + ++ // Spigot start ++ if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { ++ LOGGER.info("Saving usercache.json"); ++ this.X.c(); ++ } ++ // Spigot end } + public String getServerIp() { diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { - this.c.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercache_usercacheentry); - this.d.put(uuid, usercache_usercacheentry); - this.e.addFirst(gameprofile); + this.d.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercache_usercacheentry); + this.e.put(uuid, usercache_usercacheentry); + this.f.addFirst(gameprofile); - this.c(); + if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled } diff --git a/CraftBukkit-Patches/0119-Prevent-Unbounded-IntCache-Growth.patch b/CraftBukkit-Patches/0109-Prevent-Unbounded-IntCache-Growth.patch similarity index 100% rename from CraftBukkit-Patches/0119-Prevent-Unbounded-IntCache-Growth.patch rename to CraftBukkit-Patches/0109-Prevent-Unbounded-IntCache-Growth.patch diff --git a/CraftBukkit-Patches/0120-Add-damager-to-the-unhandled-error.patch b/CraftBukkit-Patches/0110-Add-damager-to-the-unhandled-error.patch similarity index 96% rename from CraftBukkit-Patches/0120-Add-damager-to-the-unhandled-error.patch rename to CraftBukkit-Patches/0110-Add-damager-to-the-unhandled-error.patch index 20fc16a67a..c65a762582 100644 --- a/CraftBukkit-Patches/0120-Add-damager-to-the-unhandled-error.patch +++ b/CraftBukkit-Patches/0110-Add-damager-to-the-unhandled-error.patch @@ -27,8 +27,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions)); if (!event.isCancelled()) { @@ -0,0 +0,0 @@ public class CraftEventFactory { - } else if (source == DamageSource.FALL) { - cause = DamageCause.FALL; + } else if (source == DamageSource.DRAGON_BREATH) { + cause = DamageCause.DRAGON_BREATH; } else { - throw new AssertionError(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex)); + throw new RuntimeException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex)); // Spigot diff --git a/CraftBukkit-Patches/0121-Cross-World-Entity-Teleportation.patch b/CraftBukkit-Patches/0111-Cross-World-Entity-Teleportation.patch similarity index 97% rename from CraftBukkit-Patches/0121-Cross-World-Entity-Teleportation.patch rename to CraftBukkit-Patches/0111-Cross-World-Entity-Teleportation.patch index 160b8cf578..b30545ab34 100644 --- a/CraftBukkit-Patches/0121-Cross-World-Entity-Teleportation.patch +++ b/CraftBukkit-Patches/0111-Cross-World-Entity-Teleportation.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { // If this entity is riding another entity, we must dismount before teleporting. - entity.mount(null); + entity.stopRiding(); - entity.world = ((CraftWorld) location.getWorld()).getHandle(); + // Spigot start diff --git a/CraftBukkit-Patches/0112-Limit-block-placement-interaction-packets.patch b/CraftBukkit-Patches/0112-Limit-block-placement-interaction-packets.patch new file mode 100644 index 0000000000..75fffd1a5e --- /dev/null +++ b/CraftBukkit-Patches/0112-Limit-block-placement-interaction-packets.patch @@ -0,0 +1,77 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Sun, 29 Jun 2014 21:10:34 +0100 +Subject: [PATCH] Limit block placement/interaction packets + + +diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java +deleted file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java ++++ /dev/null +@@ -0,0 +0,0 @@ +-package net.minecraft.server; +- +-import java.io.IOException; +- +-public class PacketPlayInArmAnimation implements Packet { +- +- private EnumHand a; +- +- public PacketPlayInArmAnimation() {} +- +- public PacketPlayInArmAnimation(EnumHand enumhand) { +- this.a = enumhand; +- } +- +- public void a(PacketDataSerializer packetdataserializer) throws IOException { +- this.a = (EnumHand) packetdataserializer.a(EnumHand.class); +- } +- +- public void b(PacketDataSerializer packetdataserializer) throws IOException { +- packetdataserializer.a((Enum) this.a); +- } +- +- public void a(PacketListenerPlayIn packetlistenerplayin) { +- packetlistenerplayin.a(this); +- } +- +- public EnumHand a() { +- return this.a; +- } +-} +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- 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, ITickable { + + } + ++ // Spigot start - limit place/interactions ++ private long lastPlace = -1; ++ private int packets = 0; ++ // Spigot end + public void a(PacketPlayInBlockPlace packetplayinblockplace) { + PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x()); + if (this.player.dead) return; // CraftBukkit +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + ItemStack itemstack = this.player.b(enumhand); + + this.player.resetIdleTimer(); +- if (itemstack != null) { ++ // Spigot start ++ boolean throttled = false; ++ if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { ++ throttled = true; ++ } else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 ) ++ { ++ lastPlace = packetplayinblockplace.timestamp; ++ packets = 0; ++ } ++ // Spigot end ++ if (!throttled && itemstack != null) { // Spigot - skip the event if throttled + // CraftBukkit start + // Raytrace to look for 'rogue armswings' + float f1 = this.player.pitch; +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0123-Better-item-validation.patch b/CraftBukkit-Patches/0113-Better-item-validation.patch similarity index 70% rename from CraftBukkit-Patches/0123-Better-item-validation.patch rename to CraftBukkit-Patches/0113-Better-item-validation.patch index 689935003d..ef9d71ce85 100644 --- a/CraftBukkit-Patches/0123-Better-item-validation.patch +++ b/CraftBukkit-Patches/0113-Better-item-validation.patch @@ -4,50 +4,6 @@ Date: Wed, 2 Jul 2014 23:35:51 +0100 Subject: [PATCH] Better item validation -diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataWatcher.java -+++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -0,0 +0,0 @@ public class DataWatcher { - arraylist = Lists.newArrayList(); - } - -+ // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions -+ if ( datawatcher_watchableobject.b() instanceof ItemStack ) -+ { -+ datawatcher_watchableobject = new WatchableObject( -+ datawatcher_watchableobject.c(), -+ datawatcher_watchableobject.a(), -+ ( (ItemStack) datawatcher_watchableobject.b() ).cloneItemStack() -+ ); -+ } -+ // Spigot end -+ - arraylist.add(datawatcher_watchableobject); - } - } -@@ -0,0 +0,0 @@ public class DataWatcher { - this.f.readLock().lock(); - - arraylist.addAll(this.dataValues.valueCollection()); // Spigot -+ // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions -+ for ( int i = 0; i < arraylist.size(); i++ ) -+ { -+ WatchableObject watchableobject = (WatchableObject) arraylist.get( i ); -+ if ( watchableobject.b() instanceof ItemStack ) -+ { -+ watchableobject = new WatchableObject( -+ watchableobject.c(), -+ watchableobject.a(), -+ ( (ItemStack) watchableobject.b() ).cloneItemStack() -+ ); -+ arraylist.set( i, watchableobject ); -+ } -+ } -+ // Spigot end - - this.f.readLock().unlock(); - return arraylist; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java diff --git a/CraftBukkit-Patches/0124-Further-Seed-Customisation.patch b/CraftBukkit-Patches/0114-Further-Seed-Customisation.patch similarity index 81% rename from CraftBukkit-Patches/0124-Further-Seed-Customisation.patch rename to CraftBukkit-Patches/0114-Further-Seed-Customisation.patch index 7586d2be46..9fe9381f81 100644 --- a/CraftBukkit-Patches/0124-Further-Seed-Customisation.patch +++ b/CraftBukkit-Patches/0114-Further-Seed-Customisation.patch @@ -11,26 +11,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java @@ -0,0 +0,0 @@ public class WorldGenLargeFeature extends StructureGenerator { - int i1 = i / this.g; - int j1 = j / this.g; -- Random random = this.c.a(i1, j1, 14357617); -+ Random random = this.c.a(i1, j1, this.c.spigotConfig.largeFeatureSeed); // Spigot + int i1 = i / this.d; + int j1 = j / this.d; +- Random random = this.g.a(i1, j1, 14357617); ++ Random random = this.g.a(i1, j1, this.g.spigotConfig.largeFeatureSeed); // Spigot - i1 *= this.g; - j1 *= this.g; + i1 *= this.d; + j1 *= this.d; diff --git a/src/main/java/net/minecraft/server/WorldGenVillage.java b/src/main/java/net/minecraft/server/WorldGenVillage.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldGenVillage.java +++ b/src/main/java/net/minecraft/server/WorldGenVillage.java @@ -0,0 +0,0 @@ public class WorldGenVillage extends StructureGenerator { - int i1 = i / this.g; - int j1 = j / this.g; -- Random random = this.c.a(i1, j1, 10387312); -+ Random random = this.c.a(i1, j1, this.c.spigotConfig.villageSeed); // Spigot + int i1 = i / this.d; + int j1 = j / this.d; +- Random random = this.g.a(i1, j1, 10387312); ++ Random random = this.g.a(i1, j1, this.g.spigotConfig.villageSeed); // Spigot - i1 *= this.g; - j1 *= this.g; + i1 *= this.d; + j1 *= this.d; 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/0125-Disable-ResourceLeakDetector.patch b/CraftBukkit-Patches/0115-Disable-ResourceLeakDetector.patch similarity index 71% rename from CraftBukkit-Patches/0125-Disable-ResourceLeakDetector.patch rename to CraftBukkit-Patches/0115-Disable-ResourceLeakDetector.patch index 9afa2ff53f..2dcaf86243 100644 --- a/CraftBukkit-Patches/0125-Disable-ResourceLeakDetector.patch +++ b/CraftBukkit-Patches/0115-Disable-ResourceLeakDetector.patch @@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs // Spigot end - public MinecraftServer(OptionSet options, Proxy proxy, File file1) { + public MinecraftServer(OptionSet options, Proxy proxy, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { + io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable this.e = proxy; - MinecraftServer.l = this; - // this.universe = file; // CraftBukkit + this.U = yggdrasilauthenticationservice; + this.V = minecraftsessionservice; -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0126-Add-More-Information-to-session.lock-Errors.patch b/CraftBukkit-Patches/0116-Add-More-Information-to-session.lock-Errors.patch similarity index 100% rename from CraftBukkit-Patches/0126-Add-More-Information-to-session.lock-Errors.patch rename to CraftBukkit-Patches/0116-Add-More-Information-to-session.lock-Errors.patch diff --git a/CraftBukkit-Patches/0127-Safer-JSON-Loading.patch b/CraftBukkit-Patches/0117-Safer-JSON-Loading.patch similarity index 98% rename from CraftBukkit-Patches/0127-Safer-JSON-Loading.patch rename to CraftBukkit-Patches/0117-Safer-JSON-Loading.patch index 9e1264ed2e..1936797037 100644 --- a/CraftBukkit-Patches/0127-Safer-JSON-Loading.patch +++ b/CraftBukkit-Patches/0117-Safer-JSON-Loading.patch @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot Start + } catch (com.google.gson.JsonSyntaxException ex) { + JsonList.a.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." ); -+ this.g.delete(); ++ this.h.delete(); + // Spigot End } catch (JsonParseException jsonparseexception) { ; diff --git a/CraftBukkit-Patches/0129-Add-CommandLine-EULA-Flag.patch b/CraftBukkit-Patches/0118-Add-CommandLine-EULA-Flag.patch similarity index 92% rename from CraftBukkit-Patches/0129-Add-CommandLine-EULA-Flag.patch rename to CraftBukkit-Patches/0118-Add-CommandLine-EULA-Flag.patch index a71d064b6e..0ab1f0fc92 100644 --- a/CraftBukkit-Patches/0129-Add-CommandLine-EULA-Flag.patch +++ b/CraftBukkit-Patches/0118-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.p = new EULA(new File("eula.txt")); -- if (!this.p.a()) { + this.q = new EULA(new File("eula.txt")); +- if (!this.q.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.p.a() && !eulaAgreed) { // Spigot ++ if (!this.q.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.p.b(); + this.q.b(); return false; -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0130-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch b/CraftBukkit-Patches/0119-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch similarity index 100% rename from CraftBukkit-Patches/0130-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch rename to CraftBukkit-Patches/0119-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch diff --git a/CraftBukkit-Patches/0131-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch b/CraftBukkit-Patches/0120-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch similarity index 90% rename from CraftBukkit-Patches/0131-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch rename to CraftBukkit-Patches/0120-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch index dcc8b1deda..be804e6b7d 100644 --- a/CraftBukkit-Patches/0131-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch +++ b/CraftBukkit-Patches/0120-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 { - - private PathfinderGoalAvoidTarget bo; - private PathfinderGoalTempt bp; + private static final DataWatcherObject bz = DataWatcher.a(EntityOcelot.class, DataWatcherRegistry.b); + private PathfinderGoalAvoidTarget bA; + private PathfinderGoalTempt bB; + public boolean spawnBonus = true; // Spigot public EntityOcelot(World world) { diff --git a/CraftBukkit-Patches/0132-Prevent-a-crash-involving-attributes.patch b/CraftBukkit-Patches/0121-Prevent-a-crash-involving-attributes.patch similarity index 100% rename from CraftBukkit-Patches/0132-Prevent-a-crash-involving-attributes.patch rename to CraftBukkit-Patches/0121-Prevent-a-crash-involving-attributes.patch diff --git a/CraftBukkit-Patches/0122-Limit-block-placement-interaction-packets.patch b/CraftBukkit-Patches/0122-Limit-block-placement-interaction-packets.patch deleted file mode 100644 index b385c939a4..0000000000 --- a/CraftBukkit-Patches/0122-Limit-block-placement-interaction-packets.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sun, 29 Jun 2014 21:10:34 +0100 -Subject: [PATCH] Limit block placement/interaction packets - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -@@ -0,0 +0,0 @@ import java.io.IOException; - - public class PacketPlayInArmAnimation implements Packet { - -+ public long timestamp; // Spigot -+ - public PacketPlayInArmAnimation() {} - -- public void a(PacketDataSerializer packetdataserializer) throws IOException {} -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ timestamp = System.currentTimeMillis(); // Spigot -+ } - - public void b(PacketDataSerializer packetdataserializer) throws IOException {} - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- 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 - // CraftBukkit end - } - -+ // Spigot start - limit place/interactions -+ private long lastPlace = -1; -+ private int packets = 0; -+ - 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; -+ } else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 ) -+ { -+ lastPlace = packetplayinblockplace.timestamp; -+ 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' - float f1 = this.player.pitch; - float f2 = this.player.yaw; -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList - if (!cancelled) { - this.player.playerInteractManager.useItem(this.player, this.player.world, itemstack); - } -+ } -+ // Spigot end - - // CraftBukkit - notch decrements the counter by 1 in the above method with food, - // snowballs and so forth, but he does it in a place that doesn't cause the -@@ -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.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()); - } - - flag = true; --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0122-Make-moved-wrongly-limit-configurable.patch b/CraftBukkit-Patches/0122-Make-moved-wrongly-limit-configurable.patch new file mode 100644 index 0000000000..d2fda6fe35 --- /dev/null +++ b/CraftBukkit-Patches/0122-Make-moved-wrongly-limit-configurable.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Konrad +Date: Fri, 4 Jul 2014 23:03:13 +0200 +Subject: [PATCH] Make "moved wrongly" limit configurable + + +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 ++++ b/src/main/java/org/spigotmc/SpigotConfig.java +@@ -0,0 +0,0 @@ public class SpigotConfig + { + intCacheLimit = getInt( "settings.int-cache-limit", 1024 ); + } ++ ++ public static double movedWronglyThreshold; ++ private static void movedWronglyThreshold() ++ { ++ movedWronglyThreshold = getDouble( "settings.moved-wrongly-threshold", 0.0625D ); ++ } + } +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0134-Fix-Null-Tile-Entity-Worlds.patch b/CraftBukkit-Patches/0123-Fix-Null-Tile-Entity-Worlds.patch similarity index 100% rename from CraftBukkit-Patches/0134-Fix-Null-Tile-Entity-Worlds.patch rename to CraftBukkit-Patches/0123-Fix-Null-Tile-Entity-Worlds.patch diff --git a/CraftBukkit-Patches/0124-Make-moved-too-quickly-limit-configurable.patch b/CraftBukkit-Patches/0124-Make-moved-too-quickly-limit-configurable.patch new file mode 100644 index 0000000000..64723a7f75 --- /dev/null +++ b/CraftBukkit-Patches/0124-Make-moved-too-quickly-limit-configurable.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Konrad +Date: Tue, 22 Jul 2014 15:59:01 +0200 +Subject: [PATCH] Make "moved too quickly" limit configurable + + +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 ++++ b/src/main/java/org/spigotmc/SpigotConfig.java +@@ -0,0 +0,0 @@ public class SpigotConfig + { + movedWronglyThreshold = getDouble( "settings.moved-wrongly-threshold", 0.0625D ); + } ++ ++ public static double movedTooQuicklyThreshold; ++ private static void movedTooQuicklyThreshold() ++ { ++ movedTooQuicklyThreshold = getDouble( "settings.moved-too-quickly-threshold", 100.0D ); ++ } + } +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0136-Apply-NBTReadLimiter-to-more-things.patch b/CraftBukkit-Patches/0125-Apply-NBTReadLimiter-to-more-things.patch similarity index 100% rename from CraftBukkit-Patches/0136-Apply-NBTReadLimiter-to-more-things.patch rename to CraftBukkit-Patches/0125-Apply-NBTReadLimiter-to-more-things.patch diff --git a/CraftBukkit-Patches/0137-Allow-Attribute-Capping.patch b/CraftBukkit-Patches/0126-Allow-Attribute-Capping.patch similarity index 88% rename from CraftBukkit-Patches/0137-Allow-Attribute-Capping.patch rename to CraftBukkit-Patches/0126-Allow-Attribute-Capping.patch index 03ff4f8618..4490053483 100644 --- a/CraftBukkit-Patches/0137-Allow-Attribute-Capping.patch +++ b/CraftBukkit-Patches/0126-Allow-Attribute-Capping.patch @@ -25,16 +25,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; public class GenericAttributes { - private static final Logger f = LogManager.getLogger(); + private static final Logger i = LogManager.getLogger(); - public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).a("Max Health").a(true); + // Spigot start -+ public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.1D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); ++ public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); public static final IAttribute FOLLOW_RANGE = (new AttributeRanged((IAttribute) null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); public static final IAttribute c = (new AttributeRanged((IAttribute) null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); - public static final IAttribute MOVEMENT_SPEED = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).a("Movement Speed").a(true); - public static final IAttribute ATTACK_DAMAGE = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, 2048.0D); + public static final IAttribute MOVEMENT_SPEED = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, org.spigotmc.SpigotConfig.movementSpeed)).a("Movement Speed").a(true); + public static final IAttribute ATTACK_DAMAGE = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, org.spigotmc.SpigotConfig.attackDamage); + public static final IAttribute f = (new AttributeRanged((IAttribute) null, "generic.attackSpeed", 4.0D, 0.0D, 1024.0D)).a(true); + public static final IAttribute g = (new AttributeRanged((IAttribute) null, "generic.armor", 0.0D, 0.0D, 30.0D)).a(true); + public static final IAttribute h = (new AttributeRanged((IAttribute) null, "generic.luck", 0.0D, -1024.0D, 1024.0D)).a(true); + // Spigot end public static NBTTagList a(AttributeMapBase attributemapbase) { diff --git a/CraftBukkit-Patches/0138-Only-fetch-an-online-UUID-in-online-mode.patch b/CraftBukkit-Patches/0127-Only-fetch-an-online-UUID-in-online-mode.patch similarity index 89% rename from CraftBukkit-Patches/0138-Only-fetch-an-online-UUID-in-online-mode.patch rename to CraftBukkit-Patches/0127-Only-fetch-an-online-UUID-in-online-mode.patch index 9847cf491b..173eb6d5ff 100644 --- a/CraftBukkit-Patches/0138-Only-fetch-an-online-UUID-in-online-mode.patch +++ b/CraftBukkit-Patches/0127-Only-fetch-an-online-UUID-in-online-mode.patch @@ -20,13 +20,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 OfflinePlayer result = getPlayerExact(name); if (result == null) { - // This is potentially blocking :( -- GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(name); +- GameProfile profile = console.getUserCache().getProfile(name); + // Spigot Start + GameProfile profile = null; + // Only fetch an online UUID in online mode + if ( MinecraftServer.getServer().getOnlineMode() || org.spigotmc.SpigotConfig.bungee ) + { -+ profile = MinecraftServer.getServer().getUserCache().getProfile( name ); ++ profile = console.getUserCache().getProfile( name ); + } + // Spigot end if (profile == null) { diff --git a/CraftBukkit-Patches/0139-Filter-attribute-modifiers-which-cause-the-attribute.patch b/CraftBukkit-Patches/0128-Filter-attribute-modifiers-which-cause-the-attribute.patch similarity index 100% rename from CraftBukkit-Patches/0139-Filter-attribute-modifiers-which-cause-the-attribute.patch rename to CraftBukkit-Patches/0128-Filter-attribute-modifiers-which-cause-the-attribute.patch diff --git a/CraftBukkit-Patches/0128-Fix-Slow-Loading-Libraries.patch b/CraftBukkit-Patches/0128-Fix-Slow-Loading-Libraries.patch deleted file mode 100644 index 2adb0908a3..0000000000 --- a/CraftBukkit-Patches/0128-Fix-Slow-Loading-Libraries.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 8 Jul 2014 20:27:52 +1000 -Subject: [PATCH] Fix Slow "Loading Libraries" - - -diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/resources/log4j2.xml -+++ b/src/main/resources/log4j2.xml -@@ -0,0 +0,0 @@ - -- -+ - - - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0140-Plug-WorldMap-Memory-Leak.patch b/CraftBukkit-Patches/0129-Plug-WorldMap-Memory-Leak.patch similarity index 88% rename from CraftBukkit-Patches/0140-Plug-WorldMap-Memory-Leak.patch rename to CraftBukkit-Patches/0129-Plug-WorldMap-Memory-Leak.patch index 72c80da1ce..d136603d4c 100644 --- a/CraftBukkit-Patches/0140-Plug-WorldMap-Memory-Leak.patch +++ b/CraftBukkit-Patches/0129-Plug-WorldMap-Memory-Leak.patch @@ -31,8 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if ( o instanceof WorldMap ) + { + WorldMap map = (WorldMap) o; -+ map.i.remove( entity ); -+ for ( Iterator iter = (Iterator) map.g.iterator(); iter.hasNext(); ) ++ map.j.remove( entity ); ++ for ( Iterator iter = (Iterator) map.h.iterator(); iter.hasNext(); ) + { + if ( iter.next().trackee == entity ) + { @@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end this.everyoneSleeping(); - this.b(entity); + this.c(entity); } diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -52,9 +52,9 @@ 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 List h = Lists.newArrayList(); +- private Map j = Maps.newHashMap(); ++ public Map j = Maps.newHashMap(); // Spigot public Map decorations = Maps.newLinkedHashMap(); // CraftBukkit start diff --git a/CraftBukkit-Patches/0141-Fix-Corrupted-Trapped-Chest.patch b/CraftBukkit-Patches/0130-Fix-Corrupted-Trapped-Chest.patch similarity index 100% rename from CraftBukkit-Patches/0141-Fix-Corrupted-Trapped-Chest.patch rename to CraftBukkit-Patches/0130-Fix-Corrupted-Trapped-Chest.patch diff --git a/CraftBukkit-Patches/0142-Remove-uneeded-validation.patch b/CraftBukkit-Patches/0131-Remove-uneeded-validation.patch similarity index 100% rename from CraftBukkit-Patches/0142-Remove-uneeded-validation.patch rename to CraftBukkit-Patches/0131-Remove-uneeded-validation.patch diff --git a/CraftBukkit-Patches/0143-Add-Hunger-Config-Values.patch b/CraftBukkit-Patches/0132-Add-Hunger-Config-Values.patch similarity index 91% rename from CraftBukkit-Patches/0143-Add-Hunger-Config-Values.patch rename to CraftBukkit-Patches/0132-Add-Hunger-Config-Values.patch index f24df3114f..699b0bf738 100644 --- a/CraftBukkit-Patches/0143-Add-Hunger-Config-Values.patch +++ b/CraftBukkit-Patches/0132-Add-Hunger-Config-Values.patch @@ -14,12 +14,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.applyExhaustion(0.3F); + this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value - } else if (flag1) { - entity.extinguish(); - } + } else { + this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dY, this.bz(), 1.0F, 1.0F); + if (flag4) { @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - super.bF(); - this.b(StatisticList.u); + super.ch(); + this.b(StatisticList.w); if (this.isSprinting()) { - this.applyExhaustion(0.8F); + this.applyExhaustion(world.spigotConfig.sprintExhaustion); // Spigot - Change to use configurable value @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.foodTickTimer >= 80) { // CraftBukkit - added RegainReason entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); -- this.a(3.0F); +- this.a(4.0F); + this.a(entityhuman.world.spigotConfig.regenExhaustion); // Spigot - Change to use configurable value this.foodTickTimer = 0; } diff --git a/CraftBukkit-Patches/0144-Make-debug-logging-togglable.patch b/CraftBukkit-Patches/0133-Make-debug-logging-togglable.patch similarity index 100% rename from CraftBukkit-Patches/0144-Make-debug-logging-togglable.patch rename to CraftBukkit-Patches/0133-Make-debug-logging-togglable.patch diff --git a/CraftBukkit-Patches/0133-Make-moved-wrongly-limit-configurable.patch b/CraftBukkit-Patches/0133-Make-moved-wrongly-limit-configurable.patch deleted file mode 100644 index 2346256e9c..0000000000 --- a/CraftBukkit-Patches/0133-Make-moved-wrongly-limit-configurable.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonas Konrad -Date: Fri, 4 Jul 2014 23:03:13 +0200 -Subject: [PATCH] Make "moved wrongly" limit configurable - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- 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 - d15 = d11 * d11 + d12 * d12 + d13 * d13; - boolean flag1 = false; - -- if (d15 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { -+ // Spigot: make "moved wrongly" limit configurable -+ if (d15 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { - flag1 = true; - PlayerConnection.c.warn(this.player.getName() + " moved wrongly!"); - } -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 -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -0,0 +0,0 @@ public class SpigotConfig - { - intCacheLimit = getInt( "settings.int-cache-limit", 1024 ); - } -+ -+ public static double movedWronglyThreshold; -+ private static void movedWronglyThreshold() -+ { -+ movedWronglyThreshold = getDouble( "settings.moved-wrongly-threshold", 0.0625D ); -+ } - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0145-Skip-invalid-enchants-in-CraftMetaItem.patch b/CraftBukkit-Patches/0134-Skip-invalid-enchants-in-CraftMetaItem.patch similarity index 100% rename from CraftBukkit-Patches/0145-Skip-invalid-enchants-in-CraftMetaItem.patch rename to CraftBukkit-Patches/0134-Skip-invalid-enchants-in-CraftMetaItem.patch diff --git a/CraftBukkit-Patches/0146-Limit-TNT-Detonations-per-tick.patch b/CraftBukkit-Patches/0135-Limit-TNT-Detonations-per-tick.patch similarity index 96% rename from CraftBukkit-Patches/0146-Limit-TNT-Detonations-per-tick.patch rename to CraftBukkit-Patches/0135-Limit-TNT-Detonations-per-tick.patch index b79357ab13..e3e4a29748 100644 --- a/CraftBukkit-Patches/0146-Limit-TNT-Detonations-per-tick.patch +++ b/CraftBukkit-Patches/0135-Limit-TNT-Detonations-per-tick.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { } - public void t_() { + public void m() { + if (world.spigotConfig.currentPrimedTnt++ > world.spigotConfig.maxTntTicksPerTick) { return; } // Spigot this.lastX = this.locX; this.lastY = this.locY; @@ -23,13 +23,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - } + this.worldProvider.r(); super.tickEntities(); + spigotConfig.currentPrimedTnt = 0; // Spigot } - public void j() { + protected void l() { 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/0135-Make-moved-too-quickly-limit-configurable.patch b/CraftBukkit-Patches/0135-Make-moved-too-quickly-limit-configurable.patch deleted file mode 100644 index d826a7e803..0000000000 --- a/CraftBukkit-Patches/0135-Make-moved-too-quickly-limit-configurable.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonas Konrad -Date: Tue, 22 Jul 2014 15:59:01 +0200 -Subject: [PATCH] Make "moved too quickly" limit configurable - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- 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 - double d14 = this.player.motX * this.player.motX + this.player.motY * this.player.motY + this.player.motZ * this.player.motZ; - double d15 = d11 * d11 + d12 * d12 + d13 * d13; - -- if (d15 - d14 > 100.0D && this.checkMovement && (!this.minecraftServer.T() || !this.minecraftServer.S().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports -+ // Spigot: make "moved too quickly" limit configurable -+ if (d15 - d14 > org.spigotmc.SpigotConfig.movedTooQuicklyThreshold && this.checkMovement && (!this.minecraftServer.T() || !this.minecraftServer.S().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports - PlayerConnection.c.warn(this.player.getName() + " moved too quickly! " + d11 + "," + d12 + "," + d13 + " (" + d11 + ", " + d12 + ", " + d13 + ")"); - this.a(this.o, this.p, this.q, this.player.yaw, this.player.pitch); - return; -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 -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -0,0 +0,0 @@ public class SpigotConfig - { - movedWronglyThreshold = getDouble( "settings.moved-wrongly-threshold", 0.0625D ); - } -+ -+ public static double movedTooQuicklyThreshold; -+ private static void movedTooQuicklyThreshold() -+ { -+ movedTooQuicklyThreshold = getDouble( "settings.moved-too-quickly-threshold", 100.0D ); -+ } - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0147-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/CraftBukkit-Patches/0136-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch similarity index 100% rename from CraftBukkit-Patches/0147-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch rename to CraftBukkit-Patches/0136-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch diff --git a/CraftBukkit-Patches/0148-Configurable-Hanging-Tick.patch b/CraftBukkit-Patches/0137-Configurable-Hanging-Tick.patch similarity index 88% rename from CraftBukkit-Patches/0148-Configurable-Hanging-Tick.patch rename to CraftBukkit-Patches/0137-Configurable-Hanging-Tick.patch index 3452c9b59d..c89ff08984 100644 --- a/CraftBukkit-Patches/0148-Configurable-Hanging-Tick.patch +++ b/CraftBukkit-Patches/0137-Configurable-Hanging-Tick.patch @@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; -- if (this.c++ == 100 && !this.world.isClientSide) { -+ if (this.c++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isClientSide) { - this.c = 0; +- if (this.d++ == 100 && !this.world.isClientSide) { ++ if (this.d++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isClientSide) { // Spigot + this.d = 0; if (!this.dead && !this.survives()) { // CraftBukkit start - fire break events diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0149-Refactor-ItemDoor-Place.patch b/CraftBukkit-Patches/0138-Refactor-ItemDoor-Place.patch similarity index 80% rename from CraftBukkit-Patches/0149-Refactor-ItemDoor-Place.patch rename to CraftBukkit-Patches/0138-Refactor-ItemDoor-Place.patch index 73db3e8512..67911efd6d 100644 --- a/CraftBukkit-Patches/0149-Refactor-ItemDoor-Place.patch +++ b/CraftBukkit-Patches/0138-Refactor-ItemDoor-Place.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ItemDoor.java +++ 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 ? BlockDoor.EnumDoorHinge.RIGHT : BlockDoor.EnumDoorHinge.LEFT); + boolean flag3 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition3); + IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag ? BlockDoor.EnumDoorHinge.RIGHT : BlockDoor.EnumDoorHinge.LEFT).set(BlockDoor.POWERED, Boolean.valueOf(flag3)).set(BlockDoor.OPEN, Boolean.valueOf(flag3)); - world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); - world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); diff --git a/CraftBukkit-Patches/0150-BungeeCord-Chat-API.patch b/CraftBukkit-Patches/0139-BungeeCord-Chat-API.patch similarity index 76% rename from CraftBukkit-Patches/0150-BungeeCord-Chat-API.patch rename to CraftBukkit-Patches/0139-BungeeCord-Chat-API.patch index 7acdbcce6d..22372d4c3f 100644 --- a/CraftBukkit-Patches/0150-BungeeCord-Chat-API.patch +++ b/CraftBukkit-Patches/0139-BungeeCord-Chat-API.patch @@ -5,38 +5,22 @@ Subject: [PATCH] BungeeCord Chat API diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutChat implements Packet { -+ -+ private IChatBaseComponent a; +@@ -0,0 +0,0 @@ import java.io.IOException; + public class PacketPlayOutChat implements Packet { + + private IChatBaseComponent a; + public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot -+ private byte b; -+ -+ public PacketPlayOutChat() {} -+ -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent) { -+ this(ichatbasecomponent, (byte) 1); -+ } -+ -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, byte b0) { -+ this.a = ichatbasecomponent; -+ this.b = b0; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.d(); -+ this.b = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { + private byte b; + + public PacketPlayOutChat() {} +@@ -0,0 +0,0 @@ public class PacketPlayOutChat implements Packet { + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { +- packetdataserializer.a(this.a); + // Spigot start + if (components != null) { + packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); @@ -44,17 +28,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + packetdataserializer.a(this.a); + } + // Spigot end -+ packetdataserializer.writeByte(this.b); -+ } -+ -+ public void a(PacketListenerPlayOut packetlistenerplayout) { -+ packetlistenerplayout.a(this); -+ } -+ -+ public boolean b() { -+ return this.b == 1 || this.b == 2; -+ } -+} + packetdataserializer.writeByte(this.b); + } + 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/0151-Use-Standard-List-for-EntitySlices.patch b/CraftBukkit-Patches/0140-Use-Standard-List-for-EntitySlices.patch similarity index 90% rename from CraftBukkit-Patches/0151-Use-Standard-List-for-EntitySlices.patch rename to CraftBukkit-Patches/0140-Use-Standard-List-for-EntitySlices.patch index e19b732d00..a407dca250 100644 --- a/CraftBukkit-Patches/0151-Use-Standard-List-for-EntitySlices.patch +++ b/CraftBukkit-Patches/0140-Use-Standard-List-for-EntitySlices.patch @@ -10,17 +10,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { public final int locZ; - private boolean k; + private boolean l; public final Map tileEntities; - public final EntitySlice[] entitySlices; + public final List[] entitySlices; // Spigot private boolean done; private boolean lit; - private boolean p; + private boolean q; @@ -0,0 +0,0 @@ public class Chunk { this.tileEntities = Maps.newHashMap(); - this.v = 4096; - this.w = Queues.newConcurrentLinkedQueue(); + this.w = 4096; + this.x = Queues.newConcurrentLinkedQueue(); - this.entitySlices = (EntitySlice[]) (new EntitySlice[16]); + this.entitySlices = (List[]) (new List[16]); // Spigot this.world = world; @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.entitySlices[k] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot } - Arrays.fill(this.f, -999); + Arrays.fill(this.g, -999); @@ -0,0 +0,0 @@ public class Chunk { j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); @@ -62,6 +62,13 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -0,0 +0,0 @@ + package org.spigotmc; + ++import java.util.List; + import java.util.Set; + import net.minecraft.server.AxisAlignedBB; + import net.minecraft.server.Chunk; @@ -0,0 +0,0 @@ public class ActivationRange */ private static void activateChunkEntities(Chunk chunk) diff --git a/CraftBukkit-Patches/0152-Allow-Capping-Tile-Entity-Tick-Time.patch b/CraftBukkit-Patches/0141-Allow-Capping-Tile-Entity-Tick-Time.patch similarity index 85% rename from CraftBukkit-Patches/0152-Allow-Capping-Tile-Entity-Tick-Time.patch rename to CraftBukkit-Patches/0141-Allow-Capping-Tile-Entity-Tick-Time.patch index a1af16efa6..6f544dac62 100644 --- a/CraftBukkit-Patches/0152-Allow-Capping-Tile-Entity-Tick-Time.patch +++ b/CraftBukkit-Patches/0141-Allow-Capping-Tile-Entity-Tick-Time.patch @@ -14,20 +14,20 @@ 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; + private boolean guardEntityList; // Spigot public static boolean haveWeSilencedAPhysicsCrash; public static String blockLocation; + private org.spigotmc.TickLimiter entityLimiter; + private org.spigotmc.TickLimiter tileLimiter; + private int tileTickPosition; - public static long chunkToKey(int x, int z) - { + public CraftWorld getWorld() { + return this.world; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - 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.N = worldprovider.getWorldBorder(); + this.getServer().addWorld(this.world); // CraftBukkit + 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); } @@ -45,28 +45,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + tickPosition = (tickPosition < entityList.size()) ? tickPosition : 0; entity = (Entity) this.entityList.get(this.tickPosition); // CraftBukkit end - if (entity.vehicle != null) { + Entity entity1 = entity.by(); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.c.clear(); + this.tileEntityListUnload.clear(); } // CraftBukkit end -- Iterator iterator = this.tileEntityList.iterator(); +- Iterator iterator = this.tileEntityListTick.iterator(); - while (iterator.hasNext()) { - TileEntity tileentity = (TileEntity) iterator.next(); + // Spigot start ++ // Iterator iterator = this.tileEntityListTick.iterator(); + int tilesThisCycle = 0; + for (tileLimiter.initTick(); -+ tilesThisCycle < tileEntityList.size() && (tilesThisCycle % 10 != 0 || tileLimiter.shouldContinue()); ++ tilesThisCycle < tileEntityListTick.size() && (tilesThisCycle % 10 != 0 || tileLimiter.shouldContinue()); + tileTickPosition++, tilesThisCycle++) { -+ tileTickPosition = (tileTickPosition < tileEntityList.size()) ? tileTickPosition : 0; -+ TileEntity tileentity = (TileEntity) this.tileEntityList.get(tileTickPosition); ++ tileTickPosition = (tileTickPosition < tileEntityListTick.size()) ? tileTickPosition : 0; ++ TileEntity tileentity = (TileEntity) this.tileEntityListTick.get(tileTickPosition); // Spigot start if (tileentity == null) { getServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash"); - iterator.remove(); + tilesThisCycle--; -+ this.tileEntityList.remove(tileTickPosition--); ++ this.tileEntityListTick.remove(tileTickPosition--); continue; } // Spigot end @@ -76,10 +77,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (tileentity.x()) { - iterator.remove(); + tilesThisCycle--; -+ this.tileEntityList.remove(tileTickPosition--); - this.h.remove(tileentity); ++ this.tileEntityListTick.remove(tileTickPosition--); + this.tileEntityList.remove(tileentity); if (this.isLoaded(tileentity.getPosition())) { - this.getChunkAtWorldCoords(tileentity.getPosition()).e(tileentity.getPosition()); + this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition()); 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/0153-Use-FastMatches-for-ItemStack-Dirty-Check.patch b/CraftBukkit-Patches/0142-Use-FastMatches-for-ItemStack-Dirty-Check.patch similarity index 98% rename from CraftBukkit-Patches/0153-Use-FastMatches-for-ItemStack-Dirty-Check.patch rename to CraftBukkit-Patches/0142-Use-FastMatches-for-ItemStack-Dirty-Check.patch index 8c81db375b..d298baa9c2 100644 --- a/CraftBukkit-Patches/0153-Use-FastMatches-for-ItemStack-Dirty-Check.patch +++ b/CraftBukkit-Patches/0142-Use-FastMatches-for-ItemStack-Dirty-Check.patch @@ -55,6 +55,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot End + public static boolean matches(ItemStack itemstack, ItemStack itemstack1) { - return itemstack == null && itemstack1 == null ? true : (itemstack != null && itemstack1 != null ? itemstack.d(itemstack1) : false); + return itemstack == null && itemstack1 == null ? true : (itemstack != null && itemstack1 != null ? itemstack.e(itemstack1) : false); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0154-Use-CLQ-for-main-thread-tasks.patch b/CraftBukkit-Patches/0143-Use-CLQ-for-main-thread-tasks.patch similarity index 94% rename from CraftBukkit-Patches/0154-Use-CLQ-for-main-thread-tasks.patch rename to CraftBukkit-Patches/0143-Use-CLQ-for-main-thread-tasks.patch index 64a6bb56d8..49f8a9ff32 100644 --- a/CraftBukkit-Patches/0154-Use-CLQ-for-main-thread-tasks.patch +++ b/CraftBukkit-Patches/0143-Use-CLQ-for-main-thread-tasks.patch @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 Runnable, ICommandListener, IAs - private long X = 0L; - private final GameProfileRepository Y; - private final UserCache Z; + private final GameProfileRepository W; + private final UserCache X; + private long Y = 0L; - protected final Queue> j = Queues.newArrayDeque(); + protected final Queue> j = new java.util.concurrent.ConcurrentLinkedQueue>(); // Spigot, PAIL: Rename private Thread serverThread; - private long ab = az(); + private long aa = av(); @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.methodProfiler.a("jobs"); diff --git a/CraftBukkit-Patches/0155-map-decoration-fix.patch b/CraftBukkit-Patches/0144-map-decoration-fix.patch similarity index 91% rename from CraftBukkit-Patches/0155-map-decoration-fix.patch rename to CraftBukkit-Patches/0144-map-decoration-fix.patch index b0fbac20e6..0b7a2d3b17 100644 --- a/CraftBukkit-Patches/0155-map-decoration-fix.patch +++ b/CraftBukkit-Patches/0144-map-decoration-fix.patch @@ -13,10 +13,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.UUID; +import org.apache.commons.codec.Charsets; -+ - public class EntityItemFrame extends EntityHanging { + import com.google.common.base.Optional; - private float c = 1.0F; + public class EntityItemFrame extends EntityHanging { @@ -0,0 +0,0 @@ public class EntityItemFrame extends EntityHanging { if (itemstack.getItem() == Items.FILLED_MAP) { WorldMap worldmap = ((ItemWorldMap) itemstack.getItem()).getSavedMap(itemstack, this.world); @@ -39,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.Iterator; @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { public byte[] colors = new byte[16384]; - public List g = Lists.newArrayList(); - public Map i = Maps.newHashMap(); // Spigot + public List h = Lists.newArrayList(); + public Map j = Maps.newHashMap(); // Spigot - public Map decorations = Maps.newLinkedHashMap(); + public Map decorations = Maps.newLinkedHashMap(); // Spigot @@ -49,27 +48,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { } - if (!entityhuman.inventory.c(itemstack)) { + if (!entityhuman.inventory.f(itemstack)) { - this.decorations.remove(entityhuman.getName()); + this.decorations.remove(entityhuman.getUniqueID()); // Spigot } - for (int i = 0; i < this.g.size(); ++i) { + for (int i = 0; i < this.h.size(); ++i) { @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { - if (!worldmap_worldmaphumantracker1.trackee.dead && (worldmap_worldmaphumantracker1.trackee.inventory.c(itemstack) || itemstack.y())) { - if (!itemstack.y() && worldmap_worldmaphumantracker1.trackee.dimension == this.map) { + if (!worldmap_worldmaphumantracker1.trackee.dead && (worldmap_worldmaphumantracker1.trackee.inventory.f(itemstack) || itemstack.y())) { + if (!itemstack.y() && worldmap_worldmaphumantracker1.trackee.dimension == this.map && this.track) { - this.a(0, worldmap_worldmaphumantracker1.trackee.world, worldmap_worldmaphumantracker1.trackee.getName(), worldmap_worldmaphumantracker1.trackee.locX, worldmap_worldmaphumantracker1.trackee.locZ, (double) worldmap_worldmaphumantracker1.trackee.yaw); + this.a(0, worldmap_worldmaphumantracker1.trackee.world, worldmap_worldmaphumantracker1.trackee.getUniqueID(), worldmap_worldmaphumantracker1.trackee.locX, worldmap_worldmaphumantracker1.trackee.locZ, (double) worldmap_worldmaphumantracker1.trackee.yaw); // Spigot } } else { - this.i.remove(worldmap_worldmaphumantracker1.trackee); + this.j.remove(worldmap_worldmaphumantracker1.trackee); @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { EntityItemFrame entityitemframe = itemstack.z(); BlockPosition blockposition = entityitemframe.getBlockPosition(); -- this.a(1, entityhuman.world, "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.direction.b() * 90)); -+ this.a(1, entityhuman.world, UUID.nameUUIDFromBytes(("frame-" + entityitemframe.getId()).getBytes(Charsets.US_ASCII)), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.direction.b() * 90)); // Spigot +- this.a(1, entityhuman.world, "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.direction.get2DRotationValue() * 90)); ++ this.a(1, entityhuman.world, UUID.nameUUIDFromBytes(("frame-" + entityitemframe.getId()).getBytes(Charsets.US_ASCII)), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.direction.get2DRotationValue() * 90)); // Spigot } if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("Decorations", 9)) { diff --git a/CraftBukkit-Patches/0156-Use-Map-for-getPlayer-String-lookup.patch b/CraftBukkit-Patches/0145-Use-Map-for-getPlayer-String-lookup.patch similarity index 95% rename from CraftBukkit-Patches/0156-Use-Map-for-getPlayer-String-lookup.patch rename to CraftBukkit-Patches/0145-Use-Map-for-getPlayer-String-lookup.patch index 9ae6d2635b..5e1e1c4806 100644 --- a/CraftBukkit-Patches/0156-Use-Map-for-getPlayer-String-lookup.patch +++ b/CraftBukkit-Patches/0145-Use-Map-for-getPlayer-String-lookup.patch @@ -33,8 +33,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 EntityPlayer entityplayer1 = (EntityPlayer) this.j.get(uuid); @@ -0,0 +0,0 @@ public abstract class PlayerList { - // entityplayer.u().getTracker().untrackEntity(entityplayer); // CraftBukkit - entityplayer.u().getPlayerChunkMap().removePlayer(entityplayer); + // entityplayer.x().getTracker().untrackEntity(entityplayer); // CraftBukkit + entityplayer.x().getPlayerChunkMap().removePlayer(entityplayer); this.players.remove(entityplayer); + this.playersByName.remove(entityplayer.getName()); // Spigot this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer); @@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.playersByName.get(s); // Spigot } - public void sendPacketNearby(double d0, double d1, double d2, double d3, int i, Packet packet) { + public void sendPacketNearby(EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet) { diff --git a/src/main/java/org/spigotmc/CaseInsensitiveHashingStrategy.java b/src/main/java/org/spigotmc/CaseInsensitiveHashingStrategy.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/CraftBukkit-Patches/0157-Clear-Packet-Queue-on-Disconnect.patch b/CraftBukkit-Patches/0146-Clear-Packet-Queue-on-Disconnect.patch similarity index 82% rename from CraftBukkit-Patches/0157-Clear-Packet-Queue-on-Disconnect.patch rename to CraftBukkit-Patches/0146-Clear-Packet-Queue-on-Disconnect.patch index aa4de1db6b..b31ccbe556 100644 --- a/CraftBukkit-Patches/0157-Clear-Packet-Queue-on-Disconnect.patch +++ b/CraftBukkit-Patches/0146-Clear-Packet-Queue-on-Disconnect.patch @@ -8,19 +8,19 @@ 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 { - } else if (this.getPacketListener() != null) { - this.getPacketListener().a(new ChatComponentText("Disconnected")); +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { + } else if (this.i() != null) { + this.i().a(new ChatComponentText("Disconnected")); } + this.i.clear(); // Free up packet queue. - } else { - NetworkManager.g.warn("handleDisconnection() called twice"); } + + } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- 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 +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } // CraftBukkit start diff --git a/CraftBukkit-Patches/0158-Optimize-Chunk-Saving-Memory-Allocation-and-Compress.patch b/CraftBukkit-Patches/0147-Optimize-Chunk-Saving-Memory-Allocation-and-Compress.patch similarity index 91% rename from CraftBukkit-Patches/0158-Optimize-Chunk-Saving-Memory-Allocation-and-Compress.patch rename to CraftBukkit-Patches/0147-Optimize-Chunk-Saving-Memory-Allocation-and-Compress.patch index 827a4b9502..f6a7c5ca4a 100644 --- a/CraftBukkit-Patches/0158-Optimize-Chunk-Saving-Memory-Allocation-and-Compress.patch +++ b/CraftBukkit-Patches/0147-Optimize-Chunk-Saving-Memory-Allocation-and-Compress.patch @@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - public DataOutputStream b(int i, int j) { -- return this.d(i, j) ? null : new DataOutputStream(new DeflaterOutputStream(new RegionFile.ChunkBuffer(i, j))); +- return this.d(i, j) ? null : new DataOutputStream(new BufferedOutputStream(new DeflaterOutputStream(new RegionFile.ChunkBuffer(i, j)))); + public DataOutputStream b(int i, int j) { // PAIL: getChunkOutputStream + // PAIL: isInvalidRegion + return this.d(i, j) ? null : new DataOutputStream(new java.io.BufferedOutputStream(new DeflaterOutputStream(new RegionFile.ChunkBuffer(i, j)))); // Spigot - use a BufferedOutputStream to greatly improve file write performance diff --git a/CraftBukkit-Patches/0159-More-effecient-RegionFile-zero-ing.patch b/CraftBukkit-Patches/0148-More-effecient-RegionFile-zero-ing.patch similarity index 85% rename from CraftBukkit-Patches/0159-More-effecient-RegionFile-zero-ing.patch rename to CraftBukkit-Patches/0148-More-effecient-RegionFile-zero-ing.patch index a64e98802e..5a23c8d8bd 100644 --- a/CraftBukkit-Patches/0159-More-effecient-RegionFile-zero-ing.patch +++ b/CraftBukkit-Patches/0148-More-effecient-RegionFile-zero-ing.patch @@ -20,20 +20,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private RandomAccessFile c; private final int[] d = new int[1024]; @@ -0,0 +0,0 @@ public class RegionFile { - int i; + this.c = new RandomAccessFile(file, "rw"); if (this.c.length() < 4096L) { -- for (i = 0; i < 1024; ++i) { -- this.c.writeInt(0); -- } -- -- for (i = 0; i < 1024; ++i) { -- this.c.writeInt(0); -- } +- this.c.write(RegionFile.a); +- this.c.write(RegionFile.a); + // Spigot - more effecient chunk zero'ing + this.c.write(RegionFile.a); // Spigot + this.c.write(RegionFile.a); // Spigot - this.g += 8192; } + -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0160-Don-t-sleep-between-chunk-saves.patch b/CraftBukkit-Patches/0160-Don-t-sleep-between-chunk-saves.patch deleted file mode 100644 index 45b936038d..0000000000 --- a/CraftBukkit-Patches/0160-Don-t-sleep-between-chunk-saves.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 9 Sep 2015 21:09:58 -0400 -Subject: [PATCH] Don't sleep between chunk saves - -For some unknown reason, Minecraft is sleeping 10ms between every single chunk being saved to disk. -Under high chunk load/unload activity (lots of movement / teleporting), this causes the chunk unload queue -to build up in size. - -This has multiple impacts: -1) Performance of the unload queue itself - The save thread is pretty ineffecient for how it accesses it - By letting the queue get larger, checking and popping work off the queue can get less performant. -2) Performance of chunk loading - As with #1, chunk loads also have to check this queue when loading - chunk data so that it doesn't load stale data if new data is pending write to disk. -3) Memory Usage - The entire chunk has been serialized to NBT, and now sits in this queue. This leads to - elevated memory usage, and then the objects used in the serialization sit around longer than needed, - resulting in promotion to Old Generation instead of dying young. - -If there is work to do, then the thread should be doing its work, and only sleep when it is done. - -diff --git a/src/main/java/net/minecraft/server/FileIOThread.java b/src/main/java/net/minecraft/server/FileIOThread.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/FileIOThread.java -+++ b/src/main/java/net/minecraft/server/FileIOThread.java -@@ -0,0 +0,0 @@ public class FileIOThread implements Runnable { - ++this.d; - } - -+ /* // Spigot start - don't sleep in between chunks so we unload faster. - try { - Thread.sleep(this.e ? 0L : 10L); - } catch (InterruptedException interruptedexception) { - interruptedexception.printStackTrace(); -- } -+ } */ // Spigot end - } - - if (this.b.isEmpty()) { --- \ No newline at end of file