summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nms-patches/Block.patch10
-rw-r--r--nms-patches/BlockButtonAbstract.patch12
-rw-r--r--nms-patches/BlockCactus.patch2
-rw-r--r--nms-patches/BlockCake.patch2
-rw-r--r--nms-patches/BlockCauldron.patch22
-rw-r--r--nms-patches/BlockChorusFlower.patch8
-rw-r--r--nms-patches/BlockCommand.patch17
-rw-r--r--nms-patches/BlockCrops.patch8
-rw-r--r--nms-patches/BlockDaylightDetector.patch2
-rw-r--r--nms-patches/BlockDispenser.patch4
-rw-r--r--nms-patches/BlockDoor.patch8
-rw-r--r--nms-patches/BlockDragonEgg.patch6
-rw-r--r--nms-patches/BlockDropper.patch8
-rw-r--r--nms-patches/BlockEnderPortal.patch6
-rw-r--r--nms-patches/BlockFire.patch24
-rw-r--r--nms-patches/BlockGrass.patch10
-rw-r--r--nms-patches/BlockIce.patch2
-rw-r--r--nms-patches/BlockJukeBox.patch4
-rw-r--r--nms-patches/BlockLeaves.patch6
-rw-r--r--nms-patches/BlockLever.patch6
-rw-r--r--nms-patches/BlockMinecartDetector.patch6
-rw-r--r--nms-patches/BlockMinecartTrackAbstract.patch2
-rw-r--r--nms-patches/BlockMobSpawner.patch2
-rw-r--r--nms-patches/BlockMycel.patch8
-rw-r--r--nms-patches/BlockNetherWart.patch2
-rw-r--r--nms-patches/BlockOre.patch4
-rw-r--r--nms-patches/BlockPiston.patch10
-rw-r--r--nms-patches/BlockPlant.patch6
-rw-r--r--nms-patches/BlockPortal.patch22
-rw-r--r--nms-patches/BlockPoweredRail.patch6
-rw-r--r--nms-patches/BlockPressurePlateAbstract.patch6
-rw-r--r--nms-patches/BlockPumpkin.patch12
-rw-r--r--nms-patches/BlockRedstoneLamp.patch10
-rw-r--r--nms-patches/BlockRedstoneOre.patch18
-rw-r--r--nms-patches/BlockRedstoneTorch.patch10
-rw-r--r--nms-patches/BlockRedstoneWire.patch6
-rw-r--r--nms-patches/BlockReed.patch2
-rw-r--r--nms-patches/BlockSkull.patch14
-rw-r--r--nms-patches/BlockSnow.patch2
-rw-r--r--nms-patches/BlockSoil.patch8
-rw-r--r--nms-patches/BlockStationary.patch4
-rw-r--r--nms-patches/BlockStem.patch10
-rw-r--r--nms-patches/BlockTrapdoor.patch8
-rw-r--r--nms-patches/BlockTripwire.patch6
-rw-r--r--nms-patches/BlockTripwireHook.patch6
-rw-r--r--nms-patches/BlockVine.patch10
-rw-r--r--nms-patches/BlockWaterLily.patch2
-rw-r--r--nms-patches/BossBattleServer.patch11
-rw-r--r--nms-patches/ChatBaseComponent.patch2
-rw-r--r--nms-patches/ChatModifier.patch4
-rw-r--r--nms-patches/Chunk.patch37
-rw-r--r--nms-patches/ChunkProviderServer.patch171
-rw-r--r--nms-patches/ChunkRegionLoader.patch17
-rw-r--r--nms-patches/CommandBlockListenerAbstract.patch6
-rw-r--r--nms-patches/CommandExecute.patch10
-rw-r--r--nms-patches/CommandGamemode.patch6
-rw-r--r--nms-patches/CommandGamerule.patch4
-rw-r--r--nms-patches/CommandSpreadPlayers.patch10
-rw-r--r--nms-patches/CommandTp.patch4
-rw-r--r--nms-patches/Container.patch22
-rw-r--r--nms-patches/ContainerAnvil.patch16
-rw-r--r--nms-patches/ContainerBeacon.patch9
-rw-r--r--nms-patches/ContainerBrewingStand.patch12
-rw-r--r--nms-patches/ContainerChest.patch9
-rw-r--r--nms-patches/ContainerDispenser.patch9
-rw-r--r--nms-patches/ContainerEnchantTable.patch22
-rw-r--r--nms-patches/ContainerFurnace.patch10
-rw-r--r--nms-patches/ContainerHopper.patch7
-rw-r--r--nms-patches/ContainerHorse.patch5
-rw-r--r--nms-patches/ContainerMerchant.patch9
-rw-r--r--nms-patches/ContainerPlayer.patch14
-rw-r--r--nms-patches/ContainerWorkbench.patch11
-rw-r--r--nms-patches/CraftingManager.patch8
-rw-r--r--nms-patches/CrashReport.patch4
-rw-r--r--nms-patches/DataPaletteBlock.patch2
-rw-r--r--nms-patches/DataWatcher.patch4
-rw-r--r--nms-patches/DedicatedServer.patch24
-rw-r--r--nms-patches/DispenserRegistry.patch2
-rw-r--r--nms-patches/DragonControllerManager.patch61
-rw-r--r--nms-patches/Enchantment.patch6
-rw-r--r--nms-patches/EnchantmentFrostWalker.patch10
-rw-r--r--nms-patches/EnderDragonBattle.patch4
-rw-r--r--nms-patches/Entity.patch70
-rw-r--r--nms-patches/EntityAgeable.patch12
-rw-r--r--nms-patches/EntityAnimal.patch4
-rw-r--r--nms-patches/EntityAreaEffectCloud.patch10
-rw-r--r--nms-patches/EntityArmorStand.patch14
-rw-r--r--nms-patches/EntityArrow.patch14
-rw-r--r--nms-patches/EntityBoat.patch32
-rw-r--r--nms-patches/EntityChicken.patch14
-rw-r--r--nms-patches/EntityCow.patch10
-rw-r--r--nms-patches/EntityCreature.patch4
-rw-r--r--nms-patches/EntityCreeper.patch20
-rw-r--r--nms-patches/EntityDamageSourceIndirect.patch2
-rw-r--r--nms-patches/EntityEnderCrystal.patch8
-rw-r--r--nms-patches/EntityEnderDragon.patch26
-rw-r--r--nms-patches/EntityEnderman.patch10
-rw-r--r--nms-patches/EntityFallingBlock.patch12
-rw-r--r--nms-patches/EntityFireworks.patch2
-rw-r--r--nms-patches/EntityFishingHook.patch10
-rw-r--r--nms-patches/EntityGhast.patch2
-rw-r--r--nms-patches/EntityHanging.patch16
-rw-r--r--nms-patches/EntityHorse.patch38
-rw-r--r--nms-patches/EntityHuman.patch62
-rw-r--r--nms-patches/EntityInsentient.patch41
-rw-r--r--nms-patches/EntityIronGolem.patch2
-rw-r--r--nms-patches/EntityItem.patch20
-rw-r--r--nms-patches/EntityItemFrame.patch2
-rw-r--r--nms-patches/EntityLeash.patch8
-rw-r--r--nms-patches/EntityLiving.patch90
-rw-r--r--nms-patches/EntityMinecartAbstract.patch32
-rw-r--r--nms-patches/EntityMinecartCommandBlock.patch2
-rw-r--r--nms-patches/EntityMinecartContainer.patch14
-rw-r--r--nms-patches/EntityMushroomCow.patch8
-rw-r--r--nms-patches/EntityOcelot.patch12
-rw-r--r--nms-patches/EntityPainting.patch2
-rw-r--r--nms-patches/EntityPig.patch12
-rw-r--r--nms-patches/EntityPlayer.patch117
-rw-r--r--nms-patches/EntityPotion.patch19
-rw-r--r--nms-patches/EntityProjectile.patch4
-rw-r--r--nms-patches/EntityRabbit.patch2
-rw-r--r--nms-patches/EntitySheep.patch20
-rw-r--r--nms-patches/EntityShulkerBullet.patch2
-rw-r--r--nms-patches/EntitySilverfish.patch4
-rw-r--r--nms-patches/EntitySkeleton.patch18
-rw-r--r--nms-patches/EntitySlime.patch10
-rw-r--r--nms-patches/EntitySnowman.patch10
-rw-r--r--nms-patches/EntitySpectralArrow.patch11
-rw-r--r--nms-patches/EntitySpider.patch2
-rw-r--r--nms-patches/EntityTracker.patch4
-rw-r--r--nms-patches/EntityVillager.patch14
-rw-r--r--nms-patches/EntityWither.patch16
-rw-r--r--nms-patches/EntityWolf.patch20
-rw-r--r--nms-patches/EntityZombie.patch32
-rw-r--r--nms-patches/FoodMetaData.patch2
-rw-r--r--nms-patches/HandshakeListener.patch18
-rw-r--r--nms-patches/IChunkProvider.patch9
-rw-r--r--nms-patches/IInventory.patch8
-rw-r--r--nms-patches/IRecipe.patch2
-rw-r--r--nms-patches/InventoryCraftResult.patch7
-rw-r--r--nms-patches/InventoryCrafting.patch8
-rw-r--r--nms-patches/InventoryLargeChest.patch9
-rw-r--r--nms-patches/InventoryMerchant.patch19
-rw-r--r--nms-patches/InventorySubcontainer.patch6
-rw-r--r--nms-patches/ItemBow.patch10
-rw-r--r--nms-patches/ItemBucket.patch16
-rw-r--r--nms-patches/ItemChorusFruit.patch8
-rw-r--r--nms-patches/ItemHanging.patch8
-rw-r--r--nms-patches/ItemMonsterEgg.patch13
-rw-r--r--nms-patches/ItemStack.patch20
-rw-r--r--nms-patches/ItemWorldMap.patch12
-rw-r--r--nms-patches/JsonList.patch2
-rw-r--r--nms-patches/LoginListener.patch2
-rw-r--r--nms-patches/MerchantRecipe.patch10
-rw-r--r--nms-patches/MinecraftServer.patch89
-rw-r--r--nms-patches/MobEffectList.patch20
-rw-r--r--nms-patches/NameReferencingFileConverter.patch12
-rw-r--r--nms-patches/NetworkManager.patch6
-rw-r--r--nms-patches/PacketDataSerializer.patch18
-rw-r--r--nms-patches/PacketEncoder.patch27
-rw-r--r--nms-patches/PacketPlayOutLogin.patch17
-rw-r--r--nms-patches/PacketPlayOutNamedSoundEffect.patch21
-rw-r--r--nms-patches/PacketStatusListener.patch7
-rw-r--r--nms-patches/PathfinderAbstract.patch11
-rw-r--r--nms-patches/PathfinderGoalHurtByTarget.patch2
-rw-r--r--nms-patches/PathfinderGoalNearestAttackableTarget.patch14
-rw-r--r--nms-patches/PathfinderGoalNearestAttackableTargetInsentient.patch2
-rw-r--r--nms-patches/PathfinderGoalTargetNearestPlayer.patch2
-rw-r--r--nms-patches/PathfinderNormal.patch126
-rw-r--r--nms-patches/PlayerChunk.patch21
-rw-r--r--nms-patches/PlayerChunkMap.patch22
-rw-r--r--nms-patches/PlayerConnection.patch88
-rw-r--r--nms-patches/PlayerInteractManager.patch32
-rw-r--r--nms-patches/PlayerInventory.patch10
-rw-r--r--nms-patches/PlayerList.patch62
-rw-r--r--nms-patches/PortalTravelAgent.patch45
-rw-r--r--nms-patches/RecipeArmorDye.patch4
-rw-r--r--nms-patches/RecipeBookClone.patch6
-rw-r--r--nms-patches/RecipeFireworks.patch4
-rw-r--r--nms-patches/RecipeMapClone.patch5
-rw-r--r--nms-patches/RecipeRepair.patch6
-rw-r--r--nms-patches/RecipeTippedArrow.patch4
-rw-r--r--nms-patches/RecipesBanner.patch4
-rw-r--r--nms-patches/RecipesFurnace.patch10
-rw-r--r--nms-patches/RecipiesShield.patch2
-rw-r--r--nms-patches/ShapedRecipes.patch10
-rw-r--r--nms-patches/ShapelessRecipes.patch8
-rw-r--r--nms-patches/Slot.patch2
-rw-r--r--nms-patches/SlotFurnaceResult.patch8
-rw-r--r--nms-patches/SpawnerCreature.patch4
-rw-r--r--nms-patches/StructureGenerator.patch8
-rw-r--r--nms-patches/TileEntity.patch2
-rw-r--r--nms-patches/TileEntityBanner.patch4
-rw-r--r--nms-patches/TileEntityBeacon.patch6
-rw-r--r--nms-patches/TileEntityBrewingStand.patch12
-rw-r--r--nms-patches/TileEntityChest.patch14
-rw-r--r--nms-patches/TileEntityCommand.patch2
-rw-r--r--nms-patches/TileEntityContainer.patch2
-rw-r--r--nms-patches/TileEntityDispenser.patch8
-rw-r--r--nms-patches/TileEntityEndGateway.patch24
-rw-r--r--nms-patches/TileEntityFurnace.patch20
-rw-r--r--nms-patches/TileEntityHopper.patch12
-rw-r--r--nms-patches/TileEntityNote.patch2
-rw-r--r--nms-patches/TileEntityPiston.patch2
-rw-r--r--nms-patches/TileEntitySign.patch8
-rw-r--r--nms-patches/TileEntitySkull.patch2
-rw-r--r--nms-patches/UserCache.patch4
-rw-r--r--nms-patches/VillageSiege.patch2
-rw-r--r--nms-patches/World.patch105
-rw-r--r--nms-patches/WorldData.patch2
-rw-r--r--nms-patches/WorldManager.patch10
-rw-r--r--nms-patches/WorldMap.patch14
-rw-r--r--nms-patches/WorldNBTStorage.patch8
-rw-r--r--nms-patches/WorldServer.patch103
-rw-r--r--pom.xml6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java3
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftStatistic.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java30
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftEndGateway.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java8
236 files changed, 1471 insertions, 1822 deletions
diff --git a/nms-patches/Block.patch b/nms-patches/Block.patch
index 4980705c..e0c2bb60 100644
--- a/nms-patches/Block.patch
+++ b/nms-patches/Block.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
-@@ -34,7 +34,7 @@
+@@ -35,7 +35,7 @@
private String name;
public static int getId(Block block) {
@@ -9,7 +9,7 @@
}
public static int getCombinedId(IBlockData iblockdata) {
-@@ -301,7 +301,8 @@
+@@ -327,7 +327,8 @@
int j = this.getDropCount(i, world.random);
for (int k = 0; k < j; ++k) {
@@ -19,7 +19,7 @@
Item item = this.getDropType(iblockdata, world.random, i);
if (item != null) {
-@@ -825,7 +826,7 @@
+@@ -863,7 +864,7 @@
if (hashset.contains(block16)) {
for (int i = 0; i < 15; ++i) {
@@ -28,7 +28,7 @@
Block.REGISTRY_ID.a(block16.fromLegacyData(i), j);
}
-@@ -834,7 +835,7 @@
+@@ -872,7 +873,7 @@
while (iterator2.hasNext()) {
IBlockData iblockdata = (IBlockData) iterator2.next();
@@ -37,7 +37,7 @@
Block.REGISTRY_ID.a(iblockdata, k);
}
-@@ -843,6 +844,12 @@
+@@ -881,6 +882,12 @@
}
diff --git a/nms-patches/BlockButtonAbstract.patch b/nms-patches/BlockButtonAbstract.patch
index 27e38ee5..d114d927 100644
--- a/nms-patches/BlockButtonAbstract.patch
+++ b/nms-patches/BlockButtonAbstract.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockButtonAbstract.java
+++ b/net/minecraft/server/BlockButtonAbstract.java
-@@ -3,6 +3,11 @@
- import java.util.List;
+@@ -4,6 +4,11 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.event.block.BlockRedstoneEvent;
@@ -12,7 +12,7 @@
public abstract class BlockButtonAbstract extends BlockDirectional {
public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
-@@ -121,6 +126,19 @@
+@@ -123,6 +128,19 @@
if (((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue()) {
return true;
} else {
@@ -32,7 +32,7 @@
world.setTypeAndData(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true)), 3);
world.b(blockposition, blockposition);
this.a(entityhuman, world, blockposition);
-@@ -162,6 +180,16 @@
+@@ -164,6 +182,16 @@
if (this.I) {
this.e(iblockdata, world, blockposition);
} else {
@@ -49,7 +49,7 @@
world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(false)));
this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
this.b(world, blockposition);
-@@ -187,7 +215,41 @@
+@@ -189,7 +217,41 @@
boolean flag = !list.isEmpty();
boolean flag1 = ((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue();
@@ -91,7 +91,7 @@
world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true)));
this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
world.b(blockposition, blockposition);
-@@ -195,6 +257,16 @@
+@@ -197,6 +259,16 @@
}
if (!flag && flag1) {
diff --git a/nms-patches/BlockCactus.patch b/nms-patches/BlockCactus.patch
index 97f6078e..951d5a9b 100644
--- a/nms-patches/BlockCactus.patch
+++ b/nms-patches/BlockCactus.patch
@@ -19,7 +19,7 @@
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ(), this, 0); // CraftBukkit
world.setTypeAndData(blockposition, iblockdata1, 4);
- this.doPhysics(world, blockposition1, iblockdata1, this);
+ iblockdata1.doPhysics(world, blockposition1, this);
} else {
@@ -87,7 +90,9 @@
}
diff --git a/nms-patches/BlockCake.patch b/nms-patches/BlockCake.patch
index b3c6df05..dd717e39 100644
--- a/nms-patches/BlockCake.patch
+++ b/nms-patches/BlockCake.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockCake.java
+++ b/net/minecraft/server/BlockCake.java
-@@ -33,7 +33,18 @@
+@@ -34,7 +34,18 @@
private void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
if (entityhuman.l(false)) {
entityhuman.b(StatisticList.J);
diff --git a/nms-patches/BlockCauldron.patch b/nms-patches/BlockCauldron.patch
index 716766ba..08b09fac 100644
--- a/nms-patches/BlockCauldron.patch
+++ b/nms-patches/BlockCauldron.patch
@@ -1,14 +1,14 @@
--- a/net/minecraft/server/BlockCauldron.java
+++ b/net/minecraft/server/BlockCauldron.java
-@@ -2,6 +2,7 @@
-
+@@ -3,6 +3,7 @@
import java.util.List;
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.CauldronLevelChangeEvent; // CraftBukkit
public class BlockCauldron extends Block {
-@@ -42,8 +43,13 @@
+@@ -43,8 +44,13 @@
float f = (float) blockposition.getY() + (6.0F + (float) (3 * i)) / 16.0F;
if (!world.isClientSide && entity.isBurning() && i > 0 && entity.getBoundingBox().b <= (double) f) {
@@ -23,7 +23,7 @@
}
}
-@@ -57,17 +63,26 @@
+@@ -58,17 +64,26 @@
if (item == Items.WATER_BUCKET) {
if (i < 3 && !world.isClientSide) {
@@ -51,7 +51,7 @@
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
if (itemstack.count == 0) {
-@@ -78,7 +93,8 @@
+@@ -79,7 +94,8 @@
}
entityhuman.b(StatisticList.L);
@@ -61,7 +61,7 @@
}
return true;
-@@ -87,6 +103,10 @@
+@@ -88,6 +104,10 @@
if (item == Items.GLASS_BOTTLE) {
if (i > 0 && !world.isClientSide) {
@@ -72,7 +72,7 @@
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack1 = PotionUtil.a(new ItemStack(Items.POTION), Potions.b);
entityhuman.b(StatisticList.L);
-@@ -99,7 +119,8 @@
+@@ -100,7 +120,8 @@
}
}
@@ -82,7 +82,7 @@
}
return true;
-@@ -108,8 +129,13 @@
+@@ -109,8 +130,13 @@
ItemArmor itemarmor = (ItemArmor) item;
if (itemarmor.d() == ItemArmor.EnumArmorMaterial.LEATHER && itemarmor.e_(itemstack) && !world.isClientSide) {
@@ -97,7 +97,7 @@
entityhuman.b(StatisticList.M);
return true;
}
-@@ -134,7 +160,7 @@
+@@ -135,7 +161,7 @@
}
if (!entityhuman.abilities.canInstantlyBuild) {
@@ -106,7 +106,7 @@
}
}
-@@ -147,9 +173,25 @@
+@@ -148,9 +174,25 @@
}
}
@@ -133,7 +133,7 @@
}
public void h(World world, BlockPosition blockposition) {
-@@ -160,7 +202,7 @@
+@@ -161,7 +203,7 @@
IBlockData iblockdata = world.getType(blockposition);
if (((Integer) iblockdata.get(BlockCauldron.LEVEL)).intValue() < 3) {
diff --git a/nms-patches/BlockChorusFlower.patch b/nms-patches/BlockChorusFlower.patch
index c4a0d9d5..e5482d55 100644
--- a/nms-patches/BlockChorusFlower.patch
+++ b/nms-patches/BlockChorusFlower.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockChorusFlower.java
+++ b/net/minecraft/server/BlockChorusFlower.java
-@@ -3,6 +3,8 @@
- import java.util.Iterator;
+@@ -4,6 +4,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockChorusFlower extends Block {
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 5);
-@@ -66,8 +68,20 @@
+@@ -68,8 +70,20 @@
}
if (flag && a(world, blockposition1, (EnumDirection) null) && world.isEmpty(blockposition.up(2))) {
@@ -32,7 +32,7 @@
} else if (i < 4) {
j = random.nextInt(4);
boolean flag2 = false;
-@@ -81,18 +95,53 @@
+@@ -83,18 +97,53 @@
BlockPosition blockposition2 = blockposition.shift(enumdirection);
if (world.isEmpty(blockposition2) && world.isEmpty(blockposition2.down()) && a(world, blockposition2, enumdirection.opposite())) {
diff --git a/nms-patches/BlockCommand.patch b/nms-patches/BlockCommand.patch
index 94c248a6..08c95440 100644
--- a/nms-patches/BlockCommand.patch
+++ b/nms-patches/BlockCommand.patch
@@ -1,21 +1,20 @@
--- a/net/minecraft/server/BlockCommand.java
+++ b/net/minecraft/server/BlockCommand.java
-@@ -2,6 +2,8 @@
-
+@@ -3,6 +3,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockCommand extends BlockTileEntity {
public static final BlockStateDirection a = BlockDirectional.FACING;
-@@ -29,7 +31,17 @@
- boolean flag1 = tileentitycommand.d();
- boolean flag2 = tileentitycommand.e();
+@@ -30,7 +32,16 @@
+ boolean flag1 = tileentitycommand.e();
+ boolean flag2 = tileentitycommand.g();
- if (flag && !flag1) {
+ // CraftBukkit start
-+ // PAIL: This section - renames, ordering
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ int old = flag1 ? 15 : 0;
+ int current = flag ? 15 : 0;
@@ -26,9 +25,9 @@
+
+ if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
tileentitycommand.a(true);
- if (tileentitycommand.i() != TileEntityCommand.Type.SEQUENCE && !flag2) {
- boolean flag3 = !tileentitycommand.j() || this.e(world, blockposition, iblockdata);
-@@ -40,7 +52,7 @@
+ if (tileentitycommand.j() != TileEntityCommand.Type.SEQUENCE && !flag2) {
+ boolean flag3 = !tileentitycommand.k() || this.e(world, blockposition, iblockdata);
+@@ -41,7 +52,7 @@
this.c(world, blockposition);
}
}
diff --git a/nms-patches/BlockCrops.patch b/nms-patches/BlockCrops.patch
index 385751da..22e562bc 100644
--- a/nms-patches/BlockCrops.patch
+++ b/nms-patches/BlockCrops.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockCrops.java
+++ b/net/minecraft/server/BlockCrops.java
-@@ -2,6 +2,8 @@
-
+@@ -3,6 +3,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 7);
-@@ -53,7 +55,10 @@
+@@ -54,7 +56,10 @@
float f = a((Block) this, world, blockposition);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
@@ -21,7 +21,7 @@
}
}
}
-@@ -68,7 +73,10 @@
+@@ -69,7 +74,10 @@
i = j;
}
diff --git a/nms-patches/BlockDaylightDetector.patch b/nms-patches/BlockDaylightDetector.patch
index a9525a88..134da667 100644
--- a/nms-patches/BlockDaylightDetector.patch
+++ b/nms-patches/BlockDaylightDetector.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockDaylightDetector.java
+++ b/net/minecraft/server/BlockDaylightDetector.java
-@@ -45,6 +45,7 @@
+@@ -46,6 +46,7 @@
i = MathHelper.clamp(i, 0, 15);
if (((Integer) iblockdata.get(BlockDaylightDetector.POWER)).intValue() != i) {
diff --git a/nms-patches/BlockDispenser.patch b/nms-patches/BlockDispenser.patch
index d0668995..0ab8ace8 100644
--- a/nms-patches/BlockDispenser.patch
+++ b/nms-patches/BlockDispenser.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockDispenser.java
+++ b/net/minecraft/server/BlockDispenser.java
-@@ -8,6 +8,7 @@
+@@ -9,6 +9,7 @@
public static final BlockStateBoolean TRIGGERED = BlockStateBoolean.of("triggered");
public static final RegistryDefault<Item, IDispenseBehavior> REGISTRY = new RegistryDefault(new DispenseBehaviorItem());
protected Random d = new Random();
@@ -8,7 +8,7 @@
protected BlockDispenser() {
super(Material.STONE);
-@@ -83,6 +84,7 @@
+@@ -84,6 +85,7 @@
if (idispensebehavior != IDispenseBehavior.NONE) {
ItemStack itemstack1 = idispensebehavior.a(sourceblock, itemstack);
diff --git a/nms-patches/BlockDoor.patch b/nms-patches/BlockDoor.patch
index 2e1dfe91..0de53123 100644
--- a/nms-patches/BlockDoor.patch
+++ b/nms-patches/BlockDoor.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockDoor.java
+++ b/net/minecraft/server/BlockDoor.java
-@@ -2,6 +2,8 @@
-
+@@ -3,6 +3,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockDoor extends Block {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
-@@ -137,9 +139,22 @@
+@@ -138,9 +140,22 @@
this.b(world, blockposition, iblockdata, 0);
}
} else {
@@ -34,7 +34,7 @@
world.setTypeAndData(blockposition2, iblockdata2.set(BlockDoor.POWERED, Boolean.valueOf(flag1)), 2);
if (flag1 != ((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue()) {
world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.OPEN, Boolean.valueOf(flag1)), 2);
-@@ -147,6 +162,7 @@
+@@ -148,6 +163,7 @@
world.a((EntityHuman) null, flag1 ? this.g() : this.e(), blockposition, 0);
}
}
diff --git a/nms-patches/BlockDragonEgg.patch b/nms-patches/BlockDragonEgg.patch
index af397c67..454b3191 100644
--- a/nms-patches/BlockDragonEgg.patch
+++ b/nms-patches/BlockDragonEgg.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockDragonEgg.java
+++ b/net/minecraft/server/BlockDragonEgg.java
-@@ -2,6 +2,8 @@
-
+@@ -3,6 +3,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit
+
public class BlockDragonEgg extends Block {
protected static final AxisAlignedBB a = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 1.0D, 0.9375D);
-@@ -66,6 +68,18 @@
+@@ -67,6 +69,18 @@
BlockPosition blockposition1 = blockposition.a(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16));
if (world.getType(blockposition1).getBlock().material == Material.AIR) {
diff --git a/nms-patches/BlockDropper.patch b/nms-patches/BlockDropper.patch
index aa3c82ff..cdb5ed4e 100644
--- a/nms-patches/BlockDropper.patch
+++ b/nms-patches/BlockDropper.patch
@@ -1,17 +1,17 @@
--- a/net/minecraft/server/BlockDropper.java
+++ b/net/minecraft/server/BlockDropper.java
-@@ -1,5 +1,10 @@
+@@ -1,6 +1,10 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.inventory.InventoryMoveItemEvent;
+// CraftBukkit end
-+
+
public class BlockDropper extends BlockDispenser {
- private final IDispenseBehavior e = new DispenseBehaviorItem();
-@@ -38,8 +43,25 @@
+@@ -40,8 +44,25 @@
itemstack1 = null;
}
} else {
diff --git a/nms-patches/BlockEnderPortal.patch b/nms-patches/BlockEnderPortal.patch
index 0e141d99..b818c2af 100644
--- a/nms-patches/BlockEnderPortal.patch
+++ b/nms-patches/BlockEnderPortal.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockEnderPortal.java
+++ b/net/minecraft/server/BlockEnderPortal.java
-@@ -3,6 +3,8 @@
- import java.util.List;
+@@ -4,6 +4,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit
+
public class BlockEnderPortal extends BlockTileEntity {
protected static final AxisAlignedBB a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D);
-@@ -36,6 +38,10 @@
+@@ -37,6 +39,10 @@
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
if (!entity.isPassenger() && !entity.isVehicle() && entity.aV() && !world.isClientSide && entity.getBoundingBox().b(iblockdata.c(world, blockposition).a(blockposition))) {
diff --git a/nms-patches/BlockFire.patch b/nms-patches/BlockFire.patch
index a8d60ca0..2e7ea0a4 100644
--- a/nms-patches/BlockFire.patch
+++ b/nms-patches/BlockFire.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockFire.java
+++ b/net/minecraft/server/BlockFire.java
-@@ -4,6 +4,12 @@
- import java.util.Map;
+@@ -5,6 +5,12 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -13,7 +13,7 @@
public class BlockFire extends Block {
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 15);
-@@ -93,7 +99,7 @@
+@@ -95,7 +101,7 @@
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (world.getGameRules().getBoolean("doFireTick")) {
if (!this.canPlace(world, blockposition)) {
@@ -22,7 +22,7 @@
}
Block block = world.getType(blockposition.down()).getBlock();
-@@ -106,7 +112,7 @@
+@@ -108,7 +114,7 @@
int i = ((Integer) iblockdata.get(BlockFire.AGE)).intValue();
if (!flag && world.W() && this.b(world, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
@@ -31,7 +31,7 @@
} else {
if (i < 15) {
iblockdata = iblockdata.set(BlockFire.AGE, Integer.valueOf(i + random.nextInt(3) / 2));
-@@ -117,14 +123,14 @@
+@@ -119,14 +125,14 @@
if (!flag) {
if (!this.c(world, blockposition)) {
if (!world.getType(blockposition.down()).q() || i > 3) {
@@ -48,7 +48,7 @@
return;
}
}
-@@ -170,7 +176,26 @@
+@@ -172,7 +178,26 @@
l1 = 15;
}
@@ -76,7 +76,7 @@
}
}
}
-@@ -208,6 +233,17 @@
+@@ -210,6 +235,17 @@
if (random.nextInt(i) < k) {
IBlockData iblockdata = world.getType(blockposition);
@@ -94,7 +94,7 @@
if (random.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) {
int l = j + random.nextInt(5) / 4;
-@@ -217,7 +253,7 @@
+@@ -219,7 +255,7 @@
world.setTypeAndData(blockposition, this.getBlockData().set(BlockFire.AGE, Integer.valueOf(l)), 3);
} else {
@@ -103,16 +103,16 @@
}
if (iblockdata.getBlock() == Blocks.TNT) {
-@@ -274,7 +310,7 @@
+@@ -276,7 +312,7 @@
- public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
+ public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Block block) {
if (!world.getType(blockposition.down()).q() && !this.c(world, blockposition)) {
- world.setAir(blockposition);
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block gone
}
}
-@@ -282,7 +318,7 @@
+@@ -284,7 +320,7 @@
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (world.worldProvider.getDimensionManager().getDimensionID() > 0 || !Blocks.PORTAL.b(world, blockposition)) {
if (!world.getType(blockposition.down()).q() && !this.c(world, blockposition)) {
@@ -121,7 +121,7 @@
} else {
world.a(blockposition, (Block) this, this.a(world) + world.random.nextInt(10));
}
-@@ -304,4 +340,12 @@
+@@ -306,4 +342,12 @@
protected BlockStateList getStateList() {
return new BlockStateList(this, new IBlockState[] { BlockFire.AGE, BlockFire.NORTH, BlockFire.EAST, BlockFire.SOUTH, BlockFire.WEST, BlockFire.UPPER});
}
diff --git a/nms-patches/BlockGrass.patch b/nms-patches/BlockGrass.patch
index 040f26ae..741320cc 100644
--- a/nms-patches/BlockGrass.patch
+++ b/nms-patches/BlockGrass.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockGrass.java
+++ b/net/minecraft/server/BlockGrass.java
-@@ -2,6 +2,14 @@
-
+@@ -3,6 +3,14 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.block.BlockState;
@@ -15,7 +15,7 @@
public class BlockGrass extends Block implements IBlockFragilePlantElement {
public static final BlockStateBoolean SNOWY = BlockStateBoolean.of("snowy");
-@@ -22,7 +30,19 @@
+@@ -23,7 +31,19 @@
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (!world.isClientSide) {
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).c() > 2) {
@@ -36,7 +36,7 @@
} else {
if (world.getLightLevel(blockposition.up()) >= 9) {
for (int i = 0; i < 4; ++i) {
-@@ -36,7 +56,19 @@
+@@ -37,7 +57,19 @@
IBlockData iblockdata2 = world.getType(blockposition1);
if (iblockdata2.getBlock() == Blocks.DIRT && iblockdata2.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && iblockdata1.c() <= 2) {
@@ -57,7 +57,7 @@
}
}
}
-@@ -79,13 +111,15 @@
+@@ -81,13 +113,15 @@
IBlockData iblockdata1 = blockflowers.getBlockData().set(blockflowers.g(), blockflowers_enumflowervarient);
if (blockflowers.f(world, blockposition2, iblockdata1)) {
diff --git a/nms-patches/BlockIce.patch b/nms-patches/BlockIce.patch
index b9d8696a..6d0beefb 100644
--- a/nms-patches/BlockIce.patch
+++ b/nms-patches/BlockIce.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockIce.java
+++ b/net/minecraft/server/BlockIce.java
-@@ -50,6 +50,11 @@
+@@ -51,6 +51,11 @@
}
protected void b(World world, BlockPosition blockposition) {
diff --git a/nms-patches/BlockJukeBox.patch b/nms-patches/BlockJukeBox.patch
index 080ba7ef..b279f101 100644
--- a/nms-patches/BlockJukeBox.patch
+++ b/nms-patches/BlockJukeBox.patch
@@ -1,9 +1,9 @@
--- a/net/minecraft/server/BlockJukeBox.java
+++ b/net/minecraft/server/BlockJukeBox.java
-@@ -136,6 +136,11 @@
+@@ -140,6 +140,11 @@
}
- public void setRecord(ItemStack itemstack) {
+ public void setRecord(@Nullable ItemStack itemstack) {
+ // CraftBukkit start - There can only be one
+ if (itemstack != null) {
+ itemstack.count = 1;
diff --git a/nms-patches/BlockLeaves.patch b/nms-patches/BlockLeaves.patch
index bb3a479d..5867b84e 100644
--- a/nms-patches/BlockLeaves.patch
+++ b/nms-patches/BlockLeaves.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockLeaves.java
+++ b/net/minecraft/server/BlockLeaves.java
-@@ -2,6 +2,8 @@
-
+@@ -3,6 +3,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
+
public abstract class BlockLeaves extends Block {
public static final BlockStateBoolean DECAYABLE = BlockStateBoolean.of("decayable");
-@@ -132,6 +134,14 @@
+@@ -133,6 +135,14 @@
}
private void b(World world, BlockPosition blockposition) {
diff --git a/nms-patches/BlockLever.patch b/nms-patches/BlockLever.patch
index bded7ed0..db03cc1f 100644
--- a/nms-patches/BlockLever.patch
+++ b/nms-patches/BlockLever.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockLever.java
+++ b/net/minecraft/server/BlockLever.java
-@@ -2,6 +2,8 @@
-
+@@ -3,6 +3,8 @@
import java.util.Iterator;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockLever extends Block {
public static final BlockStateEnum<BlockLever.EnumLeverPosition> FACING = BlockStateEnum.of("facing", BlockLever.EnumLeverPosition.class);
-@@ -127,6 +129,20 @@
+@@ -129,6 +131,20 @@
if (world.isClientSide) {
return true;
} else {
diff --git a/nms-patches/BlockMinecartDetector.patch b/nms-patches/BlockMinecartDetector.patch
index 56c9cd09..3d322600 100644
--- a/nms-patches/BlockMinecartDetector.patch
+++ b/nms-patches/BlockMinecartDetector.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockMinecartDetector.java
+++ b/net/minecraft/server/BlockMinecartDetector.java
-@@ -5,6 +5,8 @@
- import java.util.List;
+@@ -6,6 +6,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
public static final BlockStateEnum<BlockMinecartTrackAbstract.EnumTrackPosition> SHAPE = BlockStateEnum.a("shape", BlockMinecartTrackAbstract.EnumTrackPosition.class, new Predicate() {
-@@ -65,6 +67,17 @@
+@@ -66,6 +68,17 @@
flag1 = true;
}
diff --git a/nms-patches/BlockMinecartTrackAbstract.patch b/nms-patches/BlockMinecartTrackAbstract.patch
index 755761e7..b78169d6 100644
--- a/nms-patches/BlockMinecartTrackAbstract.patch
+++ b/nms-patches/BlockMinecartTrackAbstract.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockMinecartTrackAbstract.java
+++ b/net/minecraft/server/BlockMinecartTrackAbstract.java
-@@ -10,6 +10,7 @@
+@@ -11,6 +11,7 @@
protected static final AxisAlignedBB b = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.15625D, 1.0D);
protected final boolean c;
diff --git a/nms-patches/BlockMobSpawner.patch b/nms-patches/BlockMobSpawner.patch
index 67c46a90..708f413b 100644
--- a/nms-patches/BlockMobSpawner.patch
+++ b/nms-patches/BlockMobSpawner.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockMobSpawner.java
+++ b/net/minecraft/server/BlockMobSpawner.java
-@@ -22,9 +22,19 @@
+@@ -24,9 +24,19 @@
public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {
super.dropNaturally(world, blockposition, iblockdata, f, i);
diff --git a/nms-patches/BlockMycel.patch b/nms-patches/BlockMycel.patch
index 626b81bf..8fbe0109 100644
--- a/nms-patches/BlockMycel.patch
+++ b/nms-patches/BlockMycel.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockMycel.java
+++ b/net/minecraft/server/BlockMycel.java
-@@ -2,6 +2,13 @@
-
+@@ -3,6 +3,13 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.block.BlockState;
@@ -14,7 +14,7 @@
public class BlockMycel extends Block {
public static final BlockStateBoolean SNOWY = BlockStateBoolean.of("snowy");
-@@ -22,7 +29,19 @@
+@@ -23,7 +30,19 @@
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (!world.isClientSide) {
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).c() > 2) {
@@ -35,7 +35,7 @@
} else {
if (world.getLightLevel(blockposition.up()) >= 9) {
for (int i = 0; i < 4; ++i) {
-@@ -31,7 +50,19 @@
+@@ -32,7 +51,19 @@
IBlockData iblockdata2 = world.getType(blockposition1.up());
if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && iblockdata2.c() <= 2) {
diff --git a/nms-patches/BlockNetherWart.patch b/nms-patches/BlockNetherWart.patch
index 1af3f818..7992cd52 100644
--- a/nms-patches/BlockNetherWart.patch
+++ b/nms-patches/BlockNetherWart.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockNetherWart.java
+++ b/net/minecraft/server/BlockNetherWart.java
-@@ -31,7 +31,8 @@
+@@ -32,7 +32,8 @@
if (i < 3 && random.nextInt(10) == 0) {
iblockdata = iblockdata.set(BlockNetherWart.AGE, Integer.valueOf(i + 1));
diff --git a/nms-patches/BlockOre.patch b/nms-patches/BlockOre.patch
index cbe3d905..4e995e40 100644
--- a/nms-patches/BlockOre.patch
+++ b/nms-patches/BlockOre.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockOre.java
+++ b/net/minecraft/server/BlockOre.java
-@@ -37,6 +37,7 @@
+@@ -39,6 +39,7 @@
public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {
super.dropNaturally(world, blockposition, iblockdata, f, i);
@@ -8,7 +8,7 @@
if (this.getDropType(iblockdata, world.random, i) != Item.getItemOf(this)) {
int j = 0;
-@@ -54,13 +55,42 @@
+@@ -56,13 +57,42 @@
this.dropExperience(world, blockposition, j);
}
diff --git a/nms-patches/BlockPiston.patch b/nms-patches/BlockPiston.patch
index 58de3a2e..9c7cf575 100644
--- a/nms-patches/BlockPiston.patch
+++ b/nms-patches/BlockPiston.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockPiston.java
+++ b/net/minecraft/server/BlockPiston.java
-@@ -4,6 +4,18 @@
- import java.util.ArrayList;
+@@ -5,6 +5,18 @@
import java.util.List;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.AbstractList;
@@ -19,7 +19,7 @@
public class BlockPiston extends BlockDirectional {
public static final BlockStateBoolean EXTENDED = BlockStateBoolean.of("extended");
-@@ -98,6 +110,18 @@
+@@ -99,6 +111,18 @@
world.playBlockAction(blockposition, this, 0, enumdirection.a());
}
} else if (!flag && ((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) {
@@ -38,7 +38,7 @@
world.playBlockAction(blockposition, this, 1, enumdirection.a());
}
-@@ -188,7 +212,7 @@
+@@ -189,7 +213,7 @@
}
}
@@ -47,7 +47,7 @@
this.a(world, blockposition, enumdirection, false);
}
} else {
-@@ -284,6 +308,48 @@
+@@ -286,6 +310,48 @@
int j = list.size() + list1.size();
IBlockData[] aiblockdata = new IBlockData[j];
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
diff --git a/nms-patches/BlockPlant.patch b/nms-patches/BlockPlant.patch
index 7e62b1ff..ff1d2de5 100644
--- a/nms-patches/BlockPlant.patch
+++ b/nms-patches/BlockPlant.patch
@@ -1,9 +1,9 @@
--- a/net/minecraft/server/BlockPlant.java
+++ b/net/minecraft/server/BlockPlant.java
-@@ -1,6 +1,10 @@
- package net.minecraft.server;
+@@ -2,6 +2,10 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.event.block.BlockPhysicsEvent;
@@ -11,7 +11,7 @@
public class BlockPlant extends Block {
-@@ -39,6 +43,15 @@
+@@ -40,6 +44,15 @@
protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (!this.f(world, blockposition, iblockdata)) {
diff --git a/nms-patches/BlockPortal.patch b/nms-patches/BlockPortal.patch
index 3ac6f992..812e886e 100644
--- a/nms-patches/BlockPortal.patch
+++ b/nms-patches/BlockPortal.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockPortal.java
+++ b/net/minecraft/server/BlockPortal.java
-@@ -3,6 +3,9 @@
- import com.google.common.cache.LoadingCache;
+@@ -4,6 +4,9 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit
+import org.bukkit.event.world.PortalCreateEvent; // CraftBukkit
@@ -10,7 +10,7 @@
public class BlockPortal extends BlockHalfTransparent {
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockStateEnum.of("axis", EnumDirection.EnumAxis.class, new EnumDirection.EnumAxis[] { EnumDirection.EnumAxis.X, EnumDirection.EnumAxis.Z});
-@@ -42,7 +45,8 @@
+@@ -43,7 +46,8 @@
}
if (i > 0 && !world.getType(blockposition1.up()).l()) {
@@ -20,7 +20,7 @@
if (entity != null) {
entity.portalCooldown = entity.aC();
-@@ -68,14 +72,16 @@
+@@ -70,14 +74,16 @@
BlockPortal.Shape blockportal_shape = new BlockPortal.Shape(world, blockposition, EnumDirection.EnumAxis.X);
if (blockportal_shape.d() && blockportal_shape.e == 0) {
@@ -41,7 +41,7 @@
} else {
return false;
}
-@@ -106,6 +112,10 @@
+@@ -108,6 +114,10 @@
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
if (!entity.isPassenger() && !entity.isVehicle() && entity.aV()) {
@@ -52,7 +52,7 @@
entity.e(blockposition);
}
-@@ -251,6 +261,7 @@
+@@ -254,6 +264,7 @@
private BlockPosition position;
private int height;
private int width;
@@ -60,7 +60,7 @@
public Shape(World world, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
this.a = world;
-@@ -309,6 +320,10 @@
+@@ -312,6 +323,10 @@
}
protected int c() {
@@ -71,7 +71,7 @@
int i;
label56:
-@@ -329,11 +344,21 @@
+@@ -332,11 +347,21 @@
block = this.a.getType(blockposition.shift(this.d)).getBlock();
if (block != Blocks.OBSIDIAN) {
break label56;
@@ -93,7 +93,7 @@
}
}
}
-@@ -343,6 +368,11 @@
+@@ -346,6 +371,11 @@
if (this.a.getType(this.position.shift(this.c, i).up(this.height)).getBlock() != Blocks.OBSIDIAN) {
this.height = 0;
break;
@@ -105,7 +105,7 @@
}
}
-@@ -364,7 +394,27 @@
+@@ -367,7 +397,27 @@
return this.position != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
}
@@ -134,7 +134,7 @@
for (int i = 0; i < this.width; ++i) {
BlockPosition blockposition = this.position.shift(this.c, i);
-@@ -373,6 +423,7 @@
+@@ -376,6 +426,7 @@
}
}
diff --git a/nms-patches/BlockPoweredRail.patch b/nms-patches/BlockPoweredRail.patch
index 61dcda6e..f4dfbd55 100644
--- a/nms-patches/BlockPoweredRail.patch
+++ b/nms-patches/BlockPoweredRail.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockPoweredRail.java
+++ b/net/minecraft/server/BlockPoweredRail.java
-@@ -2,6 +2,8 @@
-
+@@ -3,6 +3,8 @@
import com.google.common.base.Predicate;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockPoweredRail extends BlockMinecartTrackAbstract {
public static final BlockStateEnum<BlockMinecartTrackAbstract.EnumTrackPosition> SHAPE = BlockStateEnum.a("shape", BlockMinecartTrackAbstract.EnumTrackPosition.class, new Predicate() {
-@@ -116,6 +118,13 @@
+@@ -117,6 +119,13 @@
boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || this.a(world, blockposition, iblockdata, true, 0) || this.a(world, blockposition, iblockdata, false, 0);
if (flag1 != flag) {
diff --git a/nms-patches/BlockPressurePlateAbstract.patch b/nms-patches/BlockPressurePlateAbstract.patch
index 58ff2ff6..775f0989 100644
--- a/nms-patches/BlockPressurePlateAbstract.patch
+++ b/nms-patches/BlockPressurePlateAbstract.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockPressurePlateAbstract.java
+++ b/net/minecraft/server/BlockPressurePlateAbstract.java
-@@ -2,6 +2,8 @@
-
+@@ -3,6 +3,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public abstract class BlockPressurePlateAbstract extends Block {
protected static final AxisAlignedBB a = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.03125D, 0.9375D);
-@@ -93,6 +95,19 @@
+@@ -95,6 +97,19 @@
boolean flag = i > 0;
boolean flag1 = j > 0;
diff --git a/nms-patches/BlockPumpkin.patch b/nms-patches/BlockPumpkin.patch
index 4ddb2b1b..4404b2f3 100644
--- a/nms-patches/BlockPumpkin.patch
+++ b/nms-patches/BlockPumpkin.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockPumpkin.java
+++ b/net/minecraft/server/BlockPumpkin.java
-@@ -2,6 +2,12 @@
-
+@@ -3,6 +3,12 @@
import com.google.common.base.Predicate;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
@@ -13,7 +13,7 @@
public class BlockPumpkin extends BlockFacingHorizontal {
private ShapeDetector snowGolemPart;
-@@ -40,17 +46,24 @@
+@@ -41,17 +47,24 @@
int j;
if ((shapedetector_shapedetectorcollection = this.getDetectorSnowGolem().a(world, blockposition)) != null) {
@@ -40,7 +40,7 @@
for (j = 0; j < 120; ++j) {
world.addParticle(EnumParticle.SNOW_SHOVEL, (double) blockposition1.getX() + world.random.nextDouble(), (double) blockposition1.getY() + world.random.nextDouble() * 2.5D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
-@@ -61,10 +74,16 @@
+@@ -62,10 +75,16 @@
world.update(shapedetectorblock1.getPosition(), Blocks.AIR);
}
@@ -58,7 +58,7 @@
}
}
-@@ -73,7 +92,10 @@
+@@ -74,7 +93,10 @@
entityirongolem.setPlayerCreated(true);
entityirongolem.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
@@ -70,7 +70,7 @@
for (j = 0; j < 120; ++j) {
world.addParticle(EnumParticle.SNOWBALL, (double) blockposition2.getX() + world.random.nextDouble(), (double) blockposition2.getY() + world.random.nextDouble() * 3.9D, (double) blockposition2.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
-@@ -86,6 +108,7 @@
+@@ -87,6 +109,7 @@
world.update(shapedetectorblock2.getPosition(), Blocks.AIR);
}
}
diff --git a/nms-patches/BlockRedstoneLamp.patch b/nms-patches/BlockRedstoneLamp.patch
index 1aec6322..19afa4da 100644
--- a/nms-patches/BlockRedstoneLamp.patch
+++ b/nms-patches/BlockRedstoneLamp.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockRedstoneLamp.java
+++ b/net/minecraft/server/BlockRedstoneLamp.java
-@@ -2,6 +2,8 @@
-
+@@ -3,6 +3,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockRedstoneLamp extends Block {
private final boolean a;
-@@ -20,6 +22,11 @@
+@@ -21,6 +23,11 @@
if (this.a && !world.isBlockIndirectlyPowered(blockposition)) {
world.setTypeAndData(blockposition, Blocks.REDSTONE_LAMP.getBlockData(), 2);
} else if (!this.a && world.isBlockIndirectlyPowered(blockposition)) {
@@ -21,7 +21,7 @@
world.setTypeAndData(blockposition, Blocks.LIT_REDSTONE_LAMP.getBlockData(), 2);
}
-@@ -31,6 +38,11 @@
+@@ -32,6 +39,11 @@
if (this.a && !world.isBlockIndirectlyPowered(blockposition)) {
world.a(blockposition, (Block) this, 4);
} else if (!this.a && world.isBlockIndirectlyPowered(blockposition)) {
@@ -33,7 +33,7 @@
world.setTypeAndData(blockposition, Blocks.LIT_REDSTONE_LAMP.getBlockData(), 2);
}
-@@ -40,6 +52,11 @@
+@@ -41,6 +53,11 @@
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (!world.isClientSide) {
if (this.a && !world.isBlockIndirectlyPowered(blockposition)) {
diff --git a/nms-patches/BlockRedstoneOre.patch b/nms-patches/BlockRedstoneOre.patch
index 586afb83..f209a284 100644
--- a/nms-patches/BlockRedstoneOre.patch
+++ b/nms-patches/BlockRedstoneOre.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockRedstoneOre.java
+++ b/net/minecraft/server/BlockRedstoneOre.java
-@@ -2,6 +2,11 @@
-
+@@ -3,6 +3,11 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class BlockRedstoneOre extends Block {
private final boolean a;
-@@ -20,23 +25,46 @@
+@@ -21,23 +26,45 @@
}
public void attack(World world, BlockPosition blockposition, EntityHuman entityhuman) {
@@ -25,7 +25,6 @@
- this.interact(world, blockposition);
- super.stepOn(world, blockposition, entity);
+ // CraftBukkit start
-+ // PAIL: Rename this method
+ // this.interact(world, blockposition);
+ // super.stepOn(world, blockposition, entity);
+ if (entity instanceof EntityHuman) {
@@ -46,7 +45,7 @@
}
+
- public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
+ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, @Nullable ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
- this.interact(world, blockposition);
+ this.interact(world, blockposition, entityhuman); // CraftBukkit - add entityhuman
return super.interact(world, blockposition, iblockdata, entityhuman, enumhand, itemstack, enumdirection, f, f1, f2);
@@ -64,7 +63,7 @@
world.setTypeUpdate(blockposition, Blocks.LIT_REDSTONE_ORE.getBlockData());
}
-@@ -44,6 +72,11 @@
+@@ -45,6 +72,11 @@
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (this == Blocks.LIT_REDSTONE_ORE) {
@@ -76,7 +75,7 @@
world.setTypeUpdate(blockposition, Blocks.REDSTONE_ORE.getBlockData());
}
-@@ -63,12 +96,24 @@
+@@ -65,12 +97,25 @@
public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {
super.dropNaturally(world, blockposition, iblockdata, f, i);
@@ -87,13 +86,14 @@
this.dropExperience(world, blockposition, j);
}
+ // */
++
+ }
-
++
+ @Override
+ public int getExpDrop(World world, IBlockData data, int i) {
+ if (this.getDropType(data, world.random, i) != Item.getItemOf(this)) {
+ int j = 1 + world.random.nextInt(5);
-+
+
+ return j;
+ }
+ return 0;
diff --git a/nms-patches/BlockRedstoneTorch.patch b/nms-patches/BlockRedstoneTorch.patch
index cb3e3e9c..4f65a1ab 100644
--- a/nms-patches/BlockRedstoneTorch.patch
+++ b/nms-patches/BlockRedstoneTorch.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockRedstoneTorch.java
+++ b/net/minecraft/server/BlockRedstoneTorch.java
-@@ -6,6 +6,8 @@
- import java.util.Map;
+@@ -7,6 +7,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockRedstoneTorch extends BlockTorch {
private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> g = Maps.newHashMap();
-@@ -13,7 +15,7 @@
+@@ -14,7 +16,7 @@
private boolean a(World world, BlockPosition blockposition, boolean flag) {
if (!BlockRedstoneTorch.g.containsKey(world)) {
@@ -18,7 +18,7 @@
}
List list = (List) BlockRedstoneTorch.g.get(world);
-@@ -96,8 +98,25 @@
+@@ -97,8 +99,25 @@
list.remove(0);
}
@@ -44,7 +44,7 @@
world.setTypeAndData(blockposition, Blocks.UNLIT_REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3);
if (this.a(world, blockposition, true)) {
world.a((EntityHuman) null, blockposition, SoundEffects.eG, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
-@@ -114,6 +133,15 @@
+@@ -115,6 +134,15 @@
}
}
} else if (!flag && !this.a(world, blockposition, false)) {
diff --git a/nms-patches/BlockRedstoneWire.patch b/nms-patches/BlockRedstoneWire.patch
index 18fdea9d..0f200a35 100644
--- a/nms-patches/BlockRedstoneWire.patch
+++ b/nms-patches/BlockRedstoneWire.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockRedstoneWire.java
+++ b/net/minecraft/server/BlockRedstoneWire.java
-@@ -8,6 +8,8 @@
- import java.util.Random;
+@@ -9,6 +9,8 @@
import java.util.Set;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockRedstoneWire extends Block {
public static final BlockStateEnum<BlockRedstoneWire.EnumRedstoneWireConnection> NORTH = BlockStateEnum.of("north", BlockRedstoneWire.EnumRedstoneWireConnection.class);
-@@ -166,6 +168,15 @@
+@@ -168,6 +170,15 @@
j = k;
}
diff --git a/nms-patches/BlockReed.patch b/nms-patches/BlockReed.patch
index de1b755b..8acc843a 100644
--- a/nms-patches/BlockReed.patch
+++ b/nms-patches/BlockReed.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockReed.java
+++ b/net/minecraft/server/BlockReed.java
-@@ -31,8 +31,12 @@
+@@ -32,8 +32,12 @@
int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue();
if (j == 15) {
diff --git a/nms-patches/BlockSkull.patch b/nms-patches/BlockSkull.patch
index 914d423d..ba234cb7 100644
--- a/nms-patches/BlockSkull.patch
+++ b/nms-patches/BlockSkull.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockSkull.java
+++ b/net/minecraft/server/BlockSkull.java
-@@ -4,6 +4,11 @@
- import java.util.Iterator;
+@@ -5,6 +5,11 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
@@ -12,7 +12,7 @@
public class BlockSkull extends BlockTileEntity {
public static final BlockStateDirection FACING = BlockDirectional.FACING;
-@@ -81,7 +86,25 @@
+@@ -82,7 +87,25 @@
return new ItemStack(Items.SKULL, 1, i);
}
@@ -39,7 +39,7 @@
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
if (entityhuman.abilities.canInstantlyBuild) {
-@@ -94,7 +117,10 @@
+@@ -95,7 +118,10 @@
public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (!world.isClientSide) {
@@ -51,7 +51,7 @@
TileEntity tileentity = world.getTileEntity(blockposition);
if (tileentity instanceof TileEntitySkull) {
-@@ -126,24 +152,36 @@
+@@ -128,24 +154,36 @@
}
public void a(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
@@ -90,7 +90,7 @@
}
}
-@@ -156,14 +194,16 @@
+@@ -158,14 +196,16 @@
entitywither.o();
Iterator iterator = world.a(EntityHuman.class, entitywither.getBoundingBox().g(50.0D)).iterator();
@@ -109,7 +109,7 @@
int k;
for (k = 0; k < 120; ++k) {
-@@ -177,6 +217,7 @@
+@@ -179,6 +219,7 @@
world.update(shapedetectorblock2.getPosition(), Blocks.AIR);
}
}
diff --git a/nms-patches/BlockSnow.patch b/nms-patches/BlockSnow.patch
index bbe41c9d..434eaed9 100644
--- a/nms-patches/BlockSnow.patch
+++ b/nms-patches/BlockSnow.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockSnow.java
+++ b/net/minecraft/server/BlockSnow.java
-@@ -79,6 +79,11 @@
+@@ -82,6 +82,11 @@
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (world.b(EnumSkyBlock.BLOCK, blockposition) > 11) {
diff --git a/nms-patches/BlockSoil.patch b/nms-patches/BlockSoil.patch
index eb2caefc..96deb823 100644
--- a/nms-patches/BlockSoil.patch
+++ b/nms-patches/BlockSoil.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockSoil.java
+++ b/net/minecraft/server/BlockSoil.java
-@@ -3,6 +3,11 @@
- import java.util.Iterator;
+@@ -4,6 +4,11 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityInteractEvent;
@@ -12,7 +12,7 @@
public class BlockSoil extends Block {
public static final BlockStateInteger MOISTURE = BlockStateInteger.of("moisture", 0, 7);
-@@ -38,6 +43,12 @@
+@@ -40,6 +45,12 @@
if (i > 0) {
world.setTypeAndData(blockposition, iblockdata.set(BlockSoil.MOISTURE, Integer.valueOf(i - 1)), 2);
} else if (!this.b(world, blockposition)) {
@@ -25,7 +25,7 @@
world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
}
} else if (i < 7) {
-@@ -47,11 +58,31 @@
+@@ -49,11 +60,31 @@
}
public void fallOn(World world, BlockPosition blockposition, Entity entity, float f) {
diff --git a/nms-patches/BlockStationary.patch b/nms-patches/BlockStationary.patch
index 4f9bbe20..02a516fd 100644
--- a/nms-patches/BlockStationary.patch
+++ b/nms-patches/BlockStationary.patch
@@ -23,11 +23,9 @@
world.setTypeUpdate(blockposition1, Blocks.FIRE.getBlockData());
return;
}
-@@ -60,7 +69,16 @@
- return;
+@@ -61,6 +70,14 @@
}
-+ // PAIL: rename
if (world.isEmpty(blockposition2.up()) && this.d(world, blockposition2)) {
+ // CraftBukkit start - Prevent lava putting something on fire
+ BlockPosition up = blockposition2.up();
diff --git a/nms-patches/BlockStem.patch b/nms-patches/BlockStem.patch
index 0fab7bdb..df952dca 100644
--- a/nms-patches/BlockStem.patch
+++ b/nms-patches/BlockStem.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockStem.java
+++ b/net/minecraft/server/BlockStem.java
-@@ -3,6 +3,8 @@
- import java.util.Iterator;
+@@ -4,6 +4,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 7);
-@@ -53,7 +55,8 @@
+@@ -54,7 +56,8 @@
if (i < 7) {
iblockdata = iblockdata.set(BlockStem.AGE, Integer.valueOf(i + 1));
@@ -19,7 +19,7 @@
} else {
Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
-@@ -69,7 +72,8 @@
+@@ -70,7 +73,8 @@
Block block = world.getType(blockposition.down()).getBlock();
if (world.getType(blockposition).getBlock().material == Material.AIR && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.GRASS)) {
@@ -29,7 +29,7 @@
}
}
}
-@@ -80,7 +84,8 @@
+@@ -81,7 +85,8 @@
public void g(World world, BlockPosition blockposition, IBlockData iblockdata) {
int i = ((Integer) iblockdata.get(BlockStem.AGE)).intValue() + MathHelper.nextInt(world.random, 2, 5);
diff --git a/nms-patches/BlockTrapdoor.patch b/nms-patches/BlockTrapdoor.patch
index 90372d08..58cfb760 100644
--- a/nms-patches/BlockTrapdoor.patch
+++ b/nms-patches/BlockTrapdoor.patch
@@ -1,14 +1,14 @@
--- a/net/minecraft/server/BlockTrapdoor.java
+++ b/net/minecraft/server/BlockTrapdoor.java
-@@ -1,5 +1,7 @@
+@@ -1,6 +1,7 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
-+
+
public class BlockTrapdoor extends Block {
- public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
-@@ -92,6 +94,19 @@
+@@ -94,6 +95,19 @@
boolean flag = world.isBlockIndirectlyPowered(blockposition);
if (flag || block.getBlockData().m()) {
diff --git a/nms-patches/BlockTripwire.patch b/nms-patches/BlockTripwire.patch
index 249f6c29..c4b40aa3 100644
--- a/nms-patches/BlockTripwire.patch
+++ b/nms-patches/BlockTripwire.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockTripwire.java
+++ b/net/minecraft/server/BlockTripwire.java
-@@ -4,6 +4,8 @@
- import java.util.List;
+@@ -5,6 +5,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
+
public class BlockTripwire extends Block {
public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
-@@ -136,6 +138,40 @@
+@@ -139,6 +141,40 @@
}
}
diff --git a/nms-patches/BlockTripwireHook.patch b/nms-patches/BlockTripwireHook.patch
index 16cb8927..c167cfee 100644
--- a/nms-patches/BlockTripwireHook.patch
+++ b/nms-patches/BlockTripwireHook.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockTripwireHook.java
+++ b/net/minecraft/server/BlockTripwireHook.java
-@@ -4,6 +4,8 @@
- import java.util.Iterator;
+@@ -5,6 +5,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockTripwireHook extends Block {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
-@@ -153,6 +155,17 @@
+@@ -155,6 +157,17 @@
this.a(world, blockposition1, flag4, flag5, flag2, flag3);
}
diff --git a/nms-patches/BlockVine.patch b/nms-patches/BlockVine.patch
index b0455671..c3b2a19d 100644
--- a/nms-patches/BlockVine.patch
+++ b/nms-patches/BlockVine.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/BlockVine.java
+++ b/net/minecraft/server/BlockVine.java
-@@ -3,6 +3,8 @@
- import java.util.Iterator;
+@@ -4,6 +4,8 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockVine extends Block {
public static final BlockStateBoolean UP = BlockStateBoolean.of("up");
-@@ -172,7 +174,13 @@
+@@ -174,7 +176,13 @@
}
if (((Boolean) iblockdata1.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.WEST)).booleanValue()) {
@@ -24,7 +24,7 @@
}
}
-@@ -194,17 +202,29 @@
+@@ -196,17 +204,29 @@
BlockPosition blockposition3 = blockposition2.shift(enumdirection2);
BlockPosition blockposition4 = blockposition2.shift(enumdirection3);
@@ -59,7 +59,7 @@
} else if (block.material.k() && iblockdata2.h()) {
world.setTypeAndData(blockposition, iblockdata.set(getDirection(enumdirection), Boolean.valueOf(true)), 2);
}
-@@ -231,7 +251,12 @@
+@@ -233,7 +253,12 @@
}
if (((Boolean) iblockdata3.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.WEST)).booleanValue()) {
diff --git a/nms-patches/BlockWaterLily.patch b/nms-patches/BlockWaterLily.patch
index 1b10f877..561facbf 100644
--- a/nms-patches/BlockWaterLily.patch
+++ b/nms-patches/BlockWaterLily.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockWaterLily.java
+++ b/net/minecraft/server/BlockWaterLily.java
-@@ -19,7 +19,7 @@
+@@ -20,7 +20,7 @@
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
super.a(world, blockposition, iblockdata, entity);
diff --git a/nms-patches/BossBattleServer.patch b/nms-patches/BossBattleServer.patch
deleted file mode 100644
index 1a18af71..00000000
--- a/nms-patches/BossBattleServer.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/net/minecraft/server/BossBattleServer.java
-+++ b/net/minecraft/server/BossBattleServer.java
-@@ -10,7 +10,7 @@
-
- private final Set<EntityPlayer> h = Sets.newHashSet();
- private final Set<EntityPlayer> i;
-- private boolean j;
-+ public boolean j; // PAIL: rename / public
-
- public BossBattleServer(IChatBaseComponent ichatbasecomponent, BossBattle.BarColor bossbattle_barcolor, BossBattle.BarStyle bossbattle_barstyle) {
- super(MathHelper.a(), ichatbasecomponent, bossbattle_barcolor, bossbattle_barstyle);
diff --git a/nms-patches/ChatBaseComponent.patch b/nms-patches/ChatBaseComponent.patch
index 308ddf9f..bd82c4a1 100644
--- a/nms-patches/ChatBaseComponent.patch
+++ b/nms-patches/ChatBaseComponent.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChatBaseComponent.java
+++ b/net/minecraft/server/ChatBaseComponent.java
-@@ -111,7 +111,7 @@
+@@ -112,7 +112,7 @@
}
public int hashCode() {
diff --git a/nms-patches/ChatModifier.patch b/nms-patches/ChatModifier.patch
index a91ca87a..f84aedb4 100644
--- a/nms-patches/ChatModifier.patch
+++ b/nms-patches/ChatModifier.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChatModifier.java
+++ b/net/minecraft/server/ChatModifier.java
-@@ -254,16 +254,18 @@
+@@ -263,16 +263,18 @@
}
public int hashCode() {
@@ -28,7 +28,7 @@
return i;
}
-@@ -429,11 +431,11 @@
+@@ -440,11 +442,11 @@
}
}
diff --git a/nms-patches/Chunk.patch b/nms-patches/Chunk.patch
index 1772368b..83e96077 100644
--- a/nms-patches/Chunk.patch
+++ b/nms-patches/Chunk.patch
@@ -9,10 +9,10 @@
+
public class Chunk {
- private static final Logger d = LogManager.getLogger();
-@@ -41,6 +44,34 @@
- private int w;
- private ConcurrentLinkedQueue<BlockPosition> x;
+ private static final Logger e = LogManager.getLogger();
+@@ -42,6 +45,34 @@
+ private ConcurrentLinkedQueue<BlockPosition> y;
+ public boolean d;
+ // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
+ private int neighbors = 0x1 << 12;
@@ -44,12 +44,11 @@
+
public Chunk(World world, int i, int j) {
this.sections = new ChunkSection[16];
- this.f = new byte[256];
-@@ -61,8 +92,15 @@
+ this.g = new byte[256];
+@@ -62,8 +93,14 @@
- Arrays.fill(this.g, -999);
- Arrays.fill(this.f, (byte) -1);
-+
+ Arrays.fill(this.h, -999);
+ Arrays.fill(this.g, (byte) -1);
+ // CraftBukkit start
+ this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
}
@@ -61,7 +60,7 @@
public Chunk(World world, ChunkSnapshot chunksnapshot, int i, int j) {
this(world, i, j);
short short0 = 256;
-@@ -463,7 +501,8 @@
+@@ -466,7 +503,8 @@
}
}
@@ -71,22 +70,22 @@
block.onPlace(this.world, blockposition, iblockdata);
}
-@@ -544,7 +583,11 @@
+@@ -547,7 +585,11 @@
int j = MathHelper.floor(entity.locZ / 16.0D);
if (i != this.locX || j != this.locZ) {
-- Chunk.d.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.locX + ", " + this.locZ + "), " + entity, new Object[] { entity});
+- Chunk.e.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.locX + ", " + this.locZ + "), " + entity, new Object[] { entity});
+ // CraftBukkit start
+ Bukkit.getLogger().warning("Wrong location for " + entity + " in world '" + world.getWorld().getName() + "'!");
-+ // Chunk.d.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.locX + ", " + this.locZ + "), " + entity, new Object[] { entity});
++ // Chunk.e.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.locX + ", " + this.locZ + "), " + entity, new Object[] { entity});
+ Bukkit.getLogger().warning("Entity is at " + entity.locX + "," + entity.locZ + " (chunk " + i + "," + j + ") but was stored in chunk " + this.locX + "," + this.locZ);
+ // CraftBukkit end
entity.die();
}
-@@ -597,7 +640,15 @@
- }
+@@ -602,7 +644,15 @@
+ @Nullable
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
- TileEntity tileentity = (TileEntity) this.tileEntities.get(blockposition);
+ // CraftBukkit start
@@ -101,7 +100,7 @@
if (tileentity == null) {
if (chunk_enumtileentitystate == Chunk.EnumTileEntityState.IMMEDIATE) {
-@@ -632,6 +683,13 @@
+@@ -637,6 +687,13 @@
tileentity.z();
this.tileEntities.put(blockposition, tileentity);
@@ -115,7 +114,7 @@
}
}
-@@ -675,7 +733,21 @@
+@@ -680,7 +737,21 @@
}
for (int i = 0; i < this.entitySlices.length; ++i) {
@@ -138,7 +137,7 @@
}
}
-@@ -733,8 +805,8 @@
+@@ -738,8 +809,8 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -149,7 +148,7 @@
}
}
}
-@@ -797,6 +869,29 @@
+@@ -802,6 +873,29 @@
} else {
this.o();
chunkgenerator.recreateStructures(this.locX, this.locZ);
diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch
index 847c028e..9f067bb2 100644
--- a/nms-patches/ChunkProviderServer.patch
+++ b/nms-patches/ChunkProviderServer.patch
@@ -1,109 +1,41 @@
--- a/net/minecraft/server/ChunkProviderServer.java
+++ b/net/minecraft/server/ChunkProviderServer.java
-@@ -1,24 +1,31 @@
- package net.minecraft.server;
-
--import com.google.common.collect.Lists;
- import java.io.IOException;
--import java.util.ArrayList;
--import java.util.Collections;
- import java.util.Iterator;
- import java.util.List;
--import java.util.Set;
--import java.util.concurrent.ConcurrentHashMap;
-+
+@@ -14,10 +14,17 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
-+
+import org.bukkit.Server;
+import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
-+import org.bukkit.craftbukkit.util.LongHash;
+import org.bukkit.craftbukkit.util.LongHashSet;
-+import org.bukkit.craftbukkit.util.LongObjectHashMap;
+import org.bukkit.event.world.ChunkUnloadEvent;
+// CraftBukkit end
+
public class ChunkProviderServer implements IChunkProvider {
private static final Logger a = LogManager.getLogger();
-- private final Set<Long> unloadQueue = Collections.newSetFromMap(new ConcurrentHashMap());
-- private final ChunkGenerator chunkGenerator;
+- private final Set<Long> unloadQueue = Sets.newHashSet();
+ public final LongHashSet unloadQueue = new LongHashSet(); // CraftBukkit - LongHashSet
-+ public final ChunkGenerator chunkGenerator; // CraftBukkit - public
+ public final ChunkGenerator chunkGenerator;
private final IChunkLoader chunkLoader;
-- private final LongHashMap<Chunk> chunks = new LongHashMap();
-- private final List<Chunk> chunkList = Lists.newArrayList();
-+ public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>(); // CraftBukkit
-+ // private final LongHashMap<Chunk> chunks = new LongHashMap();
-+ // private final List<Chunk> chunkList = Lists.newArrayList();
- public final WorldServer world;
-
- public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, ChunkGenerator chunkgenerator) {
-@@ -27,19 +34,33 @@
- this.chunkGenerator = chunkgenerator;
- }
-
-- public List<Chunk> a() {
-- return this.chunkList;
-+ public boolean isChunkLoaded(int i, int j) {
-+ return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit
-+ }
-+
-+ // CraftBukkit start - Change return type to Collection and return the values of our chunk map
-+ public java.util.Collection a() {
-+ // return this.chunkList;
-+ return this.chunks.values();
-+ // CraftBukkit end
- }
+ public final Long2ObjectMap<Chunk> chunks = new Long2ObjectOpenHashMap(8192);
+@@ -35,7 +42,14 @@
- public void queueUnload(int i, int j) {
- if (this.world.worldProvider.c(i, j)) {
-- this.unloadQueue.add(Long.valueOf(ChunkCoordIntPair.a(i, j)));
+ public void unload(Chunk chunk) {
+ if (this.world.worldProvider.c(chunk.locX, chunk.locZ)) {
+- this.unloadQueue.add(Long.valueOf(ChunkCoordIntPair.a(chunk.locX, chunk.locZ)));
+ // CraftBukkit start
-+ this.unloadQueue.add(i, j);
++ this.unloadQueue.add(chunk.locX, chunk.locZ);
+
-+ Chunk c = chunks.get(LongHash.toLong(i, j));
++ Chunk c = chunks.get(ChunkCoordIntPair.a(chunk.locX, chunk.locZ));
+ if (c != null) {
+ c.mustSave = true;
+ }
+ // CraftBukkit end
+ chunk.d = true;
}
- }
-
- public void b() {
-- Iterator iterator = this.chunkList.iterator();
-+ Iterator iterator = this.chunks.values().iterator(); // CraftBukkit
-
- while (iterator.hasNext()) {
- Chunk chunk = (Chunk) iterator.next();
-@@ -49,11 +70,20 @@
-
- }
-
-+ // CraftBukkit start - Add async variant, provide compatibility
-+ public Chunk getOrCreateChunkFast(int x, int z) {
-+ Chunk chunk = chunks.get(LongHash.toLong(x, z));
-+ return (chunk == null) ? getChunkAt(x, z) : chunk;
-+ }
-+
-+ public Chunk getChunkIfLoaded(int x, int z) {
-+ return chunks.get(LongHash.toLong(x, z));
-+ }
-+
- public Chunk getLoadedChunkAt(int i, int j) {
-- long k = ChunkCoordIntPair.a(i, j);
-- Chunk chunk = (Chunk) this.chunks.getEntry(k);
-+ Chunk chunk = chunks.get(LongHash.toLong(i, j)); // CraftBukkit
-
-- this.unloadQueue.remove(Long.valueOf(k));
-+ this.unloadQueue.remove(i, j); // CraftBukkit
- return chunk;
- }
-
-@@ -61,20 +91,71 @@
+@@ -69,19 +83,68 @@
Chunk chunk = this.getLoadedChunkAt(i, j);
if (chunk == null) {
@@ -120,7 +52,6 @@
+ /* chunk = this.loadChunk(i, j);
if (chunk != null) {
this.chunks.put(ChunkCoordIntPair.a(i, j), chunk);
- this.chunkList.add(chunk);
chunk.addEntities();
chunk.loadNearby(this, this.chunkGenerator);
}
@@ -132,7 +63,6 @@
}
public Chunk getChunkAt(int i, int j) {
-- Chunk chunk = this.getOrLoadChunkAt(i, j);
+ return getChunkAt(i, j, null);
+ }
+
@@ -141,8 +71,7 @@
+ }
+
+ public Chunk getChunkAt(int i, int j, Runnable runnable, boolean generate) {
-+ unloadQueue.remove(i, j);
-+ Chunk chunk = chunks.get(LongHash.toLong(i, j));
++ Chunk chunk = chunks.get(ChunkCoordIntPair.a(i, j));
+ ChunkRegionLoader loader = null;
+
+ if (this.chunkLoader instanceof ChunkRegionLoader) {
@@ -170,23 +99,19 @@
+ }
+
+ public Chunk originalGetChunkAt(int i, int j) {
-+ this.unloadQueue.remove(i, j);
-+ Chunk chunk = this.chunks.get(LongHash.toLong(i, j));
+ Chunk chunk = this.getOrLoadChunkAt(i, j);
+ boolean newChunk = false;
+ // CraftBukkit end
if (chunk == null) {
long k = ChunkCoordIntPair.a(i, j);
-@@ -92,11 +173,38 @@
- crashreportsystemdetails.a("Generator", (Object) this.chunkGenerator);
- throw new ReportedException(crashreport);
- }
-+ newChunk = true; // CraftBukkit
+@@ -97,9 +160,37 @@
+ crashreportsystemdetails.a("Generator", (Object) this.chunkGenerator);
+ throw new ReportedException(crashreport);
}
++ newChunk = true; // CraftBukkit
-- this.chunks.put(k, chunk);
-- this.chunkList.add(chunk);
-+ this.chunks.put(LongHash.toLong(i, j), chunk); // CraftBukkit
+ this.chunks.put(k, chunk);
chunk.addEntities();
+
+ // CraftBukkit start
@@ -207,7 +132,7 @@
+ continue;
+ }
+
-+ Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
++ Chunk neighbor = this.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
+ if (neighbor != null) {
+ neighbor.setNeighborLoaded(-x, -z);
+ chunk.setNeighborLoaded(x, z);
@@ -218,11 +143,11 @@
chunk.loadNearby(this, this.chunkGenerator);
}
-@@ -142,10 +250,12 @@
+@@ -146,10 +237,12 @@
public boolean a(boolean flag) {
int i = 0;
-- ArrayList arraylist = Lists.newArrayList(this.chunkList);
+- ArrayList arraylist = Lists.newArrayList(this.chunks.values());
- for (int j = 0; j < arraylist.size(); ++j) {
- Chunk chunk = (Chunk) arraylist.get(j);
@@ -234,14 +159,16 @@
if (flag) {
this.saveChunkNOP(chunk);
-@@ -170,22 +280,43 @@
+@@ -174,22 +267,41 @@
public boolean unloadChunks() {
if (!this.world.savingDisabled) {
-- for (int i = 0; i < 100; ++i) {
-- if (!this.unloadQueue.isEmpty()) {
-- Long olong = (Long) this.unloadQueue.iterator().next();
-- Chunk chunk = (Chunk) this.chunks.getEntry(olong.longValue());
+- if (!this.unloadQueue.isEmpty()) {
+- Iterator iterator = this.unloadQueue.iterator();
+-
+- for (int i = 0; i < 100 && iterator.hasNext(); iterator.remove()) {
+- Long olong = (Long) iterator.next();
+- Chunk chunk = (Chunk) this.chunks.get(olong);
+ // CraftBukkit start
+ Server server = this.world.getServer();
+ for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); ++i) {
@@ -253,17 +180,15 @@
+ server.getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
- if (chunk != null) {
+- if (chunk != null && chunk.d) {
++ if (chunk != null) {
chunk.removeEntities();
this.saveChunk(chunk);
this.saveChunkNOP(chunk);
-- this.chunks.remove(olong.longValue());
-- this.chunkList.remove(chunk);
+- this.chunks.remove(olong);
+- ++i;
+ this.chunks.remove(chunkcoordinates); // CraftBukkit
- }
-
-- this.unloadQueue.remove(olong);
-+ // this.unloadQueue.remove(olong);
++ }
+
+ // Update neighbor counts
+ for (int x = -2; x < 3; x++) {
@@ -272,40 +197,16 @@
+ continue;
+ }
+
-+ Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
++ Chunk neighbor = this.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
+ if (neighbor != null) {
+ neighbor.setNeighborUnloaded(-x, -z);
+ chunk.setNeighborUnloaded(x, z);
+ }
+ }
-+ }
+ }
}
}
+ // CraftBukkit end
this.chunkLoader.a();
}
-@@ -198,7 +329,8 @@
- }
-
- public String getName() {
-- return "ServerChunkCache: " + this.chunks.count() + " Drop: " + this.unloadQueue.size();
-+ // CraftBukkit - this.chunks.count() -> .size()
-+ return "ServerChunkCache: " + this.chunks.size() + " Drop: " + this.unloadQueue.size();
- }
-
- public List<BiomeBase.BiomeMeta> a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
-@@ -210,10 +342,11 @@
- }
-
- public int g() {
-- return this.chunks.count();
-+ // CraftBukkit - this.chunks.count() -> this.chunks.size()
-+ return this.chunks.size();
- }
-
- public boolean e(int i, int j) {
-- return this.chunks.contains(ChunkCoordIntPair.a(i, j));
-+ return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit
- }
- }
diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch
index 44998f47..309445cd 100644
--- a/nms-patches/ChunkRegionLoader.patch
+++ b/nms-patches/ChunkRegionLoader.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkRegionLoader.java
+++ b/net/minecraft/server/ChunkRegionLoader.java
-@@ -28,7 +28,35 @@
+@@ -29,8 +29,36 @@
this.e = dataconvertermanager;
}
@@ -19,6 +19,7 @@
+ // CraftBukkit end
+
+ // CraftBukkit start - Add async variant, provide compatibility
+ @Nullable
public Chunk a(World world, int i, int j) throws IOException {
+ Object[] data = loadChunk(world, i, j);
+ if (data != null) {
@@ -36,7 +37,7 @@
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(chunkcoordintpair);
-@@ -45,7 +73,7 @@
+@@ -47,7 +75,7 @@
return this.a(world, i, j, nbttagcompound);
}
@@ -45,7 +46,7 @@
if (!nbttagcompound.hasKeyOfType("Level", 10)) {
ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is missing level data, skipping");
return null;
-@@ -62,10 +90,28 @@
+@@ -64,10 +92,28 @@
ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")");
nbttagcompound1.setInt("xPos", i);
nbttagcompound1.setInt("zPos", j);
@@ -75,7 +76,7 @@
}
}
}
-@@ -295,6 +341,13 @@
+@@ -296,6 +342,13 @@
chunk.a(nbttagcompound.getByteArray("Biomes"));
}
@@ -89,7 +90,7 @@
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
if (nbttaglist1 != null) {
-@@ -338,7 +391,7 @@
+@@ -339,7 +392,7 @@
}
}
@@ -97,8 +98,8 @@
+ // return chunk; // CraftBukkit
}
- public static Entity a(NBTTagCompound nbttagcompound, World world, Chunk chunk) {
-@@ -399,8 +452,14 @@
+ @Nullable
+@@ -403,8 +456,14 @@
}
}
@@ -111,6 +112,6 @@
+ public static void a(Entity entity, World world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
+ if (world.addEntity(entity, reason) && entity.isVehicle()) {
+ // CraftBukkit end
- Iterator iterator = entity.bu().iterator();
+ Iterator iterator = entity.bv().iterator();
while (iterator.hasNext()) {
diff --git a/nms-patches/CommandBlockListenerAbstract.patch b/nms-patches/CommandBlockListenerAbstract.patch
index 949cb489..ffa7081e 100644
--- a/nms-patches/CommandBlockListenerAbstract.patch
+++ b/nms-patches/CommandBlockListenerAbstract.patch
@@ -2,7 +2,7 @@
+++ b/net/minecraft/server/CommandBlockListenerAbstract.java
@@ -4,6 +4,13 @@
import java.util.Date;
- import java.util.concurrent.Callable;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.ArrayList;
@@ -22,7 +22,7 @@
public CommandBlockListenerAbstract() {}
-@@ -91,7 +99,9 @@
+@@ -92,7 +100,9 @@
try {
this.d = null;
@@ -33,7 +33,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
-@@ -123,6 +133,125 @@
+@@ -124,6 +134,125 @@
}
}
diff --git a/nms-patches/CommandExecute.patch b/nms-patches/CommandExecute.patch
index 42b16464..6b7a5aab 100644
--- a/nms-patches/CommandExecute.patch
+++ b/nms-patches/CommandExecute.patch
@@ -1,9 +1,9 @@
--- a/net/minecraft/server/CommandExecute.java
+++ b/net/minecraft/server/CommandExecute.java
-@@ -3,6 +3,10 @@
- import java.util.Collection;
+@@ -4,6 +4,10 @@
import java.util.Collections;
import java.util.List;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.command.ProxiedNativeCommandSender;
+import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
@@ -11,7 +11,7 @@
public class CommandExecute extends CommandAbstract {
-@@ -49,7 +53,10 @@
+@@ -50,7 +54,10 @@
}
String s = a(astring, b0);
@@ -23,7 +23,7 @@
public String getName() {
return entity.getName();
}
-@@ -94,25 +101,57 @@
+@@ -95,25 +102,57 @@
return entity.h();
}
};
@@ -67,7 +67,7 @@
}
}
- public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
+ public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, @Nullable BlockPosition blockposition) {
- return astring.length == 1 ? a(astring, minecraftserver.getPlayers()) : (astring.length > 1 && astring.length <= 4 ? a(astring, 1, blockposition) : (astring.length > 5 && astring.length <= 8 && "detect".equals(astring[4]) ? a(astring, 5, blockposition) : (astring.length == 9 && "detect".equals(astring[4]) ? a(astring, (Collection) Block.REGISTRY.keySet()) : Collections.emptyList())));
+ return astring.length == 1 ? a(astring, minecraftserver.getPlayers()) : (astring.length > 1 && astring.length <= 4 ? a(astring, 1, blockposition) : (astring.length > 5 && astring.length <= 8 && "detect".equals(astring[4]) ? a(astring, 5, blockposition) : (astring.length == 9 && "detect".equals(astring[4]) ? a(astring, (Collection) Block.REGISTRY.keySet()) : Collections.<String>emptyList()))); // CraftBukkit - decompile error
}
diff --git a/nms-patches/CommandGamemode.patch b/nms-patches/CommandGamemode.patch
index f9e342f3..4c838cf5 100644
--- a/nms-patches/CommandGamemode.patch
+++ b/nms-patches/CommandGamemode.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandGamemode.java
+++ b/net/minecraft/server/CommandGamemode.java
-@@ -27,6 +27,12 @@
+@@ -28,6 +28,12 @@
EntityPlayer entityplayer = astring.length >= 2 ? a(minecraftserver, icommandlistener, astring[1]) : a(icommandlistener);
entityplayer.a(worldsettings_enumgamemode);
@@ -13,10 +13,10 @@
ChatMessage chatmessage = new ChatMessage("gameMode." + worldsettings_enumgamemode.b(), new Object[0]);
if (icommandlistener.getWorld().getGameRules().getBoolean("sendCommandFeedback")) {
-@@ -49,10 +55,17 @@
+@@ -50,10 +56,17 @@
}
- public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
+ public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, @Nullable BlockPosition blockposition) {
- return astring.length == 1 ? a(astring, new String[] { "survival", "creative", "adventure", "spectator"}) : (astring.length == 2 ? a(astring, minecraftserver.getPlayers()) : Collections.emptyList());
+ return astring.length == 1 ? a(astring, new String[] { "survival", "creative", "adventure", "spectator"}) : (astring.length == 2 ? a(astring, minecraftserver.getPlayers()) : Collections.<String>emptyList()); // CraftBukkit - decompile error
}
diff --git a/nms-patches/CommandGamerule.patch b/nms-patches/CommandGamerule.patch
index acb2de48..9dceb5c9 100644
--- a/nms-patches/CommandGamerule.patch
+++ b/nms-patches/CommandGamerule.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandGamerule.java
+++ b/net/minecraft/server/CommandGamerule.java
-@@ -21,7 +21,7 @@
+@@ -22,7 +22,7 @@
}
public void execute(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring) throws CommandException {
@@ -9,7 +9,7 @@
String s = astring.length > 0 ? astring[0] : "";
String s1 = astring.length > 1 ? a(astring, 1) : "";
-@@ -86,4 +86,11 @@
+@@ -87,4 +87,11 @@
private GameRules a(MinecraftServer minecraftserver) {
return minecraftserver.getWorldServer(0).getGameRules();
}
diff --git a/nms-patches/CommandSpreadPlayers.patch b/nms-patches/CommandSpreadPlayers.patch
index 03ecb614..eb672206 100644
--- a/nms-patches/CommandSpreadPlayers.patch
+++ b/nms-patches/CommandSpreadPlayers.patch
@@ -1,9 +1,9 @@
--- a/net/minecraft/server/CommandSpreadPlayers.java
+++ b/net/minecraft/server/CommandSpreadPlayers.java
-@@ -235,9 +235,16 @@
+@@ -236,9 +236,16 @@
}
- public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
+ public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, @Nullable BlockPosition blockposition) {
- return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : Collections.emptyList();
+ return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : Collections.<String>emptyList(); // CraftBukkit - decompile error
}
@@ -18,7 +18,7 @@
static class Location2D {
double a;
-@@ -304,7 +311,7 @@
+@@ -305,7 +312,7 @@
}
blockposition = blockposition.down();
@@ -27,7 +27,7 @@
return blockposition.getY() + 1;
}
-@@ -320,7 +327,7 @@
+@@ -321,7 +328,7 @@
}
blockposition = blockposition.down();
@@ -36,7 +36,7 @@
} while (material == Material.AIR);
return !material.isLiquid() && material != Material.FIRE;
-@@ -330,5 +337,12 @@
+@@ -331,5 +338,12 @@
this.a = MathHelper.a(random, d0, d2);
this.b = MathHelper.a(random, d1, d3);
}
diff --git a/nms-patches/CommandTp.patch b/nms-patches/CommandTp.patch
index de9d839e..e1663bf7 100644
--- a/nms-patches/CommandTp.patch
+++ b/nms-patches/CommandTp.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandTp.java
+++ b/net/minecraft/server/CommandTp.java
-@@ -97,27 +97,28 @@
+@@ -98,27 +98,28 @@
} else {
Entity entity = b(minecraftserver, icommandlistener, astring[astring.length - 1]);
@@ -24,7 +24,7 @@
}
}
- public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
+ public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, @Nullable BlockPosition blockposition) {
- return astring.length != 1 && astring.length != 2 ? Collections.emptyList() : a(astring, minecraftserver.getPlayers());
+ return astring.length != 1 && astring.length != 2 ? Collections.<String>emptyList() : a(astring, minecraftserver.getPlayers()); // CraftBukkit - decompile error
}
diff --git a/nms-patches/Container.patch b/nms-patches/Container.patch
index cc1df43a..9e43c736 100644
--- a/nms-patches/Container.patch
+++ b/nms-patches/Container.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/Container.java
+++ b/net/minecraft/server/Container.java
-@@ -7,6 +7,17 @@
- import java.util.List;
+@@ -8,6 +8,17 @@
import java.util.Set;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.HashMap;
@@ -18,7 +18,7 @@
public abstract class Container {
public List<ItemStack> b = Lists.newArrayList();
-@@ -18,12 +29,24 @@
+@@ -19,12 +30,24 @@
protected List<ICrafting> listeners = Lists.newArrayList();
private Set<EntityHuman> i = Sets.newHashSet();
@@ -44,7 +44,7 @@
return slot;
}
-@@ -124,6 +147,7 @@
+@@ -128,6 +151,7 @@
k = playerinventory.getCarried().count;
Iterator iterator = this.h.iterator();
@@ -52,7 +52,7 @@
while (iterator.hasNext()) {
Slot slot1 = (Slot) iterator.next();
-@@ -141,16 +165,48 @@
+@@ -145,16 +169,48 @@
}
k -= itemstack2.count - i1;
@@ -106,7 +106,7 @@
}
this.d();
-@@ -173,8 +229,14 @@
+@@ -177,8 +233,14 @@
}
if (j == 1) {
@@ -123,7 +123,7 @@
playerinventory.setCarried((ItemStack) null);
}
}
-@@ -225,7 +287,11 @@
+@@ -229,7 +291,11 @@
slot2.set(itemstack3.cloneAndSubtract(j1));
if (itemstack3.count == 0) {
playerinventory.setCarried((ItemStack) null);
@@ -135,7 +135,7 @@
}
} else if (slot2.isAllowed(entityhuman)) {
if (itemstack3 == null) {
-@@ -255,7 +321,11 @@
+@@ -259,7 +325,11 @@
itemstack3.cloneAndSubtract(j1);
if (itemstack3.count == 0) {
playerinventory.setCarried((ItemStack) null);
@@ -147,7 +147,7 @@
itemstack1.count += j1;
} else if (itemstack3.count <= slot2.getMaxStackSize(itemstack3)) {
-@@ -264,7 +334,10 @@
+@@ -268,7 +338,10 @@
}
} else if (itemstack1.getItem() == itemstack3.getItem() && itemstack3.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack3.getData()) && ItemStack.equals(itemstack1, itemstack3)) {
j1 = itemstack1.count;
@@ -159,7 +159,7 @@
itemstack3.count += j1;
itemstack1 = slot2.a(j1);
if (itemstack1.count == 0) {
-@@ -272,11 +345,24 @@
+@@ -276,11 +349,24 @@
}
slot2.a(entityhuman, playerinventory.getCarried());
@@ -184,7 +184,7 @@
}
}
} else if (inventoryclicktype == InventoryClickType.SWAP && j >= 0 && j < 9) {
-@@ -430,14 +516,17 @@
+@@ -434,14 +520,17 @@
if (itemstack1 != null && a(itemstack, itemstack1)) {
int l = itemstack1.count + itemstack.count;
diff --git a/nms-patches/ContainerAnvil.patch b/nms-patches/ContainerAnvil.patch
index 55856177..f18c3171 100644
--- a/nms-patches/ContainerAnvil.patch
+++ b/nms-patches/ContainerAnvil.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ContainerAnvil.java
+++ b/net/minecraft/server/ContainerAnvil.java
-@@ -6,6 +6,12 @@
+@@ -7,6 +7,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -13,7 +13,7 @@
public class ContainerAnvil extends Container {
private static final Logger f = LogManager.getLogger();
-@@ -22,8 +28,13 @@
+@@ -23,8 +29,13 @@
private int k;
private String l;
private final EntityHuman m;
@@ -27,7 +27,7 @@
this.j = blockposition;
this.i = world;
this.m = entityhuman;
-@@ -109,7 +120,7 @@
+@@ -110,7 +121,7 @@
byte b1 = 0;
if (itemstack == null) {
@@ -36,7 +36,7 @@
this.a = 0;
} else {
ItemStack itemstack1 = itemstack.cloneItemStack();
-@@ -127,7 +138,7 @@
+@@ -128,7 +139,7 @@
if (itemstack1.e() && itemstack1.getItem().a(itemstack, itemstack2)) {
k = Math.min(itemstack1.h(), itemstack1.j() / 4);
if (k <= 0) {
@@ -45,7 +45,7 @@
this.a = 0;
return;
}
-@@ -142,7 +153,7 @@
+@@ -143,7 +154,7 @@
this.k = l;
} else {
if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.e())) {
@@ -54,7 +54,7 @@
this.a = 0;
return;
}
-@@ -269,7 +280,7 @@
+@@ -270,7 +281,7 @@
EnchantmentManager.a(map, itemstack1);
}
@@ -63,7 +63,7 @@
this.b();
}
}
-@@ -294,6 +305,7 @@
+@@ -295,6 +306,7 @@
}
public boolean a(EntityHuman entityhuman) {
@@ -71,7 +71,7 @@
return this.i.getType(this.j).getBlock() != Blocks.ANVIL ? false : entityhuman.e((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D;
}
-@@ -350,6 +362,20 @@
+@@ -352,6 +364,20 @@
this.e();
}
diff --git a/nms-patches/ContainerBeacon.patch b/nms-patches/ContainerBeacon.patch
index 332ab07f..fd200e71 100644
--- a/nms-patches/ContainerBeacon.patch
+++ b/nms-patches/ContainerBeacon.patch
@@ -1,10 +1,11 @@
--- a/net/minecraft/server/ContainerBeacon.java
+++ b/net/minecraft/server/ContainerBeacon.java
-@@ -1,11 +1,18 @@
+@@ -1,13 +1,19 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
-+
+
public class ContainerBeacon extends Container {
private IInventory beacon;
@@ -19,7 +20,7 @@
this.beacon = iinventory1;
this.a((Slot) (this.f = new ContainerBeacon.SlotBeacon(iinventory1, 0, 136, 110)));
byte b0 = 36;
-@@ -47,6 +54,7 @@
+@@ -49,6 +55,7 @@
}
public boolean a(EntityHuman entityhuman) {
@@ -27,7 +28,7 @@
return this.beacon.a(entityhuman);
}
-@@ -110,4 +118,17 @@
+@@ -113,4 +120,17 @@
return 1;
}
}
diff --git a/nms-patches/ContainerBrewingStand.patch b/nms-patches/ContainerBrewingStand.patch
index 91c9b24a..98ae5c5e 100644
--- a/nms-patches/ContainerBrewingStand.patch
+++ b/nms-patches/ContainerBrewingStand.patch
@@ -1,17 +1,17 @@
--- a/net/minecraft/server/ContainerBrewingStand.java
+++ b/net/minecraft/server/ContainerBrewingStand.java
-@@ -1,5 +1,10 @@
+@@ -1,6 +1,10 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
-+
+
public class ContainerBrewingStand extends Container {
- private IInventory brewingStand;
-@@ -7,7 +12,13 @@
+@@ -9,7 +13,13 @@
private int g;
private int h;
@@ -25,7 +25,7 @@
this.brewingStand = iinventory;
this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 0, 56, 51)));
this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 1, 79, 58)));
-@@ -54,6 +65,7 @@
+@@ -56,6 +66,7 @@
}
public boolean a(EntityHuman entityhuman) {
@@ -33,7 +33,7 @@
return this.brewingStand.a(entityhuman);
}
-@@ -182,4 +194,17 @@
+@@ -185,4 +196,17 @@
}
}
}
diff --git a/nms-patches/ContainerChest.patch b/nms-patches/ContainerChest.patch
index e28d0dc2..0a166c6a 100644
--- a/nms-patches/ContainerChest.patch
+++ b/nms-patches/ContainerChest.patch
@@ -1,13 +1,14 @@
--- a/net/minecraft/server/ContainerChest.java
+++ b/net/minecraft/server/ContainerChest.java
-@@ -1,9 +1,37 @@
+@@ -1,11 +1,38 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
-+
+
public class ContainerChest extends Container {
private IInventory container;
@@ -38,7 +39,7 @@
public ContainerChest(IInventory iinventory, IInventory iinventory1, EntityHuman entityhuman) {
this.container = iinventory1;
-@@ -11,6 +39,11 @@
+@@ -13,6 +40,11 @@
iinventory1.startOpen(entityhuman);
int i = (this.f - 4) * 18;
@@ -50,7 +51,7 @@
int j;
int k;
-@@ -33,6 +66,7 @@
+@@ -35,6 +67,7 @@
}
public boolean a(EntityHuman entityhuman) {
diff --git a/nms-patches/ContainerDispenser.patch b/nms-patches/ContainerDispenser.patch
index 44e157ea..d1a63cd6 100644
--- a/nms-patches/ContainerDispenser.patch
+++ b/nms-patches/ContainerDispenser.patch
@@ -1,13 +1,14 @@
--- a/net/minecraft/server/ContainerDispenser.java
+++ b/net/minecraft/server/ContainerDispenser.java
-@@ -1,11 +1,24 @@
+@@ -1,13 +1,25 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
-+
+
public class ContainerDispenser extends Container {
public IInventory items;
@@ -25,7 +26,7 @@
int i;
int j;
-@@ -29,6 +42,7 @@
+@@ -31,6 +43,7 @@
}
public boolean a(EntityHuman entityhuman) {
@@ -33,7 +34,7 @@
return this.items.a(entityhuman);
}
-@@ -63,4 +77,17 @@
+@@ -66,4 +79,17 @@
return itemstack;
}
diff --git a/nms-patches/ContainerEnchantTable.patch b/nms-patches/ContainerEnchantTable.patch
index 40ddb908..37fd4ffa 100644
--- a/nms-patches/ContainerEnchantTable.patch
+++ b/nms-patches/ContainerEnchantTable.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/ContainerEnchantTable.java
+++ b/net/minecraft/server/ContainerEnchantTable.java
-@@ -3,9 +3,22 @@
- import java.util.List;
+@@ -4,9 +4,22 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.Map;
@@ -24,7 +24,7 @@
public int getMaxStackSize() {
return 64;
}
-@@ -14,6 +27,11 @@
+@@ -15,6 +28,11 @@
super.update();
ContainerEnchantTable.this.a((IInventory) this);
}
@@ -36,7 +36,7 @@
};
private World world;
private BlockPosition position;
-@@ -22,6 +40,10 @@
+@@ -23,6 +41,10 @@
public int[] costs = new int[3];
public int[] h = new int[] { -1, -1, -1};
public int[] i = new int[] { -1, -1, -1};
@@ -47,7 +47,7 @@
public ContainerEnchantTable(PlayerInventory playerinventory, World world, BlockPosition blockposition) {
this.world = world;
-@@ -54,6 +76,9 @@
+@@ -55,6 +77,9 @@
this.a(new Slot(playerinventory, i, 8 + i * 18, 142));
}
@@ -57,7 +57,7 @@
}
protected void c(ICrafting icrafting) {
-@@ -90,7 +115,7 @@
+@@ -91,7 +116,7 @@
ItemStack itemstack = iinventory.getItem(0);
int i;
@@ -66,7 +66,7 @@
if (!this.world.isClientSide) {
i = 0;
-@@ -139,6 +164,20 @@
+@@ -140,6 +165,20 @@
}
}
@@ -87,7 +87,7 @@
for (j = 0; j < 3; ++j) {
if (this.costs[j] > 0) {
List list = this.a(itemstack, j, this.costs[j]);
-@@ -175,24 +214,55 @@
+@@ -176,24 +215,55 @@
} else if (this.costs[i] > 0 && itemstack != null && (entityhuman.expLevel >= j && entityhuman.expLevel >= this.costs[i] || entityhuman.abilities.canInstantlyBuild)) {
if (!this.world.isClientSide) {
List list = this.a(itemstack, i, this.costs[i]);
@@ -150,7 +150,7 @@
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack1.count -= j;
if (itemstack1.count <= 0) {
-@@ -226,6 +296,11 @@
+@@ -227,6 +297,11 @@
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
@@ -162,7 +162,7 @@
if (!this.world.isClientSide) {
for (int i = 0; i < this.enchantSlots.getSize(); ++i) {
ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(i);
-@@ -239,6 +314,7 @@
+@@ -240,6 +315,7 @@
}
public boolean a(EntityHuman entityhuman) {
@@ -170,7 +170,7 @@
return this.world.getType(this.position).getBlock() != Blocks.ENCHANTING_TABLE ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D;
}
-@@ -291,4 +367,17 @@
+@@ -293,4 +369,17 @@
return itemstack;
}
diff --git a/nms-patches/ContainerFurnace.patch b/nms-patches/ContainerFurnace.patch
index e64b7818..609b2f6f 100644
--- a/nms-patches/ContainerFurnace.patch
+++ b/nms-patches/ContainerFurnace.patch
@@ -1,17 +1,17 @@
--- a/net/minecraft/server/ContainerFurnace.java
+++ b/net/minecraft/server/ContainerFurnace.java
-@@ -1,5 +1,10 @@
+@@ -1,6 +1,10 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
-+
+
public class ContainerFurnace extends Container {
- private final IInventory furnace;
-@@ -8,11 +13,28 @@
+@@ -10,11 +14,28 @@
private int h;
private int i;
@@ -40,7 +40,7 @@
int i;
-@@ -63,6 +85,7 @@
+@@ -65,6 +86,7 @@
}
public boolean a(EntityHuman entityhuman) {
diff --git a/nms-patches/ContainerHopper.patch b/nms-patches/ContainerHopper.patch
index a78872ca..3f5914a7 100644
--- a/nms-patches/ContainerHopper.patch
+++ b/nms-patches/ContainerHopper.patch
@@ -1,13 +1,14 @@
--- a/net/minecraft/server/ContainerHopper.java
+++ b/net/minecraft/server/ContainerHopper.java
-@@ -1,11 +1,33 @@
+@@ -1,13 +1,34 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
-+
+
public class ContainerHopper extends Container {
private final IInventory hopper;
@@ -34,7 +35,7 @@
iinventory.startOpen(entityhuman);
byte b0 = 51;
-@@ -28,6 +50,7 @@
+@@ -30,6 +51,7 @@
}
public boolean a(EntityHuman entityhuman) {
diff --git a/nms-patches/ContainerHorse.patch b/nms-patches/ContainerHorse.patch
index 845da062..0a80f141 100644
--- a/nms-patches/ContainerHorse.patch
+++ b/nms-patches/ContainerHorse.patch
@@ -1,14 +1,15 @@
--- a/net/minecraft/server/ContainerHorse.java
+++ b/net/minecraft/server/ContainerHorse.java
-@@ -1,11 +1,33 @@
+@@ -1,13 +1,34 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+import org.bukkit.inventory.InventoryView;
+// CraftBukkit end
-+
+
public class ContainerHorse extends Container {
private IInventory a;
diff --git a/nms-patches/ContainerMerchant.patch b/nms-patches/ContainerMerchant.patch
index 362f8d77..92b1aede 100644
--- a/nms-patches/ContainerMerchant.patch
+++ b/nms-patches/ContainerMerchant.patch
@@ -1,13 +1,14 @@
--- a/net/minecraft/server/ContainerMerchant.java
+++ b/net/minecraft/server/ContainerMerchant.java
-@@ -1,11 +1,26 @@
+@@ -1,6 +1,7 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
-+
+
public class ContainerMerchant extends Container {
- private IMerchant merchant;
+@@ -8,6 +9,19 @@
private InventoryMerchant f;
private final World g;
@@ -27,7 +28,7 @@
public ContainerMerchant(PlayerInventory playerinventory, IMerchant imerchant, World world) {
this.merchant = imerchant;
this.g = world;
-@@ -13,6 +28,7 @@
+@@ -15,6 +29,7 @@
this.a(new Slot(this.f, 0, 36, 53));
this.a(new Slot(this.f, 1, 62, 53));
this.a((Slot) (new SlotMerchantResult(playerinventory.player, imerchant, this.f, 2, 120, 53)));
diff --git a/nms-patches/ContainerPlayer.patch b/nms-patches/ContainerPlayer.patch
index 7bdf1448..f868d983 100644
--- a/nms-patches/ContainerPlayer.patch
+++ b/nms-patches/ContainerPlayer.patch
@@ -1,17 +1,17 @@
--- a/net/minecraft/server/ContainerPlayer.java
+++ b/net/minecraft/server/ContainerPlayer.java
-@@ -1,5 +1,10 @@
+@@ -1,6 +1,10 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
-+
+
public class ContainerPlayer extends Container {
- private static final EnumItemSlot[] h = new EnumItemSlot[] { EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET};
-@@ -7,10 +12,20 @@
+@@ -9,10 +13,20 @@
public IInventory resultInventory = new InventoryCraftResult();
public boolean g;
private final EntityHuman owner;
@@ -32,7 +32,7 @@
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 154, 28)));
int i;
-@@ -23,7 +38,7 @@
+@@ -25,7 +39,7 @@
}
for (i = 0; i < 4; ++i) {
@@ -41,7 +41,7 @@
this.a(new Slot(playerinventory, 36 + (3 - i), 8, 8 + i * 18) {
public int getMaxStackSize() {
-@@ -57,11 +72,22 @@
+@@ -59,11 +73,22 @@
return super.isAllowed(itemstack);
}
});
@@ -66,7 +66,7 @@
}
public void b(EntityHuman entityhuman) {
-@@ -143,4 +169,17 @@
+@@ -146,4 +171,17 @@
public boolean a(ItemStack itemstack, Slot slot) {
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
}
diff --git a/nms-patches/ContainerWorkbench.patch b/nms-patches/ContainerWorkbench.patch
index 850e4404..9680722d 100644
--- a/nms-patches/ContainerWorkbench.patch
+++ b/nms-patches/ContainerWorkbench.patch
@@ -1,13 +1,14 @@
--- a/net/minecraft/server/ContainerWorkbench.java
+++ b/net/minecraft/server/ContainerWorkbench.java
-@@ -1,13 +1,28 @@
+@@ -1,15 +1,29 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
-+
+
public class ContainerWorkbench extends Container {
- public InventoryCrafting craftInventory = new InventoryCrafting(this, 3, 3);
@@ -31,7 +32,7 @@
this.g = world;
this.h = blockposition;
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 124, 35)));
-@@ -35,7 +50,21 @@
+@@ -37,7 +51,21 @@
}
public void a(IInventory iinventory) {
@@ -54,7 +55,7 @@
}
public void b(EntityHuman entityhuman) {
-@@ -53,6 +82,7 @@
+@@ -55,6 +83,7 @@
}
public boolean a(EntityHuman entityhuman) {
@@ -62,7 +63,7 @@
return this.g.getType(this.h).getBlock() != Blocks.CRAFTING_TABLE ? false : entityhuman.e((double) this.h.getX() + 0.5D, (double) this.h.getY() + 0.5D, (double) this.h.getZ() + 0.5D) <= 64.0D;
}
-@@ -101,4 +131,17 @@
+@@ -104,4 +133,17 @@
public boolean a(ItemStack itemstack, Slot slot) {
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
}
diff --git a/nms-patches/CraftingManager.patch b/nms-patches/CraftingManager.patch
index 9ecb653c..58ea8f37 100644
--- a/nms-patches/CraftingManager.patch
+++ b/nms-patches/CraftingManager.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/CraftingManager.java
+++ b/net/minecraft/server/CraftingManager.java
-@@ -9,10 +9,16 @@
- import java.util.Iterator;
+@@ -10,10 +10,16 @@
import java.util.List;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
@@ -17,7 +17,7 @@
public static CraftingManager getInstance() {
return CraftingManager.a;
-@@ -176,7 +182,12 @@
+@@ -177,7 +183,12 @@
this.registerShapedRecipe(new ItemStack(Blocks.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Items.IRON_INGOT, Character.valueOf('C'), Blocks.CHEST});
this.registerShapedRecipe(new ItemStack(Items.ARMOR_STAND, 1), new Object[] { "///", " / ", "/_/", Character.valueOf('/'), Items.STICK, Character.valueOf('_'), new ItemStack(Blocks.STONE_SLAB, 1, BlockDoubleStepAbstract.EnumStoneSlabVariant.STONE.a())});
this.registerShapedRecipe(new ItemStack(Blocks.END_ROD, 4), new Object[] { "/", "#", Character.valueOf('/'), Items.BLAZE_ROD, Character.valueOf('#'), Items.CHORUS_FRUIT_POPPED});
@@ -31,7 +31,7 @@
public int a(IRecipe irecipe, IRecipe irecipe1) {
return irecipe instanceof ShapelessRecipes && irecipe1 instanceof ShapedRecipes ? 1 : (irecipe1 instanceof ShapelessRecipes && irecipe instanceof ShapedRecipes ? -1 : (irecipe1.a() < irecipe.a() ? -1 : (irecipe1.a() > irecipe.a() ? 1 : 0)));
}
-@@ -283,13 +294,18 @@
+@@ -285,13 +296,18 @@
do {
if (!iterator.hasNext()) {
diff --git a/nms-patches/CrashReport.patch b/nms-patches/CrashReport.patch
index f0dc0645..7bafbb1c 100644
--- a/nms-patches/CrashReport.patch
+++ b/nms-patches/CrashReport.patch
@@ -1,10 +1,10 @@
--- a/net/minecraft/server/CrashReport.java
+++ b/net/minecraft/server/CrashReport.java
-@@ -124,6 +124,7 @@
+@@ -123,6 +123,7 @@
return this.a();
}
});
-+ this.d.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit
++ this.d.a("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
}
public String a() {
diff --git a/nms-patches/DataPaletteBlock.patch b/nms-patches/DataPaletteBlock.patch
index d761b41d..676b070e 100644
--- a/nms-patches/DataPaletteBlock.patch
+++ b/nms-patches/DataPaletteBlock.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/DataPaletteBlock.java
+++ b/net/minecraft/server/DataPaletteBlock.java
-@@ -109,7 +109,21 @@
+@@ -112,7 +112,21 @@
int i1 = nibblearray1 == null ? 0 : nibblearray1.a(j, k, l);
int j1 = i1 << 12 | (abyte[i] & 255) << 4 | nibblearray.a(j, k, l);
diff --git a/nms-patches/DataWatcher.patch b/nms-patches/DataWatcher.patch
index 2afb3eb2..251f284c 100644
--- a/nms-patches/DataWatcher.patch
+++ b/nms-patches/DataWatcher.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/DataWatcher.java
+++ b/net/minecraft/server/DataWatcher.java
-@@ -54,7 +54,7 @@
+@@ -55,7 +55,7 @@
}
}
@@ -9,7 +9,7 @@
int i = datawatcherobject.a();
if (i > 254) {
-@@ -68,7 +68,7 @@
+@@ -69,7 +69,7 @@
}
}
diff --git a/nms-patches/DedicatedServer.patch b/nms-patches/DedicatedServer.patch
index 51e175d8..47e205cc 100644
--- a/nms-patches/DedicatedServer.patch
+++ b/nms-patches/DedicatedServer.patch
@@ -12,7 +12,7 @@
import java.net.InetAddress;
import java.net.Proxy;
import java.util.Collections;
-@@ -18,10 +17,20 @@
+@@ -17,10 +16,20 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -34,7 +34,7 @@
private RemoteStatusListener m;
public final RemoteControlCommandListener remoteControlCommandListener = new RemoteControlCommandListener(this);
private RemoteControlListener o;
-@@ -31,8 +40,10 @@
+@@ -30,8 +39,10 @@
private WorldSettings.EnumGamemode s;
private boolean t;
@@ -47,7 +47,7 @@
Thread thread = new Thread("Server Infinisleeper") {
{
this.setDaemon(true);
-@@ -54,13 +65,27 @@
+@@ -53,13 +64,27 @@
protected boolean init() throws IOException {
Thread thread = new Thread("Server console handler") {
public void run() {
@@ -78,7 +78,7 @@
}
} catch (IOException ioexception) {
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
-@@ -69,6 +94,27 @@
+@@ -68,6 +93,27 @@
}
};
@@ -105,8 +105,8 @@
+
thread.setDaemon(true);
thread.start();
- DedicatedServer.LOGGER.info("Starting minecraft server version 1.9.2");
-@@ -77,7 +123,7 @@
+ DedicatedServer.LOGGER.info("Starting minecraft server version 1.9.4");
+@@ -76,7 +122,7 @@
}
DedicatedServer.LOGGER.info("Loading properties");
@@ -115,7 +115,7 @@
this.q = new EULA(new File("eula.txt"));
if (!this.q.a()) {
DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
-@@ -133,6 +179,8 @@
+@@ -132,6 +178,8 @@
return false;
}
@@ -124,7 +124,7 @@
if (!this.getOnlineMode()) {
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
-@@ -147,7 +195,7 @@
+@@ -146,7 +194,7 @@
if (!NameReferencingFileConverter.a(this.propertyManager)) {
return false;
} else {
@@ -133,7 +133,7 @@
long j = System.nanoTime();
if (this.S() == null) {
-@@ -205,7 +253,18 @@
+@@ -204,7 +252,18 @@
DedicatedServer.LOGGER.info("Starting remote control listener");
this.o = new RemoteControlListener(this);
this.o.a();
@@ -152,7 +152,7 @@
if (this.aP() > 0L) {
Thread thread1 = new Thread(new ThreadWatchdog(this));
-@@ -298,7 +357,7 @@
+@@ -297,7 +356,7 @@
System.exit(0);
}
@@ -161,7 +161,7 @@
super.D();
this.aL();
}
-@@ -329,7 +388,15 @@
+@@ -328,7 +387,15 @@
while (!this.serverCommandQueue.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
@@ -178,7 +178,7 @@
}
}
-@@ -536,16 +603,70 @@
+@@ -535,16 +602,70 @@
}
public String getPlugins() {
diff --git a/nms-patches/DispenserRegistry.patch b/nms-patches/DispenserRegistry.patch
index 522519c9..85c1dd22 100644
--- a/nms-patches/DispenserRegistry.patch
+++ b/nms-patches/DispenserRegistry.patch
@@ -396,7 +396,7 @@
+ EntityBoat entityboat = new EntityBoat(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
+ // CraftBukkit end
- entityboat.a(this.c);
+ entityboat.setType(this.c);
entityboat.yaw = enumdirection.opposite().l();
world.addEntity(entityboat);
- itemstack.cloneAndSubtract(1);
diff --git a/nms-patches/DragonControllerManager.patch b/nms-patches/DragonControllerManager.patch
index f33447d3..d637a25d 100644
--- a/nms-patches/DragonControllerManager.patch
+++ b/nms-patches/DragonControllerManager.patch
@@ -1,64 +1,41 @@
--- a/net/minecraft/server/DragonControllerManager.java
+++ b/net/minecraft/server/DragonControllerManager.java
-@@ -2,32 +2,44 @@
+@@ -2,6 +2,10 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
++// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftEnderDragon;
-+import org.bukkit.entity.EnderDragon;
+import org.bukkit.event.entity.EnderDragonChangePhaseEvent;
++// CraftBukkit end
public class DragonControllerManager {
- private static final Logger a = LogManager.getLogger();
-- private final EntityEnderDragon b;
-- private final IDragonController[] c = new IDragonController[DragonControllerPhase.c()];
-- private IDragonController d;
-+ private final EntityEnderDragon b; // PAIL: Rename enderDragon
-+ private final IDragonController[] c = new IDragonController[DragonControllerPhase.c()]; // PAIL: Rename dragonControllers
-+ private IDragonController d; // PAIL: Rename currentDragonController
-
- public DragonControllerManager(EntityEnderDragon entityenderdragon) {
- this.b = entityenderdragon;
- this.a(DragonControllerPhase.k);
- }
-
-- public void a(DragonControllerPhase<?> dragoncontrollerphase) {
-- if (this.d == null || dragoncontrollerphase != this.d.i()) {
-+ public void a(DragonControllerPhase<?> dragoncontrollerphase) { // PAIL: Rename setControllerPhase
-+ if (this.d == null || dragoncontrollerphase != this.d.i()) { // PAIL: Rename getControllerPhase
- if (this.d != null) {
-- this.d.e();
-+ this.d.e(); // PAIL: Rename
+@@ -21,6 +25,19 @@
+ this.currentDragonController.e();
}
-- this.d = this.b(dragoncontrollerphase);
+ // CraftBukkit start - Call EnderDragonChangePhaseEvent
-+ EnderDragonChangePhaseEvent event = new EnderDragonChangePhaseEvent((CraftEnderDragon) this.b.getBukkitEntity(), this.d == null ? null : CraftEnderDragon.getBukkitPhase(this.d.i()), CraftEnderDragon.getBukkitPhase(dragoncontrollerphase));
-+ this.b.world.getServer().getPluginManager().callEvent(event);
++ EnderDragonChangePhaseEvent event = new EnderDragonChangePhaseEvent(
++ (CraftEnderDragon) this.enderDragon.getBukkitEntity(),
++ (this.currentDragonController == null) ? null : CraftEnderDragon.getBukkitPhase(this.currentDragonController.getControllerPhase()),
++ CraftEnderDragon.getBukkitPhase(dragoncontrollerphase)
++ );
++ this.enderDragon.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ dragoncontrollerphase = CraftEnderDragon.getMinecraftPhase(event.getNewPhase());
+ // CraftBukkit end
-+
-+ this.d = this.b(dragoncontrollerphase); // PAIL: Rename getDragonController
- if (!this.b.world.isClientSide) {
-- this.b.getDataWatcher().set(EntityEnderDragon.a, Integer.valueOf(dragoncontrollerphase.b()));
-+ this.b.getDataWatcher().set(EntityEnderDragon.a, Integer.valueOf(dragoncontrollerphase.b())); // PAIL: Rename getId
- }
-
- DragonControllerManager.a.debug("Dragon is now in phase {} on the {}", new Object[] { dragoncontrollerphase, this.b.world.isClientSide ? "client" : "server"});
-- this.d.d();
-+ this.d.d(); // PAIL: Rename reset
- }
- }
-
-@@ -42,6 +54,6 @@
- this.c[i] = dragoncontrollerphase.a(this.b);
++
+ this.currentDragonController = this.b(dragoncontrollerphase);
+ if (!this.enderDragon.world.isClientSide) {
+ this.enderDragon.getDataWatcher().set(EntityEnderDragon.PHASE, Integer.valueOf(dragoncontrollerphase.b()));
+@@ -42,6 +59,6 @@
+ this.dragonControllers[i] = dragoncontrollerphase.a(this.enderDragon);
}
-- return this.c[i];
-+ return (T) this.c[i];
+- return this.dragonControllers[i];
++ return (T) this.dragonControllers[i]; // CraftBukkit - decompile error
}
}
diff --git a/nms-patches/Enchantment.patch b/nms-patches/Enchantment.patch
index ddddc8e0..beea80b0 100644
--- a/nms-patches/Enchantment.patch
+++ b/nms-patches/Enchantment.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/Enchantment.java
+++ b/net/minecraft/server/Enchantment.java
-@@ -16,7 +16,7 @@
+@@ -18,7 +18,7 @@
}
public static int getId(Enchantment enchantment) {
@@ -8,8 +8,8 @@
+ return Enchantment.enchantments.a(enchantment); // CraftBukkit - fix decompile error
}
- public static Enchantment b(String s) {
-@@ -135,6 +135,11 @@
+ @Nullable
+@@ -139,6 +139,11 @@
Enchantment.enchantments.a(61, new MinecraftKey("luck_of_the_sea"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnchantmentSlotType.FISHING_ROD, new EnumItemSlot[] { EnumItemSlot.MAINHAND}));
Enchantment.enchantments.a(62, new MinecraftKey("lure"), new EnchantmentLure(Enchantment.Rarity.RARE, EnchantmentSlotType.FISHING_ROD, new EnumItemSlot[] { EnumItemSlot.MAINHAND}));
Enchantment.enchantments.a(70, new MinecraftKey("mending"), new EnchantmentMending(Enchantment.Rarity.RARE, EnumItemSlot.values()));
diff --git a/nms-patches/EnchantmentFrostWalker.patch b/nms-patches/EnchantmentFrostWalker.patch
index dafe3811..2078780d 100644
--- a/nms-patches/EnchantmentFrostWalker.patch
+++ b/nms-patches/EnchantmentFrostWalker.patch
@@ -12,19 +12,19 @@
@@ -42,8 +45,18 @@
IBlockData iblockdata1 = world.getType(blockposition_mutableblockposition1);
- if (iblockdata1.getMaterial() == Material.WATER && ((Integer) iblockdata1.get(BlockFluids.LEVEL)).intValue() == 0 && world.a(Blocks.de, blockposition_mutableblockposition1, false, EnumDirection.DOWN, (Entity) null, (ItemStack) null)) {
-- world.setTypeUpdate(blockposition_mutableblockposition1, Blocks.de.getBlockData());
-- world.a(blockposition_mutableblockposition1.h(), Blocks.de, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ if (iblockdata1.getMaterial() == Material.WATER && ((Integer) iblockdata1.get(BlockFluids.LEVEL)).intValue() == 0 && world.a(Blocks.FROSTED_ICE, blockposition_mutableblockposition1, false, EnumDirection.DOWN, (Entity) null, (ItemStack) null)) {
+- world.setTypeUpdate(blockposition_mutableblockposition1, Blocks.FROSTED_ICE.getBlockData());
+- world.a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ // CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
+ org.bukkit.block.BlockState blockState = world.getWorld().getBlockAt(blockposition_mutableblockposition1.getX(), blockposition_mutableblockposition1.getY(), blockposition_mutableblockposition1.getZ()).getState();
-+ blockState.setType(CraftMagicNumbers.getMaterial(Blocks.de)); // PAIL - Rename de->FROSTED_ICE
++ blockState.setType(CraftMagicNumbers.getMaterial(Blocks.FROSTED_ICE));
+
+ EntityBlockFormEvent event = new EntityBlockFormEvent(entityliving.bukkitEntity, blockState.getBlock(), blockState);
+ world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ blockState.update(true);
-+ world.a(blockposition_mutableblockposition1.h(), Blocks.de, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
++ world.a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ }
+ // CraftBukkit End
}
diff --git a/nms-patches/EnderDragonBattle.patch b/nms-patches/EnderDragonBattle.patch
index fda6fe13..59158e3e 100644
--- a/nms-patches/EnderDragonBattle.patch
+++ b/nms-patches/EnderDragonBattle.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EnderDragonBattle.java
+++ b/net/minecraft/server/EnderDragonBattle.java
-@@ -247,7 +247,7 @@
+@@ -249,7 +249,7 @@
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = this.f.a(this.d, tileentity.getPosition());
if (shapedetector_shapedetectorcollection != null) {
@@ -9,7 +9,7 @@
if (this.o == null && blockposition.getX() == 0 && blockposition.getZ() == 0) {
this.o = blockposition;
-@@ -267,7 +267,7 @@
+@@ -269,7 +269,7 @@
if (shapedetector_shapedetectorcollection1 != null) {
if (this.o == null) {
diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch
index 847f1793..9a9a59a6 100644
--- a/nms-patches/Entity.patch
+++ b/nms-patches/Entity.patch
@@ -48,17 +48,17 @@
private static final Logger a = LogManager.getLogger();
private static final AxisAlignedBB b = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
private static double c = 1.0D;
-@@ -97,6 +136,9 @@
+@@ -98,6 +137,9 @@
public boolean glowing;
- private final Set<String> aF;
- private boolean aG;
+ private final Set<String> aG;
+ private boolean aH;
+ public boolean valid; // CraftBukkit
+ public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
+ public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949
public Entity(World world) {
this.id = Entity.entityCount++;
-@@ -193,6 +235,33 @@
+@@ -195,6 +237,33 @@
}
protected void setYawPitch(float f, float f1) {
@@ -92,7 +92,7 @@
this.yaw = f % 360.0F;
this.pitch = f1 % 360.0F;
}
-@@ -236,7 +305,7 @@
+@@ -238,7 +307,7 @@
if (this.ak) {
MinecraftServer minecraftserver = this.world.getMinecraftServer();
@@ -101,7 +101,7 @@
if (!this.isPassenger()) {
int i = this.V();
-@@ -321,6 +390,27 @@
+@@ -323,6 +392,27 @@
protected void burnFromLava() {
if (!this.fireProof) {
this.damageEntity(DamageSource.LAVA, 4.0F);
@@ -129,7 +129,7 @@
this.setOnFire(15);
}
}
-@@ -361,6 +451,22 @@
+@@ -363,6 +453,22 @@
this.a(this.getBoundingBox().c(d0, d1, d2));
this.recalcPosition();
} else {
@@ -152,7 +152,7 @@
this.world.methodProfiler.a("move");
double d3 = this.locX;
double d4 = this.locY;
-@@ -585,6 +691,26 @@
+@@ -587,6 +693,26 @@
block1.a(this.world, this);
}
@@ -179,7 +179,7 @@
if (this.playStepSound() && !flag && !this.isPassenger()) {
double d21 = this.locX - d3;
double d22 = this.locY - d4;
-@@ -595,7 +721,7 @@
+@@ -597,7 +723,7 @@
}
if (block1 != null && this.onGround) {
@@ -188,7 +188,7 @@
}
this.J = (float) ((double) this.J + (double) MathHelper.sqrt(d21 * d21 + d10 * d10) * 0.6D);
-@@ -613,9 +739,12 @@
+@@ -615,9 +741,12 @@
}
this.a(blockposition, block1);
@@ -201,7 +201,7 @@
try {
this.checkBlockCollisions();
} catch (Throwable throwable) {
-@@ -625,6 +754,8 @@
+@@ -627,6 +756,8 @@
this.appendEntityCrashDetails(crashreportsystemdetails);
throw new ReportedException(crashreport);
}
@@ -210,7 +210,7 @@
boolean flag2 = this.ah();
-@@ -632,7 +763,16 @@
+@@ -634,7 +765,16 @@
this.burn(1);
if (!flag2) {
++this.fireTicks;
@@ -228,7 +228,7 @@
this.setOnFire(8);
}
}
-@@ -745,7 +885,7 @@
+@@ -748,7 +888,7 @@
return null;
}
@@ -237,7 +237,7 @@
if (!this.fireProof) {
this.damageEntity(DamageSource.FIRE, (float) i);
}
-@@ -911,6 +1051,13 @@
+@@ -914,6 +1054,13 @@
}
public void spawnIn(World world) {
@@ -251,7 +251,7 @@
this.world = world;
}
-@@ -1104,6 +1251,18 @@
+@@ -1107,6 +1254,18 @@
try {
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ}));
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
@@ -270,7 +270,7 @@
nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.setShort("Fire", (short) this.fireTicks);
-@@ -1113,6 +1272,12 @@
+@@ -1116,6 +1275,12 @@
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
nbttagcompound.a("UUID", this.getUniqueID());
@@ -283,7 +283,7 @@
if (this.getCustomName() != null && !this.getCustomName().isEmpty()) {
nbttagcompound.setString("CustomName", this.getCustomName());
}
-@@ -1183,6 +1348,8 @@
+@@ -1187,6 +1352,8 @@
this.motX = nbttaglist1.e(0);
this.motY = nbttaglist1.e(1);
this.motZ = nbttaglist1.e(2);
@@ -292,7 +292,7 @@
if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D;
}
-@@ -1194,6 +1361,7 @@
+@@ -1198,6 +1365,7 @@
if (Math.abs(this.motZ) > 10.0D) {
this.motZ = 0.0D;
}
@@ -300,7 +300,7 @@
this.lastX = this.M = this.locX = nbttaglist.e(0);
this.lastY = this.N = this.locY = nbttaglist.e(1);
-@@ -1241,6 +1409,58 @@
+@@ -1246,6 +1414,58 @@
this.setPosition(this.locX, this.locY, this.locZ);
}
@@ -359,7 +359,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
-@@ -1302,6 +1522,12 @@
+@@ -1307,6 +1527,12 @@
public EntityItem a(ItemStack itemstack, float f) {
if (itemstack.count != 0 && itemstack.getItem() != null) {
@@ -372,8 +372,8 @@
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
entityitem.q();
-@@ -1422,6 +1648,24 @@
- if (entity.by() != this) {
+@@ -1428,6 +1654,24 @@
+ if (entity.bz() != this) {
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
} else {
+ // CraftBukkit start
@@ -394,11 +394,11 @@
+ }
+ }
+ // CraftBukkit end
- if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bt() instanceof EntityHuman)) {
+ if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bu() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
-@@ -1435,6 +1679,22 @@
- if (entity.by() == this) {
+@@ -1441,6 +1685,22 @@
+ if (entity.bz() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
+ // CraftBukkit start
@@ -420,7 +420,7 @@
this.passengers.remove(entity);
entity.j = 60;
}
-@@ -1577,10 +1837,38 @@
+@@ -1584,10 +1844,38 @@
}
public void onLightningStrike(EntityLightning entitylightning) {
@@ -461,7 +461,7 @@
}
}
-@@ -1715,19 +2003,67 @@
+@@ -1722,19 +2010,67 @@
if (!this.world.isClientSide && !this.dead) {
this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = this.h();
@@ -532,7 +532,7 @@
BlockPosition blockposition;
if (i == 1) {
-@@ -1756,12 +2092,18 @@
+@@ -1763,12 +2099,18 @@
blockposition = new BlockPosition(this);
}
@@ -552,7 +552,7 @@
if (j == 1 && i == 1) {
BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn());
-@@ -1769,6 +2111,7 @@
+@@ -1776,6 +2118,7 @@
} else {
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
}
@@ -560,7 +560,7 @@
boolean flag = entity.attachedToPlayer;
-@@ -1776,6 +2119,14 @@
+@@ -1783,6 +2126,14 @@
worldserver1.addEntity(entity);
entity.attachedToPlayer = flag;
worldserver1.entityJoinedWorld(entity, false);
@@ -575,7 +575,7 @@
}
this.dead = true;
-@@ -1881,6 +2232,11 @@
+@@ -1893,6 +2244,11 @@
}
public void setCustomName(String s) {
@@ -584,10 +584,10 @@
+ s = s.substring(0, 256);
+ }
+ // CraftBukkit end
- this.datawatcher.set(Entity.az, s);
+ this.datawatcher.set(Entity.aA, s);
}
-@@ -1938,7 +2294,26 @@
+@@ -1950,7 +2306,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {
@@ -615,8 +615,8 @@
}
public float getHeadHeight() {
-@@ -2110,7 +2485,7 @@
- for (Iterator iterator = this.bu().iterator(); iterator.hasNext(); entity.a(oclass, set)) {
+@@ -2124,7 +2499,7 @@
+ for (Iterator iterator = this.bv().iterator(); iterator.hasNext(); entity.a(oclass, set)) {
entity = (Entity) iterator.next();
if (oclass.isAssignableFrom(entity.getClass())) {
- set.add(entity);
diff --git a/nms-patches/EntityAgeable.patch b/nms-patches/EntityAgeable.patch
index 8aba8a6a..a8ceef62 100644
--- a/nms-patches/EntityAgeable.patch
+++ b/nms-patches/EntityAgeable.patch
@@ -1,14 +1,14 @@
--- a/net/minecraft/server/EntityAgeable.java
+++ b/net/minecraft/server/EntityAgeable.java
-@@ -8,6 +8,7 @@
+@@ -10,6 +10,7 @@
protected int c;
- private float bw = -1.0F;
- private float bx;
+ private float bx = -1.0F;
+ private float by;
+ public boolean ageLocked; // CraftBukkit
public EntityAgeable(World world) {
super(world);
-@@ -26,13 +27,16 @@
+@@ -28,13 +29,16 @@
if (entityageable != null) {
entityageable.setAgeRaw(-24000);
entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F);
@@ -26,7 +26,7 @@
}
}
}
-@@ -95,12 +99,14 @@
+@@ -97,12 +101,14 @@
super.b(nbttagcompound);
nbttagcompound.setInt("Age", this.getAge());
nbttagcompound.setInt("ForcedAge", this.b);
@@ -41,7 +41,7 @@
}
public void a(DataWatcherObject<?> datawatcherobject) {
-@@ -113,7 +119,7 @@
+@@ -115,7 +121,7 @@
public void n() {
super.n();
diff --git a/nms-patches/EntityAnimal.patch b/nms-patches/EntityAnimal.patch
index d289c413..aae4904d 100644
--- a/nms-patches/EntityAnimal.patch
+++ b/nms-patches/EntityAnimal.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityAnimal.java
+++ b/net/minecraft/server/EntityAnimal.java
-@@ -38,6 +38,9 @@
+@@ -40,6 +40,9 @@
}
@@ -10,7 +10,7 @@
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {
return false;
-@@ -46,6 +49,7 @@
+@@ -48,6 +51,7 @@
return super.damageEntity(damagesource, f);
}
}
diff --git a/nms-patches/EntityAreaEffectCloud.patch b/nms-patches/EntityAreaEffectCloud.patch
index 08cb2e41..2da2e1c5 100644
--- a/nms-patches/EntityAreaEffectCloud.patch
+++ b/nms-patches/EntityAreaEffectCloud.patch
@@ -9,15 +9,15 @@
+import org.bukkit.entity.LivingEntity; // CraftBukkit
+
import java.util.Map.Entry;
+ import javax.annotation.Nullable;
- public class EntityAreaEffectCloud extends Entity {
-@@ -91,6 +95,22 @@
+@@ -92,6 +96,22 @@
}
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
-+ if (!this.au) {
++ if (!this.hasColor) {
+ this.getDataWatcher().set(EntityAreaEffectCloud.b, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.e, (Collection) this.effects)))); // PAIL: rename
+ }
+ }
@@ -34,7 +34,7 @@
public int getColor() {
return ((Integer) this.getDataWatcher().get(EntityAreaEffectCloud.b)).intValue();
}
-@@ -237,6 +257,7 @@
+@@ -238,6 +258,7 @@
if (!list.isEmpty()) {
Iterator iterator2 = list.iterator();
@@ -42,7 +42,7 @@
while (iterator2.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator2.next();
-@@ -246,6 +267,17 @@
+@@ -247,6 +268,17 @@
double d2 = d0 * d0 + d1 * d1;
if (d2 <= (double) (f * f)) {
diff --git a/nms-patches/EntityArmorStand.patch b/nms-patches/EntityArmorStand.patch
index 9eb9bb36..67ced54f 100644
--- a/nms-patches/EntityArmorStand.patch
+++ b/nms-patches/EntityArmorStand.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityArmorStand.java
+++ b/net/minecraft/server/EntityArmorStand.java
-@@ -4,6 +4,15 @@
- import java.util.Arrays;
+@@ -5,6 +5,15 @@
import java.util.List;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.inventory.EquipmentSlot;
@@ -15,10 +15,10 @@
+
public class EntityArmorStand extends EntityLiving {
- private static final Vector3f bp = new Vector3f(0.0F, 0.0F, 0.0F);
-@@ -360,6 +369,21 @@
- if (itemstack1 == null || (this.bz & 1 << enumitemslot.c() + 8) == 0) {
- if (itemstack1 != null || (this.bz & 1 << enumitemslot.c() + 16) == 0) {
+ private static final Vector3f bq = new Vector3f(0.0F, 0.0F, 0.0F);
+@@ -362,6 +371,21 @@
+ if (itemstack1 == null || (this.bA & 1 << enumitemslot.c() + 8) == 0) {
+ if (itemstack1 != null || (this.bA & 1 << enumitemslot.c() + 16) == 0) {
ItemStack itemstack2;
+ // CraftBukkit start
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1);
@@ -38,7 +38,7 @@
if (entityhuman.abilities.canInstantlyBuild && (itemstack1 == null || itemstack1.getItem() == Item.getItemOf(Blocks.AIR)) && itemstack != null) {
itemstack2 = itemstack.cloneItemStack();
-@@ -381,6 +405,11 @@
+@@ -383,6 +407,11 @@
}
public boolean damageEntity(DamageSource damagesource, float f) {
diff --git a/nms-patches/EntityArrow.patch b/nms-patches/EntityArrow.patch
index f00b6b7f..5299df78 100644
--- a/nms-patches/EntityArrow.patch
+++ b/nms-patches/EntityArrow.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityArrow.java
+++ b/net/minecraft/server/EntityArrow.java
-@@ -4,6 +4,12 @@
- import com.google.common.base.Predicates;
+@@ -5,6 +5,12 @@
import java.util.List;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.entity.LivingEntity;
@@ -13,7 +13,7 @@
public abstract class EntityArrow extends Entity implements IProjectile {
private static final Predicate<Entity> f = Predicates.and(new Predicate[] { IEntitySelector.e, IEntitySelector.a, new Predicate() {
-@@ -49,6 +55,7 @@
+@@ -50,6 +56,7 @@
public EntityArrow(World world, EntityLiving entityliving) {
this(world, entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D, entityliving.locZ);
this.shooter = entityliving;
@@ -21,7 +21,7 @@
if (entityliving instanceof EntityHuman) {
this.fromPlayer = EntityArrow.PickupStatus.ALLOWED;
}
-@@ -228,7 +235,7 @@
+@@ -229,7 +236,7 @@
protected void a(MovingObjectPosition movingobjectposition) {
Entity entity = movingobjectposition.entity;
@@ -30,7 +30,7 @@
if (entity != null) {
float f = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
int i = MathHelper.f((double) f * this.damage);
-@@ -245,11 +252,18 @@
+@@ -246,11 +253,18 @@
damagesource = DamageSource.arrow(this, this.shooter);
}
@@ -51,7 +51,7 @@
if (entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) entity;
-@@ -395,6 +409,20 @@
+@@ -397,6 +411,20 @@
public void d(EntityHuman entityhuman) {
if (!this.world.isClientSide && this.inGround && this.shake <= 0) {
@@ -72,7 +72,7 @@
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild;
if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.j())) {
-@@ -453,6 +481,12 @@
+@@ -455,6 +483,12 @@
return (b0 & 1) != 0;
}
diff --git a/nms-patches/EntityBoat.patch b/nms-patches/EntityBoat.patch
index d99b9d13..4b659458 100644
--- a/nms-patches/EntityBoat.patch
+++ b/nms-patches/EntityBoat.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityBoat.java
+++ b/net/minecraft/server/EntityBoat.java
-@@ -4,6 +4,15 @@
- import java.util.ArrayList;
+@@ -5,6 +5,15 @@
import java.util.List;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.Location;
@@ -16,9 +16,9 @@
public class EntityBoat extends Entity {
private static final DataWatcherObject<Integer> a = DataWatcher.a(EntityBoat.class, DataWatcherRegistry.b);
-@@ -31,6 +40,14 @@
- private EntityBoat.EnumStatus aG;
- private double aH;
+@@ -32,6 +41,14 @@
+ private EntityBoat.EnumStatus aH;
+ private double aI;
+ // CraftBukkit start
+ // PAIL: Some of these haven't worked since a few updates, and since 1.9 they are less and less applicable.
@@ -31,7 +31,7 @@
public EntityBoat(World world) {
super(world);
this.f = new float[2];
-@@ -47,6 +64,7 @@
+@@ -48,6 +65,7 @@
this.lastX = d0;
this.lastY = d1;
this.lastZ = d2;
@@ -39,7 +39,7 @@
}
protected boolean playStepSound() {
-@@ -88,6 +106,19 @@
+@@ -91,6 +109,19 @@
if (damagesource instanceof EntityDamageSourceIndirect && damagesource.getEntity() != null && this.w(damagesource.getEntity())) {
return false;
} else {
@@ -59,7 +59,7 @@
this.d(-this.q());
this.b(10);
this.setDamage(this.n() + f * 10.0F);
-@@ -95,6 +126,15 @@
+@@ -98,6 +129,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.n() > 40.0F) {
@@ -75,7 +75,7 @@
if (!flag && this.world.getGameRules().getBoolean("doEntityDrops")) {
this.a(this.j(), 1, 0.0F);
}
-@@ -112,9 +152,25 @@
+@@ -115,9 +155,25 @@
public void collide(Entity entity) {
if (entity instanceof EntityBoat) {
if (entity.getBoundingBox().b < this.getBoundingBox().e) {
@@ -101,16 +101,16 @@
super.collide(entity);
}
-@@ -151,6 +207,8 @@
+@@ -154,6 +210,8 @@
return this.getDirection().e();
}
+ private Location lastLocation; // CraftBukkit
+
public void m() {
- this.aG = this.aF;
- this.aF = this.t();
-@@ -171,7 +229,6 @@
+ this.aH = this.aG;
+ this.aG = this.t();
+@@ -174,7 +232,6 @@
if (this.n() > 0.0F) {
this.setDamage(this.n() - 1.0F);
}
@@ -118,7 +118,7 @@
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
-@@ -195,6 +252,22 @@
+@@ -198,6 +255,22 @@
this.motZ = 0.0D;
}
@@ -141,7 +141,7 @@
for (int i = 0; i <= 1; ++i) {
if (this.a(i)) {
this.f[i] = (float) ((double) this.f[i] + 0.01D);
-@@ -591,6 +664,11 @@
+@@ -595,6 +668,11 @@
this.e(this.fallDistance, 1.0F);
if (!this.world.isClientSide && !this.dead) {
@@ -153,7 +153,7 @@
this.die();
if (this.world.getGameRules().getBoolean("doEntityDrops")) {
int i;
-@@ -604,6 +682,7 @@
+@@ -608,6 +686,7 @@
}
}
}
diff --git a/nms-patches/EntityChicken.patch b/nms-patches/EntityChicken.patch
index f40dd021..ab00defe 100644
--- a/nms-patches/EntityChicken.patch
+++ b/nms-patches/EntityChicken.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityChicken.java
+++ b/net/minecraft/server/EntityChicken.java
-@@ -43,6 +43,11 @@
+@@ -44,6 +44,11 @@
}
public void n() {
@@ -10,15 +10,15 @@
+ }
+ // CraftBukkit end
super.n();
- this.bz = this.bv;
- this.bx = this.bw;
-@@ -60,7 +65,9 @@
- this.bv += this.bA * 2.0F;
- if (!this.world.isClientSide && !this.isBaby() && !this.isChickenJockey() && --this.bB <= 0) {
+ this.bA = this.bw;
+ this.by = this.bx;
+@@ -61,7 +66,9 @@
+ this.bw += this.bB * 2.0F;
+ if (!this.world.isClientSide && !this.isBaby() && !this.isChickenJockey() && --this.bC <= 0) {
this.a(SoundEffects.aa, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.forceDrops = true; // CraftBukkit
this.a(Items.EGG, 1);
+ this.forceDrops = false; // CraftBukkit
- this.bB = this.random.nextInt(6000) + 6000;
+ this.bC = this.random.nextInt(6000) + 6000;
}
diff --git a/nms-patches/EntityCow.patch b/nms-patches/EntityCow.patch
index d702c87d..34570ca3 100644
--- a/nms-patches/EntityCow.patch
+++ b/nms-patches/EntityCow.patch
@@ -1,19 +1,19 @@
--- a/net/minecraft/server/EntityCow.java
+++ b/net/minecraft/server/EntityCow.java
-@@ -1,5 +1,10 @@
+@@ -1,6 +1,10 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+// CraftBukkit end
-+
+
public class EntityCow extends EntityAnimal {
- public EntityCow(World world) {
-@@ -50,12 +55,22 @@
+@@ -53,12 +57,22 @@
- public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand, @Nullable ItemStack itemstack) {
if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
+ // CraftBukkit start - Got milk?
+ org.bukkit.Location loc = this.getBukkitEntity().getLocation();
diff --git a/nms-patches/EntityCreature.patch b/nms-patches/EntityCreature.patch
index ecc84756..c1c0f98b 100644
--- a/nms-patches/EntityCreature.patch
+++ b/nms-patches/EntityCreature.patch
@@ -10,7 +10,7 @@
+
public abstract class EntityCreature extends EntityInsentient {
- public static final UUID bt = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
+ public static final UUID bu = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
@@ -71,6 +75,7 @@
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
@@ -26,4 +26,4 @@
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
- } else if (!this.isLeashed() && this.bv) {
+ } else if (!this.isLeashed() && this.bw) {
diff --git a/nms-patches/EntityCreeper.patch b/nms-patches/EntityCreeper.patch
index 05a4dd21..72fa1d23 100644
--- a/nms-patches/EntityCreeper.patch
+++ b/nms-patches/EntityCreeper.patch
@@ -1,17 +1,17 @@
--- a/net/minecraft/server/EntityCreeper.java
+++ b/net/minecraft/server/EntityCreeper.java
-@@ -1,5 +1,10 @@
+@@ -1,6 +1,10 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
+// CraftBukkit end
-+
+
public class EntityCreeper extends EntityMonster {
- private static final DataWatcherObject<Integer> a = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.b);
-@@ -117,7 +122,7 @@
+@@ -119,7 +123,7 @@
}
public void die(DamageSource damagesource) {
@@ -20,7 +20,7 @@
if (this.world.getGameRules().getBoolean("doMobLoot")) {
if (damagesource.getEntity() instanceof EntitySkeleton) {
int i = Item.getId(Items.RECORD_13);
-@@ -130,6 +135,7 @@
+@@ -132,6 +136,7 @@
this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
}
}
@@ -28,7 +28,7 @@
}
-@@ -155,8 +161,18 @@
+@@ -158,8 +163,18 @@
public void onLightningStrike(EntityLightning entitylightning) {
super.onLightningStrike(entitylightning);
@@ -45,20 +45,20 @@
}
+ // CraftBukkit end
- protected boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
+ protected boolean a(EntityHuman entityhuman, EnumHand enumhand, @Nullable ItemStack itemstack) {
if (itemstack != null && itemstack.getItem() == Items.FLINT_AND_STEEL) {
-@@ -177,9 +193,17 @@
+@@ -180,9 +195,17 @@
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
float f = this.isPowered() ? 2.0F : 1.0F;
-- this.aT = true;
+- this.aU = true;
- this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, flag);
- this.die();
+ // CraftBukkit start
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
-+ this.aT = true;
++ this.aU = true;
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
+ this.die();
+ } else {
diff --git a/nms-patches/EntityDamageSourceIndirect.patch b/nms-patches/EntityDamageSourceIndirect.patch
index fe6a74a9..3c1c0f81 100644
--- a/nms-patches/EntityDamageSourceIndirect.patch
+++ b/nms-patches/EntityDamageSourceIndirect.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityDamageSourceIndirect.java
+++ b/net/minecraft/server/EntityDamageSourceIndirect.java
-@@ -25,4 +25,10 @@
+@@ -29,4 +29,10 @@
return itemstack != null && itemstack.hasName() && LocaleI18n.c(s1) ? new ChatMessage(s1, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent, itemstack.B()}) : new ChatMessage(s, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent});
}
diff --git a/nms-patches/EntityEnderCrystal.patch b/nms-patches/EntityEnderCrystal.patch
index 41f4cf39..df8d9a5f 100644
--- a/nms-patches/EntityEnderCrystal.patch
+++ b/nms-patches/EntityEnderCrystal.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityEnderCrystal.java
+++ b/net/minecraft/server/EntityEnderCrystal.java
-@@ -2,6 +2,11 @@
-
+@@ -3,6 +3,11 @@
import com.google.common.base.Optional;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class EntityEnderCrystal extends Entity {
private static final DataWatcherObject<Optional<BlockPosition>> b = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.k);
-@@ -38,7 +43,11 @@
+@@ -39,7 +44,11 @@
BlockPosition blockposition = new BlockPosition(this);
if (this.world.worldProvider instanceof WorldProviderTheEnd && this.world.getType(blockposition).getBlock() != Blocks.FIRE) {
@@ -25,7 +25,7 @@
}
}
-@@ -74,9 +83,22 @@
+@@ -75,9 +84,22 @@
return false;
} else {
if (!this.dead && !this.world.isClientSide) {
diff --git a/nms-patches/EntityEnderDragon.patch b/nms-patches/EntityEnderDragon.patch
index 456f569a..2973d62d 100644
--- a/nms-patches/EntityEnderDragon.patch
+++ b/nms-patches/EntityEnderDragon.patch
@@ -1,7 +1,7 @@
--- a/net/minecraft/server/EntityEnderDragon.java
+++ b/net/minecraft/server/EntityEnderDragon.java
-@@ -4,7 +4,12 @@
- import java.util.List;
+@@ -5,7 +5,12 @@
+ import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
@@ -12,25 +12,25 @@
+// PAIL: Fixme
public class EntityEnderDragon extends EntityInsentient implements IComplex, IMonster {
- private static final Logger bH = LogManager.getLogger();
-@@ -32,6 +37,7 @@
- private final PathPoint[] bM = new PathPoint[24];
- private final int[] bN = new int[24];
- private final Path bO = new Path();
+ private static final Logger bI = LogManager.getLogger();
+@@ -33,6 +38,7 @@
+ private final PathPoint[] bN = new PathPoint[24];
+ private final int[] bO = new int[24];
+ private final Path bP = new Path();
+ private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, true); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
public EntityEnderDragon(World world) {
super(world);
-@@ -169,7 +175,7 @@
+@@ -170,7 +176,7 @@
Vec3D vec3d = idragoncontroller.g();
- if (vec3d != null) {
-+ if (vec3d != null && idragoncontroller.i() != DragonControllerPhase.k) { // CraftBukkit - Don't move when hovering
++ if (vec3d != null && idragoncontroller.getControllerPhase() != DragonControllerPhase.k) { // CraftBukkit - Don't move when hovering // PAIL: rename
d0 = vec3d.x - this.locX;
d1 = vec3d.y - this.locY;
d2 = vec3d.z - this.locZ;
-@@ -308,7 +314,14 @@
+@@ -309,7 +315,14 @@
if (this.currentEnderCrystal.dead) {
this.currentEnderCrystal = null;
} else if (this.ticksLived % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@@ -46,7 +46,7 @@
}
}
-@@ -381,6 +394,10 @@
+@@ -382,6 +395,10 @@
int j1 = MathHelper.floor(axisalignedbb.f);
boolean flag = false;
boolean flag1 = false;
@@ -57,7 +57,7 @@
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
-@@ -394,7 +411,11 @@
+@@ -395,7 +412,11 @@
flag = true;
} else if (block != Blocks.BARRIER && block != Blocks.OBSIDIAN && block != Blocks.END_STONE && block != Blocks.BEDROCK && block != Blocks.END_PORTAL && block != Blocks.END_PORTAL_FRAME) {
if (block != Blocks.COMMAND_BLOCK && block != Blocks.dc && block != Blocks.dd && block != Blocks.IRON_BARS && block != Blocks.END_GATEWAY) {
@@ -70,7 +70,7 @@
} else {
flag = true;
}
-@@ -406,6 +427,41 @@
+@@ -407,6 +428,41 @@
}
}
diff --git a/nms-patches/EntityEnderman.patch b/nms-patches/EntityEnderman.patch
index 7f11f0a9..9b434da9 100644
--- a/nms-patches/EntityEnderman.patch
+++ b/nms-patches/EntityEnderman.patch
@@ -9,10 +9,10 @@
import java.util.Random;
import java.util.Set;
import java.util.UUID;
-@@ -55,7 +57,17 @@
+@@ -56,7 +58,17 @@
}
- public void setGoalTarget(EntityLiving entityliving) {
+ public void setGoalTarget(@Nullable EntityLiving entityliving) {
- super.setGoalTarget(entityliving);
+ // CraftBukkit start - fire event
+ setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
@@ -28,7 +28,7 @@
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
if (entityliving == null) {
-@@ -69,6 +81,7 @@
+@@ -70,6 +82,7 @@
attributeinstance.b(EntityEnderman.b);
}
}
@@ -36,7 +36,7 @@
}
-@@ -306,8 +319,12 @@
+@@ -309,8 +322,12 @@
boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition);
if (EntityEnderman.c.contains(block) && flag) {
@@ -51,7 +51,7 @@
}
}
-@@ -337,8 +354,12 @@
+@@ -340,8 +357,12 @@
IBlockData iblockdata2 = this.a.getCarried();
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2.getBlock(), iblockdata, iblockdata1)) {
diff --git a/nms-patches/EntityFallingBlock.patch b/nms-patches/EntityFallingBlock.patch
index 54afb180..a57a6e9e 100644
--- a/nms-patches/EntityFallingBlock.patch
+++ b/nms-patches/EntityFallingBlock.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/EntityFallingBlock.java
+++ b/net/minecraft/server/EntityFallingBlock.java
-@@ -4,6 +4,8 @@
- import java.util.ArrayList;
+@@ -5,6 +5,8 @@
import java.util.Iterator;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class EntityFallingBlock extends Entity {
private IBlockData block;
-@@ -64,7 +66,7 @@
+@@ -65,7 +67,7 @@
if (this.ticksLived++ == 0) {
blockposition = new BlockPosition(this);
@@ -18,7 +18,7 @@
this.world.setAir(blockposition);
} else if (!this.world.isClientSide) {
this.die();
-@@ -84,7 +86,7 @@
+@@ -85,7 +87,7 @@
if (BlockFalling.i(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) {
this.onGround = false;
@@ -27,7 +27,7 @@
}
this.motX *= 0.699999988079071D;
-@@ -93,7 +95,13 @@
+@@ -94,7 +96,13 @@
if (iblockdata.getBlock() != Blocks.PISTON_EXTENSION) {
this.die();
if (!this.f) {
@@ -42,7 +42,7 @@
if (block instanceof BlockFalling) {
((BlockFalling) block).a_(this.world, blockposition);
}
-@@ -152,7 +160,9 @@
+@@ -151,7 +159,9 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
diff --git a/nms-patches/EntityFireworks.patch b/nms-patches/EntityFireworks.patch
index 5e917620..7d26d656 100644
--- a/nms-patches/EntityFireworks.patch
+++ b/nms-patches/EntityFireworks.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityFireworks.java
+++ b/net/minecraft/server/EntityFireworks.java
-@@ -79,7 +79,7 @@
+@@ -80,7 +80,7 @@
}
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
diff --git a/nms-patches/EntityFishingHook.patch b/nms-patches/EntityFishingHook.patch
index 4fabdd73..e993146c 100644
--- a/nms-patches/EntityFishingHook.patch
+++ b/nms-patches/EntityFishingHook.patch
@@ -22,9 +22,9 @@
this.hooked = movingobjectposition.entity;
this.getDataWatcher().set(EntityFishingHook.c, Integer.valueOf(this.hooked.getId() + 1));
@@ -266,6 +273,10 @@
- if (this.au <= 0) {
- this.av = 0;
+ if (this.av <= 0) {
this.aw = 0;
+ this.ax = 0;
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
@@ -33,9 +33,9 @@
} else {
double d10;
@@ -278,6 +289,13 @@
- if (this.aw > 0) {
- this.aw -= l;
- if (this.aw <= 0) {
+ if (this.ax > 0) {
+ this.ax -= l;
+ if (this.ax <= 0) {
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.BITE);
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
diff --git a/nms-patches/EntityGhast.patch b/nms-patches/EntityGhast.patch
index 3bee78d1..d48f0d42 100644
--- a/nms-patches/EntityGhast.patch
+++ b/nms-patches/EntityGhast.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityGhast.java
+++ b/net/minecraft/server/EntityGhast.java
-@@ -153,7 +153,8 @@
+@@ -155,7 +155,8 @@
world.a((EntityHuman) null, 1016, new BlockPosition(this.ghast), 0);
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4);
diff --git a/nms-patches/EntityHanging.patch b/nms-patches/EntityHanging.patch
index 086d3fa9..88050c95 100644
--- a/nms-patches/EntityHanging.patch
+++ b/nms-patches/EntityHanging.patch
@@ -1,7 +1,7 @@
--- a/net/minecraft/server/EntityHanging.java
+++ b/net/minecraft/server/EntityHanging.java
-@@ -3,6 +3,11 @@
- import com.google.common.base.Predicate;
+@@ -4,6 +4,11 @@
+ import javax.annotation.Nullable;
import org.apache.commons.lang3.Validate;
+// CraftBukkit start
@@ -12,7 +12,7 @@
public abstract class EntityHanging extends Entity {
private static final Predicate<Entity> c = new Predicate() {
-@@ -38,30 +43,39 @@
+@@ -40,30 +45,39 @@
this.updateBoundingBox();
}
@@ -69,7 +69,7 @@
d8 = 1.0D;
} else {
d6 = 1.0D;
-@@ -70,11 +84,18 @@
+@@ -72,11 +86,18 @@
d6 /= 32.0D;
d7 /= 32.0D;
d8 /= 32.0D;
@@ -90,7 +90,7 @@
return i % 32 == 0 ? 0.5D : 0.0D;
}
-@@ -85,6 +106,24 @@
+@@ -87,6 +108,24 @@
if (this.d++ == 100 && !this.world.isClientSide) {
this.d = 0;
if (!this.dead && !this.survives()) {
@@ -115,7 +115,7 @@
this.die();
this.a((Entity) null);
}
-@@ -135,6 +174,21 @@
+@@ -137,6 +176,21 @@
return false;
} else {
if (!this.dead && !this.world.isClientSide) {
@@ -137,7 +137,7 @@
this.die();
this.ao();
this.a(damagesource.getEntity());
-@@ -146,6 +200,18 @@
+@@ -148,6 +202,18 @@
public void move(double d0, double d1, double d2) {
if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
@@ -156,7 +156,7 @@
this.die();
this.a((Entity) null);
}
-@@ -153,7 +219,7 @@
+@@ -155,7 +221,7 @@
}
public void g(double d0, double d1, double d2) {
diff --git a/nms-patches/EntityHorse.patch b/nms-patches/EntityHorse.patch
index 6030f31b..0e047ddc 100644
--- a/nms-patches/EntityHorse.patch
+++ b/nms-patches/EntityHorse.patch
@@ -1,32 +1,32 @@
--- a/net/minecraft/server/EntityHorse.java
+++ b/net/minecraft/server/EntityHorse.java
-@@ -6,6 +6,8 @@
- import java.util.List;
+@@ -7,6 +7,8 @@
import java.util.UUID;
+ import javax.annotation.Nullable;
+import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit
+
public class EntityHorse extends EntityAnimal implements IInventoryListener, IJumpable {
- private static final Predicate<Entity> bB = new Predicate() {
-@@ -52,6 +54,7 @@
- private String cd;
- private String[] ce = new String[3];
- private boolean cf = false;
+ private static final Predicate<Entity> bC = new Predicate() {
+@@ -53,6 +55,7 @@
+ private String ce;
+ private String[] cf = new String[3];
+ private boolean cg = false;
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value
public EntityHorse(World world) {
super(world);
-@@ -318,7 +321,7 @@
+@@ -321,7 +324,7 @@
public void loadChest() {
InventoryHorseChest inventoryhorsechest = this.inventoryChest;
-- this.inventoryChest = new InventoryHorseChest("HorseChest", this.dI());
-+ this.inventoryChest = new InventoryHorseChest("HorseChest", this.dI(), this); // CraftBukkit
+- this.inventoryChest = new InventoryHorseChest("HorseChest", this.dJ());
++ this.inventoryChest = new InventoryHorseChest("HorseChest", this.dJ(), this); // CraftBukkit
this.inventoryChest.a(this.getName());
if (inventoryhorsechest != null) {
inventoryhorsechest.b(this);
-@@ -470,7 +473,7 @@
+@@ -474,7 +477,7 @@
}
public int getMaxDomestication() {
@@ -34,8 +34,8 @@
+ return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100
}
- protected float cd() {
-@@ -560,7 +563,7 @@
+ protected float ce() {
+@@ -564,7 +567,7 @@
}
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
@@ -44,7 +44,7 @@
flag = true;
}
-@@ -651,11 +654,11 @@
+@@ -655,11 +658,11 @@
}
public void die(DamageSource damagesource) {
@@ -58,7 +58,7 @@
}
public void n() {
-@@ -666,7 +669,7 @@
+@@ -670,7 +673,7 @@
super.n();
if (!this.world.isClientSide) {
if (this.random.nextInt(900) == 0 && this.deathTicks == 0) {
@@ -66,8 +66,8 @@
+ this.heal(1.0F, RegainReason.REGEN); // CraftBukkit
}
- if (!this.dm() && !this.isVehicle() && this.random.nextInt(300) == 0 && this.world.getType(new BlockPosition(MathHelper.floor(this.locX), MathHelper.floor(this.locY) - 1, MathHelper.floor(this.locZ))).getBlock() == Blocks.GRASS) {
-@@ -919,6 +922,7 @@
+ if (!this.dn() && !this.isVehicle() && this.random.nextInt(300) == 0 && this.world.getType(new BlockPosition(MathHelper.floor(this.locX), MathHelper.floor(this.locY) - 1, MathHelper.floor(this.locZ))).getBlock() == Blocks.GRASS) {
+@@ -921,6 +924,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.setString("OwnerUUID", this.getOwnerUUID().toString());
}
@@ -75,7 +75,7 @@
if (this.hasChest()) {
NBTTagList nbttaglist = new NBTTagList();
-@@ -974,6 +978,12 @@
+@@ -976,6 +980,12 @@
this.setOwnerUUID(UUID.fromString(s));
}
@@ -88,7 +88,7 @@
AttributeInstance attributeinstance = this.getAttributeMap().a("Speed");
if (attributeinstance != null) {
-@@ -1145,6 +1155,18 @@
+@@ -1148,6 +1158,18 @@
}
public void b(int i) {
diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch
index a72bb09f..6c5c2bbe 100644
--- a/nms-patches/EntityHuman.patch
+++ b/nms-patches/EntityHuman.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityHuman.java
+++ b/net/minecraft/server/EntityHuman.java
-@@ -9,6 +9,19 @@
- import java.util.List;
+@@ -10,6 +10,19 @@
import java.util.UUID;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
@@ -20,17 +20,17 @@
public abstract class EntityHuman extends EntityLiving {
private static final DataWatcherObject<Float> a = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c);
-@@ -19,7 +32,7 @@
+@@ -20,7 +33,7 @@
private InventoryEnderChest enderChest = new InventoryEnderChest();
public Container defaultContainer;
public Container activeContainer;
- protected FoodMetaData foodData = new FoodMetaData();
+ protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor
- protected int bv;
- public float bw;
+ protected int bw;
public float bx;
-@@ -52,6 +65,17 @@
- private final ItemCooldown bU = this.l();
+ public float by;
+@@ -53,6 +66,17 @@
+ private final ItemCooldown bV = this.l();
public EntityFishingHook hookedFish;
+ // CraftBukkit start
@@ -47,7 +47,7 @@
protected ItemCooldown l() {
return new ItemCooldown();
}
-@@ -301,7 +325,8 @@
+@@ -302,7 +326,8 @@
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.world.getGameRules().getBoolean("naturalRegeneration")) {
if (this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 == 0) {
@@ -57,7 +57,7 @@
}
if (this.foodData.c() && this.ticksLived % 10 == 0) {
-@@ -325,7 +350,7 @@
+@@ -326,7 +351,7 @@
this.l((float) attributeinstance.getValue());
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@@ -66,7 +66,7 @@
if (f > 0.1F) {
f = 0.1F;
-@@ -416,29 +441,35 @@
+@@ -417,30 +442,36 @@
public void b(Entity entity, int i) {
if (entity != this) {
this.addScore(i);
@@ -105,11 +105,13 @@
}
- private Collection<ScoreboardObjective> d(Entity entity) {
+- String s = entity instanceof EntityHuman ? entity.getName() : entity.bd();
+ private Collection<ScoreboardScore> d(Entity entity) { // CraftBukkit
- String s = entity instanceof EntityHuman ? entity.getName() : entity.getUniqueID().toString();
++ String s = entity instanceof EntityHuman ? entity.getName() : entity.getUniqueID().toString();
ScoreboardTeam scoreboardteam = this.getScoreboard().getPlayerTeam(this.getName());
-@@ -463,7 +494,10 @@
+ if (scoreboardteam != null) {
+@@ -464,7 +495,10 @@
int j = scoreboardteam1.m().b();
if (j >= 0 && j < IScoreboardCriteria.m.length) {
@@ -121,15 +123,15 @@
}
}
-@@ -471,6 +505,7 @@
- }
+@@ -473,6 +507,7 @@
+ @Nullable
public EntityItem a(boolean flag) {
+ // Called only when dropped by Q or CTRL-Q
return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false, true);
}
-@@ -513,6 +548,30 @@
+@@ -517,6 +552,30 @@
entityitem.motZ += Math.sin((double) f1) * (double) f;
}
@@ -160,7 +162,7 @@
ItemStack itemstack1 = this.a(entityitem);
if (flag1) {
-@@ -612,6 +671,13 @@
+@@ -615,6 +674,13 @@
this.a(true, true, false);
}
@@ -174,7 +176,7 @@
if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) {
this.e = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.f = nbttagcompound.getBoolean("SpawnForced");
-@@ -649,6 +715,12 @@
+@@ -652,6 +718,12 @@
this.foodData.b(nbttagcompound);
this.abilities.a(nbttagcompound);
nbttagcompound.set("EnderItems", this.enderChest.h());
@@ -187,7 +189,7 @@
}
public boolean damageEntity(DamageSource damagesource, float f) {
-@@ -667,7 +739,7 @@
+@@ -670,7 +742,7 @@
if (damagesource.r()) {
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL) {
@@ -196,7 +198,7 @@
}
if (this.world.getDifficulty() == EnumDifficulty.EASY) {
-@@ -679,7 +751,7 @@
+@@ -682,7 +754,7 @@
}
}
@@ -205,7 +207,7 @@
return false;
} else {
Entity entity = damagesource.getEntity();
-@@ -695,10 +767,29 @@
+@@ -698,10 +770,29 @@
}
public boolean a(EntityHuman entityhuman) {
@@ -238,7 +240,7 @@
}
protected void damageArmor(float f) {
-@@ -742,7 +833,12 @@
+@@ -745,7 +836,12 @@
return (float) i / (float) this.inventory.armor.length;
}
@@ -252,7 +254,7 @@
if (!this.isInvulnerable(damagesource)) {
f = this.applyArmorModifier(damagesource, f);
f = this.applyMagicModifier(damagesource, f);
-@@ -762,6 +858,7 @@
+@@ -765,6 +861,7 @@
}
}
@@ -260,7 +262,7 @@
}
public void openSign(TileEntitySign tileentitysign) {}
-@@ -884,8 +981,15 @@
+@@ -887,8 +984,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isBurning()) {
@@ -278,7 +280,7 @@
}
}
-@@ -915,8 +1019,11 @@
+@@ -918,8 +1022,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.r(entityliving) && this.h(entityliving) < 9.0D) {
@@ -291,7 +293,7 @@
}
}
-@@ -925,11 +1032,28 @@
+@@ -928,11 +1035,28 @@
}
if (entity instanceof EntityPlayer && entity.velocityChanged) {
@@ -320,7 +322,7 @@
}
if (flag2) {
-@@ -991,7 +1115,8 @@
+@@ -994,7 +1118,8 @@
if (itemstack3 != null && object instanceof EntityLiving) {
itemstack3.a((EntityLiving) object, this);
@@ -330,7 +332,7 @@
this.a(EnumHand.MAIN_HAND, (ItemStack) null);
}
}
-@@ -1001,7 +1126,14 @@
+@@ -1004,7 +1129,14 @@
this.a(StatisticList.y, Math.round(f5 * 10.0F));
if (j > 0) {
@@ -346,7 +348,7 @@
}
if (this.world instanceof WorldServer && f5 > 2.0F) {
-@@ -1090,6 +1222,20 @@
+@@ -1093,6 +1225,20 @@
this.stopRiding();
}
@@ -367,7 +369,7 @@
this.setSize(0.2F, 0.2F);
if (this.world.isLoaded(blockposition)) {
EnumDirection enumdirection = (EnumDirection) this.world.getType(blockposition).get(BlockFacingHorizontal.FACING);
-@@ -1172,6 +1318,23 @@
+@@ -1175,6 +1321,23 @@
this.world.everyoneSleeping();
}
@@ -391,7 +393,7 @@
this.sleepTicks = flag ? 0 : 100;
if (flag2) {
this.setRespawnPosition(this.bedPosition, false);
-@@ -1222,9 +1385,11 @@
+@@ -1226,9 +1389,11 @@
if (blockposition != null) {
this.e = blockposition;
this.f = flag;
diff --git a/nms-patches/EntityInsentient.patch b/nms-patches/EntityInsentient.patch
index fc63698e..832a598c 100644
--- a/nms-patches/EntityInsentient.patch
+++ b/nms-patches/EntityInsentient.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityInsentient.java
+++ b/net/minecraft/server/EntityInsentient.java
-@@ -8,6 +8,15 @@
- import java.util.Random;
+@@ -9,6 +9,15 @@
import java.util.UUID;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -16,7 +16,7 @@
public abstract class EntityInsentient extends EntityLiving {
private static final DataWatcherObject<Byte> a = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
-@@ -60,6 +69,9 @@
+@@ -61,6 +70,9 @@
this.r();
}
@@ -26,10 +26,23 @@
}
protected void r() {}
-@@ -110,7 +122,38 @@
+@@ -75,9 +87,10 @@
}
- public void setGoalTarget(EntityLiving entityliving) {
+ public float a(PathType pathtype) {
+- Float float = (Float) this.bA.get(pathtype);
++ // CraftBukkit - decompile error
++ Float ofloat = (Float) this.bA.get(pathtype);
+
+- return float == null ? pathtype.a() : float.floatValue();
++ return ofloat == null ? pathtype.a() : ofloat.floatValue();
+ }
+
+ public void a(PathType pathtype, float f) {
+@@ -114,7 +127,38 @@
+ }
+
+ public void setGoalTarget(@Nullable EntityLiving entityliving) {
+ // CraftBukkit start - fire event
+ setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
+ }
@@ -65,7 +78,7 @@
}
public boolean d(Class<? extends EntityLiving> oclass) {
-@@ -321,11 +364,20 @@
+@@ -327,11 +371,20 @@
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
@@ -88,7 +101,7 @@
NBTTagList nbttaglist;
int i;
-@@ -549,11 +601,11 @@
+@@ -556,11 +609,11 @@
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
@@ -102,9 +115,9 @@
this.die();
} else if (d3 < 1024.0D) {
this.ticksFarFromPlayer = 0;
-@@ -931,9 +983,21 @@
+@@ -940,9 +993,21 @@
- public final boolean a(EntityHuman entityhuman, ItemStack itemstack, EnumHand enumhand) {
+ public final boolean a(EntityHuman entityhuman, @Nullable ItemStack itemstack, EnumHand enumhand) {
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
+ // CraftBukkit start - fire PlayerUnleashEntityEvent
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) {
@@ -124,9 +137,9 @@
this.setLeashHolder(entityhuman, true);
--itemstack.count;
return true;
-@@ -953,10 +1017,12 @@
+@@ -962,10 +1027,12 @@
- if (this.bC) {
+ if (this.bD) {
if (!this.isAlive()) {
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.PLAYER_UNLEASH)); // CraftBukkit
this.unleash(true, true);
@@ -137,8 +150,8 @@
this.unleash(true, true);
}
}
-@@ -967,7 +1033,9 @@
- this.bC = false;
+@@ -976,7 +1043,9 @@
+ this.bD = false;
this.leashHolder = null;
if (!this.world.isClientSide && flag1) {
+ this.forceDrops = true; // CraftBukkit
@@ -147,7 +160,7 @@
}
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
-@@ -1037,6 +1105,7 @@
+@@ -1046,6 +1115,7 @@
this.leashHolder = entityleash;
} else {
diff --git a/nms-patches/EntityIronGolem.patch b/nms-patches/EntityIronGolem.patch
index 6fe4f58e..6b9b2f87 100644
--- a/nms-patches/EntityIronGolem.patch
+++ b/nms-patches/EntityIronGolem.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityIronGolem.java
+++ b/net/minecraft/server/EntityIronGolem.java
-@@ -71,7 +71,7 @@
+@@ -72,7 +72,7 @@
protected void C(Entity entity) {
if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.getRandom().nextInt(20) == 0) {
diff --git a/nms-patches/EntityItem.patch b/nms-patches/EntityItem.patch
index 5699d56e..2c8a05d7 100644
--- a/nms-patches/EntityItem.patch
+++ b/nms-patches/EntityItem.patch
@@ -1,14 +1,14 @@
--- a/net/minecraft/server/EntityItem.java
+++ b/net/minecraft/server/EntityItem.java
-@@ -4,6 +4,7 @@
- import java.util.Iterator;
+@@ -5,6 +5,7 @@
+ import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit
public class EntityItem extends Entity {
-@@ -15,6 +16,7 @@
+@@ -16,6 +17,7 @@
private String g;
private String h;
public float a;
@@ -16,7 +16,7 @@
public EntityItem(World world, double d0, double d1, double d2) {
super(world);
-@@ -30,6 +32,11 @@
+@@ -31,6 +33,11 @@
public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) {
this(world, d0, d1, d2);
@@ -28,7 +28,7 @@
this.setItemStack(itemstack);
}
-@@ -54,9 +61,12 @@
+@@ -55,9 +62,12 @@
this.die();
} else {
super.m();
@@ -44,7 +44,7 @@
this.lastX = this.locX;
this.lastY = this.locY;
-@@ -92,12 +102,20 @@
+@@ -93,12 +103,20 @@
this.motY *= -0.5D;
}
@@ -65,7 +65,7 @@
this.die();
}
-@@ -139,6 +157,7 @@
+@@ -140,6 +158,7 @@
} else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) {
return false;
} else {
@@ -73,7 +73,7 @@
itemstack1.count += itemstack.count;
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
entityitem.age = Math.min(entityitem.age, this.age);
-@@ -185,6 +204,11 @@
+@@ -186,6 +205,11 @@
} else if (this.getItemStack() != null && this.getItemStack().getItem() == Items.NETHER_STAR && damagesource.isExplosion()) {
return false;
} else {
@@ -85,7 +85,7 @@
this.ao();
this.f = (int) ((float) this.f - f);
if (this.f <= 0) {
-@@ -230,7 +254,18 @@
+@@ -231,7 +255,18 @@
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item");
@@ -105,7 +105,7 @@
if (this.getItemStack() == null) {
this.die();
}
-@@ -242,6 +277,26 @@
+@@ -243,6 +278,26 @@
ItemStack itemstack = this.getItemStack();
int i = itemstack.count;
diff --git a/nms-patches/EntityItemFrame.patch b/nms-patches/EntityItemFrame.patch
index a0d38bb7..a6450f8c 100644
--- a/nms-patches/EntityItemFrame.patch
+++ b/nms-patches/EntityItemFrame.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityItemFrame.java
+++ b/net/minecraft/server/EntityItemFrame.java
-@@ -31,6 +31,11 @@
+@@ -32,6 +32,11 @@
return false;
} else if (!damagesource.isExplosion() && this.getItem() != null) {
if (!this.world.isClientSide) {
diff --git a/nms-patches/EntityLeash.patch b/nms-patches/EntityLeash.patch
index 190a9178..9d251bda 100644
--- a/nms-patches/EntityLeash.patch
+++ b/nms-patches/EntityLeash.patch
@@ -7,8 +7,8 @@
+
import java.util.Iterator;
import java.util.List;
-
-@@ -73,6 +75,12 @@
+ import javax.annotation.Nullable;
+@@ -74,6 +76,12 @@
while (iterator.hasNext()) {
entityinsentient = (EntityInsentient) iterator.next();
if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == entityhuman) {
@@ -21,7 +21,7 @@
entityinsentient.setLeashHolder(this, true);
flag = true;
}
-@@ -80,8 +88,11 @@
+@@ -81,8 +89,11 @@
}
if (!flag) {
@@ -35,7 +35,7 @@
d0 = 7.0D;
list = this.world.a(EntityInsentient.class, new AxisAlignedBB(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + d0, this.locZ + d0));
iterator = list.iterator();
-@@ -89,9 +100,20 @@
+@@ -90,9 +101,20 @@
while (iterator.hasNext()) {
entityinsentient = (EntityInsentient) iterator.next();
if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == this) {
diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch
index 2d5dbe3e..a9d111ae 100644
--- a/nms-patches/EntityLiving.patch
+++ b/nms-patches/EntityLiving.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityLiving.java
+++ b/net/minecraft/server/EntityLiving.java
-@@ -9,6 +9,22 @@
- import java.util.Random;
+@@ -10,6 +10,22 @@
import java.util.UUID;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.ArrayList;
@@ -23,10 +23,10 @@
public abstract class EntityLiving extends Entity {
private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
-@@ -80,6 +96,14 @@
- protected int bn;
+@@ -81,6 +97,14 @@
protected int bo;
- private BlockPosition bC;
+ protected int bp;
+ private BlockPosition bD;
+ // CraftBukkit start
+ public int expToDrop;
+ public int maxAirTicks = 300;
@@ -38,7 +38,7 @@
public void Q() {
this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
-@@ -88,7 +112,8 @@
+@@ -89,7 +113,8 @@
public EntityLiving(World world) {
super(world);
this.initAttributes();
@@ -46,9 +46,9 @@
+ // CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor
+ this.datawatcher.set(EntityLiving.HEALTH, (float) this.getAttributeInstance(GenericAttributes.maxHealth).getValue());
this.i = true;
- this.aL = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
+ this.aM = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.setPosition(this.locX, this.locY, this.locZ);
-@@ -126,7 +151,13 @@
+@@ -127,7 +152,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@@ -63,7 +63,7 @@
}
}
-@@ -188,7 +219,11 @@
+@@ -189,7 +220,11 @@
this.stopRiding();
}
} else {
@@ -76,7 +76,7 @@
}
if (!this.world.isClientSide) {
-@@ -245,6 +280,18 @@
+@@ -246,6 +281,18 @@
this.world.methodProfiler.b();
}
@@ -95,9 +95,9 @@
protected void b(BlockPosition blockposition) {
int i = EnchantmentManager.a(Enchantments.j, this);
-@@ -260,19 +307,19 @@
+@@ -261,19 +308,19 @@
- protected void bC() {
+ protected void bD() {
++this.deathTicks;
- if (this.deathTicks == 20) {
+ if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
@@ -124,7 +124,7 @@
this.die();
-@@ -426,6 +473,17 @@
+@@ -427,6 +474,17 @@
}
}
@@ -142,7 +142,7 @@
if (nbttagcompound.hasKeyOfType("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
-@@ -441,9 +499,15 @@
+@@ -442,9 +500,15 @@
}
@@ -158,7 +158,7 @@
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
MobEffect mobeffect = (MobEffect) this.effects.get(mobeffectlist);
-@@ -457,6 +521,16 @@
+@@ -458,6 +522,16 @@
this.a(mobeffect, false);
}
}
@@ -175,7 +175,7 @@
if (this.updateEffects) {
if (!this.world.isClientSide) {
-@@ -553,6 +627,12 @@
+@@ -555,6 +629,12 @@
}
public void addEffect(MobEffect mobeffect) {
@@ -188,10 +188,10 @@
if (this.d(mobeffect)) {
MobEffect mobeffect1 = (MobEffect) this.effects.get(mobeffect.getMobEffect());
-@@ -584,6 +664,12 @@
- }
+@@ -587,6 +667,12 @@
- public MobEffect c(MobEffectList mobeffectlist) {
+ @Nullable
+ public MobEffect c(@Nullable MobEffectList mobeffectlist) {
+ // CraftBukkit start
+ if (isTickingEffects) {
+ effectsToProcess.add(mobeffectlist);
@@ -201,7 +201,7 @@
return (MobEffect) this.effects.remove(mobeffectlist);
}
-@@ -623,20 +709,52 @@
+@@ -626,20 +712,52 @@
}
@@ -255,7 +255,7 @@
this.datawatcher.set(EntityLiving.HEALTH, Float.valueOf(MathHelper.a(f, 0.0F, this.getMaxHealth())));
}
-@@ -652,14 +770,16 @@
+@@ -655,14 +773,16 @@
} else if (damagesource.o() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
} else {
@@ -275,7 +275,7 @@
this.k(f);
if (damagesource.a()) {
f = 0.0F;
-@@ -678,19 +798,38 @@
+@@ -681,19 +801,38 @@
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
if (f <= this.lastDamage) {
@@ -301,7 +301,7 @@
- this.damageEntity0(damagesource, f);
+ // this.damageEntity0(damagesource, f);
+ // CraftBukkit end
- this.hurtTicks = this.ay = 10;
+ this.hurtTicks = this.az = 10;
}
+ // CraftBukkit start
@@ -313,10 +313,10 @@
+ }
+ // CraftBukkit end
+
- this.az = 0.0F;
+ this.aA = 0.0F;
Entity entity = damagesource.getEntity();
-@@ -830,6 +969,12 @@
+@@ -833,6 +972,12 @@
boolean flag = this.lastDamageByPlayerTime > 0;
this.a(flag, i, damagesource);
@@ -329,7 +329,7 @@
}
}
-@@ -917,8 +1062,13 @@
+@@ -922,8 +1067,13 @@
int i = MathHelper.f((f - 3.0F - f2) * f1);
if (i > 0) {
@@ -344,7 +344,7 @@
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
int l = MathHelper.floor(this.locZ);
-@@ -945,8 +1095,8 @@
+@@ -950,8 +1100,8 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
@@ -355,7 +355,7 @@
}
return f;
-@@ -958,7 +1108,8 @@
+@@ -963,7 +1113,8 @@
} else {
int i;
@@ -365,7 +365,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
-@@ -979,22 +1130,127 @@
+@@ -984,22 +1135,127 @@
}
}
@@ -503,15 +503,15 @@
}
public CombatTracker getCombatTracker() {
-@@ -1060,6 +1316,7 @@
+@@ -1065,6 +1321,7 @@
public AttributeMapBase getAttributeMap() {
- if (this.bp == null) {
- this.bp = new AttributeMapServer();
-+ this.craftAttributes = new CraftAttributeMap(bp); // CraftBukkit
+ if (this.bq == null) {
+ this.bq = new AttributeMapServer();
++ this.craftAttributes = new CraftAttributeMap(bq); // CraftBukkit
}
- return this.bp;
-@@ -1334,6 +1591,7 @@
+ return this.bq;
+@@ -1343,6 +1600,7 @@
}
if (this.onGround && !this.world.isClientSide) {
@@ -519,7 +519,7 @@
this.setFlag(7, false);
}
} else {
-@@ -1694,6 +1952,7 @@
+@@ -1703,6 +1961,7 @@
}
if (!this.world.isClientSide) {
@@ -527,7 +527,7 @@
this.setFlag(7, flag);
}
-@@ -1707,6 +1966,13 @@
+@@ -1716,6 +1975,13 @@
if (!list.isEmpty()) {
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
@@ -541,7 +541,7 @@
this.C(entity);
}
-@@ -1782,11 +2048,11 @@
+@@ -1791,11 +2057,11 @@
}
public boolean isInteractable() {
@@ -555,13 +555,13 @@
}
protected void ao() {
-@@ -1923,7 +2189,22 @@
+@@ -1932,7 +2198,22 @@
protected void v() {
- if (this.bm != null && this.cs()) {
- this.a(this.bm, 16);
-- ItemStack itemstack = this.bm.a(this.world, this);
+ if (this.bn != null && this.ct()) {
+ this.a(this.bn, 16);
+- ItemStack itemstack = this.bn.a(this.world, this);
+ // CraftBukkit start - fire PlayerItemConsumeEvent
-+ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.bm); // PAIL: rename
++ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.bn); // PAIL: rename
+ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem);
+ world.getServer().getPluginManager().callEvent(event);
+
@@ -574,12 +574,12 @@
+ return;
+ }
+
-+ ItemStack itemstack = (craftItem.equals(event.getItem())) ? this.bm.a(this.world, this) : CraftItemStack.asNMSCopy(event.getItem()).a(world, this);
++ ItemStack itemstack = (craftItem.equals(event.getItem())) ? this.bn.a(this.world, this) : CraftItemStack.asNMSCopy(event.getItem()).a(world, this);
+ // CraftBukkit end
if (itemstack != null && itemstack.count == 0) {
itemstack = null;
-@@ -2007,7 +2288,17 @@
+@@ -2017,7 +2298,17 @@
}
if (flag1) {
diff --git a/nms-patches/EntityMinecartAbstract.patch b/nms-patches/EntityMinecartAbstract.patch
index 099aa1a2..8b959348 100644
--- a/nms-patches/EntityMinecartAbstract.patch
+++ b/nms-patches/EntityMinecartAbstract.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityMinecartAbstract.java
+++ b/net/minecraft/server/EntityMinecartAbstract.java
-@@ -4,6 +4,15 @@
- import java.util.Iterator;
+@@ -5,6 +5,15 @@
import java.util.Map;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.Location;
@@ -16,9 +16,9 @@
public abstract class EntityMinecartAbstract extends Entity implements INamableTileEntity {
private static final DataWatcherObject<Integer> a = DataWatcher.a(EntityMinecartAbstract.class, DataWatcherRegistry.b);
-@@ -21,6 +30,17 @@
- private double aw;
+@@ -22,6 +31,17 @@
private double ax;
+ private double ay;
+ // CraftBukkit start
+ public boolean slowWhenEmpty = true;
@@ -34,7 +34,7 @@
public EntityMinecartAbstract(World world) {
super(world);
this.i = true;
-@@ -86,6 +106,8 @@
+@@ -89,6 +109,8 @@
this.lastX = d0;
this.lastY = d1;
this.lastZ = d2;
@@ -43,7 +43,7 @@
}
public double ay() {
-@@ -97,6 +119,19 @@
+@@ -100,6 +122,19 @@
if (this.isInvulnerable(damagesource)) {
return false;
} else {
@@ -63,7 +63,7 @@
this.e(-this.u());
this.d(10);
this.ao();
-@@ -104,6 +139,15 @@
+@@ -107,6 +142,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.getDamage() > 40.0F) {
@@ -79,7 +79,7 @@
this.az();
if (flag && !this.hasCustomName()) {
this.die();
-@@ -146,6 +190,14 @@
+@@ -149,6 +193,14 @@
}
public void m() {
@@ -94,7 +94,7 @@
if (this.getType() > 0) {
this.d(this.getType() - 1);
}
-@@ -166,7 +218,7 @@
+@@ -169,7 +221,7 @@
i = this.V();
if (this.ak) {
@@ -103,7 +103,7 @@
if (!this.isPassenger() && this.al++ >= i) {
this.al = i;
this.portalCooldown = this.aC();
-@@ -263,6 +315,20 @@
+@@ -266,6 +318,20 @@
}
this.setYawPitch(this.yaw, this.pitch);
@@ -124,7 +124,7 @@
Iterator iterator = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator();
while (iterator.hasNext()) {
-@@ -278,7 +344,7 @@
+@@ -281,7 +347,7 @@
}
protected double o() {
@@ -133,7 +133,7 @@
}
public void a(int i, int j, int k, boolean flag) {}
-@@ -289,16 +355,20 @@
+@@ -292,16 +358,20 @@
this.motX = MathHelper.a(this.motX, -d0, d0);
this.motZ = MathHelper.a(this.motZ, -d0, d0);
if (this.onGround) {
@@ -160,7 +160,7 @@
}
}
-@@ -487,7 +557,7 @@
+@@ -490,7 +560,7 @@
}
protected void r() {
@@ -169,7 +169,7 @@
this.motX *= 0.996999979019165D;
this.motY *= 0.0D;
this.motZ *= 0.996999979019165D;
-@@ -599,6 +669,17 @@
+@@ -602,6 +672,17 @@
if (!this.world.isClientSide) {
if (!entity.noclip && !this.noclip) {
if (!this.w(entity)) {
@@ -187,7 +187,7 @@
if (entity instanceof EntityLiving && this.v() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.motX * this.motX + this.motZ * this.motZ > 0.01D && !(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !this.isVehicle() && !entity.isPassenger()) {
entity.startRiding(this);
}
-@@ -607,7 +688,8 @@
+@@ -610,7 +691,8 @@
double d1 = entity.locZ - this.locZ;
double d2 = d0 * d0 + d1 * d1;
@@ -197,7 +197,7 @@
d2 = (double) MathHelper.sqrt(d2);
d0 /= d2;
d1 /= d2;
-@@ -836,4 +918,26 @@
+@@ -839,4 +921,26 @@
}
}
diff --git a/nms-patches/EntityMinecartCommandBlock.patch b/nms-patches/EntityMinecartCommandBlock.patch
index 811b2567..55a49cc0 100644
--- a/nms-patches/EntityMinecartCommandBlock.patch
+++ b/nms-patches/EntityMinecartCommandBlock.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityMinecartCommandBlock.java
+++ b/net/minecraft/server/EntityMinecartCommandBlock.java
-@@ -5,6 +5,9 @@
+@@ -7,6 +7,9 @@
private static final DataWatcherObject<String> a = DataWatcher.a(EntityMinecartCommandBlock.class, DataWatcherRegistry.d);
private static final DataWatcherObject<IChatBaseComponent> b = DataWatcher.a(EntityMinecartCommandBlock.class, DataWatcherRegistry.e);
private final CommandBlockListenerAbstract c = new CommandBlockListenerAbstract() {
diff --git a/nms-patches/EntityMinecartContainer.patch b/nms-patches/EntityMinecartContainer.patch
index afd254cd..452fa392 100644
--- a/nms-patches/EntityMinecartContainer.patch
+++ b/nms-patches/EntityMinecartContainer.patch
@@ -1,11 +1,12 @@
--- a/net/minecraft/server/EntityMinecartContainer.java
+++ b/net/minecraft/server/EntityMinecartContainer.java
-@@ -1,14 +1,51 @@
- package net.minecraft.server;
+@@ -2,14 +2,57 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.List;
++import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.inventory.InventoryHolder;
@@ -48,12 +49,17 @@
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
++
++ @Override
++ public Location getLocation() {
++ return getBukkitEntity().getLocation();
++ }
+ // CraftBukkit end
+
public EntityMinecartContainer(World world) {
super(world);
}
-@@ -71,7 +108,7 @@
+@@ -75,7 +118,7 @@
}
public int getMaxStackSize() {
@@ -61,4 +67,4 @@
+ return maxStack; // CraftBukkit
}
- public Entity c(int i) {
+ @Nullable
diff --git a/nms-patches/EntityMushroomCow.patch b/nms-patches/EntityMushroomCow.patch
index 9ae6061f..32b544d6 100644
--- a/nms-patches/EntityMushroomCow.patch
+++ b/nms-patches/EntityMushroomCow.patch
@@ -1,14 +1,14 @@
--- a/net/minecraft/server/EntityMushroomCow.java
+++ b/net/minecraft/server/EntityMushroomCow.java
-@@ -1,5 +1,7 @@
+@@ -1,6 +1,7 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+import org.bukkit.event.player.PlayerShearEntityEvent; // CraftBukkit
-+
+
public class EntityMushroomCow extends EntityCow {
- public EntityMushroomCow(World world) {
-@@ -18,6 +20,14 @@
+@@ -20,6 +21,14 @@
return true;
} else if (itemstack != null && itemstack.getItem() == Items.SHEARS && this.getAge() >= 0) {
diff --git a/nms-patches/EntityOcelot.patch b/nms-patches/EntityOcelot.patch
index 96d329f5..69c08b9e 100644
--- a/nms-patches/EntityOcelot.patch
+++ b/nms-patches/EntityOcelot.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityOcelot.java
+++ b/net/minecraft/server/EntityOcelot.java
-@@ -54,7 +54,7 @@
+@@ -55,7 +55,7 @@
}
protected boolean isTypeNotPersistent() {
@@ -9,7 +9,7 @@
}
protected void initAttributes() {
-@@ -95,6 +95,9 @@
+@@ -97,6 +97,9 @@
return entity.damageEntity(DamageSource.mobAttack(this), 3.0F);
}
@@ -19,15 +19,15 @@
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {
return false;
-@@ -106,6 +109,7 @@
+@@ -108,6 +111,7 @@
return super.damageEntity(damagesource, f);
}
}
+ // CraftBukkit end */
+ @Nullable
protected MinecraftKey J() {
- return LootTables.K;
-@@ -122,7 +126,8 @@
+@@ -125,7 +129,8 @@
}
if (!this.world.isClientSide) {
@@ -37,7 +37,7 @@
this.setTamed(true);
this.setCatType(1 + this.world.random.nextInt(3));
this.setOwnerUUID(entityhuman.getUniqueID());
-@@ -230,7 +235,7 @@
+@@ -234,7 +239,7 @@
entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityocelot.setAgeRaw(-24000);
diff --git a/nms-patches/EntityPainting.patch b/nms-patches/EntityPainting.patch
index 2e0e1c05..f8f07bc3 100644
--- a/nms-patches/EntityPainting.patch
+++ b/nms-patches/EntityPainting.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityPainting.java
+++ b/net/minecraft/server/EntityPainting.java
-@@ -9,6 +9,7 @@
+@@ -10,6 +10,7 @@
public EntityPainting(World world) {
super(world);
diff --git a/nms-patches/EntityPig.patch b/nms-patches/EntityPig.patch
index 77e77006..557b39b1 100644
--- a/nms-patches/EntityPig.patch
+++ b/nms-patches/EntityPig.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/EntityPig.java
+++ b/net/minecraft/server/EntityPig.java
-@@ -4,6 +4,8 @@
- import java.util.Iterator;
+@@ -5,6 +5,8 @@
import java.util.Set;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class EntityPig extends EntityAnimal {
- private static final DataWatcherObject<Boolean> bv = DataWatcher.a(EntityPig.class, DataWatcherRegistry.h);
-@@ -130,6 +132,12 @@
+ private static final DataWatcherObject<Boolean> bw = DataWatcher.a(EntityPig.class, DataWatcherRegistry.h);
+@@ -133,6 +135,12 @@
if (!this.world.isClientSide && !this.dead) {
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
@@ -21,8 +21,8 @@
+
entitypigzombie.setSlot(EnumItemSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
- entitypigzombie.m(this.cR());
-@@ -138,7 +146,8 @@
+ entitypigzombie.setAI(this.hasAI());
+@@ -141,7 +149,8 @@
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible());
}
diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch
index ca39da4d..922ce37d 100644
--- a/nms-patches/EntityPlayer.patch
+++ b/nms-patches/EntityPlayer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityPlayer.java
+++ b/net/minecraft/server/EntityPlayer.java
-@@ -11,6 +11,17 @@
+@@ -12,6 +12,17 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -17,13 +17,13 @@
+
public class EntityPlayer extends EntityHuman implements ICrafting {
- private static final Logger bQ = LogManager.getLogger();
-@@ -37,12 +48,24 @@
- private boolean cg = true;
- private long ch = System.currentTimeMillis();
- private Entity ci = null;
-- private boolean cj;
-+ protected boolean cj; // PAIL: private -> protected, rename worldChangeInvuln
+ private static final Logger bR = LogManager.getLogger();
+@@ -38,12 +49,24 @@
+ private boolean ch = true;
+ private long ci = System.currentTimeMillis();
+ private Entity cj = null;
+- private boolean ck;
++ protected boolean ck; // PAIL: private -> protected, rename worldChangeInvuln
private int containerCounter;
public boolean f;
public int ping;
@@ -44,7 +44,7 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, gameprofile);
playerinteractmanager.player = this;
-@@ -73,6 +96,11 @@
+@@ -74,6 +97,11 @@
this.setPosition(this.locX, this.locY + 1.0D, this.locZ);
}
@@ -56,7 +56,7 @@
}
public void a(NBTTagCompound nbttagcompound) {
-@@ -85,6 +113,7 @@
+@@ -86,6 +114,7 @@
}
}
@@ -64,7 +64,7 @@
}
public void b(NBTTagCompound nbttagcompound) {
-@@ -101,8 +130,33 @@
+@@ -102,8 +131,33 @@
nbttagcompound1.set("Entity", nbttagcompound2);
nbttagcompound.set("RootVehicle", nbttagcompound1);
}
@@ -98,7 +98,7 @@
public void levelDown(int i) {
super.levelDown(i);
-@@ -133,6 +187,11 @@
+@@ -134,6 +188,11 @@
}
public void m() {
@@ -110,29 +110,31 @@
this.playerInteractManager.a();
--this.invulnerableTicks;
if (this.noDamageTicks > 0) {
-@@ -192,7 +251,7 @@
+@@ -193,7 +252,7 @@
}
- if (this.getHealth() != this.lastHealthSent || this.cb != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cc) {
+ if (this.getHealth() != this.lastHealthSent || this.cc != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cd) {
- this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel()));
+ this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel())); // CraftBukkit
this.lastHealthSent = this.getHealth();
- this.cb = this.foodData.getFoodLevel();
- this.cc = this.foodData.getSaturationLevel() == 0.0F;
-@@ -213,6 +272,12 @@
- this.a(IScoreboardCriteria.i, MathHelper.f((float) this.bW));
+ this.cc = this.foodData.getFoodLevel();
+ this.cd = this.foodData.getSaturationLevel() == 0.0F;
+@@ -214,10 +273,11 @@
+ this.a(IScoreboardCriteria.i, MathHelper.f((float) this.bX));
}
+- if (this.getArmorStrength() != this.bY) {
+- this.bY = this.getArmorStrength();
+- this.a(IScoreboardCriteria.j, MathHelper.f((float) this.bY));
+ // CraftBukkit start - Force max health updates
+ if (this.maxHealthCache != this.getMaxHealth()) {
+ this.getBukkitEntity().updateScaledHealth();
-+ }
+ }
+ // CraftBukkit end
-+
- if (this.getArmorStrength() != this.bX) {
- this.bX = this.getArmorStrength();
- this.a(IScoreboardCriteria.j, MathHelper.f((float) this.bX));
-@@ -237,6 +302,16 @@
+
+ if (this.expTotal != this.ca) {
+ this.ca = this.expTotal;
+@@ -238,6 +298,16 @@
this.o();
}
@@ -149,7 +151,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
-@@ -247,12 +322,11 @@
+@@ -248,12 +318,11 @@
}
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
@@ -164,7 +166,7 @@
scoreboardscore.setScore(i);
}
-@@ -301,30 +375,79 @@
+@@ -302,30 +371,79 @@
boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag));
@@ -194,27 +196,27 @@
+ }
+ }
+ }
-+
+
+- if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) {
+- if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) {
+- this.server.getPlayerList().a((EntityHuman) this, this.getCombatTracker().getDeathMessage());
+- } else if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) {
+- this.server.getPlayerList().b((EntityHuman) this, this.getCombatTracker().getDeathMessage());
+ IChatBaseComponent chatmessage = this.getCombatTracker().getDeathMessage();
+
+ String deathmessage = chatmessage.toPlainText();
+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory);
-
-- if (scoreboardteambase != null && scoreboardteambase.j() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) {
-- if (scoreboardteambase.j() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) {
-- this.server.getPlayerList().a((EntityHuman) this, this.getCombatTracker().getDeathMessage());
-- } else if (scoreboardteambase.j() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) {
-- this.server.getPlayerList().b((EntityHuman) this, this.getCombatTracker().getDeathMessage());
++
+ String deathMessage = event.getDeathMessage();
+
+ if (deathMessage != null && deathMessage.length() > 0 && flag) { // TODO: allow plugins to override?
+ if (deathMessage.equals(deathmessage)) {
+ ScoreboardTeamBase scoreboardteambase = this.aO();
+
-+ if (scoreboardteambase != null && scoreboardteambase.j() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) {
-+ if (scoreboardteambase.j() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) {
++ if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) {
++ if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) {
+ this.server.getPlayerList().a((EntityHuman) this, chatmessage);
-+ } else if (scoreboardteambase.j() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) {
++ } else if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) {
+ this.server.getPlayerList().b((EntityHuman) this, chatmessage);
+ }
+ } else {
@@ -257,7 +259,7 @@
scoreboardscore.incrementScore();
}
-@@ -381,12 +504,14 @@
+@@ -382,13 +500,15 @@
}
private boolean canPvP() {
@@ -266,15 +268,16 @@
+ return this.world.pvpMode;
}
+ @Nullable
public Entity c(int i) {
-- this.cj = true;
-+ //this.cj = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
+- this.ck = true;
++ //this.ck = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
if (this.dimension == 1 && i == 1) {
-+ this.cj = true; // CraftBukkit - Moved down from above
++ this.ck = true; // CraftBukkit - Moved down from above
this.world.kill(this);
if (!this.viewingCredits) {
this.viewingCredits = true;
-@@ -407,7 +532,10 @@
+@@ -409,7 +529,10 @@
this.b((Statistic) AchievementList.y);
}
@@ -286,7 +289,7 @@
this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false));
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
-@@ -452,6 +580,7 @@
+@@ -454,6 +577,7 @@
}
public void a(boolean flag, boolean flag1, boolean flag2) {
@@ -294,7 +297,7 @@
if (this.isSleeping()) {
this.x().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2));
}
-@@ -530,23 +659,48 @@
+@@ -532,23 +656,48 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
}
@@ -352,7 +355,7 @@
if (iinventory instanceof ILootable && ((ILootable) iinventory).b() != null && this.isSpectator()) {
this.sendMessage((new ChatMessage("container.spectatorCantOpen", new Object[0])).setChatModifier((new ChatModifier()).setColor(EnumChatFormat.RED)));
} else {
-@@ -560,18 +714,21 @@
+@@ -562,18 +711,21 @@
if (itileinventory.x_() && !this.a(itileinventory.y_()) && !this.isSpectator()) {
this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), (byte) 2));
this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.W, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F));
@@ -376,7 +379,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
-@@ -579,8 +736,14 @@
+@@ -581,8 +733,14 @@
}
public void openTrade(IMerchant imerchant) {
@@ -392,7 +395,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).e();
-@@ -599,14 +762,21 @@
+@@ -601,14 +759,21 @@
}
@@ -416,7 +419,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
-@@ -646,6 +816,11 @@
+@@ -648,6 +813,11 @@
public void a(Container container, List<ItemStack> list) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, list));
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
@@ -428,7 +431,7 @@
}
public void setContainerData(Container container, int i, int j) {
-@@ -660,6 +835,7 @@
+@@ -662,6 +832,7 @@
}
public void closeInventory() {
@@ -436,7 +439,7 @@
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.s();
}
-@@ -741,7 +917,16 @@
+@@ -743,7 +914,16 @@
public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F;
@@ -453,7 +456,7 @@
public void b(IChatBaseComponent ichatbasecomponent) {
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent));
-@@ -802,6 +987,8 @@
+@@ -804,6 +984,8 @@
}
public void a(WorldSettings.EnumGamemode worldsettings_enumgamemode) {
@@ -462,15 +465,15 @@
this.playerInteractManager.setGameMode(worldsettings_enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) worldsettings_enumgamemode.getId()));
if (worldsettings_enumgamemode == WorldSettings.EnumGamemode.SPECTATOR) {
-@@ -812,6 +999,7 @@
+@@ -814,6 +996,7 @@
this.updateAbilities();
- this.cq();
+ this.cr();
+ // CraftBukkit end */
}
public boolean isSpectator() {
-@@ -827,6 +1015,7 @@
+@@ -829,6 +1012,7 @@
}
public boolean a(int i, String s) {
@@ -478,7 +481,7 @@
if ("seed".equals(s) && !this.server.aa()) {
return true;
} else if (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) && !"trigger".equals(s)) {
-@@ -840,6 +1029,15 @@
+@@ -842,6 +1026,15 @@
} else {
return true;
}
@@ -494,16 +497,16 @@
}
public String A() {
-@@ -938,7 +1136,7 @@
- }
+@@ -941,7 +1134,7 @@
+ @Nullable
public IChatBaseComponent getPlayerListName() {
- return null;
+ return listName; // CraftBukkit
}
public void a(EnumHand enumhand) {
-@@ -955,11 +1153,139 @@
+@@ -958,11 +1151,139 @@
}
public void M() {
diff --git a/nms-patches/EntityPotion.patch b/nms-patches/EntityPotion.patch
index 471800d4..07c28cea 100644
--- a/nms-patches/EntityPotion.patch
+++ b/nms-patches/EntityPotion.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityPotion.java
+++ b/net/minecraft/server/EntityPotion.java
-@@ -6,6 +6,13 @@
+@@ -7,6 +7,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -14,20 +14,20 @@
public class EntityPotion extends EntityProjectile {
private static final DataWatcherObject<Optional<ItemStack>> d = DataWatcher.a(EntityItem.class, DataWatcherRegistry.f);
-@@ -77,10 +84,11 @@
+@@ -78,10 +85,11 @@
this.world.triggerEffect(2002, new BlockPosition(this), PotionRegistry.a(potionregistry));
this.die();
} else {
- if (!list.isEmpty()) {
+ if (true || !list.isEmpty()) { // CraftBukkit - Call event even if no effects to apply
- if (this.n()) {
+ if (this.isLingering()) {
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX, this.locY, this.locZ);
+ entityareaeffectcloud.projectileSource = this.projectileSource; // CraftBukkit
- entityareaeffectcloud.a(this.getShooter());
+ entityareaeffectcloud.setSource(this.getShooter());
entityareaeffectcloud.setRadius(3.0F);
entityareaeffectcloud.setRadiusOnUse(-0.5F);
-@@ -95,11 +103,21 @@
+@@ -96,11 +104,21 @@
entityareaeffectcloud.a(new MobEffect(mobeffect.getMobEffect(), mobeffect.getDuration(), mobeffect.getAmplifier()));
}
@@ -50,7 +50,7 @@
if (!list1.isEmpty()) {
Iterator iterator1 = list1.iterator();
-@@ -116,21 +134,45 @@
+@@ -117,21 +135,45 @@
d1 = 1.0D;
}
@@ -110,7 +110,7 @@
}
}
}
-@@ -138,19 +180,20 @@
+@@ -139,10 +181,10 @@
}
}
}
@@ -124,10 +124,7 @@
}
}
-- private boolean n() {
-+ public boolean n() { // PAIL: rename, access
- return this.getItem().getItem() == Items.LINGERING_POTION;
- }
+@@ -152,6 +194,7 @@
private void a(BlockPosition blockposition) {
if (this.world.getType(blockposition).getBlock() == Blocks.FIRE) {
diff --git a/nms-patches/EntityProjectile.patch b/nms-patches/EntityProjectile.patch
index f5c27ca2..5f83ce9b 100644
--- a/nms-patches/EntityProjectile.patch
+++ b/nms-patches/EntityProjectile.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityProjectile.java
+++ b/net/minecraft/server/EntityProjectile.java
-@@ -34,6 +34,7 @@
+@@ -35,6 +35,7 @@
public EntityProjectile(World world, EntityLiving entityliving) {
this(world, entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D, entityliving.locZ);
this.shooter = entityliving;
@@ -8,7 +8,7 @@
}
protected void i() {}
-@@ -161,6 +162,11 @@
+@@ -162,6 +163,11 @@
this.e(movingobjectposition.a());
} else {
this.a(movingobjectposition);
diff --git a/nms-patches/EntityRabbit.patch b/nms-patches/EntityRabbit.patch
index e32bf767..b9bcabf1 100644
--- a/nms-patches/EntityRabbit.patch
+++ b/nms-patches/EntityRabbit.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityRabbit.java
+++ b/net/minecraft/server/EntityRabbit.java
-@@ -14,8 +14,14 @@
+@@ -16,8 +16,14 @@
this.setSize(0.4F, 0.5F);
this.g = new EntityRabbit.ControllerJumpRabbit(this);
this.moveController = new EntityRabbit.ControllerMoveRabbit(this);
diff --git a/nms-patches/EntitySheep.patch b/nms-patches/EntitySheep.patch
index 5cd1df48..b2f78628 100644
--- a/nms-patches/EntitySheep.patch
+++ b/nms-patches/EntitySheep.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntitySheep.java
+++ b/net/minecraft/server/EntitySheep.java
-@@ -4,6 +4,12 @@
- import java.util.Map;
+@@ -5,6 +5,12 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.event.entity.SheepRegrowWoolEvent;
@@ -12,8 +12,8 @@
+
public class EntitySheep extends EntityAnimal {
- private static final DataWatcherObject<Byte> bv = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.a);
-@@ -11,6 +17,13 @@
+ private static final DataWatcherObject<Byte> bw = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.a);
+@@ -12,6 +18,13 @@
public boolean a(EntityHuman entityhuman) {
return false;
}
@@ -25,9 +25,9 @@
+ }
+ // CraftBukkit end
}, 2, 1);
- private static final Map<EnumColor, float[]> bx = Maps.newEnumMap(EnumColor.class);
- private int bz;
-@@ -25,6 +38,7 @@
+ private static final Map<EnumColor, float[]> by = Maps.newEnumMap(EnumColor.class);
+ private int bA;
+@@ -26,6 +39,7 @@
this.setSize(0.9F, 1.3F);
this.container.setItem(0, new ItemStack(Items.DYE));
this.container.setItem(1, new ItemStack(Items.DYE));
@@ -35,8 +35,8 @@
}
protected void r() {
-@@ -123,11 +137,22 @@
- public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
+@@ -125,11 +139,22 @@
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand, @Nullable ItemStack itemstack) {
if (itemstack != null && itemstack.getItem() == Items.SHEARS && !this.isSheared() && !this.isBaby()) {
if (!this.world.isClientSide) {
+ // CraftBukkit start
@@ -58,7 +58,7 @@
entityitem.motY += (double) (this.random.nextFloat() * 0.05F);
entityitem.motX += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
-@@ -210,6 +235,12 @@
+@@ -212,6 +237,12 @@
}
public void B() {
diff --git a/nms-patches/EntityShulkerBullet.patch b/nms-patches/EntityShulkerBullet.patch
index d1fcd624..5a6bb0ce 100644
--- a/nms-patches/EntityShulkerBullet.patch
+++ b/nms-patches/EntityShulkerBullet.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityShulkerBullet.java
+++ b/net/minecraft/server/EntityShulkerBullet.java
-@@ -42,8 +42,29 @@
+@@ -46,8 +46,29 @@
this.target = entity;
this.c = EnumDirection.UP;
this.a(enumdirection_enumaxis);
diff --git a/nms-patches/EntitySilverfish.patch b/nms-patches/EntitySilverfish.patch
index 10e635b5..054cd7de 100644
--- a/nms-patches/EntitySilverfish.patch
+++ b/nms-patches/EntitySilverfish.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntitySilverfish.java
+++ b/net/minecraft/server/EntitySilverfish.java
-@@ -149,6 +149,11 @@
+@@ -151,6 +151,11 @@
IBlockData iblockdata = world.getType(blockposition);
if (BlockMonsterEggs.i(iblockdata)) {
@@ -12,7 +12,7 @@
world.setTypeAndData(blockposition, Blocks.MONSTER_EGG.getBlockData().set(BlockMonsterEggs.VARIANT, BlockMonsterEggs.EnumMonsterEggVarient.a(iblockdata)), 3);
this.silverfish.doSpawnEffect();
this.silverfish.die();
-@@ -192,6 +197,11 @@
+@@ -194,6 +199,11 @@
IBlockData iblockdata = world.getType(blockposition1);
if (iblockdata.getBlock() == Blocks.MONSTER_EGG) {
diff --git a/nms-patches/EntitySkeleton.patch b/nms-patches/EntitySkeleton.patch
index a1e52ebf..63a27c52 100644
--- a/nms-patches/EntitySkeleton.patch
+++ b/nms-patches/EntitySkeleton.patch
@@ -1,22 +1,22 @@
--- a/net/minecraft/server/EntitySkeleton.java
+++ b/net/minecraft/server/EntitySkeleton.java
-@@ -2,12 +2,14 @@
+@@ -2,13 +2,14 @@
import java.util.Calendar;
-
+ import javax.annotation.Nullable;
+import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
-+
+
public class EntitySkeleton extends EntityMonster implements IRangedEntity {
private static final DataWatcherObject<Integer> a = DataWatcher.a(EntitySkeleton.class, DataWatcherRegistry.b);
private static final DataWatcherObject<Boolean> b = DataWatcher.a(EntitySkeleton.class, DataWatcherRegistry.h);
private final PathfinderGoalBowShoot c = new PathfinderGoalBowShoot(this, 1.0D, 20, 15.0F);
-- private final PathfinderGoalMeleeAttack bv = new PathfinderGoalMeleeAttack(this, 1.2D, flag) {
-+ private final PathfinderGoalMeleeAttack bv = new PathfinderGoalMeleeAttack(this, 1.2D, false) { // CraftBukkit decompile error flag -> false
+- private final PathfinderGoalMeleeAttack bw = new PathfinderGoalMeleeAttack(this, 1.2D, flag) {
++ private final PathfinderGoalMeleeAttack bw = new PathfinderGoalMeleeAttack(this, 1.2D, false) { // CraftBukkit decompile error flag -> false
public void d() {
super.d();
EntitySkeleton.this.a(false);
-@@ -102,7 +104,14 @@
+@@ -103,7 +104,14 @@
}
if (flag) {
@@ -32,7 +32,7 @@
}
}
}
-@@ -125,7 +134,7 @@
+@@ -126,7 +134,7 @@
}
public void die(DamageSource damagesource) {
@@ -41,7 +41,7 @@
if (damagesource.i() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) damagesource.getEntity();
double d0 = entityhuman.locX - this.locX;
-@@ -138,6 +147,7 @@
+@@ -139,6 +147,7 @@
((EntityCreeper) damagesource.getEntity()).setCausedHeadDrop();
this.a(new ItemStack(Items.SKULL, 1, this.getSkeletonType() == 1 ? 1 : 0), 0.0F);
}
@@ -49,7 +49,7 @@
}
-@@ -219,11 +229,30 @@
+@@ -222,11 +231,30 @@
}
if (EnchantmentManager.a(Enchantments.ARROW_FIRE, (EntityLiving) this) > 0 || this.getSkeletonType() == 1) {
diff --git a/nms-patches/EntitySlime.patch b/nms-patches/EntitySlime.patch
index c5cb1648..c2696a14 100644
--- a/nms-patches/EntitySlime.patch
+++ b/nms-patches/EntitySlime.patch
@@ -1,16 +1,16 @@
--- a/net/minecraft/server/EntitySlime.java
+++ b/net/minecraft/server/EntitySlime.java
-@@ -1,5 +1,9 @@
+@@ -1,6 +1,9 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.event.entity.SlimeSplitEvent;
+// CraftBukkit end
-+
+
public class EntitySlime extends EntityInsentient implements IMonster {
- private static final DataWatcherObject<Integer> bt = DataWatcher.a(EntitySlime.class, DataWatcherRegistry.b);
-@@ -134,6 +138,18 @@
+@@ -136,6 +139,18 @@
if (!this.world.isClientSide && i > 1 && this.getHealth() <= 0.0F) {
int j = 2 + this.random.nextInt(3);
@@ -29,7 +29,7 @@
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
-@@ -149,7 +165,7 @@
+@@ -151,7 +166,7 @@
entityslime.setSize(i / 2);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
diff --git a/nms-patches/EntitySnowman.patch b/nms-patches/EntitySnowman.patch
index 47a97c9f..8edc685c 100644
--- a/nms-patches/EntitySnowman.patch
+++ b/nms-patches/EntitySnowman.patch
@@ -1,18 +1,18 @@
--- a/net/minecraft/server/EntitySnowman.java
+++ b/net/minecraft/server/EntitySnowman.java
-@@ -1,5 +1,11 @@
+@@ -1,6 +1,11 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.event.block.EntityBlockFormEvent;
+// CraftBukkit end
-+
+
public class EntitySnowman extends EntityGolem implements IRangedEntity {
- private static final DataWatcherObject<Byte> a = DataWatcher.a(EntitySnowman.class, DataWatcherRegistry.a);
-@@ -40,7 +46,7 @@
+@@ -42,7 +47,7 @@
}
if (this.world.getBiome(new BlockPosition(i, 0, k)).a(new BlockPosition(i, j, k)) > 1.0F) {
@@ -21,7 +21,7 @@
}
if (!this.world.getGameRules().getBoolean("mobGriefing")) {
-@@ -54,7 +60,17 @@
+@@ -56,7 +61,17 @@
BlockPosition blockposition = new BlockPosition(i, j, k);
if (this.world.getType(blockposition).getMaterial() == Material.AIR && this.world.getBiome(new BlockPosition(i, 0, k)).a(blockposition) < 0.8F && Blocks.SNOW_LAYER.canPlace(this.world, blockposition)) {
diff --git a/nms-patches/EntitySpectralArrow.patch b/nms-patches/EntitySpectralArrow.patch
deleted file mode 100644
index 9e1d5b0a..00000000
--- a/nms-patches/EntitySpectralArrow.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/net/minecraft/server/EntitySpectralArrow.java
-+++ b/net/minecraft/server/EntitySpectralArrow.java
-@@ -2,7 +2,7 @@
-
- public class EntitySpectralArrow extends EntityArrow {
-
-- private int f = 200;
-+ public int f = 200; // PAIL: private to public
-
- public EntitySpectralArrow(World world) {
- super(world);
diff --git a/nms-patches/EntitySpider.patch b/nms-patches/EntitySpider.patch
index 8688249b..b9ba2b63 100644
--- a/nms-patches/EntitySpider.patch
+++ b/nms-patches/EntitySpider.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntitySpider.java
+++ b/net/minecraft/server/EntitySpider.java
-@@ -108,7 +108,7 @@
+@@ -111,7 +111,7 @@
entityskeleton.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entityskeleton.prepare(difficultydamagescaler, (GroupDataEntity) null);
diff --git a/nms-patches/EntityTracker.patch b/nms-patches/EntityTracker.patch
index 56d5f158..e9239724 100644
--- a/nms-patches/EntityTracker.patch
+++ b/nms-patches/EntityTracker.patch
@@ -1,11 +1,11 @@
--- a/net/minecraft/server/EntityTracker.java
+++ b/net/minecraft/server/EntityTracker.java
-@@ -117,11 +117,12 @@
+@@ -116,11 +116,12 @@
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity To Track");
crashreportsystemdetails.a("Tracking range", (Object) (i + " blocks"));
+ final int finalI = i; // CraftBukkit - fix decompile error
- crashreportsystemdetails.a("Update interval", new Callable() {
+ crashreportsystemdetails.a("Update interval", new CrashReportCallable() {
public String a() throws Exception {
- String s = "Once per " + i + " ticks";
+ String s = "Once per " + finalI + " ticks"; // CraftBukkit
diff --git a/nms-patches/EntityVillager.patch b/nms-patches/EntityVillager.patch
index 8b66079e..2d36fde8 100644
--- a/nms-patches/EntityVillager.patch
+++ b/nms-patches/EntityVillager.patch
@@ -1,19 +1,21 @@
--- a/net/minecraft/server/EntityVillager.java
+++ b/net/minecraft/server/EntityVillager.java
-@@ -2,6 +2,12 @@
-
+@@ -3,6 +3,14 @@
import java.util.Iterator;
import java.util.Random;
+ import javax.annotation.Nullable;
++// CraftBukkit start
+import org.bukkit.Bukkit;
-+import org.bukkit.craftbukkit.entity.CraftVillager; // CraftBukkit
++import org.bukkit.craftbukkit.entity.CraftVillager;
+import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe;
+import org.bukkit.entity.Villager;
+import org.bukkit.event.entity.VillagerAcquireTradeEvent;
+import org.bukkit.event.entity.VillagerReplenishTradeEvent;
++// CraftBukkit end
public class EntityVillager extends EntityAgeable implements IMerchant, NPC {
-@@ -30,7 +36,7 @@
+@@ -31,7 +39,7 @@
public EntityVillager(World world, int i) {
super(world);
@@ -22,7 +24,7 @@
this.setProfession(i);
this.setSize(0.6F, 1.95F);
((Navigation) this.getNavigation()).a(true);
-@@ -109,7 +115,14 @@
+@@ -110,7 +118,14 @@
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
if (merchantrecipe.h()) {
@@ -38,7 +40,7 @@
}
}
-@@ -401,7 +414,20 @@
+@@ -402,7 +417,20 @@
for (int l = 0; l < k; ++l) {
EntityVillager.IMerchantRecipeOption entityvillager_imerchantrecipeoption = aentityvillager_imerchantrecipeoption3[l];
diff --git a/nms-patches/EntityWither.patch b/nms-patches/EntityWither.patch
index 1b925cd8..7acdbb78 100644
--- a/nms-patches/EntityWither.patch
+++ b/nms-patches/EntityWither.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityWither.java
+++ b/net/minecraft/server/EntityWither.java
-@@ -5,6 +5,12 @@
- import java.util.Iterator;
+@@ -6,6 +6,12 @@
import java.util.List;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -13,9 +13,9 @@
public class EntityWither extends EntityMonster implements IRangedEntity {
private static final DataWatcherObject<Integer> a = DataWatcher.a(EntityWither.class, DataWatcherRegistry.b);
-@@ -179,13 +185,38 @@
- if (this.cZ() > 0) {
- i = this.cZ() - 1;
+@@ -180,13 +186,38 @@
+ if (this.da() > 0) {
+ i = this.da() - 1;
if (i <= 0) {
- this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, this.world.getGameRules().getBoolean("mobGriefing"));
- this.world.a(1023, new BlockPosition(this), 0);
@@ -55,7 +55,7 @@
}
} else {
-@@ -276,6 +307,11 @@
+@@ -277,6 +308,11 @@
Block block = iblockdata.getBlock();
if (iblockdata.getMaterial() != Material.AIR && a(block)) {
@@ -67,7 +67,7 @@
flag = this.world.setAir(blockposition, true) || flag;
}
}
-@@ -289,7 +325,7 @@
+@@ -290,7 +326,7 @@
}
if (this.ticksLived % 20 == 0) {
@@ -75,4 +75,4 @@
+ this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
}
- this.bE.setProgress(this.getHealth() / this.getMaxHealth());
+ this.bF.setProgress(this.getHealth() / this.getMaxHealth());
diff --git a/nms-patches/EntityWolf.patch b/nms-patches/EntityWolf.patch
index ed990124..c37aeb64 100644
--- a/nms-patches/EntityWolf.patch
+++ b/nms-patches/EntityWolf.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityWolf.java
+++ b/net/minecraft/server/EntityWolf.java
-@@ -3,6 +3,11 @@
- import com.google.common.base.Predicate;
+@@ -4,6 +4,11 @@
import java.util.UUID;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class EntityWolf extends EntityTameableAnimal {
private static final DataWatcherObject<Float> DATA_HEALTH = DataWatcher.a(EntityWolf.class, DataWatcherRegistry.c);
-@@ -59,6 +64,22 @@
+@@ -60,6 +65,22 @@
this.getAttributeMap().b(GenericAttributes.ATTACK_DAMAGE).setValue(2.0D);
}
@@ -32,10 +32,10 @@
+ }
+ // CraftBukkit end
+
- public void setGoalTarget(EntityLiving entityliving) {
+ public void setGoalTarget(@Nullable EntityLiving entityliving) {
super.setGoalTarget(entityliving);
if (entityliving == null) {
-@@ -192,9 +213,10 @@
+@@ -194,9 +215,10 @@
Entity entity = damagesource.getEntity();
if (this.goalSit != null) {
@@ -48,7 +48,7 @@
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
f = (f + 1.0F) / 2.0F;
}
-@@ -235,7 +257,7 @@
+@@ -237,7 +259,7 @@
--itemstack.count;
}
@@ -57,16 +57,16 @@
return true;
}
} else if (itemstack.getItem() == Items.DYE) {
-@@ -256,7 +278,7 @@
+@@ -258,7 +280,7 @@
this.goalSit.setSitting(!this.isSitting());
- this.bc = false;
+ this.bd = false;
this.navigation.o();
- this.setGoalTarget((EntityLiving) null);
+ this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
}
} else if (itemstack != null && itemstack.getItem() == Items.BONE && !this.isAngry()) {
if (!entityhuman.abilities.canInstantlyBuild) {
-@@ -264,12 +286,14 @@
+@@ -266,12 +288,14 @@
}
if (!this.world.isClientSide) {
@@ -82,7 +82,7 @@
this.setOwnerUUID(entityhuman.getUniqueID());
this.o(true);
this.world.broadcastEntityEffect(this, (byte) 7);
-@@ -351,7 +375,7 @@
+@@ -353,7 +377,7 @@
}
protected boolean isTypeNotPersistent() {
diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch
index c6995929..0fe3d3c0 100644
--- a/nms-patches/EntityZombie.patch
+++ b/nms-patches/EntityZombie.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityZombie.java
+++ b/net/minecraft/server/EntityZombie.java
-@@ -4,6 +4,13 @@
- import java.util.List;
+@@ -5,6 +5,13 @@
import java.util.UUID;
+ import javax.annotation.Nullable;
+//CraftBukkit start
+import org.bukkit.event.entity.CreatureSpawnEvent;
@@ -14,15 +14,15 @@
public class EntityZombie extends EntityMonster {
protected static final IAttribute a = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
-@@ -18,6 +25,7 @@
- private boolean bB = false;
- private float bC = -1.0F;
- private float bD;
+@@ -19,6 +26,7 @@
+ private boolean bC = false;
+ private float bD = -1.0F;
+ private float bE;
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
public EntityZombie(World world) {
super(world);
-@@ -152,7 +160,14 @@
+@@ -153,7 +161,14 @@
}
if (flag) {
@@ -38,7 +38,7 @@
}
}
}
-@@ -182,8 +197,8 @@
+@@ -183,8 +198,8 @@
if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).q() && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) {
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.a(entityzombie.getBoundingBox(), (Entity) entityzombie) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()).isEmpty() && !this.world.containsLiquid(entityzombie.getBoundingBox())) {
@@ -49,7 +49,7 @@
entityzombie.prepare(this.world.D(new BlockPosition(entityzombie)), (GroupDataEntity) null);
this.getAttributeInstance(EntityZombie.a).b(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
entityzombie.getAttributeInstance(EntityZombie.a).b(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
-@@ -202,6 +217,11 @@
+@@ -203,6 +218,11 @@
public void m() {
if (!this.world.isClientSide && this.isConverting()) {
int i = this.getConversionTime();
@@ -59,9 +59,9 @@
+ i *= elapsedTicks;
+ // CraftBukkit end
- this.bA -= i;
- if (this.bA <= 0) {
-@@ -219,7 +239,14 @@
+ this.bB -= i;
+ if (this.bB <= 0) {
+@@ -220,7 +240,14 @@
int i = this.world.getDifficulty().a();
if (this.getItemInMainHand() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) {
@@ -77,7 +77,7 @@
}
}
-@@ -321,7 +348,7 @@
+@@ -323,7 +350,7 @@
entityzombie.setCustomNameVisible(entityvillager.getCustomNameVisible());
}
@@ -86,7 +86,7 @@
this.world.a((EntityHuman) null, 1026, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0);
}
-@@ -374,7 +401,7 @@
+@@ -377,7 +404,7 @@
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null);
entitychicken1.o(true);
@@ -95,7 +95,7 @@
this.startRiding(entitychicken1);
}
}
-@@ -458,7 +485,7 @@
+@@ -461,7 +488,7 @@
entityvillager.setCustomNameVisible(this.getCustomNameVisible());
}
@@ -104,7 +104,7 @@
entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
this.world.a((EntityHuman) null, 1027, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0);
}
-@@ -514,11 +541,12 @@
+@@ -517,11 +544,12 @@
}
public void die(DamageSource damagesource) {
diff --git a/nms-patches/FoodMetaData.patch b/nms-patches/FoodMetaData.patch
index 60b398c7..3f9a0a9f 100644
--- a/nms-patches/FoodMetaData.patch
+++ b/nms-patches/FoodMetaData.patch
@@ -64,7 +64,7 @@
this.a(f);
this.foodTickTimer = 0;
}
- } else if (flag && this.foodLevel >= 18 && entityhuman.cT()) {
+ } else if (flag && this.foodLevel >= 18 && entityhuman.cU()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
- entityhuman.heal(1.0F);
diff --git a/nms-patches/HandshakeListener.patch b/nms-patches/HandshakeListener.patch
index 920c5c6a..a03c85d9 100644
--- a/nms-patches/HandshakeListener.patch
+++ b/nms-patches/HandshakeListener.patch
@@ -18,13 +18,7 @@
private final MinecraftServer a;
private final NetworkManager b;
-@@ -11,21 +21,58 @@
- }
-
- public void a(PacketHandshakingInSetProtocol packethandshakinginsetprotocol) {
-+ this.b.channel.pipeline().get(PacketEncoder.class).version = packethandshakinginsetprotocol.b(); // CraftBukkit
- switch (HandshakeListener.SyntheticClass_1.a[packethandshakinginsetprotocol.a().ordinal()]) {
- case 1:
+@@ -16,6 +26,41 @@
this.b.setProtocol(EnumProtocol.LOGIN);
ChatComponentText chatcomponenttext;
@@ -63,14 +57,10 @@
+ }
+ // CraftBukkit end
+
- if (packethandshakinginsetprotocol.b() > 109) {
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.9.2");
- this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext));
- this.b.close(chatcomponenttext);
-- } else if (packethandshakinginsetprotocol.b() < 109) {
-+ } else if (packethandshakinginsetprotocol.b() < 107) {
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.9.2");
+ if (packethandshakinginsetprotocol.b() > 110) {
+ chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.9.4");
this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext));
+@@ -26,6 +71,7 @@
this.b.close(chatcomponenttext);
} else {
this.b.setPacketListener(new LoginListener(this.a, this.b));
diff --git a/nms-patches/IChunkProvider.patch b/nms-patches/IChunkProvider.patch
deleted file mode 100644
index a0e6eeab..00000000
--- a/nms-patches/IChunkProvider.patch
+++ /dev/null
@@ -1,9 +0,0 @@
---- a/net/minecraft/server/IChunkProvider.java
-+++ b/net/minecraft/server/IChunkProvider.java
-@@ -9,4 +9,6 @@
- boolean unloadChunks();
-
- String getName();
-+
-+ Chunk getOrCreateChunkFast(int x, int z); // CraftBukkit
- }
diff --git a/nms-patches/IInventory.patch b/nms-patches/IInventory.patch
index 548011fa..16aa68e4 100644
--- a/nms-patches/IInventory.patch
+++ b/nms-patches/IInventory.patch
@@ -1,14 +1,14 @@
--- a/net/minecraft/server/IInventory.java
+++ b/net/minecraft/server/IInventory.java
-@@ -1,5 +1,7 @@
+@@ -1,6 +1,7 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity; // CraftBukkit
-+
+
public interface IInventory extends INamableTileEntity {
- int getSize();
-@@ -31,4 +33,22 @@
+@@ -36,4 +37,22 @@
int g();
void l();
diff --git a/nms-patches/IRecipe.patch b/nms-patches/IRecipe.patch
index 68aab813..bc315529 100644
--- a/nms-patches/IRecipe.patch
+++ b/nms-patches/IRecipe.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/IRecipe.java
+++ b/net/minecraft/server/IRecipe.java
-@@ -11,4 +11,6 @@
+@@ -15,4 +15,6 @@
ItemStack b();
ItemStack[] b(InventoryCrafting inventorycrafting);
diff --git a/nms-patches/InventoryCraftResult.patch b/nms-patches/InventoryCraftResult.patch
index 18926273..9434a528 100644
--- a/nms-patches/InventoryCraftResult.patch
+++ b/nms-patches/InventoryCraftResult.patch
@@ -1,14 +1,15 @@
--- a/net/minecraft/server/InventoryCraftResult.java
+++ b/net/minecraft/server/InventoryCraftResult.java
-@@ -1,9 +1,43 @@
+@@ -1,11 +1,44 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
-+
+
public class InventoryCraftResult implements IInventory {
private ItemStack[] items = new ItemStack[1];
@@ -44,7 +45,7 @@
public InventoryCraftResult() {}
public int getSize() {
-@@ -39,7 +73,7 @@
+@@ -44,7 +77,7 @@
}
public int getMaxStackSize() {
diff --git a/nms-patches/InventoryCrafting.patch b/nms-patches/InventoryCrafting.patch
index c51c6dde..45dcce2b 100644
--- a/nms-patches/InventoryCrafting.patch
+++ b/nms-patches/InventoryCrafting.patch
@@ -1,8 +1,9 @@
--- a/net/minecraft/server/InventoryCrafting.java
+++ b/net/minecraft/server/InventoryCrafting.java
-@@ -1,5 +1,14 @@
+@@ -1,6 +1,14 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.Location;
@@ -11,11 +12,10 @@
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.event.inventory.InventoryType;
+// CraftBukkit end
-+
+
public class InventoryCrafting implements IInventory {
- private final ItemStack[] items;
-@@ -7,6 +16,53 @@
+@@ -9,6 +17,53 @@
private final int c;
private final Container d;
diff --git a/nms-patches/InventoryLargeChest.patch b/nms-patches/InventoryLargeChest.patch
index 2332ec3b..17df409c 100644
--- a/nms-patches/InventoryLargeChest.patch
+++ b/nms-patches/InventoryLargeChest.patch
@@ -1,8 +1,9 @@
--- a/net/minecraft/server/InventoryLargeChest.java
+++ b/net/minecraft/server/InventoryLargeChest.java
-@@ -1,11 +1,61 @@
+@@ -1,6 +1,13 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.Location;
@@ -10,10 +11,10 @@
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
-+
+
public class InventoryLargeChest implements ITileInventory {
- private String a;
+@@ -8,6 +15,48 @@
public ITileInventory left;
public ITileInventory right;
@@ -62,7 +63,7 @@
public InventoryLargeChest(String s, ITileInventory itileinventory, ITileInventory itileinventory1) {
this.a = s;
if (itileinventory == null) {
-@@ -68,7 +118,7 @@
+@@ -73,7 +122,7 @@
}
public int getMaxStackSize() {
diff --git a/nms-patches/InventoryMerchant.patch b/nms-patches/InventoryMerchant.patch
index 26027d36..51bf4d59 100644
--- a/nms-patches/InventoryMerchant.patch
+++ b/nms-patches/InventoryMerchant.patch
@@ -1,8 +1,9 @@
--- a/net/minecraft/server/InventoryMerchant.java
+++ b/net/minecraft/server/InventoryMerchant.java
-@@ -1,12 +1,54 @@
+@@ -1,6 +1,13 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.Location;
@@ -10,16 +11,13 @@
+import org.bukkit.craftbukkit.entity.CraftVillager;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
-+
+
public class InventoryMerchant implements IInventory {
- private final IMerchant merchant;
- private ItemStack[] itemsInSlots = new ItemStack[3];
- private final EntityHuman player;
+@@ -10,6 +17,40 @@
private MerchantRecipe recipe;
-- private int e;
-+ public int e; // PAIL: private -> public, selectedIndex
-+
+ public int selectedIndex;
+
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
@@ -53,10 +51,11 @@
+ return ((EntityVillager) this.merchant).getBukkitEntity().getLocation();
+ }
+ // CraftBukkit end
-
++
public InventoryMerchant(EntityHuman entityhuman, IMerchant imerchant) {
this.player = entityhuman;
-@@ -68,7 +110,7 @@
+ this.merchant = imerchant;
+@@ -73,7 +114,7 @@
}
public int getMaxStackSize() {
diff --git a/nms-patches/InventorySubcontainer.patch b/nms-patches/InventorySubcontainer.patch
index efc31989..a57a94a4 100644
--- a/nms-patches/InventorySubcontainer.patch
+++ b/nms-patches/InventorySubcontainer.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/InventorySubcontainer.java
+++ b/net/minecraft/server/InventorySubcontainer.java
-@@ -3,6 +3,13 @@
- import com.google.common.collect.Lists;
+@@ -4,6 +4,13 @@
import java.util.List;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.List;
@@ -14,7 +14,7 @@
public class InventorySubcontainer implements IInventory {
private String a;
-@@ -11,7 +18,47 @@
+@@ -12,7 +19,47 @@
private List<IInventoryListener> d;
private boolean e;
diff --git a/nms-patches/ItemBow.patch b/nms-patches/ItemBow.patch
index e54d003c..b168fc48 100644
--- a/nms-patches/ItemBow.patch
+++ b/nms-patches/ItemBow.patch
@@ -1,14 +1,14 @@
--- a/net/minecraft/server/ItemBow.java
+++ b/net/minecraft/server/ItemBow.java
-@@ -1,5 +1,7 @@
+@@ -1,6 +1,7 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
-+
+
public class ItemBow extends Item {
- public ItemBow() {
-@@ -73,7 +75,20 @@
+@@ -75,7 +76,20 @@
}
if (EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_FIRE, itemstack) > 0) {
@@ -30,7 +30,7 @@
}
itemstack.damage(1, entityhuman);
-@@ -81,7 +96,15 @@
+@@ -83,7 +97,15 @@
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
diff --git a/nms-patches/ItemBucket.patch b/nms-patches/ItemBucket.patch
index 9b3780c7..4a89f897 100644
--- a/nms-patches/ItemBucket.patch
+++ b/nms-patches/ItemBucket.patch
@@ -1,19 +1,19 @@
--- a/net/minecraft/server/ItemBucket.java
+++ b/net/minecraft/server/ItemBucket.java
-@@ -1,5 +1,12 @@
+@@ -1,6 +1,12 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.player.PlayerBucketEmptyEvent;
+import org.bukkit.event.player.PlayerBucketFillEvent;
+// CraftBukkit end
-+
+
public class ItemBucket extends Item {
- private Block a;
-@@ -31,15 +38,29 @@
+@@ -33,15 +39,29 @@
Material material = iblockdata.getMaterial();
if (material == Material.WATER && ((Integer) iblockdata.get(BlockFluids.LEVEL)).intValue() == 0) {
@@ -45,7 +45,7 @@
} else {
return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack);
}
-@@ -50,7 +71,7 @@
+@@ -52,7 +72,7 @@
if (!entityhuman.a(blockposition1, movingobjectposition.direction, itemstack)) {
return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack);
@@ -54,7 +54,7 @@
entityhuman.b(StatisticList.b((Item) this));
return !entityhuman.abilities.canInstantlyBuild ? new InteractionResultWrapper(EnumInteractionResult.SUCCESS, new ItemStack(Items.BUCKET)) : new InteractionResultWrapper(EnumInteractionResult.SUCCESS, itemstack);
} else {
-@@ -60,21 +81,28 @@
+@@ -62,21 +82,28 @@
}
}
@@ -78,7 +78,7 @@
}
+ // CraftBukkit start
- public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition) {
+ public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition) {
+ return a(entityhuman, world, blockposition, null, blockposition, null);
+ }
+
@@ -87,7 +87,7 @@
if (this.a == Blocks.AIR) {
return false;
} else {
-@@ -86,6 +114,15 @@
+@@ -88,6 +115,15 @@
if (!world.isEmpty(blockposition) && !flag && !flag1) {
return false;
} else {
diff --git a/nms-patches/ItemChorusFruit.patch b/nms-patches/ItemChorusFruit.patch
index 77739fe1..2c528c32 100644
--- a/nms-patches/ItemChorusFruit.patch
+++ b/nms-patches/ItemChorusFruit.patch
@@ -1,18 +1,18 @@
--- a/net/minecraft/server/ItemChorusFruit.java
+++ b/net/minecraft/server/ItemChorusFruit.java
-@@ -1,5 +1,11 @@
+@@ -1,6 +1,11 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerTeleportEvent;
+// CraftBukkit end
-+
+
public class ItemChorusFruit extends ItemFood {
- public ItemChorusFruit(int i, float f) {
-@@ -19,7 +25,21 @@
+@@ -22,7 +27,21 @@
double d4 = MathHelper.a(entityliving.locY + (double) (entityliving.getRandom().nextInt(16) - 8), 0.0D, (double) (world.Z() - 1));
double d5 = entityliving.locZ + (entityliving.getRandom().nextDouble() - 0.5D) * 16.0D;
diff --git a/nms-patches/ItemHanging.patch b/nms-patches/ItemHanging.patch
index 0b517da4..bdb70304 100644
--- a/nms-patches/ItemHanging.patch
+++ b/nms-patches/ItemHanging.patch
@@ -1,17 +1,17 @@
--- a/net/minecraft/server/ItemHanging.java
+++ b/net/minecraft/server/ItemHanging.java
-@@ -1,5 +1,10 @@
+@@ -1,6 +1,10 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.entity.Player;
+import org.bukkit.event.hanging.HangingPlaceEvent;
+// CraftBukkit end
-+
+
public class ItemHanging extends Item {
- private final Class<? extends EntityHanging> a;
-@@ -17,6 +22,18 @@
+@@ -19,6 +23,18 @@
if (entityhanging != null && entityhanging.survives()) {
if (!world.isClientSide) {
diff --git a/nms-patches/ItemMonsterEgg.patch b/nms-patches/ItemMonsterEgg.patch
index bba43c1f..357a3603 100644
--- a/nms-patches/ItemMonsterEgg.patch
+++ b/nms-patches/ItemMonsterEgg.patch
@@ -1,10 +1,11 @@
--- a/net/minecraft/server/ItemMonsterEgg.java
+++ b/net/minecraft/server/ItemMonsterEgg.java
-@@ -131,6 +131,11 @@
+@@ -130,7 +130,11 @@
}
- public static Entity a(World world, String s, double d0, double d1, double d2) {
-+ // CraftBukkit start - delegate to spawnCreature
+ @Nullable
+- public static Entity a(World world, @Nullable String s, double d0, double d1, double d2) {
++ public static Entity a(World world, @Nullable String s, double d0, double d1, double d2) { // CraftBukkit start - delegate to spawnCreature
+ return spawnCreature(world, s, d0, d1, d2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
+ }
+
@@ -12,9 +13,9 @@
if (s != null && EntityTypes.eggInfo.containsKey(s)) {
Entity entity = null;
-@@ -143,8 +148,13 @@
- entityinsentient.aO = entityinsentient.yaw;
- entityinsentient.aM = entityinsentient.yaw;
+@@ -143,8 +147,13 @@
+ entityinsentient.aP = entityinsentient.yaw;
+ entityinsentient.aN = entityinsentient.yaw;
entityinsentient.prepare(world.D(new BlockPosition(entityinsentient)), (GroupDataEntity) null);
- world.addEntity(entity);
- entityinsentient.D();
diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch
index f061c9ab..26e1bdd7 100644
--- a/nms-patches/ItemStack.patch
+++ b/nms-patches/ItemStack.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/ItemStack.java
+++ b/net/minecraft/server/ItemStack.java
-@@ -5,6 +5,19 @@
- import java.text.DecimalFormat;
+@@ -6,6 +6,19 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.List;
@@ -20,7 +20,7 @@
public final class ItemStack {
public static final DecimalFormat a = new DecimalFormat("#.##");
-@@ -46,10 +59,20 @@
+@@ -47,10 +60,20 @@
this.k = false;
this.item = item;
this.count = i;
@@ -44,7 +44,7 @@
}
-@@ -84,11 +107,131 @@
+@@ -85,11 +108,131 @@
}
public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
@@ -177,7 +177,7 @@
return enuminteractionresult;
}
-@@ -112,7 +255,7 @@
+@@ -114,7 +257,7 @@
nbttagcompound.setByte("Count", (byte) this.count);
nbttagcompound.setShort("Damage", (short) this.damage);
if (this.tag != null) {
@@ -186,7 +186,7 @@
}
return nbttagcompound;
-@@ -121,13 +264,18 @@
+@@ -123,13 +266,18 @@
public void c(NBTTagCompound nbttagcompound) {
this.item = Item.d(nbttagcompound.getString("id"));
this.count = nbttagcompound.getByte("Count");
@@ -206,7 +206,7 @@
if (this.item != null) {
this.item.a(this.tag);
}
-@@ -164,11 +312,30 @@
+@@ -166,11 +314,30 @@
}
public void setData(int i) {
@@ -239,7 +239,7 @@
}
public int j() {
-@@ -216,6 +383,12 @@
+@@ -218,6 +385,12 @@
this.count = 0;
}
@@ -252,8 +252,8 @@
this.damage = 0;
}
-@@ -513,6 +686,7 @@
-
+@@ -518,6 +691,7 @@
+ @Deprecated
public void setItem(Item item) {
this.item = item;
+ this.setData(this.getData()); // CraftBukkit - Set data again to ensure it is filtered properly
diff --git a/nms-patches/ItemWorldMap.patch b/nms-patches/ItemWorldMap.patch
index edee7580..dde295a5 100644
--- a/nms-patches/ItemWorldMap.patch
+++ b/nms-patches/ItemWorldMap.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/ItemWorldMap.java
+++ b/net/minecraft/server/ItemWorldMap.java
-@@ -4,6 +4,11 @@
- import com.google.common.collect.Iterables;
+@@ -5,6 +5,11 @@
import com.google.common.collect.Multisets;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.Bukkit;
@@ -12,7 +12,7 @@
public class ItemWorldMap extends ItemWorldMapBase {
protected ItemWorldMap() {
-@@ -11,25 +16,32 @@
+@@ -12,25 +17,32 @@
}
public WorldMap getSavedMap(ItemStack itemstack, World world) {
@@ -50,7 +50,7 @@
int i = 1 << worldmap.scale;
int j = worldmap.centerX;
int k = worldmap.centerZ;
-@@ -195,6 +207,7 @@
+@@ -197,6 +209,7 @@
protected static void a(ItemStack itemstack, World world, int i) {
WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, world);
@@ -58,7 +58,7 @@
itemstack.setData(world.b("map"));
WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData());
-@@ -204,11 +217,16 @@
+@@ -206,11 +219,16 @@
worldmap1.map = worldmap.map;
worldmap1.c();
world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1);
@@ -75,7 +75,7 @@
itemstack.setData(world.b("map"));
WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData());
-@@ -219,5 +237,9 @@
+@@ -221,5 +239,9 @@
worldmap1.map = worldmap.map;
worldmap1.c();
world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1);
diff --git a/nms-patches/JsonList.patch b/nms-patches/JsonList.patch
index 10e6bce3..adca302a 100644
--- a/nms-patches/JsonList.patch
+++ b/nms-patches/JsonList.patch
@@ -31,7 +31,7 @@
}
}
}
-@@ -205,11 +211,11 @@
+@@ -204,11 +210,11 @@
}
}
diff --git a/nms-patches/LoginListener.patch b/nms-patches/LoginListener.patch
index 8daab679..96ef85f2 100644
--- a/nms-patches/LoginListener.patch
+++ b/nms-patches/LoginListener.patch
@@ -106,7 +106,7 @@
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else {
LoginListener.this.disconnect("Failed to verify username!");
-- LoginListener.c.error("Username \'" + LoginListener.this.i.getName() + "\' tried to join with an invalid session");
+- LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session");
+ LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer
}
} catch (AuthenticationUnavailableException authenticationunavailableexception) {
diff --git a/nms-patches/MerchantRecipe.patch b/nms-patches/MerchantRecipe.patch
index a5a3a802..7a85d094 100644
--- a/nms-patches/MerchantRecipe.patch
+++ b/nms-patches/MerchantRecipe.patch
@@ -1,14 +1,14 @@
--- a/net/minecraft/server/MerchantRecipe.java
+++ b/net/minecraft/server/MerchantRecipe.java
-@@ -1,5 +1,7 @@
+@@ -1,6 +1,7 @@
package net.minecraft.server;
-+import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe;
-+
+ import javax.annotation.Nullable;
++import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe; // CraftBukkit
+
public class MerchantRecipe {
- public ItemStack buyingItem1;
-@@ -8,6 +10,18 @@
+@@ -10,6 +11,18 @@
public int uses;
public int maxUses;
public boolean rewardExp;
diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch
index 391f2ece..429c3f77 100644
--- a/nms-patches/MinecraftServer.patch
+++ b/nms-patches/MinecraftServer.patch
@@ -25,23 +25,18 @@
import java.util.List;
import java.util.Queue;
import java.util.Random;
-@@ -33,10 +40,11 @@
- import java.util.concurrent.Callable;
- import java.util.concurrent.Executors;
- import java.util.concurrent.FutureTask;
--import javax.imageio.ImageIO;
--import org.apache.commons.lang3.Validate;
--import org.apache.logging.log4j.LogManager;
--import org.apache.logging.log4j.Logger;
+@@ -39,6 +46,10 @@
+ import org.apache.logging.log4j.LogManager;
+ import org.apache.logging.log4j.Logger;
+
++// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftServer;
-+
-+// CraftBukkit start
+// CraftBukkit end
-
public abstract class MinecraftServer implements Runnable, ICommandListener, IAsyncTaskHandler, IMojangStatistics {
-@@ -93,19 +101,61 @@
+ public static final Logger LOGGER = LogManager.getLogger();
+@@ -94,19 +105,61 @@
private Thread serverThread;
private long aa = av();
@@ -106,7 +101,7 @@
protected CommandDispatcher i() {
return new CommandDispatcher(this);
}
-@@ -143,6 +193,7 @@
+@@ -144,6 +197,7 @@
this.a(s);
this.b("menu.loadingLevel");
this.worldServer = new WorldServer[3];
@@ -114,7 +109,7 @@
this.i = new long[this.worldServer.length][100];
IDataManager idatamanager = this.convertable.a(s, true);
-@@ -166,36 +217,107 @@
+@@ -167,36 +221,107 @@
worlddata.a(s1);
worldsettings = new WorldSettings(worlddata);
}
@@ -233,7 +228,7 @@
this.v.setPlayerFileData(this.worldServer);
this.a(this.getDifficulty());
this.l();
-@@ -211,25 +333,38 @@
+@@ -212,25 +337,38 @@
this.b("menu.generatingTerrain");
byte b0 = 0;
@@ -287,7 +282,7 @@
this.t();
}
-@@ -265,14 +400,17 @@
+@@ -266,14 +404,17 @@
protected void t() {
this.f = null;
this.g = 0;
@@ -307,7 +302,7 @@
if (worldserver != null) {
if (!flag) {
-@@ -281,6 +419,7 @@
+@@ -282,6 +423,7 @@
try {
worldserver.save(true, (IProgressUpdate) null);
@@ -315,7 +310,7 @@
} catch (ExceptionWorldConflict exceptionworldconflict) {
MinecraftServer.LOGGER.warn(exceptionworldconflict.getMessage());
}
-@@ -289,8 +428,24 @@
+@@ -290,8 +432,24 @@
}
@@ -341,7 +336,7 @@
if (this.am() != null) {
this.am().b();
}
-@@ -299,6 +454,7 @@
+@@ -300,6 +458,7 @@
MinecraftServer.LOGGER.info("Saving players");
this.v.savePlayers();
this.v.u();
@@ -349,7 +344,7 @@
}
if (this.worldServer != null) {
-@@ -314,11 +470,13 @@
+@@ -315,11 +474,13 @@
this.saveChunks(false);
@@ -363,7 +358,7 @@
}
if (this.m.d()) {
-@@ -358,6 +516,7 @@
+@@ -359,6 +520,7 @@
long k = j - this.aa;
if (k > 2000L && this.aa - this.Q >= 15000L) {
@@ -371,7 +366,7 @@
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.Q = this.aa;
-@@ -370,11 +529,12 @@
+@@ -371,11 +533,12 @@
i += k;
this.aa = j;
@@ -385,7 +380,7 @@
i -= 50L;
this.C();
}
-@@ -412,6 +572,12 @@
+@@ -413,6 +576,12 @@
} catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally {
@@ -398,7 +393,7 @@
this.B();
}
-@@ -455,7 +621,7 @@
+@@ -456,7 +625,7 @@
protected void B() {}
@@ -407,7 +402,7 @@
long i = System.nanoTime();
++this.ticks;
-@@ -481,7 +647,7 @@
+@@ -482,7 +651,7 @@
this.q.b().a(agameprofile);
}
@@ -416,7 +411,7 @@
this.methodProfiler.a("save");
this.v.savePlayers();
this.saveChunks(true);
-@@ -516,20 +682,40 @@
+@@ -517,20 +686,40 @@
this.methodProfiler.c("levels");
@@ -460,7 +455,7 @@
this.methodProfiler.a("tick");
-@@ -556,9 +742,9 @@
+@@ -557,9 +746,9 @@
worldserver.getTracker().updatePlayers();
this.methodProfiler.b();
this.methodProfiler.b();
@@ -472,7 +467,7 @@
}
this.methodProfiler.c("connection");
-@@ -582,10 +768,11 @@
+@@ -583,10 +772,11 @@
this.o.add(itickable);
}
@@ -485,7 +480,7 @@
boolean flag = true;
String s = null;
String s1 = ".";
-@@ -630,13 +817,16 @@
+@@ -631,13 +821,16 @@
++j;
}
}
@@ -503,7 +498,7 @@
if (s != null) {
dedicatedserver.i(s);
}
-@@ -667,6 +857,25 @@
+@@ -668,6 +861,25 @@
dedicatedserver.stop();
}
});
@@ -529,7 +524,7 @@
} catch (Exception exception) {
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
}
-@@ -674,8 +883,10 @@
+@@ -675,8 +887,10 @@
}
public void F() {
@@ -540,7 +535,7 @@
}
public File d(String s) {
-@@ -691,7 +902,14 @@
+@@ -692,7 +906,14 @@
}
public WorldServer getWorldServer(int i) {
@@ -556,7 +551,7 @@
}
public String getVersion() {
-@@ -715,7 +933,7 @@
+@@ -716,7 +937,7 @@
}
public boolean isDebugging() {
@@ -565,7 +560,7 @@
}
public void g(String s) {
-@@ -730,7 +948,7 @@
+@@ -731,7 +952,7 @@
}
public String getServerModName() {
@@ -574,15 +569,15 @@
}
public CrashReport b(CrashReport crashreport) {
-@@ -759,6 +977,7 @@
+@@ -760,6 +981,7 @@
}
- public List<String> tabCompleteCommand(ICommandListener icommandlistener, String s, BlockPosition blockposition, boolean flag) {
+ public List<String> tabCompleteCommand(ICommandListener icommandlistener, String s, @Nullable BlockPosition blockposition, boolean flag) {
+ /* CraftBukkit start - Allow tab-completion of Bukkit commands
ArrayList arraylist = Lists.newArrayList();
boolean flag1 = s.startsWith("/");
-@@ -801,10 +1020,13 @@
+@@ -802,10 +1024,13 @@
return arraylist;
}
@@ -597,7 +592,7 @@
}
public String getName() {
-@@ -860,8 +1082,10 @@
+@@ -861,8 +1086,10 @@
}
public void a(EnumDifficulty enumdifficulty) {
@@ -610,7 +605,7 @@
if (worldserver != null) {
if (worldserver.getWorldData().isHardcore()) {
-@@ -928,9 +1152,11 @@
+@@ -929,9 +1156,11 @@
int i = 0;
if (this.worldServer != null) {
@@ -625,7 +620,7 @@
WorldData worlddata = worldserver.getWorldData();
mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimensionManager().getDimensionID()));
-@@ -963,7 +1189,7 @@
+@@ -964,7 +1193,7 @@
public abstract boolean aa();
public boolean getOnlineMode() {
@@ -634,7 +629,7 @@
}
public void setOnlineMode(boolean flag) {
-@@ -1035,8 +1261,9 @@
+@@ -1036,8 +1265,9 @@
}
public void setGamemode(WorldSettings.EnumGamemode worldsettings_enumgamemode) {
@@ -646,7 +641,7 @@
}
}
-@@ -1068,7 +1295,7 @@
+@@ -1069,7 +1299,7 @@
}
public World getWorld() {
@@ -655,7 +650,7 @@
}
public Entity f() {
-@@ -1139,8 +1366,10 @@
+@@ -1141,8 +1371,10 @@
WorldServer[] aworldserver = this.worldServer;
int i = aworldserver.length;
@@ -668,7 +663,7 @@
if (worldserver != null) {
Entity entity = worldserver.getEntity(uuid);
-@@ -1155,7 +1384,7 @@
+@@ -1157,7 +1389,7 @@
}
public boolean getSendCommandFeedback() {
@@ -677,7 +672,7 @@
}
public void a(CommandObjectiveExecutor.EnumCommandResult commandobjectiveexecutor_enumcommandresult, int i) {}
-@@ -1170,7 +1399,7 @@
+@@ -1172,7 +1404,7 @@
public <V> ListenableFuture<V> a(Callable<V> callable) {
Validate.notNull(callable);
@@ -686,8 +681,8 @@
ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable);
Queue queue = this.j;
-@@ -1215,4 +1444,11 @@
- public int a(WorldServer worldserver) {
+@@ -1217,4 +1449,11 @@
+ public int a(@Nullable WorldServer worldserver) {
return worldserver != null ? worldserver.getGameRules().c("spawnRadius") : 10;
}
+
diff --git a/nms-patches/MobEffectList.patch b/nms-patches/MobEffectList.patch
index 192ac391..5d91cf59 100644
--- a/nms-patches/MobEffectList.patch
+++ b/nms-patches/MobEffectList.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/MobEffectList.java
+++ b/net/minecraft/server/MobEffectList.java
-@@ -6,6 +6,11 @@
- import java.util.UUID;
+@@ -7,6 +7,11 @@
import java.util.Map.Entry;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -12,7 +12,7 @@
public class MobEffectList {
public static final RegistryMaterials<MinecraftKey, MobEffectList> REGISTRY = new RegistryMaterials();
-@@ -22,7 +27,7 @@
+@@ -24,7 +29,7 @@
}
public static int getId(MobEffectList mobeffectlist) {
@@ -20,8 +20,8 @@
+ return MobEffectList.REGISTRY.a(mobeffectlist); // CraftBukkit - decompile error
}
- public static MobEffectList getByName(String s) {
-@@ -48,11 +53,11 @@
+ @Nullable
+@@ -51,11 +56,11 @@
public void tick(EntityLiving entityliving, int i) {
if (this == MobEffects.REGENERATION) {
if (entityliving.getHealth() < entityliving.getMaxHealth()) {
@@ -35,7 +35,7 @@
}
} else if (this == MobEffects.WITHER) {
entityliving.damageEntity(DamageSource.WITHER, 1.0F);
-@@ -60,14 +65,25 @@
+@@ -63,14 +68,25 @@
((EntityHuman) entityliving).applyExhaustion(0.025F * (float) (i + 1));
} else if (this == MobEffects.SATURATION && entityliving instanceof EntityHuman) {
if (!entityliving.world.isClientSide) {
@@ -53,8 +53,8 @@
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
+ // CraftBukkit end
}
- } else if ((this != MobEffects.HEAL || entityliving.bP()) && (this != MobEffects.HARM || !entityliving.bP())) {
- if (this == MobEffects.HARM && !entityliving.bP() || this == MobEffects.HEAL && entityliving.bP()) {
+ } else if ((this != MobEffects.HEAL || entityliving.bQ()) && (this != MobEffects.HARM || !entityliving.bQ())) {
+ if (this == MobEffects.HARM && !entityliving.bQ() || this == MobEffects.HEAL && entityliving.bQ()) {
entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i));
}
} else {
@@ -63,7 +63,7 @@
}
}
-@@ -86,7 +102,7 @@
+@@ -89,7 +105,7 @@
}
} else {
j = (int) (d0 * (double) (4 << i) + 0.5D);
@@ -72,7 +72,7 @@
}
}
-@@ -205,5 +221,10 @@
+@@ -208,5 +224,10 @@
MobEffectList.REGISTRY.a(25, new MinecraftKey("levitation"), (new MobEffectList(true, 13565951)).c("effect.levitation").b(3, 2));
MobEffectList.REGISTRY.a(26, new MinecraftKey("luck"), (new MobEffectList(false, 3381504)).c("effect.luck").b(5, 2).j().a(GenericAttributes.i, "03C3C89D-7037-4B42-869F-B146BCB64D2E", 1.0D, 0));
MobEffectList.REGISTRY.a(27, new MinecraftKey("unluck"), (new MobEffectList(true, 12624973)).c("effect.unluck").b(6, 2).a(GenericAttributes.i, "CC5AF142-2BD2-4215-B636-2605AED11727", -1.0D, 0));
diff --git a/nms-patches/NameReferencingFileConverter.patch b/nms-patches/NameReferencingFileConverter.patch
index 4d7fed98..82806a36 100644
--- a/nms-patches/NameReferencingFileConverter.patch
+++ b/nms-patches/NameReferencingFileConverter.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/NameReferencingFileConverter.java
+++ b/net/minecraft/server/NameReferencingFileConverter.java
-@@ -87,8 +87,9 @@
+@@ -88,8 +88,9 @@
if (gameprofilebanlist.c().exists()) {
try {
gameprofilebanlist.load();
@@ -12,7 +12,7 @@
}
}
-@@ -145,8 +146,9 @@
+@@ -146,8 +147,9 @@
if (ipbanlist.c().exists()) {
try {
ipbanlist.load();
@@ -24,7 +24,7 @@
}
}
-@@ -186,8 +188,9 @@
+@@ -187,8 +189,9 @@
if (oplist.c().exists()) {
try {
oplist.load();
@@ -36,7 +36,7 @@
}
}
-@@ -230,8 +233,9 @@
+@@ -231,8 +234,9 @@
if (whitelist.c().exists()) {
try {
whitelist.load();
@@ -48,7 +48,7 @@
}
}
-@@ -349,6 +353,30 @@
+@@ -350,6 +354,30 @@
File file1 = new File(file2, s + ".dat");
File file3 = new File(file, s1 + ".dat");
@@ -79,7 +79,7 @@
NameReferencingFileConverter.b(file);
if (!file1.renameTo(file3)) {
throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s, null);
-@@ -466,7 +494,7 @@
+@@ -467,7 +495,7 @@
private static File d(PropertyManager propertymanager) {
String s = propertymanager.getString("level-name", "world");
diff --git a/nms-patches/NetworkManager.patch b/nms-patches/NetworkManager.patch
index f4de26f0..2bb9e252 100644
--- a/nms-patches/NetworkManager.patch
+++ b/nms-patches/NetworkManager.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/NetworkManager.java
+++ b/net/minecraft/server/NetworkManager.java
-@@ -113,7 +113,7 @@
+@@ -114,7 +114,7 @@
protected void a(ChannelHandlerContext channelhandlercontext, Packet<?> packet) throws Exception {
if (this.channel.isOpen()) {
try {
@@ -9,7 +9,7 @@
} catch (CancelledPacketHandleException cancelledpackethandleexception) {
;
}
-@@ -232,7 +232,7 @@
+@@ -233,7 +233,7 @@
public void close(IChatBaseComponent ichatbasecomponent) {
if (this.channel.isOpen()) {
@@ -18,7 +18,7 @@
this.n = ichatbasecomponent;
}
-@@ -309,7 +309,7 @@
+@@ -310,7 +310,7 @@
}
}
diff --git a/nms-patches/PacketDataSerializer.patch b/nms-patches/PacketDataSerializer.patch
index e77b2e14..4be816ea 100644
--- a/nms-patches/PacketDataSerializer.patch
+++ b/nms-patches/PacketDataSerializer.patch
@@ -1,19 +1,15 @@
--- a/net/minecraft/server/PacketDataSerializer.java
+++ b/net/minecraft/server/PacketDataSerializer.java
-@@ -20,9 +20,12 @@
- import java.nio.charset.Charset;
+@@ -21,6 +21,8 @@
import java.util.UUID;
+ import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
+
public class PacketDataSerializer extends ByteBuf {
private final ByteBuf a;
-+ int version = 107; // CraftBukkkit
-
- public PacketDataSerializer(ByteBuf bytebuf) {
- this.a = bytebuf;
-@@ -119,7 +122,7 @@
+@@ -120,7 +122,7 @@
}
public <T extends Enum<T>> T a(Class<T> oclass) {
@@ -22,7 +18,7 @@
}
public PacketDataSerializer a(Enum<?> oenum) {
-@@ -196,7 +199,7 @@
+@@ -197,7 +199,7 @@
} else {
try {
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
@@ -31,16 +27,16 @@
throw new EncoderException(ioexception);
}
}
-@@ -222,7 +225,7 @@
+@@ -224,7 +226,7 @@
}
- public PacketDataSerializer a(ItemStack itemstack) {
+ public PacketDataSerializer a(@Nullable ItemStack itemstack) {
- if (itemstack == null) {
+ if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
this.writeShort(-1);
} else {
this.writeShort(Item.getId(itemstack.getItem()));
-@@ -250,6 +253,11 @@
+@@ -253,6 +255,11 @@
itemstack = new ItemStack(Item.getById(short0), b0, short1);
itemstack.setTag(this.j());
diff --git a/nms-patches/PacketEncoder.patch b/nms-patches/PacketEncoder.patch
deleted file mode 100644
index ab136236..00000000
--- a/nms-patches/PacketEncoder.patch
+++ /dev/null
@@ -1,27 +0,0 @@
---- a/net/minecraft/server/PacketEncoder.java
-+++ b/net/minecraft/server/PacketEncoder.java
-@@ -14,6 +14,7 @@
- private static final Logger a = LogManager.getLogger();
- private static final Marker b = MarkerManager.getMarker("PACKET_SENT", NetworkManager.b);
- private final EnumProtocolDirection c;
-+ int version; // CraftBukkit
-
- public PacketEncoder(EnumProtocolDirection enumprotocoldirection) {
- this.c = enumprotocoldirection;
-@@ -30,6 +31,7 @@
- throw new IOException("Can\'t serialize unregistered packet");
- } else {
- PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf);
-+ packetdataserializer.version = version; // CraftBukkit
-
- packetdataserializer.d(integer.intValue());
-
-@@ -42,7 +44,7 @@
- }
- }
-
-- protected void encode(ChannelHandlerContext channelhandlercontext, Object object, ByteBuf bytebuf) throws Exception {
-+ protected void encode(ChannelHandlerContext channelhandlercontext, Packet object, ByteBuf bytebuf) throws Exception {
- this.a(channelhandlercontext, (Packet) object, bytebuf);
- }
- }
diff --git a/nms-patches/PacketPlayOutLogin.patch b/nms-patches/PacketPlayOutLogin.patch
deleted file mode 100644
index a40ee3c8..00000000
--- a/nms-patches/PacketPlayOutLogin.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- a/net/minecraft/server/PacketPlayOutLogin.java
-+++ b/net/minecraft/server/PacketPlayOutLogin.java
-@@ -54,7 +54,13 @@
- }
-
- packetdataserializer.writeByte(i);
-- packetdataserializer.writeInt(this.d);
-+ // CraftBukkit start
-+ if (packetdataserializer.version < 108) {
-+ packetdataserializer.writeByte(this.d);
-+ } else {
-+ packetdataserializer.writeInt(this.d);
-+ }
-+ // CraftBukkit end
- packetdataserializer.writeByte(this.e.a());
- packetdataserializer.writeByte(this.f);
- packetdataserializer.a(this.g.name());
diff --git a/nms-patches/PacketPlayOutNamedSoundEffect.patch b/nms-patches/PacketPlayOutNamedSoundEffect.patch
deleted file mode 100644
index 207de38a..00000000
--- a/nms-patches/PacketPlayOutNamedSoundEffect.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- a/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
-+++ b/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
-@@ -38,7 +38,17 @@
- }
-
- public void b(PacketDataSerializer packetdataserializer) throws IOException {
-- packetdataserializer.d(SoundEffect.a.a((Object) this.a));
-+ // CraftBukkit start
-+ if (packetdataserializer.version > 107) {
-+ packetdataserializer.d(SoundEffect.a.a(this.a));
-+ } else {
-+ int id = SoundEffect.a.a(this.a);
-+ if (id >= SoundEffect.a.a(SoundEffect.a.get(new MinecraftKey("item.elytra.flying")))) {
-+ id--;
-+ }
-+ packetdataserializer.d(id);
-+ }
-+ // CraftBukkit end
- packetdataserializer.a((Enum) this.b);
- packetdataserializer.writeInt(this.c);
- packetdataserializer.writeInt(this.d);
diff --git a/nms-patches/PacketStatusListener.patch b/nms-patches/PacketStatusListener.patch
index f8d73f79..c8a9a902 100644
--- a/nms-patches/PacketStatusListener.patch
+++ b/nms-patches/PacketStatusListener.patch
@@ -17,7 +17,7 @@
public class PacketStatusListener implements PacketStatusInListener {
private static final IChatBaseComponent a = new ChatComponentText("Status request has been handled.");
-@@ -19,8 +30,101 @@
+@@ -19,8 +30,96 @@
this.networkManager.close(PacketStatusListener.a);
} else {
this.d = true;
@@ -107,11 +107,6 @@
+ ping.setMOTD(new ChatComponentText(event.getMotd()));
+ ping.setPlayerSample(playerSample);
+ int version = minecraftServer.getServerPing().getServerData().getProtocolVersion();
-+ if (this.networkManager.channel.pipeline().get(PacketEncoder.class).version == 108) {
-+ version = 108;
-+ } else if (this.networkManager.channel.pipeline().get(PacketEncoder.class).version == 107) {
-+ version = 107;
-+ }
+ ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version));
+
+ this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping));
diff --git a/nms-patches/PathfinderAbstract.patch b/nms-patches/PathfinderAbstract.patch
deleted file mode 100644
index 2748b173..00000000
--- a/nms-patches/PathfinderAbstract.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/net/minecraft/server/PathfinderAbstract.java
-+++ b/net/minecraft/server/PathfinderAbstract.java
-@@ -23,7 +23,7 @@
- this.f = MathHelper.d(entityinsentient.width + 1.0F);
- }
-
-- public void a() {}
-+ public void a() { this.a = (IBlockAccess) null; } // CraftBukkit - don't leak Chunk Cache
-
- protected PathPoint a(int i, int j, int k) {
- int l = PathPoint.b(i, j, k);
diff --git a/nms-patches/PathfinderGoalHurtByTarget.patch b/nms-patches/PathfinderGoalHurtByTarget.patch
index cb3fcfd8..c928c892 100644
--- a/nms-patches/PathfinderGoalHurtByTarget.patch
+++ b/nms-patches/PathfinderGoalHurtByTarget.patch
@@ -7,7 +7,7 @@
- this.e.setGoalTarget(this.e.getLastDamager());
+ this.e.setGoalTarget(this.e.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
this.g = this.e.getGoalTarget();
- this.b = this.e.bH();
+ this.b = this.e.bI();
this.h = 300;
@@ -61,6 +61,6 @@
}
diff --git a/nms-patches/PathfinderGoalNearestAttackableTarget.patch b/nms-patches/PathfinderGoalNearestAttackableTarget.patch
index 4f44f3ab..268fcde9 100644
--- a/nms-patches/PathfinderGoalNearestAttackableTarget.patch
+++ b/nms-patches/PathfinderGoalNearestAttackableTarget.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
+++ b/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
-@@ -34,7 +34,7 @@
+@@ -35,7 +35,7 @@
}
public boolean apply(Object object) {
@@ -9,7 +9,7 @@
}
};
}
-@@ -49,11 +49,11 @@
+@@ -50,11 +50,11 @@
return false;
} else {
Collections.sort(list, this.b);
@@ -20,10 +20,10 @@
} else {
- this.d = this.e.world.a(this.e.locX, this.e.locY + (double) this.e.getHeadHeight(), this.e.locZ, this.f(), this.f(), new Function() {
+ this.d = (T) this.e.world.a(this.e.locX, this.e.locY + (double) this.e.getHeadHeight(), this.e.locZ, this.f(), this.f(), new Function<EntityHuman, Double>() { // CraftBukkit - fix decompile error
- public Double a(EntityHuman entityhuman) {
+ @Nullable
+ public Double a(@Nullable EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.getEquipment(EnumItemSlot.HEAD);
-
-@@ -71,10 +71,10 @@
+@@ -73,10 +73,10 @@
return Double.valueOf(1.0D);
}
@@ -36,7 +36,7 @@
return this.d != null;
}
}
-@@ -84,7 +84,7 @@
+@@ -86,7 +86,7 @@
}
public void c() {
@@ -45,7 +45,7 @@
super.c();
}
-@@ -103,7 +103,7 @@
+@@ -105,7 +105,7 @@
return d0 < d1 ? -1 : (d0 > d1 ? 1 : 0);
}
diff --git a/nms-patches/PathfinderGoalNearestAttackableTargetInsentient.patch b/nms-patches/PathfinderGoalNearestAttackableTargetInsentient.patch
index 624e0c10..9dad5d79 100644
--- a/nms-patches/PathfinderGoalNearestAttackableTargetInsentient.patch
+++ b/nms-patches/PathfinderGoalNearestAttackableTargetInsentient.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/PathfinderGoalNearestAttackableTargetInsentient.java
+++ b/net/minecraft/server/PathfinderGoalNearestAttackableTargetInsentient.java
-@@ -68,7 +68,7 @@
+@@ -69,7 +69,7 @@
}
public void c() {
diff --git a/nms-patches/PathfinderGoalTargetNearestPlayer.patch b/nms-patches/PathfinderGoalTargetNearestPlayer.patch
index 1bdfde60..0b3f5342 100644
--- a/nms-patches/PathfinderGoalTargetNearestPlayer.patch
+++ b/nms-patches/PathfinderGoalTargetNearestPlayer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/PathfinderGoalTargetNearestPlayer.java
+++ b/net/minecraft/server/PathfinderGoalTargetNearestPlayer.java
-@@ -91,7 +91,7 @@
+@@ -92,7 +92,7 @@
}
public void c() {
diff --git a/nms-patches/PathfinderNormal.patch b/nms-patches/PathfinderNormal.patch
deleted file mode 100644
index 1beacfe2..00000000
--- a/nms-patches/PathfinderNormal.patch
+++ /dev/null
@@ -1,126 +0,0 @@
---- a/net/minecraft/server/PathfinderNormal.java
-+++ b/net/minecraft/server/PathfinderNormal.java
-@@ -3,6 +3,7 @@
- import java.util.EnumSet;
- import java.util.HashSet;
- import java.util.Iterator;
-+import javax.annotation.Nullable;
-
- public class PathfinderNormal extends PathfinderAbstract {
-
-@@ -16,8 +17,8 @@
- }
-
- public void a() {
-- super.a();
- this.b.a(PathType.WATER, this.j);
-+ super.a();
- }
-
- public PathPoint b() {
-@@ -140,6 +141,7 @@
- return i;
- }
-
-+ @Nullable
- private PathPoint a(int i, int j, int k, int l, double d0, EnumDirection enumdirection) {
- PathPoint pathpoint = null;
- BlockPosition blockposition = new BlockPosition(i, j, k);
-@@ -287,70 +289,42 @@
- }
-
- public static PathType a(IBlockAccess iblockaccess, int i, int j, int k) {
-- BlockPosition blockposition = new BlockPosition(i, j, k);
-- IBlockData iblockdata = iblockaccess.getType(blockposition);
-- Block block = iblockdata.getBlock();
-- Material material = iblockdata.getMaterial();
-- PathType pathtype = PathType.BLOCKED;
-+ PathType pathtype = b(iblockaccess, i, j, k);
-
-- if (block != Blocks.TRAPDOOR && block != Blocks.IRON_TRAPDOOR && block != Blocks.WATERLILY) {
-- if (block == Blocks.FIRE) {
-- return PathType.DAMAGE_FIRE;
-- } else if (block == Blocks.CACTUS) {
-- return PathType.DAMAGE_CACTUS;
-- } else if (block instanceof BlockDoor && material == Material.WOOD && !((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue()) {
-- return PathType.DOOR_WOOD_CLOSED;
-- } else if (block instanceof BlockDoor && material == Material.ORE && !((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue()) {
-- return PathType.DOOR_IRON_CLOSED;
-- } else if (block instanceof BlockDoor && ((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue()) {
-- return PathType.DOOR_OPEN;
-- } else if (block instanceof BlockMinecartTrackAbstract) {
-- return PathType.RAIL;
-- } else if (!(block instanceof BlockFence) && !(block instanceof BlockCobbleWall) && (!(block instanceof BlockFenceGate) || ((Boolean) iblockdata.get(BlockFenceGate.OPEN)).booleanValue())) {
-- if (material == Material.AIR) {
-- pathtype = PathType.OPEN;
-- } else {
-- if (material == Material.WATER) {
-- return PathType.WATER;
-- }
-+ if (pathtype == PathType.OPEN && j >= 1) {
-+ PathType pathtype1 = b(iblockaccess, i, j - 1, k);
-
-- if (material == Material.LAVA) {
-- return PathType.LAVA;
-- }
-- }
-+ pathtype = pathtype1 != PathType.WALKABLE && pathtype1 != PathType.OPEN && pathtype1 != PathType.WATER && pathtype1 != PathType.LAVA ? PathType.WALKABLE : PathType.OPEN;
-+ }
-
-- if (block.b(iblockaccess, blockposition) && pathtype == PathType.BLOCKED) {
-- pathtype = PathType.OPEN;
-- }
-+ BlockPosition.PooledBlockPosition blockposition_pooledblockposition = BlockPosition.PooledBlockPosition.s();
-
-- if (pathtype == PathType.OPEN && j >= 1) {
-- PathType pathtype1 = a(iblockaccess, i, j - 1, k);
-+ if (pathtype == PathType.WALKABLE) {
-+ for (int l = -1; l <= 1; ++l) {
-+ for (int i1 = -1; i1 <= 1; ++i1) {
-+ if (l != 0 || i1 != 0) {
-+ Block block = iblockaccess.getType(blockposition_pooledblockposition.d(l + i, j, i1 + k)).getBlock();
-
-- pathtype = pathtype1 != PathType.WALKABLE && pathtype1 != PathType.OPEN && pathtype1 != PathType.WATER && pathtype1 != PathType.LAVA ? PathType.WALKABLE : PathType.OPEN;
-- }
--
-- if (pathtype == PathType.WALKABLE) {
-- for (int l = i - 1; l <= i + 1; ++l) {
-- for (int i1 = k - 1; i1 <= k + 1; ++i1) {
-- if (l != i || i1 != k) {
-- Block block1 = iblockaccess.getType(new BlockPosition(l, j, i1)).getBlock();
--
-- if (block1 == Blocks.CACTUS) {
-- pathtype = PathType.DANGER_CACTUS;
-- } else if (block1 == Blocks.FIRE) {
-- pathtype = PathType.DANGER_FIRE;
-- }
-- }
-+ if (block == Blocks.CACTUS) {
-+ pathtype = PathType.DANGER_CACTUS;
-+ } else if (block == Blocks.FIRE) {
-+ pathtype = PathType.DANGER_FIRE;
- }
- }
- }
--
-- return pathtype;
-- } else {
-- return PathType.FENCE;
- }
-- } else {
-- return PathType.TRAPDOOR;
- }
-+
-+ blockposition_pooledblockposition.t();
-+ return pathtype;
-+ }
-+
-+ private static PathType b(IBlockAccess iblockaccess, int i, int j, int k) {
-+ BlockPosition blockposition = new BlockPosition(i, j, k);
-+ IBlockData iblockdata = iblockaccess.getType(blockposition);
-+ Block block = iblockdata.getBlock();
-+ Material material = iblockdata.getMaterial();
-+
-+ return material == Material.AIR ? PathType.OPEN : (block != Blocks.TRAPDOOR && block != Blocks.IRON_TRAPDOOR && block != Blocks.WATERLILY ? (block == Blocks.FIRE ? PathType.DAMAGE_FIRE : (block == Blocks.CACTUS ? PathType.DAMAGE_CACTUS : (block instanceof BlockDoor && material == Material.WOOD && !((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue() ? PathType.DOOR_WOOD_CLOSED : (block instanceof BlockDoor && material == Material.ORE && !((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue() ? PathType.DOOR_IRON_CLOSED : (block instanceof BlockDoor && ((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue() ? PathType.DOOR_OPEN : (block instanceof BlockMinecartTrackAbstract ? PathType.RAIL : (!(block instanceof BlockFence) && !(block instanceof BlockCobbleWall) && (!(block instanceof BlockFenceGate) || ((Boolean) iblockdata.get(BlockFenceGate.OPEN)).booleanValue()) ? (material == Material.WATER ? PathType.WATER : (material == Material.LAVA ? PathType.LAVA : (block.b(iblockaccess, blockposition) ? PathType.OPEN : PathType.BLOCKED))) : PathType.FENCE))))))) : PathType.TRAPDOOR);
- }
- }
diff --git a/nms-patches/PlayerChunk.patch b/nms-patches/PlayerChunk.patch
index 7354d05c..b4387dda 100644
--- a/nms-patches/PlayerChunk.patch
+++ b/nms-patches/PlayerChunk.patch
@@ -1,15 +1,12 @@
--- a/net/minecraft/server/PlayerChunk.java
+++ b/net/minecraft/server/PlayerChunk.java
-@@ -4,35 +4,50 @@
- import com.google.common.collect.Iterables;
- import com.google.common.collect.Lists;
- import java.util.ArrayList;
-+import java.util.HashMap;
- import java.util.Iterator;
- import java.util.List;
+@@ -8,32 +8,48 @@
+ import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
++// CraftBukkit Start
+import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
++// CraftBukkit end
public class PlayerChunk {
@@ -19,6 +16,7 @@
+ public final List<EntityPlayer> c = Lists.newArrayList(); // CraftBukkit - public
private final ChunkCoordIntPair location;
private final short[] dirtyBlocks = new short[64];
+ @Nullable
- private Chunk chunk;
+ public Chunk chunk; // CraftBukkit - public
private int dirtyCount;
@@ -51,11 +49,11 @@
}
- public void a(EntityPlayer entityplayer) {
-+ public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument
++ public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument
if (this.c.contains(entityplayer)) {
PlayerChunk.a.debug("Failed to add player. {} already is in chunk {}, {}", new Object[] { entityplayer, Integer.valueOf(this.location.x), Integer.valueOf(this.location.z)});
} else {
-@@ -41,15 +56,32 @@
+@@ -42,15 +58,32 @@
}
this.c.add(entityplayer);
@@ -64,8 +62,7 @@
+ // this.sendChunk(entityplayer);
+ // }
if (this.done) {
-- this.sendChunk(entityplayer);
-+ sendChunk(entityplayer);
+ this.sendChunk(entityplayer);
}
+ // CraftBukkit end
@@ -89,7 +86,7 @@
if (this.done) {
entityplayer.playerConnection.sendPacket(new PacketPlayOutUnloadChunk(this.location.x, this.location.z));
}
-@@ -66,11 +98,18 @@
+@@ -67,11 +100,18 @@
if (this.chunk != null) {
return true;
} else {
diff --git a/nms-patches/PlayerChunkMap.patch b/nms-patches/PlayerChunkMap.patch
index 81a15a41..6ec531c9 100644
--- a/nms-patches/PlayerChunkMap.patch
+++ b/nms-patches/PlayerChunkMap.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/PlayerChunkMap.java
+++ b/net/minecraft/server/PlayerChunkMap.java
-@@ -12,6 +12,10 @@
- import java.util.List;
+@@ -15,6 +15,10 @@
import java.util.Set;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.LinkedList;
@@ -11,7 +11,7 @@
public class PlayerChunkMap {
private static final Predicate<EntityPlayer> a = new Predicate() {
-@@ -43,6 +47,7 @@
+@@ -46,6 +50,7 @@
private long k;
private boolean l = true;
private boolean m = true;
@@ -19,13 +19,13 @@
public PlayerChunkMap(WorldServer worldserver) {
this.world = worldserver;
-@@ -227,6 +232,16 @@
+@@ -231,6 +236,16 @@
return playerchunk;
}
+ // CraftBukkit start - add method
+ public final boolean isChunkInUse(int x, int z) {
-+ PlayerChunk pi = b(x, z);
++ PlayerChunk pi = getChunk(x, z);
+ if (pi != null) {
+ return (pi.c.size() > 0);
+ }
@@ -36,7 +36,7 @@
public void flagDirty(BlockPosition blockposition) {
int i = blockposition.getX() >> 4;
int j = blockposition.getZ() >> 4;
-@@ -245,12 +260,22 @@
+@@ -249,12 +264,22 @@
entityplayer.d = entityplayer.locX;
entityplayer.e = entityplayer.locZ;
@@ -60,7 +60,7 @@
this.managedPlayers.add(entityplayer);
this.e();
}
-@@ -294,11 +319,14 @@
+@@ -298,11 +323,14 @@
int j1 = i - k;
int k1 = j - l;
@@ -76,7 +76,7 @@
}
if (!this.a(l1 - j1, i2 - k1, i, j, i1)) {
-@@ -314,6 +342,13 @@
+@@ -318,6 +346,13 @@
entityplayer.d = entityplayer.locX;
entityplayer.e = entityplayer.locZ;
this.e();
@@ -90,9 +90,9 @@
}
}
}
-@@ -393,4 +428,47 @@
- this.h.remove(playerchunk);
- this.getWorld().getChunkProviderServer().queueUnload(chunkcoordintpair.x, chunkcoordintpair.z);
+@@ -402,4 +437,47 @@
+ }
+
}
+
+ // CraftBukkit start - Sorter to load nearby chunks first
diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch
index da3ef692..57495a19 100644
--- a/nms-patches/PlayerConnection.patch
+++ b/nms-patches/PlayerConnection.patch
@@ -8,7 +8,7 @@
import io.netty.buffer.Unpooled;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
-@@ -18,6 +17,49 @@
+@@ -17,6 +16,49 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -58,7 +58,7 @@
public class PlayerConnection implements PacketListenerPlayIn, ITickable {
private static final Logger LOGGER = LogManager.getLogger();
-@@ -28,7 +70,10 @@
+@@ -27,7 +69,10 @@
private int f;
private long g;
private long h;
@@ -70,7 +70,7 @@
private int j;
private final IntHashMap<Short> k = new IntHashMap();
private double l;
-@@ -53,6 +98,7 @@
+@@ -52,6 +97,7 @@
private int E;
private int F;
private int G;
@@ -78,7 +78,7 @@
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
-@@ -60,7 +106,32 @@
+@@ -59,7 +105,32 @@
networkmanager.setPacketListener(this);
this.player = entityplayer;
entityplayer.playerConnection = this;
@@ -111,7 +111,7 @@
public void c() {
this.d();
-@@ -112,15 +183,21 @@
+@@ -111,15 +182,21 @@
}
this.minecraftServer.methodProfiler.b();
@@ -133,7 +133,7 @@
this.disconnect("You have been idle for too long!");
}
-@@ -140,19 +217,37 @@
+@@ -139,19 +216,37 @@
}
public void disconnect(String s) {
@@ -174,7 +174,7 @@
}
public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) {
-@@ -191,7 +286,34 @@
+@@ -190,7 +285,34 @@
double d9 = entity.motX * entity.motX + entity.motY * entity.motY + entity.motZ * entity.motZ;
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
@@ -210,7 +210,7 @@
PlayerConnection.LOGGER.warn(entity.getName() + " (vehicle of " + this.player.getName() + ") moved too quickly! " + d6 + "," + d7 + "," + d8);
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
return;
-@@ -229,6 +351,62 @@
+@@ -228,6 +350,62 @@
return;
}
@@ -273,7 +273,7 @@
this.minecraftServer.getPlayerList().d(this.player);
this.player.checkMovement(this.player.locX - d0, this.player.locY - d1, this.player.locZ - d2);
this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && !worldserver.d(entity.getBoundingBox().g(0.0625D).a(0.0D, -0.55D, 0.0D));
-@@ -263,7 +441,7 @@
+@@ -262,7 +440,7 @@
} else {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
@@ -282,7 +282,7 @@
if (this.e == 0) {
this.d();
}
-@@ -273,13 +451,21 @@
+@@ -272,13 +450,21 @@
this.A = this.e;
this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
}
@@ -305,7 +305,7 @@
double d0 = this.player.locX;
double d1 = this.player.locY;
double d2 = this.player.locZ;
-@@ -298,15 +484,33 @@
+@@ -297,15 +483,33 @@
++this.F;
int i = this.F - this.G;
@@ -332,8 +332,8 @@
+ speed = player.abilities.walkSpeed * 10f;
+ }
+
- if (!this.player.K() && (!this.player.x().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.cB())) {
- float f2 = this.player.cB() ? 300.0F : 100.0F;
+ if (!this.player.K() && (!this.player.x().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.cC())) {
+ float f2 = this.player.cC() ? 300.0F : 100.0F;
- if (d11 - d10 > (double) (f2 * (float) i) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(this.player.getName()))) {
+ if (d11 - d10 > Math.max(100, Math.pow((double) (10.0F * (float) i * speed), 2)) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(this.player.getName()))) {
@@ -341,7 +341,7 @@
PlayerConnection.LOGGER.warn(this.player.getName() + " moved too quickly! " + d7 + "," + d8 + "," + d9);
this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch);
return;
-@@ -352,6 +556,69 @@
+@@ -351,6 +555,69 @@
}
}
@@ -410,8 +410,8 @@
+
this.B = d12 >= -0.03125D;
this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly;
- this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.cB() && !worldserver.d(this.player.getBoundingBox().g(0.0625D).a(0.0D, -0.55D, 0.0D));
-@@ -368,15 +635,79 @@
+ this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.cC() && !worldserver.d(this.player.getBoundingBox().g(0.0625D).a(0.0D, -0.55D, 0.0D));
+@@ -367,15 +634,79 @@
}
public void a(double d0, double d1, double d2, float f, float f1) {
@@ -496,7 +496,7 @@
float f2 = f;
float f3 = f1;
-@@ -388,6 +719,14 @@
+@@ -387,6 +718,14 @@
f3 = f1 + this.player.pitch;
}
@@ -511,7 +511,7 @@
if (++this.teleportAwait == Integer.MAX_VALUE) {
this.teleportAwait = 0;
}
-@@ -399,37 +738,61 @@
+@@ -398,37 +737,61 @@
public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.x());
@@ -579,7 +579,7 @@
this.player.clearActiveItem();
itemstack = this.player.getItemInMainHand();
if (itemstack != null && itemstack.count == 0) {
-@@ -438,9 +801,9 @@
+@@ -437,9 +800,9 @@
return;
@@ -592,7 +592,7 @@
double d0 = this.player.locX - ((double) blockposition.getX() + 0.5D);
double d1 = this.player.locY - ((double) blockposition.getY() + 0.5D) + 1.5D;
double d2 = this.player.locZ - ((double) blockposition.getZ() + 0.5D);
-@@ -455,7 +818,15 @@
+@@ -454,7 +817,15 @@
if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b());
} else {
@@ -608,7 +608,7 @@
}
} else {
if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) {
-@@ -475,10 +846,12 @@
+@@ -474,10 +845,12 @@
default:
throw new IllegalArgumentException("Invalid player action");
}
@@ -621,7 +621,7 @@
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
EnumHand enumhand = packetplayinuseitem.c();
ItemStack itemstack = this.player.b(enumhand);
-@@ -492,6 +865,13 @@
+@@ -491,6 +864,13 @@
chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage));
} else if (this.teleportPos == null && 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)) {
@@ -635,7 +635,7 @@
this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.d(), packetplayinuseitem.e(), packetplayinuseitem.f());
}
-@@ -507,19 +887,55 @@
+@@ -506,19 +886,55 @@
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x());
@@ -696,7 +696,7 @@
}
}
-@@ -530,8 +946,8 @@
+@@ -529,8 +945,8 @@
WorldServer[] aworldserver = this.minecraftServer.worldServer;
int i = aworldserver.length;
@@ -707,7 +707,7 @@
if (worldserver != null) {
entity = packetplayinspectate.a(worldserver);
-@@ -544,6 +960,8 @@
+@@ -543,6 +959,8 @@
if (entity != null) {
this.player.setSpectatorTarget(this.player);
this.player.stopRiding();
@@ -716,7 +716,7 @@
if (entity.world != this.player.world) {
WorldServer worldserver1 = this.player.x();
WorldServer worldserver2 = (WorldServer) entity.world;
-@@ -569,12 +987,19 @@
+@@ -568,12 +986,19 @@
} else {
this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ);
}
@@ -737,7 +737,7 @@
public void a(PacketPlayInBoatMove packetplayinboatmove) {
PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.x());
-@@ -587,14 +1012,29 @@
+@@ -586,14 +1011,29 @@
}
public void a(IChatBaseComponent ichatbasecomponent) {
@@ -769,7 +769,7 @@
if (this.minecraftServer.R() && this.player.getName().equals(this.minecraftServer.Q())) {
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
this.minecraftServer.safeShutdown();
-@@ -616,6 +1056,15 @@
+@@ -615,6 +1055,15 @@
}
}
@@ -785,7 +785,7 @@
try {
this.networkManager.sendPacket(packet);
} catch (Throwable throwable) {
-@@ -637,17 +1086,32 @@
+@@ -636,17 +1085,32 @@
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x());
@@ -820,7 +820,7 @@
ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]);
chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
-@@ -660,39 +1124,249 @@
+@@ -659,39 +1123,249 @@
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@@ -1078,7 +1078,7 @@
this.player.resetIdleTimer();
IJumpable ijumpable;
-@@ -762,6 +1436,7 @@
+@@ -761,6 +1435,7 @@
public void a(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x());
@@ -1086,7 +1086,7 @@
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
Entity entity = packetplayinuseentity.a((World) worldserver);
-@@ -778,22 +1453,72 @@
+@@ -777,22 +1452,72 @@
EnumHand enumhand;
ItemStack itemstack;
@@ -1160,7 +1160,7 @@
}
}
}
-@@ -809,7 +1534,8 @@
+@@ -808,7 +1533,8 @@
case 1:
if (this.player.viewingCredits) {
this.player.viewingCredits = false;
@@ -1170,7 +1170,7 @@
} else {
if (this.player.getHealth() > 0.0F) {
return;
-@@ -835,14 +1561,20 @@
+@@ -834,14 +1560,20 @@
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x());
@@ -1192,7 +1192,7 @@
ArrayList arraylist = Lists.newArrayList();
for (int i = 0; i < this.player.activeContainer.c.size(); ++i) {
-@@ -851,8 +1583,275 @@
+@@ -850,8 +1582,275 @@
this.player.a(this.player.activeContainer, (List) arraylist);
} else {
@@ -1469,7 +1469,7 @@
if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) {
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true));
this.player.f = true;
-@@ -881,6 +1880,7 @@
+@@ -880,6 +1879,7 @@
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x());
@@ -1477,7 +1477,7 @@
this.player.resetIdleTimer();
if (this.player.activeContainer.windowId == packetplayinenchantitem.a() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
this.player.activeContainer.a(this.player, packetplayinenchantitem.b());
-@@ -915,8 +1915,48 @@
+@@ -913,8 +1913,48 @@
}
boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45;
@@ -1527,7 +1527,7 @@
if (flag1 && flag2 && flag3) {
if (itemstack == null) {
-@@ -940,6 +1980,7 @@
+@@ -938,6 +1978,7 @@
public void a(PacketPlayInTransaction packetplayintransaction) {
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x());
@@ -1535,7 +1535,7 @@
Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
if (oshort != null && packetplayintransaction.b() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.a() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
-@@ -950,6 +1991,7 @@
+@@ -948,6 +1989,7 @@
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x());
@@ -1543,11 +1543,11 @@
this.player.resetIdleTimer();
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
BlockPosition blockposition = packetplayinupdatesign.a();
-@@ -966,14 +2008,30 @@
+@@ -964,14 +2006,30 @@
- if (!tileentitysign.b() || tileentitysign.c() != this.player) {
+ if (!tileentitysign.c() || tileentitysign.d() != this.player) {
this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
-+ this.sendPacket(new PacketPlayOutUpdateSign(tileentity.world, packetplayinupdatesign.a(), tileentitysign.lines)); // CraftBukkit
++ this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit
return;
}
@@ -1575,7 +1575,7 @@
tileentitysign.update();
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
-@@ -996,11 +2054,27 @@
+@@ -994,11 +2052,27 @@
public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x());
@@ -1604,7 +1604,7 @@
ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator();
-@@ -1334,12 +2408,34 @@
+@@ -1332,12 +2406,34 @@
packetdataserializer.release();
}
}
diff --git a/nms-patches/PlayerInteractManager.patch b/nms-patches/PlayerInteractManager.patch
index 6db3d666..47b77f13 100644
--- a/nms-patches/PlayerInteractManager.patch
+++ b/nms-patches/PlayerInteractManager.patch
@@ -1,8 +1,9 @@
--- a/net/minecraft/server/PlayerInteractManager.java
+++ b/net/minecraft/server/PlayerInteractManager.java
-@@ -1,5 +1,13 @@
+@@ -1,6 +1,13 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -10,11 +11,10 @@
+import org.bukkit.event.block.Action;
+import org.bukkit.event.player.PlayerInteractEvent;
+// CraftBukkit end
-+
+
public class PlayerInteractManager {
- public World world;
-@@ -26,7 +34,7 @@
+@@ -28,7 +35,7 @@
this.gamemode = worldsettings_enumgamemode;
worldsettings_enumgamemode.a(this.player.abilities);
this.player.updateAbilities();
@@ -23,7 +23,7 @@
this.world.everyoneSleeping();
}
-@@ -51,7 +59,7 @@
+@@ -53,7 +60,7 @@
}
public void a() {
@@ -32,7 +32,7 @@
float f;
int i;
-@@ -98,6 +106,19 @@
+@@ -100,6 +107,19 @@
}
public void a(BlockPosition blockposition, EnumDirection enumdirection) {
@@ -52,7 +52,7 @@
if (this.isCreative()) {
if (!this.world.douseFire((EntityHuman) null, blockposition, enumdirection)) {
this.breakBlock(blockposition);
-@@ -125,14 +146,48 @@
+@@ -127,14 +147,48 @@
}
}
@@ -87,7 +87,7 @@
+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
+ }
+ return;
-+ }
+ }
+ org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.player.inventory.getItemInHand(), f >= 1.0f);
+
+ if (blockEvent.isCancelled()) {
@@ -98,12 +98,12 @@
+
+ if (blockEvent.getInstaBreak()) {
+ f = 2.0f;
- }
++ }
+ // CraftBukkit end
if (iblockdata.getMaterial() != Material.AIR && f >= 1.0F) {
this.breakBlock(blockposition);
-@@ -150,6 +205,7 @@
+@@ -152,6 +206,7 @@
public void a(BlockPosition blockposition) {
if (blockposition.equals(this.f)) {
@@ -111,7 +111,7 @@
int i = this.currentTick - this.lastDigTick;
IBlockData iblockdata = this.world.getType(blockposition);
-@@ -167,6 +223,10 @@
+@@ -169,6 +224,10 @@
this.j = this.lastDigTick;
}
}
@@ -122,7 +122,7 @@
}
}
-@@ -190,12 +250,75 @@
+@@ -192,12 +251,75 @@
}
public boolean breakBlock(BlockPosition blockposition) {
@@ -199,7 +199,7 @@
if (iblockdata.getBlock() instanceof BlockCommand && !this.player.a(2, "")) {
this.world.notify(blockposition, iblockdata, iblockdata, 3);
return false;
-@@ -240,6 +363,12 @@
+@@ -242,6 +364,12 @@
}
}
@@ -212,7 +212,7 @@
return flag;
}
}
-@@ -280,7 +409,13 @@
+@@ -282,7 +410,13 @@
}
}
@@ -221,12 +221,12 @@
+ public boolean firedInteract = false;
+ // CraftBukkit end
+
- public EnumInteractionResult a(EntityHuman entityhuman, World world, ItemStack itemstack, EnumHand enumhand, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) {
+ public EnumInteractionResult a(EntityHuman entityhuman, World world, @Nullable ItemStack itemstack, EnumHand enumhand, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) {
+ /* CraftBukkit start - whole method
if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) {
TileEntity tileentity = world.getTileEntity(blockposition);
-@@ -329,6 +464,72 @@
+@@ -331,6 +465,72 @@
return itemstack.placeItem(entityhuman, world, blockposition, enumhand, enumdirection, f, f1, f2);
}
}
diff --git a/nms-patches/PlayerInventory.patch b/nms-patches/PlayerInventory.patch
index 00993e86..01e12abb 100644
--- a/nms-patches/PlayerInventory.patch
+++ b/nms-patches/PlayerInventory.patch
@@ -2,7 +2,7 @@
+++ b/net/minecraft/server/PlayerInventory.java
@@ -3,6 +3,14 @@
import java.util.Arrays;
- import java.util.concurrent.Callable;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.List;
@@ -64,7 +64,7 @@
public PlayerInventory(EntityHuman entityhuman) {
this.g = new ItemStack[][] { this.items, this.armor, this.extraSlots};
this.player = entityhuman;
-@@ -35,6 +85,22 @@
+@@ -36,6 +86,22 @@
return itemstack.getItem() == itemstack1.getItem() && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1);
}
@@ -87,7 +87,7 @@
public int getFirstEmptySlotIndex() {
for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] == null) {
-@@ -455,7 +521,7 @@
+@@ -459,7 +525,7 @@
}
public int getMaxStackSize() {
@@ -96,9 +96,9 @@
}
public boolean b(IBlockData iblockdata) {
-@@ -511,6 +577,11 @@
- }
+@@ -516,6 +582,11 @@
+ @Nullable
public ItemStack getCarried() {
+ // CraftBukkit start
+ if (this.carried != null && this.carried.count == 0) {
diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch
index cc18dd76..38b3ee32 100644
--- a/nms-patches/PlayerList.patch
+++ b/nms-patches/PlayerList.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/PlayerList.java
+++ b/net/minecraft/server/PlayerList.java
-@@ -18,6 +18,26 @@
+@@ -19,6 +19,26 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -27,7 +27,7 @@
public abstract class PlayerList {
public static final File a = new File("banned-players.json");
-@@ -27,7 +47,7 @@
+@@ -28,7 +48,7 @@
private static final Logger f = LogManager.getLogger();
private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
private final MinecraftServer server;
@@ -36,7 +36,7 @@
private final Map<UUID, EntityPlayer> j = Maps.newHashMap();
private final GameProfileBanList k;
private final IpBanList l;
-@@ -42,7 +62,15 @@
+@@ -43,7 +63,15 @@
private boolean t;
private int u;
@@ -52,7 +52,7 @@
this.k = new GameProfileBanList(PlayerList.a);
this.l = new IpBanList(PlayerList.b);
this.operators = new OpList(PlayerList.c);
-@@ -62,6 +90,12 @@
+@@ -63,6 +91,12 @@
usercache.a(gameprofile);
NBTTagCompound nbttagcompound = this.a(entityplayer);
@@ -65,7 +65,7 @@
entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension));
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
-@@ -71,7 +105,8 @@
+@@ -72,7 +106,8 @@
s1 = networkmanager.getSocketAddress().toString();
}
@@ -75,7 +75,7 @@
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
WorldData worlddata = worldserver.getWorldData();
BlockPosition blockposition = worldserver.getSpawn();
-@@ -80,6 +115,7 @@
+@@ -81,6 +116,7 @@
PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, entityplayer);
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getDimensionID(), worldserver.getDifficulty(), this.getMaxPlayers(), worlddata.getType(), worldserver.getGameRules().getBoolean("reducedDebugInfo")));
@@ -83,7 +83,7 @@
playerconnection.sendPacket(new PacketPlayOutCustomPayload("MC|Brand", (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
playerconnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition));
-@@ -90,17 +126,23 @@
+@@ -91,17 +127,23 @@
entityplayer.getStatisticManager().updateStatistics(entityplayer);
this.sendScoreboard((ScoreboardServer) worldserver.getScoreboard(), entityplayer);
this.server.aC();
@@ -113,7 +113,7 @@
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.b(entityplayer, worldserver);
if (!this.server.getResourcePack().isEmpty()) {
-@@ -160,6 +202,8 @@
+@@ -161,6 +203,8 @@
}
entityplayer.syncInventory();
@@ -122,7 +122,7 @@
}
public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
-@@ -192,26 +236,27 @@
+@@ -193,26 +237,27 @@
}
public void setPlayerFileData(WorldServer[] aworldserver) {
@@ -155,7 +155,7 @@
}
public void b(WorldBorder worldborder, double d0) {}
-@@ -236,7 +281,7 @@
+@@ -237,7 +282,7 @@
}
public NBTTagCompound a(EntityPlayer entityplayer) {
@@ -164,7 +164,7 @@
NBTTagCompound nbttagcompound1;
if (entityplayer.getName().equals(this.server.Q()) && nbttagcompound != null) {
-@@ -260,28 +305,70 @@
+@@ -261,28 +306,70 @@
}
@@ -241,7 +241,7 @@
this.savePlayerFile(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getVehicle();
-@@ -313,13 +400,61 @@
+@@ -314,13 +401,61 @@
this.o.remove(uuid);
}
@@ -306,7 +306,7 @@
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile);
s = "You are banned from this server!\nReason: " + gameprofilebanentry.getReason();
-@@ -327,10 +462,12 @@
+@@ -328,10 +463,12 @@
s = s + "\nYour ban will be removed on " + PlayerList.g.format(gameprofilebanentry.getExpires());
}
@@ -322,7 +322,7 @@
IpBanEntry ipbanentry = this.l.get(socketaddress);
s = "Your IP address is banned from this server!\nReason: " + ipbanentry.getReason();
-@@ -338,13 +475,25 @@
+@@ -339,13 +476,25 @@
s = s + "\nYour ban will be removed on " + PlayerList.g.format(ipbanentry.getExpires());
}
@@ -351,7 +351,7 @@
UUID uuid = EntityHuman.a(gameprofile);
ArrayList arraylist = Lists.newArrayList();
-@@ -379,17 +528,26 @@
+@@ -380,17 +529,26 @@
}
return new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, (PlayerInteractManager) object);
@@ -379,7 +379,7 @@
entityplayer.dimension = i;
Object object;
-@@ -400,6 +558,11 @@
+@@ -401,6 +559,11 @@
}
EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object);
@@ -391,7 +391,7 @@
entityplayer1.playerConnection = entityplayer.playerConnection;
entityplayer1.copyTo(entityplayer, flag);
-@@ -414,43 +577,156 @@
+@@ -415,43 +578,156 @@
entityplayer1.a(s);
}
@@ -520,7 +520,7 @@
+ Location exit = null;
+ boolean useTravelAgent = false; // don't use agent for custom worlds or return from THE_END
+ if (exitWorld != null) {
-+ entityplayer.cj = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
++ entityplayer.ck = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
+ if ((cause == TeleportCause.END_PORTAL) && (i == 0)) {
+ // THE_END -> NORMAL; use bed if available, otherwise default spawn
+ exit = ((org.bukkit.craftbukkit.entity.CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation();
@@ -566,7 +566,7 @@
public void f(EntityPlayer entityplayer) {
GameProfile gameprofile = entityplayer.getProfile();
int i = this.isOp(gameprofile) ? this.operators.a(gameprofile) : 0;
-@@ -489,12 +765,111 @@
+@@ -490,12 +766,111 @@
}
public void changeWorld(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) {
@@ -678,7 +678,7 @@
if (entity.dimension == -1) {
d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
d1 = MathHelper.a(d1 / d2, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
-@@ -513,6 +888,8 @@
+@@ -514,6 +889,8 @@
BlockPosition blockposition;
if (i == 1) {
@@ -687,7 +687,7 @@
blockposition = worldserver1.getSpawn();
} else {
blockposition = worldserver1.getDimensionSpawn();
-@@ -526,16 +903,27 @@
+@@ -527,16 +904,27 @@
worldserver.entityJoinedWorld(entity, false);
}
}
@@ -718,7 +718,7 @@
worldserver1.entityJoinedWorld(entity, false);
}
-@@ -543,6 +931,7 @@
+@@ -544,6 +932,7 @@
}
entity.spawnIn(worldserver1);
@@ -726,7 +726,7 @@
}
public void tick() {
-@@ -560,6 +949,25 @@
+@@ -561,6 +950,25 @@
}
@@ -752,7 +752,7 @@
public void a(Packet<?> packet, int i) {
for (int j = 0; j < this.players.size(); ++j) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
-@@ -658,11 +1066,23 @@
+@@ -659,11 +1067,23 @@
this.operators.add(new OpListEntry(gameprofile, this.server.q(), this.operators.b(gameprofile)));
this.b(this.a(gameprofile.getId()), i);
@@ -776,7 +776,7 @@
}
private void b(EntityPlayer entityplayer, int i) {
-@@ -687,7 +1107,7 @@
+@@ -688,7 +1108,7 @@
}
public boolean isOp(GameProfile gameprofile) {
@@ -784,8 +784,8 @@
+ return this.operators.d(gameprofile) || this.server.R() && this.server.worlds.get(0).getWorldData().u() && this.server.Q().equalsIgnoreCase(gameprofile.getName()) || this.t; // CraftBukkit
}
- public EntityPlayer getPlayer(String s) {
-@@ -710,6 +1130,12 @@
+ @Nullable
+@@ -712,6 +1132,12 @@
for (int j = 0; j < this.players.size(); ++j) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
@@ -798,7 +798,7 @@
if (entityplayer != entityhuman && entityplayer.dimension == i) {
double d4 = d0 - entityplayer.locX;
double d5 = d1 - entityplayer.locY;
-@@ -757,21 +1183,26 @@
+@@ -759,21 +1185,26 @@
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
@@ -830,7 +830,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
}
-@@ -784,7 +1215,7 @@
+@@ -786,7 +1217,7 @@
}
public String[] getSeenPlayers() {
@@ -839,7 +839,7 @@
}
public boolean getHasWhitelist() {
-@@ -834,16 +1265,26 @@
+@@ -836,16 +1267,26 @@
public void u() {
for (int i = 0; i < this.players.size(); ++i) {
@@ -868,7 +868,7 @@
}
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
-@@ -880,8 +1321,10 @@
+@@ -882,8 +1323,10 @@
WorldServer[] aworldserver = this.server.worldServer;
int j = aworldserver.length;
diff --git a/nms-patches/PortalTravelAgent.patch b/nms-patches/PortalTravelAgent.patch
index 8094e731..d44c9470 100644
--- a/nms-patches/PortalTravelAgent.patch
+++ b/nms-patches/PortalTravelAgent.patch
@@ -1,17 +1,18 @@
--- a/net/minecraft/server/PortalTravelAgent.java
+++ b/net/minecraft/server/PortalTravelAgent.java
-@@ -1,6 +1,10 @@
- package net.minecraft.server;
-
- import com.google.common.collect.Lists;
+@@ -4,6 +4,11 @@
+ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
+ import it.unimi.dsi.fastutil.objects.ObjectIterator;
+ import java.util.Random;
++// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.event.entity.EntityPortalExitEvent;
+import org.bukkit.util.Vector;
-+
- import java.util.Iterator;
- import java.util.List;
- import java.util.Random;
-@@ -27,6 +31,19 @@
++// CraftBukkit end
+
+ public class PortalTravelAgent {
+
+@@ -26,6 +31,19 @@
int i = MathHelper.floor(entity.locX);
int j = MathHelper.floor(entity.locY) - 1;
int k = MathHelper.floor(entity.locZ);
@@ -31,7 +32,7 @@
byte b0 = 1;
byte b1 = 0;
-@@ -43,16 +60,63 @@
+@@ -42,16 +60,63 @@
}
}
@@ -100,8 +101,8 @@
boolean flag1 = true;
Object object = BlockPosition.ZERO;
long k = ChunkCoordIntPair.a(i, j);
-@@ -65,12 +129,12 @@
- portaltravelagent_chunkcoordinatesportal.c = this.world.getTime();
+@@ -64,12 +129,12 @@
+ portaltravelagent_chunkcoordinatesportal.b = this.world.getTime();
flag1 = false;
} else {
- BlockPosition blockposition = new BlockPosition(entity);
@@ -116,9 +117,9 @@
for (BlockPosition blockposition2 = blockposition.a(l, this.world.Z() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) {
blockposition1 = blockposition2.down();
if (this.world.getType(blockposition2).getBlock() == Blocks.PORTAL) {
-@@ -95,6 +159,29 @@
+@@ -93,6 +158,29 @@
+ if (flag1) {
this.c.put(k, new PortalTravelAgent.ChunkCoordinatesPortal((BlockPosition) object, this.world.getTime()));
- this.d.add(Long.valueOf(k));
}
+ // CraftBukkit start - Move entity teleportation logic into exit
+ return (BlockPosition) object;
@@ -146,7 +147,7 @@
double d2 = (double) ((BlockPosition) object).getX() + 0.5D;
double d3 = (double) ((BlockPosition) object).getY() + 0.5D;
-@@ -133,30 +220,59 @@
+@@ -131,30 +219,59 @@
f4 = 1.0F;
}
@@ -224,7 +225,7 @@
int l = i;
int i1 = j;
int j1 = k;
-@@ -181,10 +297,10 @@
+@@ -179,10 +296,10 @@
double d4;
for (i2 = i - b0; i2 <= i + b0; ++i2) {
@@ -237,7 +238,7 @@
label271:
for (k2 = this.world.Z() - 1; k2 >= 0; --k2) {
-@@ -216,7 +332,7 @@
+@@ -214,7 +331,7 @@
}
}
@@ -246,7 +247,7 @@
d4 = d1 * d1 + d3 * d3 + d2 * d2;
if (d0 < 0.0D || d4 < d0) {
d0 = d4;
-@@ -233,10 +349,10 @@
+@@ -231,10 +348,10 @@
if (d0 < 0.0D) {
for (i2 = i - b0; i2 <= i + b0; ++i2) {
@@ -259,7 +260,7 @@
label219:
for (k2 = this.world.Z() - 1; k2 >= 0; --k2) {
-@@ -261,7 +377,7 @@
+@@ -259,7 +376,7 @@
}
}
@@ -268,14 +269,14 @@
d4 = d1 * d1 + d3 * d3 + d2 * d2;
if (d0 < 0.0D || d4 < d0) {
d0 = d4;
-@@ -362,5 +478,10 @@
+@@ -358,5 +475,10 @@
super(blockposition.getX(), blockposition.getY(), blockposition.getZ());
- this.c = i;
+ this.b = i;
}
+
+ @Override
+ public int compareTo(BaseBlockPosition o) {
-+ return this.i(o);
++ return this.l(o);
+ }
}
}
diff --git a/nms-patches/RecipeArmorDye.patch b/nms-patches/RecipeArmorDye.patch
index 2bf96ca8..b48d0e5b 100644
--- a/nms-patches/RecipeArmorDye.patch
+++ b/nms-patches/RecipeArmorDye.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/RecipeArmorDye.java
+++ b/net/minecraft/server/RecipeArmorDye.java
-@@ -3,9 +3,13 @@
- import com.google.common.collect.Lists;
+@@ -4,9 +4,13 @@
import java.util.ArrayList;
+ import javax.annotation.Nullable;
-public class RecipeArmorDye implements IRecipe {
+public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
diff --git a/nms-patches/RecipeBookClone.patch b/nms-patches/RecipeBookClone.patch
index d815fcd2..66e76dc1 100644
--- a/nms-patches/RecipeBookClone.patch
+++ b/nms-patches/RecipeBookClone.patch
@@ -1,13 +1,13 @@
--- a/net/minecraft/server/RecipeBookClone.java
+++ b/net/minecraft/server/RecipeBookClone.java
-@@ -1,8 +1,12 @@
- package net.minecraft.server;
+@@ -2,9 +2,12 @@
+
+ import javax.annotation.Nullable;
-public class RecipeBookClone implements IRecipe {
+public class RecipeBookClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
- public RecipeBookClone() {}
-+ // CraftBukkit start - Delegate to new parent class
+ public RecipeBookClone() {
+ super(new ItemStack(Items.WRITTEN_BOOK, 0, -1), java.util.Arrays.asList(new ItemStack(Items.WRITABLE_BOOK, 0, 0)));
+ }
diff --git a/nms-patches/RecipeFireworks.patch b/nms-patches/RecipeFireworks.patch
index 039e6b5a..7532dc06 100644
--- a/nms-patches/RecipeFireworks.patch
+++ b/nms-patches/RecipeFireworks.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/RecipeFireworks.java
+++ b/net/minecraft/server/RecipeFireworks.java
-@@ -3,11 +3,15 @@
- import com.google.common.collect.Lists;
+@@ -4,11 +4,15 @@
import java.util.ArrayList;
+ import javax.annotation.Nullable;
-public class RecipeFireworks implements IRecipe {
+public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
diff --git a/nms-patches/RecipeMapClone.patch b/nms-patches/RecipeMapClone.patch
index 23496349..2b067463 100644
--- a/nms-patches/RecipeMapClone.patch
+++ b/nms-patches/RecipeMapClone.patch
@@ -1,7 +1,8 @@
--- a/net/minecraft/server/RecipeMapClone.java
+++ b/net/minecraft/server/RecipeMapClone.java
-@@ -1,8 +1,12 @@
- package net.minecraft.server;
+@@ -2,9 +2,13 @@
+
+ import javax.annotation.Nullable;
-public class RecipeMapClone implements IRecipe {
+public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
diff --git a/nms-patches/RecipeRepair.patch b/nms-patches/RecipeRepair.patch
index 1d0f9144..ab7e7331 100644
--- a/nms-patches/RecipeRepair.patch
+++ b/nms-patches/RecipeRepair.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/RecipeRepair.java
+++ b/net/minecraft/server/RecipeRepair.java
-@@ -3,9 +3,13 @@
- import com.google.common.collect.Lists;
+@@ -4,9 +4,13 @@
import java.util.ArrayList;
+ import javax.annotation.Nullable;
-public class RecipeRepair implements IRecipe {
+public class RecipeRepair extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
@@ -16,7 +16,7 @@
public boolean a(InventoryCrafting inventorycrafting, World world) {
ArrayList arraylist = Lists.newArrayList();
-@@ -62,7 +66,17 @@
+@@ -64,7 +68,17 @@
i1 = 0;
}
diff --git a/nms-patches/RecipeTippedArrow.patch b/nms-patches/RecipeTippedArrow.patch
index 8004c18e..dbf39cc1 100644
--- a/nms-patches/RecipeTippedArrow.patch
+++ b/nms-patches/RecipeTippedArrow.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/RecipeTippedArrow.java
+++ b/net/minecraft/server/RecipeTippedArrow.java
-@@ -2,11 +2,19 @@
-
+@@ -3,11 +3,19 @@
import java.util.Collection;
+ import javax.annotation.Nullable;
-class RecipeTippedArrow implements IRecipe {
+class RecipeTippedArrow extends ShapedRecipes implements IRecipe { // CraftBukkit
diff --git a/nms-patches/RecipesBanner.patch b/nms-patches/RecipesBanner.patch
index 8e1e1e25..0afc40e2 100644
--- a/nms-patches/RecipesBanner.patch
+++ b/nms-patches/RecipesBanner.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/RecipesBanner.java
+++ b/net/minecraft/server/RecipesBanner.java
-@@ -20,9 +20,13 @@
+@@ -22,9 +22,13 @@
static class SyntheticClass_1 { }
@@ -16,7 +16,7 @@
public boolean a(InventoryCrafting inventorycrafting, World world) {
boolean flag = false;
-@@ -210,9 +214,13 @@
+@@ -215,9 +219,13 @@
}
}
diff --git a/nms-patches/RecipesFurnace.patch b/nms-patches/RecipesFurnace.patch
index f166bfb8..14adefbe 100644
--- a/nms-patches/RecipesFurnace.patch
+++ b/nms-patches/RecipesFurnace.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/RecipesFurnace.java
+++ b/net/minecraft/server/RecipesFurnace.java
-@@ -9,7 +9,9 @@
+@@ -10,7 +10,9 @@
private static final RecipesFurnace a = new RecipesFurnace();
public Map<ItemStack, ItemStack> recipes = Maps.newHashMap();
@@ -11,7 +11,7 @@
public static RecipesFurnace getInstance() {
return RecipesFurnace.a;
-@@ -54,6 +56,12 @@
+@@ -55,6 +57,12 @@
this.registerRecipe(Blocks.QUARTZ_ORE, new ItemStack(Items.QUARTZ), 0.2F);
}
@@ -24,9 +24,9 @@
public void registerRecipe(Block block, ItemStack itemstack, float f) {
this.a(Item.getItemOf(block), itemstack, f);
}
-@@ -68,13 +76,23 @@
- }
+@@ -70,13 +78,23 @@
+ @Nullable
public ItemStack getResult(ItemStack itemstack) {
- Iterator iterator = this.recipes.entrySet().iterator();
+ // CraftBukkit start - initialize to customRecipes
@@ -50,7 +50,7 @@
}
entry = (Entry) iterator.next();
-@@ -92,13 +110,23 @@
+@@ -94,13 +112,23 @@
}
public float b(ItemStack itemstack) {
diff --git a/nms-patches/RecipiesShield.patch b/nms-patches/RecipiesShield.patch
index d1ef9efe..827907a0 100644
--- a/nms-patches/RecipiesShield.patch
+++ b/nms-patches/RecipiesShield.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/RecipiesShield.java
+++ b/net/minecraft/server/RecipiesShield.java
-@@ -11,9 +11,13 @@
+@@ -13,9 +13,13 @@
static class SyntheticClass_1 { }
diff --git a/nms-patches/ShapedRecipes.patch b/nms-patches/ShapedRecipes.patch
index 699a2afe..d76aa390 100644
--- a/nms-patches/ShapedRecipes.patch
+++ b/nms-patches/ShapedRecipes.patch
@@ -1,17 +1,17 @@
--- a/net/minecraft/server/ShapedRecipes.java
+++ b/net/minecraft/server/ShapedRecipes.java
-@@ -1,5 +1,10 @@
+@@ -1,6 +1,10 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
+// CraftBukkit end
-+
+
public class ShapedRecipes implements IRecipe {
- private final int width;
-@@ -15,6 +20,62 @@
+@@ -17,6 +21,62 @@
this.result = itemstack;
}
@@ -71,6 +71,6 @@
+ }
+ // CraftBukkit end
+
+ @Nullable
public ItemStack b() {
return this.result;
- }
diff --git a/nms-patches/ShapelessRecipes.patch b/nms-patches/ShapelessRecipes.patch
index 0ed46af4..eee448a9 100644
--- a/nms-patches/ShapelessRecipes.patch
+++ b/nms-patches/ShapelessRecipes.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/ShapelessRecipes.java
+++ b/net/minecraft/server/ShapelessRecipes.java
-@@ -5,6 +5,11 @@
- import java.util.Iterator;
+@@ -6,6 +6,11 @@
import java.util.List;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
@@ -12,7 +12,7 @@
public class ShapelessRecipes implements IRecipe {
private final ItemStack result;
-@@ -15,6 +20,20 @@
+@@ -16,6 +21,20 @@
this.ingredients = list;
}
@@ -30,6 +30,6 @@
+ }
+ // CraftBukkit end
+
+ @Nullable
public ItemStack b() {
return this.result;
- }
diff --git a/nms-patches/Slot.patch b/nms-patches/Slot.patch
index a9b73d5c..31176516 100644
--- a/nms-patches/Slot.patch
+++ b/nms-patches/Slot.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/Slot.java
+++ b/net/minecraft/server/Slot.java
-@@ -45,6 +45,9 @@
+@@ -48,6 +48,9 @@
}
public boolean hasItem() {
diff --git a/nms-patches/SlotFurnaceResult.patch b/nms-patches/SlotFurnaceResult.patch
index cb27c684..dc7854fc 100644
--- a/nms-patches/SlotFurnaceResult.patch
+++ b/nms-patches/SlotFurnaceResult.patch
@@ -1,17 +1,17 @@
--- a/net/minecraft/server/SlotFurnaceResult.java
+++ b/net/minecraft/server/SlotFurnaceResult.java
-@@ -1,5 +1,10 @@
+@@ -1,6 +1,10 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.FurnaceExtractEvent;
+// CraftBukkit end
-+
+
public class SlotFurnaceResult extends Slot {
- private EntityHuman a;
-@@ -50,6 +55,18 @@
+@@ -52,6 +56,18 @@
i = j;
}
diff --git a/nms-patches/SpawnerCreature.patch b/nms-patches/SpawnerCreature.patch
index e9dea5c1..6f882655 100644
--- a/nms-patches/SpawnerCreature.patch
+++ b/nms-patches/SpawnerCreature.patch
@@ -36,9 +36,9 @@
+ if (!this.b.contains(chunkCoords)) {
++i;
- if (!flag3 && worldserver.getWorldBorder().isInBounds(chunkcoordintpair)) {
-- PlayerChunk playerchunk = worldserver.getPlayerChunkMap().b(chunkcoordintpair.x, chunkcoordintpair.z);
+- PlayerChunk playerchunk = worldserver.getPlayerChunkMap().getChunk(chunkcoordintpair.x, chunkcoordintpair.z);
+ if (!flag3 && worldserver.getWorldBorder().isInBounds(i1 + l, k + j)) { // CraftBukkit
-+ PlayerChunk playerchunk = worldserver.getPlayerChunkMap().b(i1 + l, k + j); // CraftBukkit
++ PlayerChunk playerchunk = worldserver.getPlayerChunkMap().getChunk(i1 + l, k + j); // CraftBukkit
if (playerchunk != null && playerchunk.e()) {
- this.b.add(chunkcoordintpair);
diff --git a/nms-patches/StructureGenerator.patch b/nms-patches/StructureGenerator.patch
index 36a0ca71..72129e0e 100644
--- a/nms-patches/StructureGenerator.patch
+++ b/nms-patches/StructureGenerator.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/StructureGenerator.java
+++ b/net/minecraft/server/StructureGenerator.java
-@@ -94,7 +94,7 @@
+@@ -93,7 +93,7 @@
return this.c(blockposition) != null;
}
@@ -9,7 +9,7 @@
Iterator iterator = this.c.values().iterator();
while (iterator.hasNext()) {
-@@ -116,7 +116,7 @@
+@@ -115,7 +115,7 @@
return null;
}
@@ -18,7 +18,7 @@
this.a(world);
Iterator iterator = this.c.values().iterator();
-@@ -133,7 +133,7 @@
+@@ -132,7 +132,7 @@
return true;
}
@@ -27,7 +27,7 @@
this.g = world;
this.a(world);
this.f.setSeed(world.getSeed());
-@@ -195,7 +195,7 @@
+@@ -194,7 +194,7 @@
return null;
}
diff --git a/nms-patches/TileEntity.patch b/nms-patches/TileEntity.patch
index 0086c128..6eac3cf7 100644
--- a/nms-patches/TileEntity.patch
+++ b/nms-patches/TileEntity.patch
@@ -9,7 +9,7 @@
public abstract class TileEntity {
private static final Logger a = LogManager.getLogger();
-@@ -234,4 +236,13 @@
+@@ -244,4 +246,13 @@
a(TileEntityEndGateway.class, "EndGateway");
a(TileEntityCommand.class, "Control");
}
diff --git a/nms-patches/TileEntityBanner.patch b/nms-patches/TileEntityBanner.patch
index d22bca51..0819ccae 100644
--- a/nms-patches/TileEntityBanner.patch
+++ b/nms-patches/TileEntityBanner.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/TileEntityBanner.java
+++ b/net/minecraft/server/TileEntityBanner.java
-@@ -20,6 +20,11 @@
+@@ -21,6 +21,11 @@
if (nbttagcompound.hasKey("Patterns")) {
this.patterns = (NBTTagList) nbttagcompound.getList("Patterns", 10).clone();
@@ -12,7 +12,7 @@
}
if (nbttagcompound.hasKeyOfType("Base", 99)) {
-@@ -54,6 +59,11 @@
+@@ -56,6 +61,11 @@
super.a(nbttagcompound);
this.color = nbttagcompound.getInt("Base");
this.patterns = nbttagcompound.getList("Patterns", 10);
diff --git a/nms-patches/TileEntityBeacon.patch b/nms-patches/TileEntityBeacon.patch
index f60dcd39..8133ba4c 100644
--- a/nms-patches/TileEntityBeacon.patch
+++ b/nms-patches/TileEntityBeacon.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/TileEntityBeacon.java
+++ b/net/minecraft/server/TileEntityBeacon.java
-@@ -8,6 +8,11 @@
- import java.util.List;
+@@ -9,6 +9,11 @@
import java.util.Set;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
@@ -12,7 +12,7 @@
public class TileEntityBeacon extends TileEntityContainer implements ITickable, IWorldInventory {
public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffects.FASTER_MOVEMENT, MobEffects.FASTER_DIG}, { MobEffects.RESISTANCE, MobEffects.JUMP}, { MobEffects.INCREASE_DAMAGE}, { MobEffects.REGENERATION}};
-@@ -19,6 +24,30 @@
+@@ -22,6 +27,30 @@
private MobEffectList m;
private ItemStack inventorySlot;
private String o;
diff --git a/nms-patches/TileEntityBrewingStand.patch b/nms-patches/TileEntityBrewingStand.patch
index 09127560..f2172667 100644
--- a/nms-patches/TileEntityBrewingStand.patch
+++ b/nms-patches/TileEntityBrewingStand.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/TileEntityBrewingStand.java
+++ b/net/minecraft/server/TileEntityBrewingStand.java
-@@ -2,6 +2,13 @@
-
+@@ -3,6 +3,13 @@
import java.util.Arrays;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.List;
@@ -14,7 +14,7 @@
public class TileEntityBrewingStand extends TileEntityContainer implements ITickable, IWorldInventory {
private static final int[] a = new int[] { 3};
-@@ -13,9 +20,35 @@
+@@ -14,9 +21,35 @@
private Item k;
private String l;
private int m;
@@ -50,7 +50,7 @@
public String getName() {
return this.hasCustomName() ? this.l : "container.brewing";
}
-@@ -46,9 +79,14 @@
+@@ -47,9 +80,14 @@
boolean flag = this.n();
boolean flag1 = this.brewTime > 0;
@@ -67,7 +67,7 @@
if (flag2 && flag) {
this.o();
-@@ -124,6 +162,15 @@
+@@ -125,6 +163,15 @@
private void o() {
ItemStack itemstack = this.items[3];
@@ -83,7 +83,7 @@
for (int i = 0; i < 3; ++i) {
this.items[i] = PotionBrewer.d(itemstack, this.items[i]);
-@@ -216,7 +263,7 @@
+@@ -221,7 +268,7 @@
}
public int getMaxStackSize() {
diff --git a/nms-patches/TileEntityChest.patch b/nms-patches/TileEntityChest.patch
index 10401b5a..f1f72a34 100644
--- a/nms-patches/TileEntityChest.patch
+++ b/nms-patches/TileEntityChest.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/TileEntityChest.java
+++ b/net/minecraft/server/TileEntityChest.java
-@@ -3,6 +3,11 @@
- import java.util.Iterator;
+@@ -4,6 +4,11 @@
import java.util.List;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
@@ -12,7 +12,7 @@
public class TileEntityChest extends TileEntityLootable implements ITickable, IInventory {
private ItemStack[] items = new ItemStack[27];
-@@ -20,6 +25,31 @@
+@@ -21,6 +26,31 @@
public TileEntityChest() {}
@@ -44,7 +44,7 @@
public TileEntityChest(BlockChest.Type blockchest_type) {
this.q = blockchest_type;
}
-@@ -118,10 +148,11 @@
+@@ -123,10 +153,11 @@
}
public int getMaxStackSize() {
@@ -57,7 +57,7 @@
return this.world.getTileEntity(this.position) != this ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D;
}
-@@ -297,9 +328,21 @@
+@@ -303,9 +334,21 @@
if (this.l < 0) {
this.l = 0;
}
@@ -79,7 +79,7 @@
this.world.applyPhysics(this.position, this.getBlock());
this.world.applyPhysics(this.position.down(), this.getBlock());
}
-@@ -308,8 +351,20 @@
+@@ -314,8 +357,20 @@
public void closeContainer(EntityHuman entityhuman) {
if (!entityhuman.isSpectator() && this.getBlock() instanceof BlockChest) {
@@ -100,7 +100,7 @@
this.world.applyPhysics(this.position, this.getBlock());
this.world.applyPhysics(this.position.down(), this.getBlock());
}
-@@ -366,6 +421,13 @@
+@@ -372,6 +427,13 @@
}
diff --git a/nms-patches/TileEntityCommand.patch b/nms-patches/TileEntityCommand.patch
index 04405163..c31a6b81 100644
--- a/nms-patches/TileEntityCommand.patch
+++ b/nms-patches/TileEntityCommand.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/TileEntityCommand.java
+++ b/net/minecraft/server/TileEntityCommand.java
-@@ -7,6 +7,9 @@
+@@ -9,6 +9,9 @@
private boolean g;
private boolean h;
private final CommandBlockListenerAbstract i = new CommandBlockListenerAbstract() {
diff --git a/nms-patches/TileEntityContainer.patch b/nms-patches/TileEntityContainer.patch
index 4d49bebb..3484ee4f 100644
--- a/nms-patches/TileEntityContainer.patch
+++ b/nms-patches/TileEntityContainer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/TileEntityContainer.java
+++ b/net/minecraft/server/TileEntityContainer.java
-@@ -36,4 +36,11 @@
+@@ -37,4 +37,11 @@
public IChatBaseComponent getScoreboardDisplayName() {
return (IChatBaseComponent) (this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatMessage(this.getName(), new Object[0]));
}
diff --git a/nms-patches/TileEntityDispenser.patch b/nms-patches/TileEntityDispenser.patch
index 3f950c83..1c73bbd0 100644
--- a/nms-patches/TileEntityDispenser.patch
+++ b/nms-patches/TileEntityDispenser.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/TileEntityDispenser.java
+++ b/net/minecraft/server/TileEntityDispenser.java
-@@ -2,12 +2,44 @@
-
+@@ -3,12 +3,44 @@
import java.util.Random;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.List;
@@ -45,7 +45,7 @@
public TileEntityDispenser() {}
public int getSize() {
-@@ -42,6 +74,7 @@
+@@ -46,6 +78,7 @@
for (int k = 0; k < this.items.length; ++k) {
if (this.items[k] != null && TileEntityDispenser.f.nextInt(j++) == 0) {
@@ -53,7 +53,7 @@
i = k;
}
}
-@@ -130,7 +163,7 @@
+@@ -135,7 +168,7 @@
}
public int getMaxStackSize() {
diff --git a/nms-patches/TileEntityEndGateway.patch b/nms-patches/TileEntityEndGateway.patch
index 750c0f2a..cb6f07d7 100644
--- a/nms-patches/TileEntityEndGateway.patch
+++ b/nms-patches/TileEntityEndGateway.patch
@@ -1,29 +1,21 @@
--- a/net/minecraft/server/TileEntityEndGateway.java
+++ b/net/minecraft/server/TileEntityEndGateway.java
-@@ -5,14 +5,18 @@
- import java.util.Random;
+@@ -6,6 +6,12 @@
+ import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
++// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.event.player.PlayerTeleportEvent;
++// CraftBukkit end
public class TileEntityEndGateway extends TileEntity implements ITickable {
- private static final Logger a = LogManager.getLogger();
- private long f = 0L;
- private int g = 0;
-- private BlockPosition h;
-- private boolean i;
-+ public BlockPosition h; // PAIL private to public
-+ public boolean i; // PAIL private to public
-
- public TileEntityEndGateway() {}
-
-@@ -103,6 +107,26 @@
- if (this.h != null) {
- BlockPosition blockposition = this.i ? this.h : this.j();
+@@ -107,6 +113,26 @@
+ if (this.exitPortal != null) {
+ BlockPosition blockposition = this.exactTeleport ? this.exitPortal : this.k();
+ // CraftBukkit start - Fire PlayerTeleportEvent
+ if (entity instanceof EntityPlayer) {
@@ -39,7 +31,7 @@
+ }
+
+ ((EntityPlayer) entity).playerConnection.teleport(teleEvent.getTo());
-+ this.h();
++ this.i();
+ return;
+
+ }
diff --git a/nms-patches/TileEntityFurnace.patch b/nms-patches/TileEntityFurnace.patch
index 39fba988..7b265b96 100644
--- a/nms-patches/TileEntityFurnace.patch
+++ b/nms-patches/TileEntityFurnace.patch
@@ -1,8 +1,9 @@
--- a/net/minecraft/server/TileEntityFurnace.java
+++ b/net/minecraft/server/TileEntityFurnace.java
-@@ -1,5 +1,15 @@
+@@ -1,6 +1,15 @@
package net.minecraft.server;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.List;
+
@@ -12,11 +13,10 @@
+import org.bukkit.event.inventory.FurnaceSmeltEvent;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+// CraftBukkit end
-+
+
public class TileEntityFurnace extends TileEntityContainer implements ITickable, IWorldInventory {
- private static final int[] a = new int[] { 0};
-@@ -12,6 +22,32 @@
+@@ -14,6 +23,32 @@
private int cookTimeTotal;
private String m;
@@ -49,7 +49,7 @@
public TileEntityFurnace() {}
public int getSize() {
-@@ -116,11 +152,29 @@
+@@ -122,11 +157,29 @@
}
public void c() {
@@ -81,7 +81,7 @@
}
if (!this.world.isClientSide) {
-@@ -129,9 +183,21 @@
+@@ -135,9 +188,21 @@
this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.cookTimeTotal);
}
} else {
@@ -106,7 +106,7 @@
flag1 = true;
if (this.items[1] != null) {
--this.items[1].count;
-@@ -144,6 +210,7 @@
+@@ -150,6 +215,7 @@
}
}
@@ -114,7 +114,7 @@
if (this.isBurning() && this.canBurn()) {
++this.cookTime;
if (this.cookTime == this.cookTimeTotal) {
-@@ -155,11 +222,13 @@
+@@ -161,11 +227,13 @@
} else {
this.cookTime = 0;
}
@@ -128,7 +128,7 @@
}
}
-@@ -179,7 +248,8 @@
+@@ -185,7 +253,8 @@
} else {
ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0]);
@@ -138,7 +138,7 @@
}
}
-@@ -187,11 +257,38 @@
+@@ -193,11 +262,38 @@
if (this.canBurn()) {
ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0]);
diff --git a/nms-patches/TileEntityHopper.patch b/nms-patches/TileEntityHopper.patch
index 9e6e3a18..14489afc 100644
--- a/nms-patches/TileEntityHopper.patch
+++ b/nms-patches/TileEntityHopper.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/TileEntityHopper.java
+++ b/net/minecraft/server/TileEntityHopper.java
-@@ -3,12 +3,46 @@
- import java.util.Iterator;
+@@ -4,12 +4,46 @@
import java.util.List;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
@@ -47,7 +47,7 @@
public TileEntityHopper() {}
public void a(NBTTagCompound nbttagcompound) {
-@@ -100,7 +134,7 @@
+@@ -105,7 +139,7 @@
}
public int getMaxStackSize() {
@@ -56,7 +56,7 @@
}
public boolean a(EntityHuman entityhuman) {
-@@ -196,10 +230,35 @@
+@@ -201,10 +235,35 @@
for (int i = 0; i < this.getSize(); ++i) {
if (this.getItem(i) != null) {
ItemStack itemstack = this.getItem(i).cloneItemStack();
@@ -94,7 +94,7 @@
return true;
}
-@@ -310,10 +369,41 @@
+@@ -315,10 +374,41 @@
if (itemstack != null && b(iinventory, itemstack, i, enumdirection)) {
ItemStack itemstack1 = itemstack.cloneItemStack();
@@ -138,7 +138,7 @@
return true;
}
-@@ -329,6 +419,13 @@
+@@ -334,6 +424,13 @@
if (entityitem == null) {
return false;
} else {
diff --git a/nms-patches/TileEntityNote.patch b/nms-patches/TileEntityNote.patch
index a702d495..c7f003e0 100644
--- a/nms-patches/TileEntityNote.patch
+++ b/nms-patches/TileEntityNote.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/TileEntityNote.java
+++ b/net/minecraft/server/TileEntityNote.java
-@@ -46,7 +46,12 @@
+@@ -47,7 +47,12 @@
b0 = 4;
}
diff --git a/nms-patches/TileEntityPiston.patch b/nms-patches/TileEntityPiston.patch
index 5b4302d0..0616921b 100644
--- a/nms-patches/TileEntityPiston.patch
+++ b/nms-patches/TileEntityPiston.patch
@@ -7,4 +7,4 @@
+ if (this.world == null) return; // CraftBukkit
this.j = this.i;
if (this.j >= 1.0F) {
- this.i();
+ this.j();
diff --git a/nms-patches/TileEntitySign.patch b/nms-patches/TileEntitySign.patch
index 7f6f556f..aa6f54d4 100644
--- a/nms-patches/TileEntitySign.patch
+++ b/nms-patches/TileEntitySign.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/TileEntitySign.java
+++ b/net/minecraft/server/TileEntitySign.java
-@@ -19,6 +19,12 @@
+@@ -21,6 +21,12 @@
nbttagcompound.setString("Text" + (i + 1), s);
}
@@ -11,9 +11,9 @@
+ // CraftBukkit end
+
this.i.b(nbttagcompound);
+ return nbttagcompound;
}
-
-@@ -67,14 +73,34 @@
+@@ -70,14 +76,34 @@
}
};
@@ -52,7 +52,7 @@
}
}
-@@ -159,7 +185,14 @@
+@@ -164,7 +190,14 @@
ChatClickable chatclickable = chatmodifier.h();
if (chatclickable.a() == ChatClickable.EnumClickAction.RUN_COMMAND) {
diff --git a/nms-patches/TileEntitySkull.patch b/nms-patches/TileEntitySkull.patch
index 3cf99060..0ca418a4 100644
--- a/nms-patches/TileEntitySkull.patch
+++ b/nms-patches/TileEntitySkull.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/TileEntitySkull.java
+++ b/net/minecraft/server/TileEntitySkull.java
-@@ -130,4 +130,10 @@
+@@ -135,4 +135,10 @@
public void setRotation(int i) {
this.rotation = i;
}
diff --git a/nms-patches/UserCache.patch b/nms-patches/UserCache.patch
index 622bff44..628fe721 100644
--- a/nms-patches/UserCache.patch
+++ b/nms-patches/UserCache.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/UserCache.java
+++ b/net/minecraft/server/UserCache.java
-@@ -44,7 +44,7 @@
+@@ -45,7 +45,7 @@
private static boolean c;
private final Map<String, UserCache.UserCacheEntry> d = Maps.newHashMap();
private final Map<UUID, UserCache.UserCacheEntry> e = Maps.newHashMap();
@@ -9,7 +9,7 @@
private final GameProfileRepository g;
protected final Gson b;
private final File h;
-@@ -335,11 +335,11 @@
+@@ -336,11 +336,11 @@
}
}
diff --git a/nms-patches/VillageSiege.patch b/nms-patches/VillageSiege.patch
index 626a008a..811d9f73 100644
--- a/nms-patches/VillageSiege.patch
+++ b/nms-patches/VillageSiege.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/VillageSiege.java
+++ b/net/minecraft/server/VillageSiege.java
-@@ -140,7 +140,7 @@
+@@ -141,7 +141,7 @@
}
entityzombie.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, this.a.random.nextFloat() * 360.0F, 0.0F);
diff --git a/nms-patches/World.patch b/nms-patches/World.patch
index f2550a55..1f3acb14 100644
--- a/nms-patches/World.patch
+++ b/nms-patches/World.patch
@@ -2,7 +2,7 @@
+++ b/net/minecraft/server/World.java
@@ -13,6 +13,21 @@
import java.util.UUID;
- import java.util.concurrent.Callable;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import com.google.common.collect.Maps;
@@ -63,7 +63,7 @@
+ }
+
+ public Chunk getChunkIfLoaded(int x, int z) {
-+ return ((ChunkProviderServer) this.chunkProvider).getChunkIfLoaded(x, z);
++ return ((ChunkProviderServer) this.chunkProvider).getLoadedChunkAt(x, z);
+ }
+
+ protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
@@ -112,12 +112,7 @@
}
public World b() {
-@@ -193,10 +282,31 @@
- }
-
- public Chunk getChunkAt(int i, int j) {
-- return this.chunkProvider.getChunkAt(i, j);
-+ return this.chunkProvider.getOrCreateChunkFast(i, j); // CraftBukkit
+@@ -202,6 +291,27 @@
}
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
@@ -142,10 +137,10 @@
+ return true;
+ }
+ // CraftBukkit end
- if (!this.isValidLocation(blockposition)) {
+ if (this.E(blockposition)) {
return false;
} else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
-@@ -204,9 +314,23 @@
+@@ -209,9 +319,23 @@
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
Block block = iblockdata.getBlock();
@@ -169,7 +164,7 @@
return false;
} else {
if (iblockdata.c() != iblockdata1.c() || iblockdata.d() != iblockdata1.d()) {
-@@ -215,6 +339,7 @@
+@@ -220,6 +344,7 @@
this.methodProfiler.b();
}
@@ -177,7 +172,7 @@
if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && chunk.isReady()) {
this.notify(blockposition, iblockdata1, iblockdata, i);
}
-@@ -225,12 +350,35 @@
+@@ -230,12 +355,35 @@
this.updateAdjacentComparators(blockposition, block);
}
}
@@ -213,7 +208,7 @@
public boolean setAir(BlockPosition blockposition) {
return this.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
}
-@@ -264,6 +412,11 @@
+@@ -269,6 +417,11 @@
public void update(BlockPosition blockposition, Block block) {
if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
@@ -225,7 +220,7 @@
this.applyPhysics(blockposition, block);
}
-@@ -339,6 +492,17 @@
+@@ -344,6 +497,17 @@
IBlockData iblockdata = this.getType(blockposition);
try {
@@ -240,10 +235,10 @@
+ }
+ }
+ // CraftBukkit end
- iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block);
+ iblockdata.doPhysics(this, blockposition, block);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
-@@ -520,6 +684,17 @@
+@@ -526,6 +690,17 @@
}
public IBlockData getType(BlockPosition blockposition) {
@@ -258,10 +253,10 @@
+ }
+ }
+ // CraftBukkit end
- if (!this.isValidLocation(blockposition)) {
+ if (this.E(blockposition)) {
return Blocks.AIR.getBlockData();
} else {
-@@ -715,6 +890,13 @@
+@@ -724,6 +899,13 @@
}
public boolean addEntity(Entity entity) {
@@ -275,7 +270,7 @@
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
boolean flag = entity.attachedToPlayer;
-@@ -723,6 +905,34 @@
+@@ -732,6 +914,34 @@
flag = true;
}
@@ -310,7 +305,7 @@
if (!flag && !this.isChunkLoaded(i, j, false)) {
return false;
} else {
-@@ -745,6 +955,7 @@
+@@ -754,6 +964,7 @@
((IWorldAccess) this.u.get(i)).a(entity);
}
@@ -318,7 +313,7 @@
}
protected void c(Entity entity) {
-@@ -752,6 +963,7 @@
+@@ -761,6 +972,7 @@
((IWorldAccess) this.u.get(i)).b(entity);
}
@@ -326,7 +321,7 @@
}
public void kill(Entity entity) {
-@@ -787,7 +999,15 @@
+@@ -796,7 +1008,15 @@
this.getChunkAt(i, j).b(entity);
}
@@ -343,7 +338,7 @@
this.c(entity);
}
-@@ -1039,6 +1259,11 @@
+@@ -1044,6 +1264,11 @@
for (i = 0; i < this.j.size(); ++i) {
entity = (Entity) this.j.get(i);
@@ -355,7 +350,7 @@
try {
++entity.ticksLived;
-@@ -1087,8 +1312,10 @@
+@@ -1092,8 +1317,10 @@
CrashReportSystemDetails crashreportsystemdetails1;
CrashReport crashreport1;
@@ -365,10 +360,10 @@
+ for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) {
+ entity = (Entity) this.entityList.get(this.tickPosition);
+ // CraftBukkit end
- Entity entity1 = entity.by();
+ Entity entity1 = entity.bz();
if (entity1 != null) {
-@@ -1121,7 +1348,7 @@
+@@ -1126,7 +1353,7 @@
this.getChunkAt(j, l).b(entity);
}
@@ -377,7 +372,7 @@
this.c(entity);
}
-@@ -1130,6 +1357,13 @@
+@@ -1135,6 +1362,13 @@
this.methodProfiler.c("blockEntities");
this.M = true;
@@ -391,7 +386,7 @@
Iterator iterator = this.tileEntityListTick.iterator();
while (iterator.hasNext()) {
-@@ -1140,7 +1374,7 @@
+@@ -1145,7 +1379,7 @@
if (this.isLoaded(blockposition) && this.N.a(blockposition)) {
try {
@@ -400,7 +395,7 @@
((ITickable) tileentity).c();
this.methodProfiler.b();
} catch (Throwable throwable2) {
-@@ -1162,11 +1396,13 @@
+@@ -1167,11 +1401,13 @@
}
this.M = false;
@@ -414,7 +409,7 @@
this.methodProfiler.c("pendingBlockEntities");
if (!this.b.isEmpty()) {
-@@ -1174,9 +1410,11 @@
+@@ -1179,9 +1415,11 @@
TileEntity tileentity1 = (TileEntity) this.b.get(i1);
if (!tileentity1.x()) {
@@ -426,7 +421,7 @@
if (this.isLoaded(tileentity1.getPosition())) {
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
-@@ -1184,6 +1422,12 @@
+@@ -1189,6 +1427,12 @@
chunk.a(tileentity1.getPosition(), tileentity1);
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
@@ -439,7 +434,7 @@
}
}
}
-@@ -1231,7 +1475,10 @@
+@@ -1236,7 +1480,10 @@
int j = MathHelper.floor(entity.locZ);
byte b0 = 32;
@@ -451,14 +446,14 @@
entity.M = entity.locX;
entity.N = entity.locY;
entity.O = entity.locZ;
-@@ -1570,10 +1817,18 @@
+@@ -1575,11 +1822,18 @@
}
}
+ public Map<BlockPosition, TileEntity> capturedTileEntities = Maps.newHashMap();
-+
+ @Nullable
public TileEntity getTileEntity(BlockPosition blockposition) {
- if (!this.isValidLocation(blockposition)) {
+ if (this.E(blockposition)) {
return null;
} else {
+ // CraftBukkit start
@@ -468,12 +463,12 @@
+ // CraftBukkit end
+
TileEntity tileentity = null;
- int i;
- TileEntity tileentity1;
-@@ -1608,6 +1863,14 @@
- public void setTileEntity(BlockPosition blockposition, TileEntity tileentity) {
- if (tileentity != null && !tileentity.x()) {
+ if (this.M) {
+@@ -1614,6 +1868,14 @@
+ public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
+ if (!this.E(blockposition)) {
+ if (tileentity != null && !tileentity.x()) {
+ // CraftBukkit start
+ if (captureBlockStates) {
+ tileentity.a(this);
@@ -482,10 +477,10 @@
+ return;
+ }
+ // CraftBukkit end
- if (this.M) {
- tileentity.a(blockposition);
- Iterator iterator = this.b.iterator();
-@@ -1762,6 +2025,14 @@
+ if (this.M) {
+ tileentity.a(blockposition);
+ Iterator iterator = this.b.iterator();
+@@ -1769,6 +2031,14 @@
}
this.o = MathHelper.a(this.o, 0.0F, 1.0F);
@@ -500,7 +495,7 @@
}
}
}
-@@ -1893,7 +2164,10 @@
+@@ -1900,7 +2170,10 @@
}
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
@@ -512,7 +507,7 @@
return false;
} else {
int i = 0;
-@@ -2058,7 +2332,7 @@
+@@ -2067,7 +2340,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -521,7 +516,7 @@
arraylist.add(entity);
}
}
-@@ -2073,7 +2347,7 @@
+@@ -2082,7 +2355,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -530,7 +525,7 @@
arraylist.add(entity);
}
}
-@@ -2121,7 +2395,7 @@
+@@ -2131,7 +2404,7 @@
}
}
@@ -538,8 +533,8 @@
+ return (T) entity; // CraftBukkit fix decompile error
}
- public Entity getEntity(int i) {
-@@ -2141,8 +2415,17 @@
+ @Nullable
+@@ -2152,8 +2425,17 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -559,7 +554,7 @@
++i;
}
}
-@@ -2151,12 +2434,18 @@
+@@ -2162,12 +2444,18 @@
}
public void a(Collection<Entity> collection) {
@@ -579,7 +574,7 @@
this.b(entity);
}
-@@ -2170,7 +2459,13 @@
+@@ -2181,7 +2469,13 @@
IBlockData iblockdata = this.getType(blockposition);
AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().d(this, blockposition);
@@ -594,7 +589,7 @@
}
public int K() {
-@@ -2270,6 +2565,11 @@
+@@ -2284,6 +2578,11 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@@ -606,7 +601,7 @@
if ((IEntitySelector.d.apply(entityhuman1) || !flag) && (IEntitySelector.e.apply(entityhuman1) || flag)) {
double d5 = entityhuman1.e(d0, d1, d2);
-@@ -2433,6 +2733,16 @@
+@@ -2452,6 +2751,16 @@
public void everyoneSleeping() {}
@@ -623,7 +618,7 @@
public float h(float f) {
return (this.p + (this.q - this.p) * f) * this.j(f);
}
-@@ -2648,7 +2958,7 @@
+@@ -2669,7 +2978,7 @@
int l = j * 16 + 8 - blockposition.getZ();
short short0 = 128;
diff --git a/nms-patches/WorldData.patch b/nms-patches/WorldData.patch
index 6c9b12c9..7fb47311 100644
--- a/nms-patches/WorldData.patch
+++ b/nms-patches/WorldData.patch
@@ -3,7 +3,7 @@
@@ -5,6 +5,11 @@
import java.util.Map;
import java.util.Map.Entry;
- import java.util.concurrent.Callable;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.event.weather.ThunderChangeEvent;
diff --git a/nms-patches/WorldManager.patch b/nms-patches/WorldManager.patch
index 606d551e..98623a14 100644
--- a/nms-patches/WorldManager.patch
+++ b/nms-patches/WorldManager.patch
@@ -1,16 +1,16 @@
--- a/net/minecraft/server/WorldManager.java
+++ b/net/minecraft/server/WorldManager.java
-@@ -32,7 +32,8 @@
+@@ -33,7 +33,8 @@
}
- public void a(EntityHuman entityhuman, SoundEffect soundeffect, SoundCategory soundcategory, double d0, double d1, double d2, float f, float f1) {
+ public void a(@Nullable EntityHuman entityhuman, SoundEffect soundeffect, SoundCategory soundcategory, double d0, double d1, double d2, float f, float f1) {
- this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.worldProvider.getDimensionManager().getDimensionID(), new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1));
+ // CraftBukkit - this.world.dimension
+ this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1));
}
public void a(int i, int j, int k, int l, int i1, int j1) {}
-@@ -46,7 +47,8 @@
+@@ -47,7 +48,8 @@
public void a(SoundEffect soundeffect, BlockPosition blockposition) {}
public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {
@@ -20,7 +20,7 @@
}
public void a(int i, BlockPosition blockposition, int j) {
-@@ -56,6 +58,12 @@
+@@ -57,6 +59,12 @@
public void b(int i, BlockPosition blockposition, int j) {
Iterator iterator = this.a.getPlayerList().v().iterator();
@@ -33,7 +33,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
-@@ -64,6 +72,12 @@
+@@ -65,6 +73,12 @@
double d1 = (double) blockposition.getY() - entityplayer.locY;
double d2 = (double) blockposition.getZ() - entityplayer.locZ;
diff --git a/nms-patches/WorldMap.patch b/nms-patches/WorldMap.patch
index be793710..84f4c0df 100644
--- a/nms-patches/WorldMap.patch
+++ b/nms-patches/WorldMap.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/WorldMap.java
+++ b/net/minecraft/server/WorldMap.java
-@@ -6,6 +6,14 @@
- import java.util.List;
+@@ -7,6 +7,14 @@
import java.util.Map;
+ import javax.annotation.Nullable;
+// CraftBukkit start
+import java.util.UUID;
@@ -15,7 +15,7 @@
public class WorldMap extends PersistentBase {
public int centerX;
-@@ -18,8 +26,18 @@
+@@ -19,8 +27,18 @@
private Map<EntityHuman, WorldMap.WorldMapHumanTracker> j = Maps.newHashMap();
public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
@@ -34,7 +34,7 @@
}
public void a(double d0, double d1, int i) {
-@@ -32,7 +50,30 @@
+@@ -33,7 +51,30 @@
}
public void a(NBTTagCompound nbttagcompound) {
@@ -66,10 +66,10 @@
this.centerX = nbttagcompound.getInt("xCenter");
this.centerZ = nbttagcompound.getInt("zCenter");
this.scale = nbttagcompound.getByte("scale");
-@@ -73,6 +114,25 @@
+@@ -74,6 +115,25 @@
}
- public void b(NBTTagCompound nbttagcompound) {
+ public NBTTagCompound b(NBTTagCompound nbttagcompound) {
+ // CraftBukkit start
+ if (this.map >= 10) {
+ if (this.uniqueId == null) {
@@ -92,7 +92,7 @@
nbttagcompound.setByte("dimension", this.map);
nbttagcompound.setInt("xCenter", this.centerX);
nbttagcompound.setInt("zCenter", this.centerZ);
-@@ -220,12 +280,26 @@
+@@ -223,12 +283,26 @@
}
public Packet<?> a(ItemStack itemstack) {
diff --git a/nms-patches/WorldNBTStorage.patch b/nms-patches/WorldNBTStorage.patch
index c52ffef2..5195c15f 100644
--- a/nms-patches/WorldNBTStorage.patch
+++ b/nms-patches/WorldNBTStorage.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/WorldNBTStorage.java
+++ b/net/minecraft/server/WorldNBTStorage.java
-@@ -11,6 +11,11 @@
+@@ -12,6 +12,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -12,7 +12,7 @@
public class WorldNBTStorage implements IDataManager, IPlayerFileData {
private static final Logger b = LogManager.getLogger();
-@@ -21,6 +26,7 @@
+@@ -22,6 +27,7 @@
private final String g;
private final DefinedStructureManager h;
protected final DataConverterManager a;
@@ -20,7 +20,7 @@
public WorldNBTStorage(File file, String s, boolean flag, DataConverterManager dataconvertermanager) {
this.a = dataconvertermanager;
-@@ -167,12 +173,38 @@
+@@ -166,12 +172,38 @@
}
if (nbttagcompound != null) {
@@ -59,7 +59,7 @@
public IPlayerFileData getPlayerFileData() {
return this;
}
-@@ -202,4 +234,50 @@
+@@ -201,4 +233,50 @@
public DefinedStructureManager h() {
return this.h;
}
diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch
index 90979679..97ac2ba3 100644
--- a/nms-patches/WorldServer.patch
+++ b/nms-patches/WorldServer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/WorldServer.java
+++ b/net/minecraft/server/WorldServer.java
-@@ -18,14 +18,25 @@
+@@ -19,14 +19,25 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -28,7 +28,7 @@
private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap();
public boolean savingDisabled;
private boolean O;
-@@ -37,14 +48,22 @@
+@@ -38,14 +49,22 @@
private int T;
private List<NextTickListEntry> U = Lists.newArrayList();
@@ -54,7 +54,7 @@
this.H();
this.I();
this.getWorldBorder().a(minecraftserver.aD());
-@@ -63,6 +82,7 @@
+@@ -64,6 +83,7 @@
this.villages.a((World) this);
}
@@ -62,7 +62,7 @@
this.scoreboard = new ScoreboardServer(this.server);
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) this.worldMaps.get(PersistentScoreboard.class, "scoreboard");
-@@ -73,6 +93,11 @@
+@@ -74,6 +94,11 @@
persistentscoreboard.a(this.scoreboard);
((ScoreboardServer) this.scoreboard).a((Runnable) (new RunnableSaveScoreboard(persistentscoreboard)));
@@ -74,7 +74,7 @@
this.B = new LootTableRegistry(new File(new File(this.dataManager.getDirectory(), "data"), "loot_tables"));
this.getWorldBorder().setCenter(this.worldData.B(), this.worldData.C());
this.getWorldBorder().setDamageAmount(this.worldData.H());
-@@ -85,9 +110,98 @@
+@@ -86,9 +111,98 @@
this.getWorldBorder().setSize(this.worldData.D());
}
@@ -173,7 +173,7 @@
public void doTick() {
super.doTick();
if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) {
-@@ -105,9 +219,11 @@
+@@ -106,9 +220,11 @@
this.f();
}
@@ -188,7 +188,7 @@
}
this.methodProfiler.c("chunkSource");
-@@ -136,6 +252,8 @@
+@@ -137,6 +253,8 @@
this.portalTravelAgent.a(this.getTime());
this.methodProfiler.b();
this.ao();
@@ -196,8 +196,8 @@
+ this.getWorld().processChunkGC(); // CraftBukkit
}
- public BiomeBase.BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
-@@ -162,7 +280,7 @@
+ @Nullable
+@@ -164,7 +282,7 @@
if (entityhuman.isSpectator()) {
++i;
@@ -206,7 +206,7 @@
++j;
}
}
-@@ -188,25 +306,46 @@
+@@ -190,25 +308,46 @@
}
private void c() {
@@ -257,7 +257,7 @@
return false;
} else {
-@@ -277,7 +416,7 @@
+@@ -279,7 +418,7 @@
entityhorse.x(true);
entityhorse.setAgeRaw(0);
entityhorse.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@@ -266,7 +266,7 @@
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), true));
} else {
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), false));
-@@ -293,11 +432,29 @@
+@@ -295,11 +434,29 @@
BlockPosition blockposition1 = blockposition.down();
if (this.v(blockposition1)) {
@@ -298,7 +298,7 @@
}
if (flag && this.getBiome(blockposition1).d()) {
-@@ -372,7 +529,7 @@
+@@ -374,7 +531,7 @@
public boolean b(BlockPosition blockposition, Block block) {
NextTickListEntry nextticklistentry = new NextTickListEntry(blockposition, block);
@@ -307,7 +307,7 @@
}
public void a(BlockPosition blockposition, Block block, int i) {
-@@ -411,8 +568,8 @@
+@@ -413,8 +570,8 @@
nextticklistentry.a(j);
}
@@ -318,7 +318,7 @@
this.nextTickList.add(nextticklistentry);
}
}
-@@ -434,15 +591,15 @@
+@@ -436,15 +593,15 @@
nextticklistentry.a((long) i + this.worldData.getTime());
}
@@ -337,7 +337,7 @@
if (this.emptyTime++ >= 300) {
return;
}
-@@ -512,11 +669,17 @@
+@@ -514,11 +671,17 @@
} else {
int i = this.nextTickList.size();
@@ -357,7 +357,7 @@
}
this.methodProfiler.a("cleaning");
-@@ -529,8 +692,9 @@
+@@ -531,8 +694,9 @@
break;
}
@@ -368,7 +368,7 @@
this.U.add(nextticklistentry);
}
-@@ -598,7 +762,7 @@
+@@ -602,7 +766,7 @@
if (blockposition.getX() >= structureboundingbox.a && blockposition.getX() < structureboundingbox.d && blockposition.getZ() >= structureboundingbox.c && blockposition.getZ() < structureboundingbox.f) {
if (flag) {
if (i == 0) {
@@ -377,7 +377,7 @@
}
iterator.remove();
-@@ -616,6 +780,7 @@
+@@ -620,6 +784,7 @@
return arraylist;
}
@@ -385,7 +385,7 @@
public void entityJoinedWorld(Entity entity, boolean flag) {
if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die();
-@@ -627,6 +792,7 @@
+@@ -631,6 +796,7 @@
super.entityJoinedWorld(entity, flag);
}
@@ -393,7 +393,7 @@
private boolean getSpawnNPCs() {
return this.server.getSpawnNPCs();
-@@ -639,12 +805,42 @@
+@@ -643,7 +809,54 @@
protected IChunkProvider n() {
IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider);
@@ -413,11 +413,11 @@
+
+ return new ChunkProviderServer(this, ichunkloader, gen);
+ // CraftBukkit end
- }
-
- public List<TileEntity> getTileEntities(int i, int j, int k, int l, int i1, int j1) {
- ArrayList arraylist = Lists.newArrayList();
-
++ }
++
++ public List<TileEntity> getTileEntities(int i, int j, int k, int l, int i1, int j1) {
++ ArrayList arraylist = Lists.newArrayList();
++
+ // CraftBukkit start - Get tile entities from chunks instead of world
+ for (int chunkX = (i >> 4); chunkX <= ((l - 1) >> 4); chunkX++) {
+ for (int chunkZ = (k >> 4); chunkZ <= ((j1 - 1) >> 4); chunkZ++) {
@@ -434,19 +434,22 @@
+ }
+ }
+ /*
- for (int k1 = 0; k1 < this.tileEntityList.size(); ++k1) {
- TileEntity tileentity = (TileEntity) this.tileEntityList.get(k1);
- BlockPosition blockposition = tileentity.getPosition();
-@@ -653,6 +849,8 @@
- arraylist.add(tileentity);
- }
- }
++ for (int k1 = 0; k1 < this.tileEntityList.size(); ++k1) {
++ TileEntity tileentity = (TileEntity) this.tileEntityList.get(k1);
++ BlockPosition blockposition = tileentity.getPosition();
++
++ if (blockposition.getX() >= i && blockposition.getY() >= j && blockposition.getZ() >= k && blockposition.getX() < l && blockposition.getY() < i1 && blockposition.getZ() < j1) {
++ arraylist.add(tileentity);
++ }
++ }
+ */
+ // CraftBukkit end
-
- return arraylist;
++
++ return arraylist;
}
-@@ -716,6 +914,23 @@
+
+ public boolean a(EntityHuman entityhuman, BlockPosition blockposition) {
+@@ -705,6 +918,23 @@
int j = this.worldProvider.getSeaLevel();
int k = 8;
@@ -470,7 +473,7 @@
if (blockposition != null) {
i = blockposition.getX();
k = blockposition.getZ();
-@@ -725,7 +940,7 @@
+@@ -714,7 +944,7 @@
int l = 0;
@@ -479,7 +482,7 @@
i += random.nextInt(64) - random.nextInt(64);
k += random.nextInt(64) - random.nextInt(64);
++l;
-@@ -766,6 +981,7 @@
+@@ -755,6 +985,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProviderServer();
if (chunkproviderserver.e()) {
@@ -487,7 +490,7 @@
if (iprogressupdate != null) {
iprogressupdate.a("Saving level");
}
-@@ -776,7 +992,8 @@
+@@ -765,7 +996,8 @@
}
chunkproviderserver.a(flag);
@@ -497,7 +500,7 @@
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
-@@ -811,6 +1028,12 @@
+@@ -800,6 +1032,12 @@
}
}
@@ -510,7 +513,7 @@
this.worldData.a(this.getWorldBorder().getSize());
this.worldData.d(this.getWorldBorder().getCenterX());
this.worldData.c(this.getWorldBorder().getCenterZ());
-@@ -820,8 +1043,12 @@
+@@ -809,8 +1047,12 @@
this.worldData.k(this.getWorldBorder().getWarningTime());
this.worldData.b(this.getWorldBorder().j());
this.worldData.e(this.getWorldBorder().i());
@@ -524,7 +527,7 @@
}
public boolean addEntity(Entity entity) {
-@@ -845,7 +1072,7 @@
+@@ -834,7 +1076,7 @@
private boolean i(Entity entity) {
if (entity.dead) {
@@ -533,7 +536,7 @@
return false;
} else {
UUID uuid = entity.getUniqueID();
-@@ -857,7 +1084,7 @@
+@@ -846,7 +1088,7 @@
this.f.remove(entity1);
} else {
if (!(entity instanceof EntityHuman)) {
@@ -542,7 +545,7 @@
return false;
}
-@@ -900,8 +1127,16 @@
+@@ -889,8 +1131,16 @@
}
public boolean strikeLightning(Entity entity) {
@@ -560,10 +563,10 @@
return true;
} else {
return false;
-@@ -917,10 +1152,20 @@
+@@ -906,10 +1156,20 @@
}
- public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
+ public Explosion createExplosion(@Nullable Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
+ // CraftBukkit start
+ Explosion explosion = super.createExplosion(entity, d0, d1, d2, f, flag, flag1);
+
@@ -581,7 +584,7 @@
if (!flag1) {
explosion.clearBlocks();
}
-@@ -966,7 +1211,8 @@
+@@ -955,7 +1215,8 @@
BlockActionData blockactiondata = (BlockActionData) iterator.next();
if (this.a(blockactiondata)) {
@@ -591,7 +594,7 @@
}
}
-@@ -989,6 +1235,7 @@
+@@ -978,6 +1239,7 @@
boolean flag = this.W();
super.t();
@@ -599,7 +602,7 @@
if (this.n != this.o) {
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.o)), this.worldProvider.getDimensionManager().getDimensionID());
}
-@@ -1007,6 +1254,21 @@
+@@ -996,6 +1258,21 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.o));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.q));
}
@@ -621,7 +624,7 @@
}
-@@ -1035,10 +1297,20 @@
+@@ -1025,10 +1302,20 @@
}
public void a(EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) {
diff --git a/pom.xml b/pom.xml
index a5ef8572..ead0dbf6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,15 +4,15 @@
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
- <version>1.9.2-R0.1-SNAPSHOT</version>
+ <version>1.9.4-R0.1-SNAPSHOT</version>
<name>CraftBukkit</name>
<url>http://www.bukkit.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<api.version>unknown</api.version>
- <minecraft.version>1.9.2</minecraft.version>
- <minecraft_version>1_9_R1</minecraft_version>
+ <minecraft.version>1.9.4</minecraft.version>
+ <minecraft_version>1_9_R2</minecraft_version>
<buildtag.prefix>git-Bukkit-</buildtag.prefix>
<buildtag.suffix></buildtag.suffix>
<maven.compiler.source>1.6</maven.compiler.source>
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java b/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
index 89983726..67f28566 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
@@ -5,6 +5,7 @@ import java.io.StringWriter;
import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.Callable;
+import net.minecraft.server.CrashReportCallable;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
@@ -12,7 +13,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import net.minecraft.server.MinecraftServer;
-public class CraftCrashReport implements Callable<Object> {
+public class CraftCrashReport implements CrashReportCallable<Object> {
public Object call() throws Exception {
StringWriter value = new StringWriter();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java b/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java
index 7037f6cb..b66a6281 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java
@@ -136,7 +136,7 @@ public class CraftStatistic {
return monsteregginfo.killEntityStatistic;
}
if (stat == org.bukkit.Statistic.ENTITY_KILLED_BY) {
- return monsteregginfo.e; // PAIL: rename
+ return monsteregginfo.killedByEntityStatistic;
}
}
return null;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 04e99b1b..46c6f00e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -41,6 +41,7 @@ import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.util.LongHash;
import org.bukkit.entity.*;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.minecart.CommandMinecart;
import org.bukkit.entity.minecart.ExplosiveMinecart;
import org.bukkit.entity.minecart.HopperMinecart;
import org.bukkit.entity.minecart.PoweredMinecart;
@@ -125,7 +126,7 @@ public class CraftWorld implements World {
}
public Chunk getChunkAt(int x, int z) {
- return this.world.getChunkProviderServer().getOrCreateChunkFast(x, z).bukkitChunk;
+ return this.world.getChunkProviderServer().getChunkAt(x, z).bukkitChunk;
}
public Chunk getChunkAt(Block block) {
@@ -133,7 +134,7 @@ public class CraftWorld implements World {
}
public boolean isChunkLoaded(int x, int z) {
- return world.getChunkProviderServer().isChunkLoaded(x, z);
+ return world.getChunkProviderServer().isLoaded(x, z);
}
public Chunk[] getLoadedChunks() {
@@ -173,7 +174,10 @@ public class CraftWorld implements World {
return false;
}
- world.getChunkProviderServer().queueUnload(x, z);
+ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getLoadedChunkAt(x, z);
+ if (chunk != null) {
+ world.getChunkProviderServer().unload(chunk);
+ }
return true;
}
@@ -200,7 +204,7 @@ public class CraftWorld implements World {
}
world.getChunkProviderServer().unloadQueue.remove(x, z);
- world.getChunkProviderServer().chunks.remove(LongHash.toLong(x, z));
+ world.getChunkProviderServer().chunks.remove(ChunkCoordIntPair.a(x, z));
// Update neighbor counts
for (int xx = -2; xx < 3; xx++) {
@@ -209,7 +213,7 @@ public class CraftWorld implements World {
continue;
}
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
+ net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
if (neighbor != null) {
neighbor.setNeighborUnloaded(-xx, -zz);
chunk.setNeighborUnloaded(xx, zz);
@@ -228,7 +232,7 @@ public class CraftWorld implements World {
net.minecraft.server.Chunk chunk = null;
chunk = world.getChunkProviderServer().chunkGenerator.getOrCreateChunk(x, z);
- PlayerChunk playerChunk = world.getPlayerChunkMap().b/*PAIL: Rename*/(x, z);
+ PlayerChunk playerChunk = world.getPlayerChunkMap().getChunk(x, z);
if (playerChunk != null) {
playerChunk.chunk = chunk;
}
@@ -272,7 +276,7 @@ public class CraftWorld implements World {
}
world.getChunkProviderServer().unloadQueue.remove(x, z);
- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().chunks.get(LongHash.toLong(x, z));
+ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().chunks.get(ChunkCoordIntPair.a(x, z));
if (chunk == null) {
chunk = world.getChunkProviderServer().getOrLoadChunkAt(x, z);
@@ -282,7 +286,7 @@ public class CraftWorld implements World {
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int cx, int cz) {
if (chunk != null) {
- world.getChunkProviderServer().chunks.put(LongHash.toLong(cx, cz), chunk);
+ world.getChunkProviderServer().chunks.put(ChunkCoordIntPair.a(cx, cz), chunk);
chunk.addEntities();
@@ -293,7 +297,7 @@ public class CraftWorld implements World {
continue;
}
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
+ net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
if (neighbor != null) {
neighbor.setNeighborLoaded(-x, -z);
chunk.setNeighborLoaded(x, z);
@@ -749,7 +753,7 @@ public class CraftWorld implements World {
}
AxisAlignedBB bb = new AxisAlignedBB(location.getX() - x, location.getY() - y, location.getZ() - z, location.getX() + x, location.getY() + y, location.getZ() + z);
- List<net.minecraft.server.Entity> entityList = getHandle().a((net.minecraft.server.Entity) null, bb, null); // PAIL : rename
+ List<net.minecraft.server.Entity> entityList = getHandle().getEntities((net.minecraft.server.Entity) null, bb, null);
List<Entity> bukkitEntityList = new ArrayList<org.bukkit.entity.Entity>(entityList.size());
for (Object entity : entityList) {
bukkitEntityList.add(((net.minecraft.server.Entity) entity).getBukkitEntity());
@@ -961,7 +965,7 @@ public class CraftWorld implements World {
entity = new EntityThrownExpBottle(world);
entity.setPositionRotation(x, y, z, 0, 0);
} else if (EnderPearl.class.isAssignableFrom(clazz)) {
- entity = new EntityEnderPearl(world, null);
+ entity = new EntityEnderPearl(world);
entity.setPositionRotation(x, y, z, 0, 0);
} else if (ThrownPotion.class.isAssignableFrom(clazz)) {
if (LingeringPotion.class.isAssignableFrom(clazz)) {
@@ -997,6 +1001,8 @@ public class CraftWorld implements World {
entity = new EntityMinecartHopper(world, x, y, z);
} else if (SpawnerMinecart.class.isAssignableFrom(clazz)) {
entity = new EntityMinecartMobSpawner(world, x, y, z);
+ } else if (CommandMinecart.class.isAssignableFrom(clazz)) {
+ entity = new EntityMinecartCommandBlock(world, x, y, z);
} else { // Default to rideable minecart for pre-rideable compatibility
entity = new EntityMinecartRideable(world, x, y, z);
}
@@ -1514,7 +1520,7 @@ public class CraftWorld implements World {
}
// Add unload request
- cps.queueUnload(chunk.locX, chunk.locZ);
+ cps.unload(chunk);
}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftEndGateway.java b/src/main/java/org/bukkit/craftbukkit/block/CraftEndGateway.java
index 4e49b18a..45f22212 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftEndGateway.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEndGateway.java
@@ -28,29 +28,29 @@ public class CraftEndGateway extends CraftBlockState implements EndGateway {
@Override
public Location getExitLocation() {
- BlockPosition pos = gateway.h; // PAIL: Rename exitLocation
+ BlockPosition pos = gateway.exitPortal;
return pos == null ? null : new Location(world, pos.getX(), pos.getY(), pos.getZ());
}
@Override
public void setExitLocation(Location location) {
if (location == null) {
- gateway.h = null;
+ gateway.exitPortal = null;
} else if (location.getWorld() != world) {
throw new IllegalArgumentException("Cannot set exit location to different world");
} else {
- gateway.h = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
+ gateway.exitPortal = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
}
}
@Override
public boolean isExactTeleport() {
- return gateway.i; // PAIL: Rename exactTeleport
+ return gateway.exactTeleport;
}
@Override
public void setExactTeleport(boolean exact) {
- gateway.i = exact;
+ gateway.exactTeleport = exact;
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java b/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java
index d54eb6ec..d98288cf 100644
--- a/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java
+++ b/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java
@@ -155,7 +155,7 @@ public class CraftBossBar implements BossBar {
@Override
public boolean isVisible() {
- return handle.j;
+ return handle.visible;
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
index 6dfef44a..1632f136 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
@@ -2,12 +2,12 @@ package org.bukkit.craftbukkit.chunkio;
import java.io.IOException;
import net.minecraft.server.Chunk;
+import net.minecraft.server.ChunkCoordIntPair;
import net.minecraft.server.ChunkRegionLoader;
import net.minecraft.server.NBTTagCompound;
import org.bukkit.Server;
import org.bukkit.craftbukkit.util.AsynchronousExecutor;
-import org.bukkit.craftbukkit.util.LongHash;
import java.util.concurrent.atomic.AtomicInteger;
@@ -41,7 +41,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
queuedChunk.loader.loadEntities(chunk, queuedChunk.compound.getCompound("Level"), queuedChunk.world);
chunk.setLastSaved(queuedChunk.provider.world.getTime());
- queuedChunk.provider.chunks.put(LongHash.toLong(queuedChunk.x, queuedChunk.z), chunk);
+ queuedChunk.provider.chunks.put(ChunkCoordIntPair.a(queuedChunk.x, queuedChunk.z), chunk);
chunk.addEntities();
if (queuedChunk.provider.chunkGenerator != null) {
@@ -60,7 +60,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
continue;
}
- Chunk neighbor = queuedChunk.provider.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
+ Chunk neighbor = queuedChunk.provider.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
if (neighbor != null) {
neighbor.setNeighborLoaded(-x, -z);
chunk.setNeighborLoaded(x, z);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
index f8d6a7b3..42f6ea4a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
@@ -211,9 +211,9 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
public void setSource(ProjectileSource shooter) {
if (shooter instanceof CraftLivingEntity) {
- getHandle().a((EntityLiving) ((CraftLivingEntity) shooter).getHandle()); // PAIL rename setSource
+ getHandle().setSource((EntityLiving) ((CraftLivingEntity) shooter).getHandle());
} else {
- getHandle().a((EntityLiving) null);
+ getHandle().setSource((EntityLiving) null);
}
getHandle().projectileSource = shooter;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
index af66b90a..3613f5b3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
@@ -14,12 +14,12 @@ public class CraftBoat extends CraftVehicle implements Boat {
@Override
public TreeSpecies getWoodType() {
- return getTreeSpecies(getHandle().r()); // PAIL: Rename getType
+ return getTreeSpecies(getHandle().getType());
}
@Override
public void setWoodType(TreeSpecies species) {
- getHandle().a(getBoatType(species)); // PAIL: Rename setType
+ getHandle().setType(getBoatType(species));
}
public double getMaxSpeed() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java
index 9d9b5d4a..ffb863e6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java
@@ -14,28 +14,28 @@ public class CraftEnderCrystal extends CraftEntity implements EnderCrystal {
@Override
public boolean isShowingBottom() {
- return getHandle().k(); // PAIL: Rename isShowingBottom
+ return getHandle().isShowingBottom();
}
@Override
public void setShowingBottom(boolean showing) {
- getHandle().a(showing); // PAIL: Rename setShowingBottom
+ getHandle().setShowingBottom(showing);
}
@Override
public Location getBeamTarget() {
- BlockPosition pos = getHandle().j(); // PAIL: Rename getBeamTarget
+ BlockPosition pos = getHandle().getBeamTarget();
return pos == null ? null : new Location(getWorld(), pos.getX(), pos.getY(), pos.getZ());
}
@Override
public void setBeamTarget(Location location) {
if (location == null) {
- getHandle().a((BlockPosition) null); // PAIL: Rename setBeamTarget
+ getHandle().setBeamTarget((BlockPosition) null);
} else if (location.getWorld() != getWorld()) {
throw new IllegalArgumentException("Cannot set beam target location to different world");
} else {
- getHandle().a(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
+ getHandle().setBeamTarget(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java
index 9b2df6ad..d31a2069 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java
@@ -45,12 +45,12 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
@Override
public Phase getPhase() {
- return Phase.values()[getHandle().getDataWatcher().get(EntityEnderDragon.a)]; // PAIL: Rename PHASE
+ return Phase.values()[getHandle().getDataWatcher().get(EntityEnderDragon.PHASE)];
}
@Override
public void setPhase(Phase phase) {
- getHandle().cT().a(getMinecraftPhase(phase)); // PAIL: Rename getDragonControllerManager setPhase
+ getHandle().getDragonControllerManager().setControllerPhase(getMinecraftPhase(phase));
}
public static Phase getBukkitPhase(DragonControllerPhase phase) {
@@ -58,6 +58,6 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
}
public static DragonControllerPhase getMinecraftPhase(Phase phase) {
- return DragonControllerPhase.a(phase.ordinal()); // PAIL: Rename getById
+ return DragonControllerPhase.getById(phase.ordinal());
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 83f91313..79fcbc4c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -138,7 +138,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
if (entity instanceof EntityEgg) { return new CraftEgg(server, (EntityEgg) entity); }
else if (entity instanceof EntitySnowball) { return new CraftSnowball(server, (EntitySnowball) entity); }
else if (entity instanceof EntityPotion) {
- if (!((EntityPotion) entity).n()) { return new CraftSplashPotion(server, (EntityPotion) entity); }
+ if (!((EntityPotion) entity).isLingering()) { return new CraftSplashPotion(server, (EntityPotion) entity); }
else { return new CraftLingeringPotion(server, (EntityPotion) entity); }
}
else if (entity instanceof EntityEnderPearl) { return new CraftEnderPearl(server, (EntityEnderPearl) entity); }
@@ -248,7 +248,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
- List<Entity> notchEntityList = entity.world.a(entity, entity.getBoundingBox().grow(x, y, z), null);
+ List<Entity> notchEntityList = entity.world.getEntities(entity, entity.getBoundingBox().grow(x, y, z), null);
List<org.bukkit.entity.Entity> bukkitEntityList = new java.util.ArrayList<org.bukkit.entity.Entity>(notchEntityList.size());
for (Entity e : notchEntityList) {
@@ -555,7 +555,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public void setInvulnerable(boolean flag) {
- getHandle().h(flag); // PAIL: rename setInvulnerable
+ getHandle().setInvulnerable(flag);
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 9902e9ee..55119f23 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -62,7 +62,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
public MainHand getMainHand() {
- return getHandle().cr() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT; // PAIL Rename cr()->getMainHand()
+ return getHandle().getMainHand()== EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT;
}
public ItemStack getItemInHand() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 8aa86868..e662e4ae 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -532,13 +532,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public void setAI(boolean ai) {
if (this.getHandle() instanceof EntityInsentient) {
- ((EntityInsentient) this.getHandle()).m(!ai); // PAIL: rename
+ ((EntityInsentient) this.getHandle()).setAI(!ai);
}
}
@Override
public boolean hasAI() {
- return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).cR() : false; // PAIL: rename
+ return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).hasAI(): false;
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
index 38a5e02c..e9963e21 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
@@ -31,11 +31,11 @@ final class CraftMinecartHopper extends CraftMinecart implements HopperMinecart
@Override
public boolean isEnabled() {
- return ((EntityMinecartHopper) getHandle()).C(); // PAIL: Rename isEnabled
+ return ((EntityMinecartHopper) getHandle()).isEnabled();
}
@Override
public void setEnabled(boolean enabled) {
- ((EntityMinecartHopper) getHandle()).k(enabled); // PAIL: Rename setEnabled
+ ((EntityMinecartHopper) getHandle()).setEnabled(enabled);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 681cc9b4..5bdf114c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -362,8 +362,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
IChatBaseComponent[] components = CraftSign.sanitizeLines(lines);
+ TileEntitySign sign = new TileEntitySign();
+ sign.a(new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); // PAIL: rename
+ System.arraycopy(components, 0, sign.lines, 0, sign.lines.length);
- getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateSign(getHandle().world, new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), components));
+ getHandle().playerConnection.sendPacket(sign.getUpdatePacket());
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java
index f2f28a0a..3a614edd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java
@@ -28,11 +28,11 @@ public class CraftSpectralArrow extends CraftArrow implements SpectralArrow {
@Override
public int getGlowingTicks() {
- return getHandle().f; // PAIL: Rename glowingDuration
+ return getHandle().duration;
}
@Override
public void setGlowingTicks(int duration) {
- getHandle().f = duration;
+ getHandle().duration = duration;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index 95ffdf67..7bb21dbb 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -93,7 +93,7 @@ public class CraftVillager extends CraftAgeable implements Villager, InventoryHo
@Override
public HumanEntity getTrader() {
- EntityHuman eh = getHandle().t_(); // PAIL: rename t_ -> getTrader
+ EntityHuman eh = getHandle().getTrader();
return eh == null ? null : eh.getBukkitEntity();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 646ee2bb..edfd0311 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -546,7 +546,7 @@ public class CraftEventFactory {
cause = DamageCause.MAGIC;
} else if (source == DamageSource.FALL) {
cause = DamageCause.FALL;
- } else if (source == DamageSource.j) { // PAIL: rename
+ } else if (source == DamageSource.FLY_INTO_WALL) {
cause = DamageCause.FLY_INTO_WALL;
} else if (source == DamageSource.GENERIC) {
return new EntityDamageEvent(entity.getBukkitEntity(), null, modifiers, modifierFunctions);
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java
index 9051d75c..4a0b5f84 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java
@@ -12,7 +12,7 @@ public class CraftInventoryMerchant extends CraftInventory implements MerchantIn
@Override
public int getSelectedRecipeIndex() {
- return getInventory().e;
+ return getInventory().selectedIndex;
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
index 6737fad5..609a1211 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
@@ -192,7 +192,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
if (blockEntityTag != null && material == Material.SHIELD) {
blockEntityTag.setString("id", "Banner"); // Hack
}
- TileEntity te = blockEntityTag == null ? null : TileEntity.a(MinecraftServer.getServer(), blockEntityTag);
+ TileEntity te = blockEntityTag == null ? null : TileEntity.c(blockEntityTag);
switch (material) {
case SIGN:
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index 160d34a0..e7688340 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -190,9 +190,9 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
case NAME_TAG_VISIBILITY:
return OptionStatus.values()[team.getNameTagVisibility().ordinal()];
case DEATH_MESSAGE_VISIBILITY:
- return OptionStatus.values()[team.j().ordinal()]; // PAIL: rename
+ return OptionStatus.values()[team.getDeathMessageVisibility().ordinal()];
case COLLISION_RULE:
- return OptionStatus.values()[team.k().ordinal()]; // PAIL: rename
+ return OptionStatus.values()[team.getCollisionRule().ordinal()];
default:
throw new IllegalArgumentException("Unrecognised option " + option);
}
@@ -207,10 +207,10 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
team.setNameTagVisibility(EnumNameTagVisibility.values()[status.ordinal()]);
break;
case DEATH_MESSAGE_VISIBILITY:
- team.b(EnumNameTagVisibility.values()[status.ordinal()]); // PAIL: rename
+ team.setDeathMessageVisibility(EnumNameTagVisibility.values()[status.ordinal()]);
break;
case COLLISION_RULE:
- team.a(ScoreboardTeamBase.EnumTeamPush.values()[status.ordinal()]); // PAIL: rename
+ team.setCollisionRule(ScoreboardTeamBase.EnumTeamPush.values()[status.ordinal()]);
break;
default:
throw new IllegalArgumentException("Unrecognised option " + option);