From de42aa13f387632b360c5b1b003b212499f3f4f2 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 11 Dec 2019 09:00:00 +1100 Subject: [PATCH] Update to Minecraft 1.15 --- nms-patches/BehaviorFarm.patch | 4 +- nms-patches/BehaviorMakeLove.patch | 8 +- nms-patches/BehaviorUtil.patch | 4 +- nms-patches/BiomeStorage.patch | 35 +++ nms-patches/Block.patch | 16 +- nms-patches/BlockBamboo.patch | 4 +- nms-patches/BlockBambooSapling.patch | 2 +- nms-patches/BlockBed.patch | 23 +- nms-patches/BlockButtonAbstract.patch | 26 +- nms-patches/BlockCactus.patch | 8 +- nms-patches/BlockCake.patch | 4 +- nms-patches/BlockCampfire.patch | 20 +- nms-patches/BlockCauldron.patch | 42 +-- nms-patches/BlockChest.patch | 29 ++- nms-patches/BlockChorusFlower.patch | 34 +-- nms-patches/BlockCocoa.patch | 10 +- nms-patches/BlockCommand.patch | 2 +- nms-patches/BlockCoral.patch | 8 +- nms-patches/BlockCoralFan.patch | 8 +- nms-patches/BlockCoralFanWall.patch | 8 +- nms-patches/BlockCoralPlant.patch | 8 +- nms-patches/BlockCrops.patch | 8 +- nms-patches/BlockDiodeAbstract.patch | 12 +- nms-patches/BlockDirtSnowSpreadable.patch | 36 +-- nms-patches/BlockFire.patch | 74 +++--- nms-patches/BlockGrass.patch | 8 +- nms-patches/BlockIce.patch | 2 +- nms-patches/BlockKelp.patch | 8 +- nms-patches/BlockLeaves.patch | 14 +- nms-patches/BlockLever.patch | 10 +- nms-patches/BlockMushroom.patch | 24 +- nms-patches/BlockNetherWart.patch | 6 +- nms-patches/BlockNote.patch | 2 +- nms-patches/BlockObserver.patch | 12 +- nms-patches/BlockPiston.patch | 14 +- nms-patches/BlockPortal.patch | 22 +- nms-patches/BlockPoweredRail.patch | 2 +- nms-patches/BlockPressurePlateAbstract.patch | 2 +- nms-patches/BlockPressurePlateWeighted.patch | 2 +- nms-patches/BlockRedstoneComparator.patch | 6 +- nms-patches/BlockRedstoneLamp.patch | 22 +- nms-patches/BlockRedstoneOre.patch | 34 +-- nms-patches/BlockReed.patch | 8 +- nms-patches/BlockSapling.patch | 22 +- nms-patches/BlockScaffolding.patch | 10 +- nms-patches/BlockSnow.patch | 10 +- nms-patches/BlockSoil.patch | 16 +- nms-patches/BlockStem.patch | 22 +- nms-patches/BlockSweetBerryBush.patch | 8 +- nms-patches/BlockTNT.patch | 2 +- nms-patches/BlockTripwire.patch | 2 +- nms-patches/BlockTurtleEgg.patch | 28 +- nms-patches/BlockVine.patch | 78 +++--- nms-patches/BlockWaterLily.patch | 6 +- nms-patches/BlockWitherSkull.patch | 4 +- nms-patches/Chunk.patch | 29 ++- nms-patches/ChunkGenerator.patch | 21 +- nms-patches/ChunkMapDistance.patch | 78 +++--- nms-patches/ChunkProviderGenerate.patch | 4 +- nms-patches/ChunkProviderServer.patch | 4 +- .../CommandBlockListenerAbstract.patch | 24 +- nms-patches/CommandDispatcher.patch | 46 ++-- nms-patches/CommandEffect.patch | 6 +- nms-patches/ContainerAnvil.patch | 2 +- nms-patches/ContainerCartography.patch | 6 +- nms-patches/ContainerLoom.patch | 8 +- nms-patches/ContainerMerchant.patch | 2 +- nms-patches/ContainerPlayer.patch | 17 +- nms-patches/ContainerStonecutter.patch | 10 +- nms-patches/ContainerWorkbench.patch | 2 +- nms-patches/CustomFunction.patch | 2 +- nms-patches/DamageSource.patch | 4 +- nms-patches/DedicatedServer.patch | 2 +- nms-patches/DimensionManager.patch | 21 +- nms-patches/DispenseBehaviorBoat.patch | 2 +- nms-patches/DispenserRegistry.patch | 34 +-- nms-patches/EnchantmentThorns.patch | 11 - nms-patches/Entity.patch | 104 ++++---- nms-patches/EntityAgeable.patch | 12 +- nms-patches/EntityAnimal.patch | 2 +- nms-patches/EntityArmorStand.patch | 64 ++--- nms-patches/EntityArrow.patch | 14 +- nms-patches/EntityBat.patch | 4 +- nms-patches/EntityBee.patch | 74 ++++++ nms-patches/EntityBoat.patch | 18 +- nms-patches/EntityCat.patch | 24 +- nms-patches/EntityChicken.patch | 6 +- nms-patches/EntityCreeper.patch | 14 +- nms-patches/EntityDolphin.patch | 4 +- nms-patches/EntityEgg.patch | 4 +- nms-patches/EntityEnderCrystal.patch | 8 +- nms-patches/EntityEnderDragon.patch | 27 +- nms-patches/EntityEnderPearl.patch | 23 +- nms-patches/EntityEnderman.patch | 10 +- nms-patches/EntityExperienceOrb.patch | 4 +- nms-patches/EntityFallingBlock.patch | 6 +- nms-patches/EntityFireball.patch | 8 +- nms-patches/EntityFireworks.patch | 23 +- nms-patches/EntityFishingHook.patch | 32 +-- nms-patches/EntityFox.patch | 36 +-- nms-patches/EntityGhast.patch | 8 +- nms-patches/EntityHanging.patch | 30 +-- nms-patches/EntityHorseAbstract.patch | 24 +- nms-patches/EntityHuman.patch | 111 ++++---- nms-patches/EntityInsentient.patch | 24 +- nms-patches/EntityIronGolem.patch | 6 +- nms-patches/EntityItem.patch | 45 ++-- nms-patches/EntityItemFrame.patch | 56 ++-- nms-patches/EntityLargeFireball.patch | 8 +- nms-patches/EntityLeash.patch | 10 +- nms-patches/EntityLightning.patch | 20 +- nms-patches/EntityLiving.patch | 246 +++++++++--------- nms-patches/EntityLlamaTrader.patch | 2 +- nms-patches/EntityMinecartAbstract.patch | 59 +++-- nms-patches/EntityMinecartCommandBlock.patch | 2 +- nms-patches/EntityMushroomCow.patch | 12 +- nms-patches/EntityOcelot.patch | 15 +- nms-patches/EntityPanda.patch | 22 +- nms-patches/EntityParrot.patch | 16 +- nms-patches/EntityPhantom.patch | 2 +- nms-patches/EntityPig.patch | 4 +- nms-patches/EntityPigZombie.patch | 16 +- nms-patches/EntityPillager.patch | 8 - nms-patches/EntityPlayer.patch | 125 ++++----- nms-patches/EntityProjectile.patch | 14 +- nms-patches/EntityRabbit.patch | 8 +- nms-patches/EntityRaider.patch | 6 +- nms-patches/EntityRavager.patch | 2 +- nms-patches/EntitySheep.patch | 16 +- nms-patches/EntityShulker.patch | 16 +- nms-patches/EntityShulkerBullet.patch | 4 +- nms-patches/EntitySilverfish.patch | 8 +- nms-patches/EntitySlime.patch | 10 +- nms-patches/EntitySmallFireball.patch | 4 +- nms-patches/EntitySnowman.patch | 27 +- nms-patches/EntitySpider.patch | 2 +- nms-patches/EntityTNTPrimed.patch | 12 +- nms-patches/EntityThrownTrident.patch | 2 +- nms-patches/EntityTippedArrow.patch | 6 +- nms-patches/EntityTrackerEntry.patch | 16 +- nms-patches/EntityTurtle.patch | 10 +- nms-patches/EntityTypes.patch | 14 +- nms-patches/EntityVillager.patch | 35 ++- nms-patches/EntityVillagerAbstract.patch | 4 +- nms-patches/EntityWither.patch | 24 +- nms-patches/EntityWitherSkull.patch | 10 +- nms-patches/EntityWolf.patch | 70 ++--- nms-patches/EntityZombie.patch | 26 +- nms-patches/EntityZombieVillager.patch | 15 +- nms-patches/Explosion.patch | 50 ++-- nms-patches/FoodMetaData.patch | 2 +- nms-patches/GameRules.patch | 16 +- nms-patches/HandshakeListener.patch | 4 +- nms-patches/IChunkLoader.patch | 32 ++- nms-patches/IDispenseBehavior.patch | 123 +++++++-- nms-patches/IRecipeComplex.patch | 14 + nms-patches/IWorldWriter.patch | 2 +- nms-patches/ItemArmor.patch | 6 +- nms-patches/ItemArmorStand.patch | 2 +- nms-patches/ItemBlock.patch | 6 +- nms-patches/ItemBoat.patch | 8 +- nms-patches/ItemBow.patch | 6 +- nms-patches/ItemBucket.patch | 32 +-- nms-patches/ItemChorusFruit.patch | 4 +- nms-patches/ItemCrossbow.patch | 4 +- nms-patches/ItemEndCrystal.patch | 2 +- nms-patches/ItemEnderPearl.patch | 20 +- nms-patches/ItemFireball.patch | 53 ++-- nms-patches/ItemFishingRod.patch | 14 +- nms-patches/ItemFlintAndSteel.patch | 28 +- nms-patches/ItemLeash.patch | 2 +- nms-patches/ItemPotion.patch | 2 +- nms-patches/ItemSnowball.patch | 26 +- nms-patches/ItemStack.patch | 59 +++-- nms-patches/ItemTrident.patch | 2 +- ...ItemConditionRandomChanceWithLooting.patch | 2 +- .../LootItemConditionSurvivesExplosion.patch | 2 +- nms-patches/MinecraftServer.patch | 108 ++++---- nms-patches/MobEffectList.patch | 4 +- nms-patches/MobSpawnerAbstract.patch | 4 +- nms-patches/MobSpawnerPatrol.patch | 2 +- nms-patches/MobSpawnerPhantom.patch | 2 +- nms-patches/MobSpawnerTrader.patch | 4 +- nms-patches/PacketStatusListener.patch | 2 +- nms-patches/PathfinderGoalBreed.patch | 6 +- nms-patches/PathfinderGoalDefendVillage.patch | 2 +- nms-patches/PathfinderGoalFollowOwner.patch | 38 +-- nms-patches/PathfinderGoalHorseTrap.patch | 6 +- nms-patches/PathfinderGoalHurtByTarget.patch | 2 +- nms-patches/PathfinderGoalPanic.patch | 2 +- nms-patches/PathfinderGoalSit.patch | 2 +- nms-patches/PersistentRaid.patch | 23 +- nms-patches/PlayerChunkMap.patch | 50 ++-- nms-patches/PlayerConnection.patch | 151 +++++------ nms-patches/PlayerInteractManager.patch | 67 ++--- nms-patches/PlayerInventory.patch | 4 +- nms-patches/PlayerList.patch | 108 ++++---- nms-patches/PortalTravelAgent.patch | 28 +- nms-patches/Raid.patch | 93 +++---- nms-patches/RecipeArmorDye.patch | 18 -- nms-patches/RecipeBannerDuplicate.patch | 17 -- nms-patches/RecipeBookClone.patch | 17 -- nms-patches/RecipeBookServer.patch | 2 +- nms-patches/RecipeFireworks.patch | 21 -- nms-patches/RecipeFireworksFade.patch | 20 -- nms-patches/RecipeFireworksStar.patch | 30 --- nms-patches/RecipeMapClone.patch | 17 -- nms-patches/RecipeRepair.patch | 35 --- nms-patches/RecipeShulkerBox.patch | 17 -- nms-patches/RecipeSuspiciousStew.patch | 17 -- nms-patches/RecipeTippedArrow.patch | 22 -- nms-patches/RecipiesShield.patch | 17 -- nms-patches/RegionFileCache.patch | 22 +- nms-patches/RegionLimitedWorldAccess.patch | 6 +- nms-patches/SpawnerCreature.patch | 12 +- nms-patches/StructureGenerator.patch | 2 +- nms-patches/TicketType.patch | 2 +- nms-patches/TileEntity.patch | 8 +- nms-patches/TileEntityBanner.patch | 2 +- nms-patches/TileEntityBarrel.patch | 5 +- nms-patches/TileEntityBeacon.patch | 2 +- nms-patches/TileEntityBrewingStand.patch | 4 +- nms-patches/TileEntityCampfire.patch | 2 +- nms-patches/TileEntityChest.patch | 6 +- nms-patches/TileEntityConduit.patch | 12 +- nms-patches/TileEntityDispenser.patch | 4 +- nms-patches/TileEntityEndGateway.patch | 22 +- nms-patches/TileEntityFurnace.patch | 2 +- nms-patches/TileEntityHopper.patch | 6 +- nms-patches/TileEntityShulkerBox.patch | 2 +- nms-patches/TileEntitySign.patch | 12 +- nms-patches/World.patch | 45 ++-- nms-patches/WorldData.patch | 14 +- nms-patches/WorldGenGroundBush.patch | 11 +- nms-patches/WorldGenMegaTreeProvider.patch | 4 +- nms-patches/WorldGenTreeProvider.patch | 62 +++-- nms-patches/WorldMap.patch | 2 +- nms-patches/WorldProvider.patch | 2 +- nms-patches/WorldProviderHell.patch | 11 +- nms-patches/WorldProviderNormal.patch | 52 +++- nms-patches/WorldProviderTheEnd.patch | 2 +- nms-patches/WorldServer.patch | 133 +++++----- nms-patches/WorldUpgrader.patch | 4 +- pom.xml | 20 +- .../org/bukkit/craftbukkit/CraftChunk.java | 15 +- .../craftbukkit/CraftChunkSnapshot.java | 2 +- .../bukkit/craftbukkit/CraftLootTable.java | 2 +- .../org/bukkit/craftbukkit/CraftParticle.java | 4 + .../craftbukkit/CraftProfileBanList.java | 2 +- .../org/bukkit/craftbukkit/CraftRaid.java | 30 +-- .../org/bukkit/craftbukkit/CraftServer.java | 7 +- .../org/bukkit/craftbukkit/CraftSound.java | 25 +- .../bukkit/craftbukkit/CraftStatistic.java | 4 +- .../org/bukkit/craftbukkit/CraftWorld.java | 66 +++-- .../java/org/bukkit/craftbukkit/Main.java | 2 +- .../craftbukkit/block/CraftBeehive.java | 32 +++ .../bukkit/craftbukkit/block/CraftBlock.java | 4 +- .../block/data/CraftBlockData.java | 1 + .../block/data/type/CraftBeehive.java | 24 ++ .../craftbukkit/block/impl/CraftBeehive.java | 53 ++++ .../bukkit/craftbukkit/entity/CraftBee.java | 85 ++++++ .../craftbukkit/entity/CraftEntity.java | 10 +- .../craftbukkit/entity/CraftFirework.java | 4 +- .../craftbukkit/entity/CraftFishHook.java | 2 +- .../craftbukkit/entity/CraftHumanEntity.java | 10 +- .../craftbukkit/entity/CraftPillager.java | 2 +- .../craftbukkit/entity/CraftPlayer.java | 16 -- .../craftbukkit/entity/CraftVillager.java | 4 +- .../craftbukkit/event/CraftEventFactory.java | 8 +- .../generator/CustomChunkGenerator.java | 17 +- .../inventory/CraftComplexRecipe.java | 32 +++ .../craftbukkit/inventory/CraftContainer.java | 2 +- .../inventory/CraftItemFactory.java | 2 + .../craftbukkit/inventory/CraftItemStack.java | 6 + .../inventory/CraftMerchantCustom.java | 6 +- .../inventory/CraftMetaBlockState.java | 10 + .../craftbukkit/inventory/CraftMetaBook.java | 2 +- .../inventory/CraftMetaBookSigned.java | 2 +- .../craftbukkit/inventory/CraftMetaItem.java | 6 +- .../inventory/CraftMetaKnowledgeBook.java | 2 +- .../inventory/CraftMetaLeatherArmor.java | 2 +- .../craftbukkit/inventory/CraftMetaMap.java | 4 +- .../inventory/CraftMetaSpawnEgg.java | 1 + .../util/CraftTileInventoryConverter.java | 3 +- .../CraftPersistentDataTypeRegistry.java | 14 +- .../util/BlockStateListPopulator.java | 2 +- .../craftbukkit/util/CraftMagicNumbers.java | 6 +- .../util/CraftNBTTagConfigSerializer.java | 8 +- .../util/DummyGeneratorAccess.java | 34 ++- src/test/java/org/bukkit/LegacyTest.java | 2 + .../inventory/ItemFactoryTest.java | 2 +- .../craftbukkit/inventory/ItemMetaTest.java | 38 --- .../bukkit/support/AbstractTestingBase.java | 3 +- 293 files changed, 2875 insertions(+), 2648 deletions(-) create mode 100644 nms-patches/BiomeStorage.patch delete mode 100644 nms-patches/EnchantmentThorns.patch create mode 100644 nms-patches/EntityBee.patch create mode 100644 nms-patches/IRecipeComplex.patch delete mode 100644 nms-patches/RecipeArmorDye.patch delete mode 100644 nms-patches/RecipeBannerDuplicate.patch delete mode 100644 nms-patches/RecipeBookClone.patch delete mode 100644 nms-patches/RecipeFireworks.patch delete mode 100644 nms-patches/RecipeFireworksFade.patch delete mode 100644 nms-patches/RecipeFireworksStar.patch delete mode 100644 nms-patches/RecipeMapClone.patch delete mode 100644 nms-patches/RecipeRepair.patch delete mode 100644 nms-patches/RecipeShulkerBox.patch delete mode 100644 nms-patches/RecipeSuspiciousStew.patch delete mode 100644 nms-patches/RecipeTippedArrow.patch delete mode 100644 nms-patches/RecipiesShield.patch create mode 100644 src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java create mode 100644 src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBeehive.java create mode 100644 src/main/java/org/bukkit/craftbukkit/block/impl/CraftBeehive.java create mode 100644 src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java create mode 100644 src/main/java/org/bukkit/craftbukkit/inventory/CraftComplexRecipe.java diff --git a/nms-patches/BehaviorFarm.patch b/nms-patches/BehaviorFarm.patch index d91bdb5023..93f11002dc 100644 --- a/nms-patches/BehaviorFarm.patch +++ b/nms-patches/BehaviorFarm.patch @@ -15,10 +15,10 @@ Block block1 = worldserver.getType(this.a.down()).getBlock(); if (block instanceof BlockCrops && ((BlockCrops) block).isRipe(iblockdata) && this.c) { -- worldserver.b(this.a, true); +- worldserver.a(this.a, true, entityvillager); + // CraftBukkit start + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.a, Blocks.AIR.getBlockData()).isCancelled()) { -+ worldserver.b(this.a, true); ++ worldserver.a(this.a, true, entityvillager); + } + // CraftBukkit end } diff --git a/nms-patches/BehaviorMakeLove.patch b/nms-patches/BehaviorMakeLove.patch index e74e3b6791..c40fc3fb76 100644 --- a/nms-patches/BehaviorMakeLove.patch +++ b/nms-patches/BehaviorMakeLove.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/BehaviorMakeLove.java +++ b/net/minecraft/server/BehaviorMakeLove.java -@@ -99,6 +99,11 @@ +@@ -100,6 +100,11 @@ private Optional a(EntityVillager entityvillager, EntityVillager entityvillager1) { EntityVillager entityvillager2 = entityvillager.createChild(entityvillager1); @@ -12,16 +12,16 @@ if (entityvillager2 == null) { return Optional.empty(); -@@ -107,7 +112,7 @@ +@@ -108,7 +113,7 @@ entityvillager1.setAgeRaw(6000); entityvillager2.setAgeRaw(-24000); - entityvillager2.setPositionRotation(entityvillager.locX, entityvillager.locY, entityvillager.locZ, 0.0F, 0.0F); + entityvillager2.setPositionRotation(entityvillager.locX(), entityvillager.locY(), entityvillager.locZ(), 0.0F, 0.0F); - entityvillager.world.addEntity(entityvillager2); + entityvillager.world.addEntity(entityvillager2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason entityvillager.world.broadcastEntityEffect(entityvillager2, (byte) 12); return Optional.of(entityvillager2); } -@@ -116,6 +121,6 @@ +@@ -117,6 +122,6 @@ private void a(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) { GlobalPos globalpos = GlobalPos.create(worldserver.getWorldProvider().getDimensionManager(), blockposition); diff --git a/nms-patches/BehaviorUtil.patch b/nms-patches/BehaviorUtil.patch index 81f3a7e955..8531646d58 100644 --- a/nms-patches/BehaviorUtil.patch +++ b/nms-patches/BehaviorUtil.patch @@ -21,8 +21,8 @@ public static void a(EntityLiving entityliving, ItemStack itemstack, EntityLiving entityliving1) { + if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-4940: no empty loot - double d0 = entityliving.locY - 0.30000001192092896D + (double) entityliving.getHeadHeight(); - EntityItem entityitem = new EntityItem(entityliving.world, entityliving.locX, d0, entityliving.locZ, itemstack); + double d0 = entityliving.getHeadY() - 0.30000001192092896D; + EntityItem entityitem = new EntityItem(entityliving.world, entityliving.locX(), d0, entityliving.locZ(), itemstack); BlockPosition blockposition = new BlockPosition(entityliving1); @@ -66,7 +67,7 @@ diff --git a/nms-patches/BiomeStorage.patch b/nms-patches/BiomeStorage.patch new file mode 100644 index 0000000000..ccb86d85a2 --- /dev/null +++ b/nms-patches/BiomeStorage.patch @@ -0,0 +1,35 @@ +--- a/net/minecraft/server/BiomeStorage.java ++++ b/net/minecraft/server/BiomeStorage.java +@@ -77,7 +77,7 @@ + int[] aint = new int[this.f.length]; + + for (int i = 0; i < this.f.length; ++i) { +- aint[i] = IRegistry.BIOME.a((Object) this.f[i]); ++ aint[i] = IRegistry.BIOME.a(this.f[i]); // CraftBukkit - decompile error + } + + return aint; +@@ -90,7 +90,7 @@ + for (int j = 0; j < i; ++j) { + BiomeBase biomebase = abiomebase[j]; + +- packetdataserializer.writeInt(IRegistry.BIOME.a((Object) biomebase)); ++ packetdataserializer.writeInt(IRegistry.BIOME.a(biomebase)); // CraftBukkit - decompile error + } + + } +@@ -107,4 +107,14 @@ + + return this.f[i1 << BiomeStorage.d + BiomeStorage.d | j1 << BiomeStorage.d | l]; + } ++ ++ // CraftBukkit start ++ public void setBiome(int i, int j, int k, BiomeBase biome) { ++ int l = i & BiomeStorage.b; ++ int i1 = MathHelper.clamp(j, 0, BiomeStorage.c); ++ int j1 = k & BiomeStorage.b; ++ ++ this.f[i1 << BiomeStorage.d + BiomeStorage.d | j1 << BiomeStorage.d | l] = biome; ++ } ++ // CraftBukkit end + } diff --git a/nms-patches/Block.patch b/nms-patches/Block.patch index 663bbad68c..f6bfbec099 100644 --- a/nms-patches/Block.patch +++ b/nms-patches/Block.patch @@ -1,16 +1,6 @@ --- a/net/minecraft/server/Block.java +++ b/net/minecraft/server/Block.java -@@ -434,7 +434,8 @@ - } - - public static List getDrops(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, @Nullable TileEntity tileentity, Entity entity, ItemStack itemstack) { -- LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder(worldserver)).a(worldserver.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, itemstack).set(LootContextParameters.THIS_ENTITY, entity).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity); -+ // CraftBukkit - make entity optional -+ LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder(worldserver)).a(worldserver.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, itemstack).setOptional(LootContextParameters.THIS_ENTITY, entity).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity); - - return iblockdata.a(loottableinfo_builder); - } -@@ -488,7 +489,13 @@ +@@ -489,7 +489,13 @@ EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack); entityitem.defaultPickupDelay(); @@ -25,8 +15,8 @@ } } -@@ -685,6 +692,12 @@ - return block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL; +@@ -682,6 +688,12 @@ + return "Block{" + IRegistry.BLOCK.getKey(this) + "}"; } + // CraftBukkit start diff --git a/nms-patches/BlockBamboo.patch b/nms-patches/BlockBamboo.patch index 1fbeea621f..4b8fd8d01f 100644 --- a/nms-patches/BlockBamboo.patch +++ b/nms-patches/BlockBamboo.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/BlockBamboo.java +++ b/net/minecraft/server/BlockBamboo.java -@@ -164,14 +164,18 @@ +@@ -159,14 +159,18 @@ BlockPosition blockposition1 = blockposition.down(2); IBlockData iblockdata2 = world.getType(blockposition1); BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE; @@ -21,7 +21,7 @@ } } } else { -@@ -182,7 +186,14 @@ +@@ -177,7 +181,14 @@ int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && iblockdata2.getBlock() != Blocks.BAMBOO ? 0 : 1; int k = (i < 11 || random.nextFloat() >= 0.25F) && i != 15 ? 0 : 1; diff --git a/nms-patches/BlockBambooSapling.patch b/nms-patches/BlockBambooSapling.patch index 9dd46c4913..675272f11c 100644 --- a/nms-patches/BlockBambooSapling.patch +++ b/nms-patches/BlockBambooSapling.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/BlockBambooSapling.java +++ b/net/minecraft/server/BlockBambooSapling.java -@@ -74,6 +74,6 @@ +@@ -69,6 +69,6 @@ } protected void a(World world, BlockPosition blockposition) { diff --git a/nms-patches/BlockBed.patch b/nms-patches/BlockBed.patch index 998bbe6e0c..5f53477bd5 100644 --- a/nms-patches/BlockBed.patch +++ b/nms-patches/BlockBed.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/BlockBed.java +++ b/net/minecraft/server/BlockBed.java -@@ -42,12 +42,22 @@ +@@ -43,7 +43,8 @@ } } @@ -8,8 +8,11 @@ + // CraftBukkit - moved world and biome check into EntityHuman + if (true || world.worldProvider.canRespawn() && world.getBiome(blockposition) != Biomes.NETHER) { if ((Boolean) iblockdata.get(BlockBed.OCCUPIED)) { - entityhuman.a((IChatBaseComponent) (new ChatMessage("block.minecraft.bed.occupied", new Object[0])), true); - return true; + if (!this.a(world, blockposition)) { + entityhuman.a((IChatBaseComponent) (new ChatMessage("block.minecraft.bed.occupied", new Object[0])), true); +@@ -51,7 +52,16 @@ + + return EnumInteractionResult.SUCCESS; } else { + // CraftBukkit start + IBlockData finaliblockdata = iblockdata; @@ -24,28 +27,28 @@ if (entityhuman_enumbedresult != null) { entityhuman.a(entityhuman_enumbedresult.a(), true); } -@@ -55,7 +65,14 @@ +@@ -59,7 +69,14 @@ }); - return true; + return EnumInteractionResult.SUCCESS; } + // CraftBukkit start - moved bed explosion into separate method } else { -+ return true; ++ return EnumInteractionResult.SUCCESS; + } + } + } + -+ private boolean explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) { ++ private EnumInteractionResult explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) { world.a(blockposition, false); BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite()); -@@ -65,8 +82,7 @@ +@@ -69,8 +86,7 @@ world.createExplosion((Entity) null, DamageSource.a(), (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.Effect.DESTROY); - return true; + return EnumInteractionResult.SUCCESS; - } - } + // CraftBukkit end } - @Override + private boolean a(World world, BlockPosition blockposition) { diff --git a/nms-patches/BlockButtonAbstract.patch b/nms-patches/BlockButtonAbstract.patch index 2ab32ecbf4..4afb1fff31 100644 --- a/nms-patches/BlockButtonAbstract.patch +++ b/nms-patches/BlockButtonAbstract.patch @@ -14,7 +14,7 @@ public static final BlockStateBoolean POWERED = BlockProperties.w; @@ -71,6 +76,19 @@ if ((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)) { - return true; + return EnumInteractionResult.CONSUME; } else { + // CraftBukkit start + boolean powered = ((Boolean) iblockdata.get(POWERED)); @@ -26,30 +26,30 @@ + world.getServer().getPluginManager().callEvent(eventRedstone); + + if ((eventRedstone.getNewCurrent() > 0) != (!powered)) { -+ return true; ++ return EnumInteractionResult.SUCCESS; + } + // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, true), 3); + this.d(iblockdata, world, blockposition); this.a(entityhuman, world, blockposition, true); - this.e(iblockdata, world, blockposition); -@@ -117,6 +135,16 @@ + return EnumInteractionResult.SUCCESS; +@@ -121,6 +139,16 @@ if (this.D) { - this.d(iblockdata, world, blockposition); + this.e(iblockdata, (World) worldserver, blockposition); } else { + // CraftBukkit start -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); ++ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0); -+ world.getServer().getPluginManager().callEvent(eventRedstone); ++ worldserver.getServer().getPluginManager().callEvent(eventRedstone); + + if (eventRedstone.getNewCurrent() > 0) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, false), 3); - this.e(iblockdata, world, blockposition); - this.a((EntityHuman) null, world, blockposition, false); -@@ -137,7 +165,44 @@ + worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, false), 3); + this.f(iblockdata, worldserver, blockposition); + this.a((EntityHuman) null, worldserver, blockposition, false); +@@ -141,7 +169,44 @@ boolean flag = !list.isEmpty(); boolean flag1 = (Boolean) iblockdata.get(BlockButtonAbstract.POWERED); @@ -92,5 +92,5 @@ + } + // CraftBukkit end world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, flag), 3); - this.e(iblockdata, world, blockposition); + this.f(iblockdata, world, blockposition); this.a((EntityHuman) null, world, blockposition, flag); diff --git a/nms-patches/BlockCactus.patch b/nms-patches/BlockCactus.patch index 58f6e31d08..4ba8044aa5 100644 --- a/nms-patches/BlockCactus.patch +++ b/nms-patches/BlockCactus.patch @@ -13,12 +13,12 @@ int j = (Integer) iblockdata.get(BlockCactus.AGE); if (j == 15) { -- world.setTypeUpdate(blockposition1, this.getBlockData()); -+ CraftEventFactory.handleBlockGrowEvent(world, blockposition1, this.getBlockData()); // CraftBukkit +- worldserver.setTypeUpdate(blockposition1, this.getBlockData()); ++ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.getBlockData()); // CraftBukkit IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockCactus.AGE, 0); - world.setTypeAndData(blockposition, iblockdata1, 4); -@@ -95,7 +97,9 @@ + worldserver.setTypeAndData(blockposition, iblockdata1, 4); +@@ -90,7 +92,9 @@ @Override public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { diff --git a/nms-patches/BlockCake.patch b/nms-patches/BlockCake.patch index d08e6c8aaf..3241a6ba9b 100644 --- a/nms-patches/BlockCake.patch +++ b/nms-patches/BlockCake.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/BlockCake.java +++ b/net/minecraft/server/BlockCake.java -@@ -31,7 +31,18 @@ - return false; +@@ -37,7 +37,18 @@ + return EnumInteractionResult.PASS; } else { entityhuman.a(StatisticList.EAT_CAKE_SLICE); - entityhuman.getFoodData().eat(2, 0.1F); diff --git a/nms-patches/BlockCampfire.patch b/nms-patches/BlockCampfire.patch index 95ef2f3d1b..a8368992af 100644 --- a/nms-patches/BlockCampfire.patch +++ b/nms-patches/BlockCampfire.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/server/BlockCampfire.java +++ b/net/minecraft/server/BlockCampfire.java -@@ -142,6 +142,11 @@ - if (entityarrow.isBurning() && !(Boolean) iblockdata.get(BlockCampfire.b) && !(Boolean) iblockdata.get(BlockCampfire.d)) { - BlockPosition blockposition = movingobjectpositionblock.getBlockPosition(); +@@ -148,6 +148,11 @@ + if (flag1 && !(Boolean) iblockdata.get(BlockCampfire.b) && !(Boolean) iblockdata.get(BlockCampfire.d)) { + BlockPosition blockposition = movingobjectpositionblock.getBlockPosition(); -+ // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, entityarrow).isCancelled()) { -+ return; -+ } -+ // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.r, true), 11); ++ // CraftBukkit start ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, entity).isCancelled()) { ++ return; ++ } ++ // CraftBukkit end + world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.r, true), 11); + } } - } diff --git a/nms-patches/BlockCauldron.patch b/nms-patches/BlockCauldron.patch index 37f214cd08..23e0a28a4e 100644 --- a/nms-patches/BlockCauldron.patch +++ b/nms-patches/BlockCauldron.patch @@ -8,10 +8,10 @@ public class BlockCauldron extends Block { public static final BlockStateInteger LEVEL = BlockProperties.al; -@@ -32,8 +34,13 @@ +@@ -27,8 +29,13 @@ float f = (float) blockposition.getY() + (6.0F + (float) (3 * i)) / 16.0F; - if (!world.isClientSide && entity.isBurning() && i > 0 && entity.getBoundingBox().minY <= (double) f) { + if (!world.isClientSide && entity.isBurning() && i > 0 && entity.locY() <= (double) f) { + // CraftBukkit start + if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH)) { + return; @@ -23,13 +23,13 @@ } } -@@ -50,18 +57,27 @@ +@@ -45,18 +52,27 @@ if (item == Items.WATER_BUCKET) { if (i < 3 && !world.isClientSide) { + // CraftBukkit start + if (!this.changeLevel(world, blockposition, iblockdata, 3, entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) { -+ return true; ++ return EnumInteractionResult.SUCCESS; + } if (!entityhuman.abilities.canInstantlyBuild) { entityhuman.a(enumhand, new ItemStack(Items.BUCKET)); @@ -42,17 +42,17 @@ world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); } - return true; + return EnumInteractionResult.SUCCESS; } else if (item == Items.BUCKET) { if (i == 3 && !world.isClientSide) { + // CraftBukkit start + if (!this.changeLevel(world, blockposition, iblockdata, 0, entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) { -+ return true; ++ return EnumInteractionResult.SUCCESS; + } if (!entityhuman.abilities.canInstantlyBuild) { itemstack.subtract(1); if (itemstack.isEmpty()) { -@@ -72,7 +88,8 @@ +@@ -67,7 +83,8 @@ } entityhuman.a(StatisticList.USE_CAULDRON); @@ -62,18 +62,18 @@ world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); } -@@ -82,6 +99,10 @@ +@@ -77,6 +94,10 @@ if (item == Items.GLASS_BOTTLE) { if (i > 0 && !world.isClientSide) { + // CraftBukkit start + if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) { -+ return true; ++ return EnumInteractionResult.SUCCESS; + } if (!entityhuman.abilities.canInstantlyBuild) { itemstack1 = PotionUtil.a(new ItemStack(Items.POTION), Potions.WATER); entityhuman.a(StatisticList.USE_CAULDRON); -@@ -96,12 +117,17 @@ +@@ -91,12 +112,17 @@ } world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); @@ -82,17 +82,17 @@ + // CraftBukkit end } - return true; + return EnumInteractionResult.SUCCESS; } else if (item == Items.POTION && PotionUtil.d(itemstack) == Potions.WATER) { if (i < 3 && !world.isClientSide) { + // CraftBukkit start + if (!this.changeLevel(world, blockposition, iblockdata, i + 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) { -+ return true; ++ return EnumInteractionResult.SUCCESS; + } if (!entityhuman.abilities.canInstantlyBuild) { itemstack1 = new ItemStack(Items.GLASS_BOTTLE); entityhuman.a(StatisticList.USE_CAULDRON); -@@ -112,7 +138,8 @@ +@@ -107,7 +133,8 @@ } world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); @@ -101,29 +101,29 @@ + // CraftBukkit end } - return true; -@@ -121,8 +148,13 @@ + return EnumInteractionResult.SUCCESS; +@@ -116,8 +143,13 @@ IDyeable idyeable = (IDyeable) item; if (idyeable.a(itemstack) && !world.isClientSide) { + // CraftBukkit start + if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) { -+ return true; ++ return EnumInteractionResult.SUCCESS; + } idyeable.c(itemstack); - this.a(world, blockposition, iblockdata, i - 1); + // this.a(world, blockposition, iblockdata, i - 1); + // CraftBukkit end entityhuman.a(StatisticList.CLEAN_ARMOR); - return true; + return EnumInteractionResult.SUCCESS; } -@@ -130,13 +162,18 @@ +@@ -125,13 +157,18 @@ if (i > 0 && item instanceof ItemBanner) { if (TileEntityBanner.a(itemstack) > 0 && !world.isClientSide) { + // CraftBukkit start + if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) { -+ return true; ++ return EnumInteractionResult.SUCCESS; + } itemstack1 = itemstack.cloneItemStack(); itemstack1.setCount(1); @@ -137,7 +137,7 @@ } if (itemstack.isEmpty()) { -@@ -173,9 +210,25 @@ +@@ -169,9 +206,25 @@ } } @@ -164,7 +164,7 @@ } @Override -@@ -187,7 +240,7 @@ +@@ -183,7 +236,7 @@ IBlockData iblockdata = world.getType(blockposition); if ((Integer) iblockdata.get(BlockCauldron.LEVEL) < 3) { diff --git a/nms-patches/BlockChest.patch b/nms-patches/BlockChest.patch index 08698b9483..629cf87f62 100644 --- a/nms-patches/BlockChest.patch +++ b/nms-patches/BlockChest.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/server/BlockChest.java +++ b/net/minecraft/server/BlockChest.java -@@ -30,24 +30,7 @@ - public ITileInventory b(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) { +@@ -35,24 +35,7 @@ + public Optional a(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) { final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1); -- return new ITileInventory() { +- return Optional.of(new ITileInventory() { - @Nullable - @Override - public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) { @@ -21,12 +21,12 @@ - public IChatBaseComponent getScoreboardDisplayName() { - return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble", new Object[0]))); - } -- }; -+ return new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest); // CraftBukkit +- }); ++ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit } - @Override -@@ -56,6 +39,38 @@ + public Optional a(TileEntityChest tileentitychest) { +@@ -65,6 +48,38 @@ } }; @@ -62,6 +62,15 @@ + }; + // CraftBukkit end + - protected BlockChest(Block.Info block_info) { - super(block_info); - this.o((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.blockStateList.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.b, BlockPropertyChestType.SINGLE)).set(BlockChest.c, false)); + protected BlockChest(Block.Info block_info, Supplier> supplier) { + super(block_info, supplier); + this.p((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.blockStateList.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.c, BlockPropertyChestType.SINGLE)).set(BlockChest.d, false)); +@@ -217,7 +232,7 @@ + } + + public DoubleBlockFinder.Result a(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) { +- BiPredicate bipredicate; ++ BiPredicate bipredicate; // CraftBukkit - decompile error + + if (flag) { + bipredicate = (generatoraccess, blockposition1) -> { diff --git a/nms-patches/BlockChorusFlower.patch b/nms-patches/BlockChorusFlower.patch index 585fcf5490..75bf329f3f 100644 --- a/nms-patches/BlockChorusFlower.patch +++ b/nms-patches/BlockChorusFlower.patch @@ -12,13 +12,13 @@ @@ -58,8 +60,12 @@ } - if (flag && b((IWorldReader) world, blockposition1, (EnumDirection) null) && world.isEmpty(blockposition.up(2))) { -- world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2); -- this.b(world, blockposition1, i); + if (flag && b((IWorldReader) worldserver, blockposition1, (EnumDirection) null) && worldserver.isEmpty(blockposition.up(2))) { +- worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2); +- this.b(worldserver, blockposition1, i); + // CraftBukkit start - add event -+ if (CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) { -+ world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2); -+ this.b(world, blockposition1, i); ++ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) { ++ worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2); ++ this.b(worldserver, blockposition1, i); + } + // CraftBukkit end } else if (i < 4) { @@ -27,12 +27,12 @@ @@ -73,18 +79,30 @@ BlockPosition blockposition2 = blockposition.shift(enumdirection); - if (world.isEmpty(blockposition2) && world.isEmpty(blockposition2.down()) && b((IWorldReader) world, blockposition2, enumdirection.opposite())) { -- this.b(world, blockposition2, i + 1); + if (worldserver.isEmpty(blockposition2) && worldserver.isEmpty(blockposition2.down()) && b((IWorldReader) worldserver, blockposition2, enumdirection.opposite())) { +- this.b(worldserver, blockposition2, i + 1); - flag2 = true; + // CraftBukkit start - add event -+ if (CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition2, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i + 1)), 2)) { -+ this.b(world, blockposition2, i + 1); ++ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i + 1)), 2)) { ++ this.b(worldserver, blockposition2, i + 1); + flag2 = true; + } + // CraftBukkit end @@ -40,20 +40,20 @@ } if (flag2) { - world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2); + worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2); } else { -- this.a(world, blockposition); +- this.a((World) worldserver, blockposition); + // CraftBukkit - add event -+ if (CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) { -+ this.a(world, blockposition); ++ if (CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) { ++ this.a((World) worldserver, blockposition); + } + // CraftBukkit end } } else { -- this.a(world, blockposition); +- this.a((World) worldserver, blockposition); + // CraftBukkit - add event -+ if (CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) { -+ this.a(world, blockposition); ++ if (CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) { ++ this.a((World) worldserver, blockposition); + } + // CraftBukkit end } diff --git a/nms-patches/BlockCocoa.patch b/nms-patches/BlockCocoa.patch index 6ad7df1a1c..cc43844182 100644 --- a/nms-patches/BlockCocoa.patch +++ b/nms-patches/BlockCocoa.patch @@ -13,17 +13,17 @@ int i = (Integer) iblockdata.get(BlockCocoa.AGE); if (i < 2) { -- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, i + 1), 2); -+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, i + 1), 2); // CraftBukkkit +- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, i + 1), 2); ++ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, i + 1), 2); // CraftBukkkit } } @@ -92,7 +94,7 @@ @Override - public void b(World world, Random random, BlockPosition blockposition, IBlockData iblockdata) { -- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, (Integer) iblockdata.get(BlockCocoa.AGE) + 1), 2); -+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, (Integer) iblockdata.get(BlockCocoa.AGE) + 1), 2); // CraftBukkit + public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) { +- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, (Integer) iblockdata.get(BlockCocoa.AGE) + 1), 2); ++ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, (Integer) iblockdata.get(BlockCocoa.AGE) + 1), 2); // CraftBukkit } @Override diff --git a/nms-patches/BlockCommand.patch b/nms-patches/BlockCommand.patch index 3827a869b2..1f53b56bba 100644 --- a/nms-patches/BlockCommand.patch +++ b/nms-patches/BlockCommand.patch @@ -24,4 +24,4 @@ + // CraftBukkit end tileentitycommand.a(flag1); - if (!flag2 && !tileentitycommand.g() && tileentitycommand.u() != TileEntityCommand.Type.SEQUENCE) { + if (!flag2 && !tileentitycommand.g() && tileentitycommand.m() != TileEntityCommand.Type.SEQUENCE) { diff --git a/nms-patches/BlockCoral.patch b/nms-patches/BlockCoral.patch index aef0dabc42..93d56b09a3 100644 --- a/nms-patches/BlockCoral.patch +++ b/nms-patches/BlockCoral.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/server/BlockCoral.java @@ -15,6 +15,11 @@ @Override - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { - if (!this.a((IBlockAccess) world, blockposition)) { + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + if (!this.a((IBlockAccess) worldserver, blockposition)) { + // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.a.getBlockData()).isCancelled()) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.a.getBlockData()).isCancelled()) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, this.a.getBlockData(), 2); + worldserver.setTypeAndData(blockposition, this.a.getBlockData(), 2); } diff --git a/nms-patches/BlockCoralFan.patch b/nms-patches/BlockCoralFan.patch index 7653ce24fe..80e781bbff 100644 --- a/nms-patches/BlockCoralFan.patch +++ b/nms-patches/BlockCoralFan.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/server/BlockCoralFan.java @@ -19,6 +19,11 @@ @Override - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { - if (!b_(iblockdata, world, blockposition)) { + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + if (!b_(iblockdata, worldserver, blockposition)) { + // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.a.getBlockData().set(BlockCoralFan.b, false)).isCancelled()) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.a.getBlockData().set(BlockCoralFan.b, false)).isCancelled()) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) this.a.getBlockData().set(BlockCoralFan.b, false), 2); + worldserver.setTypeAndData(blockposition, (IBlockData) this.a.getBlockData().set(BlockCoralFan.b, false), 2); } diff --git a/nms-patches/BlockCoralFanWall.patch b/nms-patches/BlockCoralFanWall.patch index a65bc7fedf..3463161cba 100644 --- a/nms-patches/BlockCoralFanWall.patch +++ b/nms-patches/BlockCoralFanWall.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/server/BlockCoralFanWall.java @@ -19,6 +19,11 @@ @Override - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { - if (!b_(iblockdata, world, blockposition)) { + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + if (!b_(iblockdata, worldserver, blockposition)) { + // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.c.getBlockData().set(BlockCoralFanWall.b, false).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a))).isCancelled()) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.c.getBlockData().set(BlockCoralFanWall.b, false).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a))).isCancelled()) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.c.getBlockData().set(BlockCoralFanWall.b, false)).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a)), 2); + worldserver.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.c.getBlockData().set(BlockCoralFanWall.b, false)).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a)), 2); } diff --git a/nms-patches/BlockCoralPlant.patch b/nms-patches/BlockCoralPlant.patch index 5cb15ebbdd..3080c461ab 100644 --- a/nms-patches/BlockCoralPlant.patch +++ b/nms-patches/BlockCoralPlant.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/server/BlockCoralPlant.java @@ -20,6 +20,11 @@ @Override - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { - if (!b_(iblockdata, world, blockposition)) { + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + if (!b_(iblockdata, worldserver, blockposition)) { + // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.c.getBlockData().set(BlockCoralPlant.b, false)).isCancelled()) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.c.getBlockData().set(BlockCoralPlant.b, false)).isCancelled()) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) this.c.getBlockData().set(BlockCoralPlant.b, false), 2); + worldserver.setTypeAndData(blockposition, (IBlockData) this.c.getBlockData().set(BlockCoralPlant.b, false), 2); } diff --git a/nms-patches/BlockCrops.patch b/nms-patches/BlockCrops.patch index 0157257cd0..cb87630f36 100644 --- a/nms-patches/BlockCrops.patch +++ b/nms-patches/BlockCrops.patch @@ -10,11 +10,11 @@ public static final BlockStateInteger AGE = BlockProperties.ac; @@ -52,7 +54,7 @@ - float f = a((Block) this, (IBlockAccess) world, blockposition); + float f = a((Block) this, (IBlockAccess) worldserver, blockposition); if (random.nextInt((int) (25.0F / f) + 1) == 0) { -- world.setTypeAndData(blockposition, this.setAge(i + 1), 2); -+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.setAge(i + 1), 2); // CraftBukkit +- worldserver.setTypeAndData(blockposition, this.setAge(i + 1), 2); ++ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.setAge(i + 1), 2); // CraftBukkit } } } @@ -33,6 +33,6 @@ public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { - if (entity instanceof EntityRavager && world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) { + if (entity instanceof EntityRavager && !CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData(), !world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) { // CraftBukkit - world.b(blockposition, true); + world.a(blockposition, true, entity); } diff --git a/nms-patches/BlockDiodeAbstract.patch b/nms-patches/BlockDiodeAbstract.patch index c512f2e5e5..259791ac06 100644 --- a/nms-patches/BlockDiodeAbstract.patch +++ b/nms-patches/BlockDiodeAbstract.patch @@ -10,21 +10,21 @@ protected static final VoxelShape b = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D); @@ -28,8 +30,18 @@ - boolean flag1 = this.a(world, blockposition, iblockdata); + boolean flag1 = this.a((World) worldserver, blockposition, iblockdata); if (flag && !flag1) { + // CraftBukkit start -+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) { ++ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, false), 2); + worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, false), 2); } else if (!flag) { + // CraftBukkit start -+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) { ++ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 0, 15).getNewCurrent() != 15) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, true), 2); + worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, true), 2); if (!flag1) { - world.getBlockTickList().a(blockposition, this, this.j(iblockdata), TickListPriority.HIGH); + worldserver.getBlockTickList().a(blockposition, this, this.h(iblockdata), TickListPriority.VERY_HIGH); diff --git a/nms-patches/BlockDirtSnowSpreadable.patch b/nms-patches/BlockDirtSnowSpreadable.patch index 4bff6aefe5..6eb4261cfd 100644 --- a/nms-patches/BlockDirtSnowSpreadable.patch +++ b/nms-patches/BlockDirtSnowSpreadable.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/server/BlockDirtSnowSpreadable.java +++ b/net/minecraft/server/BlockDirtSnowSpreadable.java -@@ -31,6 +31,11 @@ - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { - if (!world.isClientSide) { - if (!b(iblockdata, (IWorldReader) world, blockposition)) { -+ // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) { -+ return; -+ } -+ // CraftBukkit end - world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData()); - } else { - if (world.getLightLevel(blockposition.up()) >= 9) { -@@ -40,7 +45,7 @@ - BlockPosition blockposition1 = blockposition.b(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); +@@ -30,6 +30,11 @@ + @Override + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + if (!b(iblockdata, (IWorldReader) worldserver, blockposition)) { ++ // CraftBukkit start ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) { ++ return; ++ } ++ // CraftBukkit end + worldserver.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData()); + } else { + if (worldserver.getLightLevel(blockposition.up()) >= 9) { +@@ -39,7 +44,7 @@ + BlockPosition blockposition1 = blockposition.b(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); - if (world.getType(blockposition1).getBlock() == Blocks.DIRT && c(iblockdata1, (IWorldReader) world, blockposition1)) { -- world.setTypeUpdate(blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, world.getType(blockposition1.up()).getBlock() == Blocks.SNOW)); -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, world.getType(blockposition1.up()).getBlock() == Blocks.SNOW)); // CraftBukkit - } + if (worldserver.getType(blockposition1).getBlock() == Blocks.DIRT && c(iblockdata1, (IWorldReader) worldserver, blockposition1)) { +- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).getBlock() == Blocks.SNOW)); ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).getBlock() == Blocks.SNOW)); // CraftBukkit } } + } diff --git a/nms-patches/BlockFire.patch b/nms-patches/BlockFire.patch index 7b092eb3d2..9bb21b4103 100644 --- a/nms-patches/BlockFire.patch +++ b/nms-patches/BlockFire.patch @@ -39,73 +39,73 @@ @Nullable @@ -82,7 +104,7 @@ - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { - if (world.getGameRules().getBoolean(GameRules.DO_FIRE_TICK)) { - if (!iblockdata.canPlace(world, blockposition)) { -- world.a(blockposition, false); -+ fireExtinguished(world, blockposition); // CraftBukkit - invalid place location + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + if (worldserver.getGameRules().getBoolean(GameRules.DO_FIRE_TICK)) { + if (!iblockdata.canPlace(worldserver, blockposition)) { +- worldserver.a(blockposition, false); ++ fireExtinguished(worldserver, blockposition); // CraftBukkit - invalid place location } - Block block = world.getType(blockposition.down()).getBlock(); + Block block = worldserver.getType(blockposition.down()).getBlock(); @@ -90,7 +112,7 @@ int i = (Integer) iblockdata.get(BlockFire.AGE); - if (!flag && world.isRaining() && this.a(world, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) { -- world.a(blockposition, false); -+ fireExtinguished(world, blockposition); // CraftBukkit - extinguished by rain + if (!flag && worldserver.isRaining() && this.a((World) worldserver, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) { +- worldserver.a(blockposition, false); ++ fireExtinguished(worldserver, blockposition); // CraftBukkit - extinguished by rain } else { int j = Math.min(15, i + random.nextInt(3) / 2); @@ -105,14 +127,14 @@ BlockPosition blockposition1 = blockposition.down(); - if (!world.getType(blockposition1).d(world, blockposition1, EnumDirection.UP) || i > 3) { -- world.a(blockposition, false); -+ fireExtinguished(world, blockposition); // CraftBukkit + if (!worldserver.getType(blockposition1).d(worldserver, blockposition1, EnumDirection.UP) || i > 3) { +- worldserver.a(blockposition, false); ++ fireExtinguished(worldserver, blockposition); // CraftBukkit } return; } - if (i == 15 && random.nextInt(4) == 0 && !this.j(world.getType(blockposition.down()))) { -- world.a(blockposition, false); -+ fireExtinguished(world, blockposition); // CraftBukkit + if (i == 15 && random.nextInt(4) == 0 && !this.h(worldserver.getType(blockposition.down()))) { +- worldserver.a(blockposition, false); ++ fireExtinguished(worldserver, blockposition); // CraftBukkit return; } } @@ -120,12 +142,14 @@ - boolean flag1 = world.s(blockposition); + boolean flag1 = worldserver.s(blockposition); int k = flag1 ? -50 : 0; -- this.a(world, blockposition.east(), 300 + k, random, i); -- this.a(world, blockposition.west(), 300 + k, random, i); -- this.a(world, blockposition.down(), 250 + k, random, i); -- this.a(world, blockposition.up(), 250 + k, random, i); -- this.a(world, blockposition.north(), 300 + k, random, i); -- this.a(world, blockposition.south(), 300 + k, random, i); +- this.a(worldserver, blockposition.east(), 300 + k, random, i); +- this.a(worldserver, blockposition.west(), 300 + k, random, i); +- this.a(worldserver, blockposition.down(), 250 + k, random, i); +- this.a(worldserver, blockposition.up(), 250 + k, random, i); +- this.a(worldserver, blockposition.north(), 300 + k, random, i); +- this.a(worldserver, blockposition.south(), 300 + k, random, i); + // CraftBukkit start - add source blockposition to burn calls -+ this.a(world, blockposition.east(), 300 + k, random, i, blockposition); -+ this.a(world, blockposition.west(), 300 + k, random, i, blockposition); -+ this.a(world, blockposition.down(), 250 + k, random, i, blockposition); -+ this.a(world, blockposition.up(), 250 + k, random, i, blockposition); -+ this.a(world, blockposition.north(), 300 + k, random, i, blockposition); -+ this.a(world, blockposition.south(), 300 + k, random, i, blockposition); ++ this.a(worldserver, blockposition.east(), 300 + k, random, i, blockposition); ++ this.a(worldserver, blockposition.west(), 300 + k, random, i, blockposition); ++ this.a(worldserver, blockposition.down(), 250 + k, random, i, blockposition); ++ this.a(worldserver, blockposition.up(), 250 + k, random, i, blockposition); ++ this.a(worldserver, blockposition.north(), 300 + k, random, i, blockposition); ++ this.a(worldserver, blockposition.south(), 300 + k, random, i, blockposition); + // CraftBukkit end BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); for (int l = -1; l <= 1; ++l) { @@ -151,7 +175,15 @@ - if (i2 > 0 && random.nextInt(k1) <= i2 && (!world.isRaining() || !this.a(world, (BlockPosition) blockposition_mutableblockposition))) { + if (i2 > 0 && random.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.a((World) worldserver, (BlockPosition) blockposition_mutableblockposition))) { int j2 = Math.min(15, i + random.nextInt(5) / 4); -- world.setTypeAndData(blockposition_mutableblockposition, (IBlockData) this.a((IBlockAccess) world, (BlockPosition) blockposition_mutableblockposition).set(BlockFire.AGE, j2), 3); +- worldserver.setTypeAndData(blockposition_mutableblockposition, (IBlockData) this.a((IBlockAccess) worldserver, (BlockPosition) blockposition_mutableblockposition).set(BlockFire.AGE, j2), 3); + // CraftBukkit start - Call to stop spread of fire -+ if (world.getType(blockposition_mutableblockposition).getBlock() != Blocks.FIRE) { -+ if (CraftEventFactory.callBlockIgniteEvent(world, blockposition_mutableblockposition, blockposition).isCancelled()) { ++ if (worldserver.getType(blockposition_mutableblockposition).getBlock() != Blocks.FIRE) { ++ if (CraftEventFactory.callBlockIgniteEvent(worldserver, blockposition_mutableblockposition, blockposition).isCancelled()) { + continue; + } + -+ CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition_mutableblockposition, (IBlockData) this.a((IBlockAccess) world, (BlockPosition) blockposition_mutableblockposition).set(BlockFire.AGE, j2), 3); // CraftBukkit ++ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition_mutableblockposition, (IBlockData) this.a((IBlockAccess) worldserver, (BlockPosition) blockposition_mutableblockposition).set(BlockFire.AGE, j2), 3); // CraftBukkit + } + // CraftBukkit end } @@ -117,7 +117,7 @@ - private void a(World world, BlockPosition blockposition, int i, Random random, int j) { + private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition - int k = this.q(world.getType(blockposition)); + int k = this.i(world.getType(blockposition)); if (random.nextInt(i) < k) { IBlockData iblockdata = world.getType(blockposition); @@ -150,9 +150,9 @@ } else { world.getBlockTickList().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10)); } -@@ -395,4 +440,12 @@ - blockfire.a(Blocks.COMPOSTER, 5, 20); - blockfire.a(Blocks.SWEET_BERRY_BUSH, 60, 100); +@@ -392,4 +437,12 @@ + blockfire.a(Blocks.BEEHIVE, 5, 20); + blockfire.a(Blocks.BEE_NEST, 30, 20); } + + // CraftBukkit start diff --git a/nms-patches/BlockGrass.patch b/nms-patches/BlockGrass.patch index 4d344f2528..f1d453345a 100644 --- a/nms-patches/BlockGrass.patch +++ b/nms-patches/BlockGrass.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/BlockGrass.java +++ b/net/minecraft/server/BlockGrass.java -@@ -61,7 +61,7 @@ +@@ -63,7 +63,7 @@ } - if (iblockdata3.canPlace(world, blockposition2)) { -- world.setTypeAndData(blockposition2, iblockdata3, 3); -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition2, iblockdata3, 3); // CraftBukkit + if (iblockdata3.canPlace(worldserver, blockposition2)) { +- worldserver.setTypeAndData(blockposition2, iblockdata3, 3); ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition2, iblockdata3, 3); // CraftBukkit } } } diff --git a/nms-patches/BlockIce.patch b/nms-patches/BlockIce.patch index 0f732e5a1a..6d5bc2f8aa 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 -@@ -41,6 +41,11 @@ +@@ -36,6 +36,11 @@ } protected void melt(IBlockData iblockdata, World world, BlockPosition blockposition) { diff --git a/nms-patches/BlockKelp.patch b/nms-patches/BlockKelp.patch index 7f4dc57f10..00f48182ea 100644 --- a/nms-patches/BlockKelp.patch +++ b/nms-patches/BlockKelp.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/BlockKelp.java +++ b/net/minecraft/server/BlockKelp.java -@@ -49,7 +49,7 @@ - IBlockData iblockdata1 = world.getType(blockposition1); +@@ -44,7 +44,7 @@ + IBlockData iblockdata1 = worldserver.getType(blockposition1); if (iblockdata1.getBlock() == Blocks.WATER && (Integer) iblockdata.get(BlockKelp.a) < 25 && random.nextDouble() < 0.14D) { -- world.setTypeUpdate(blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockKelp.a)); -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockKelp.a)); // CraftBukkit +- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockKelp.a)); ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockKelp.a)); // CraftBukkit } } diff --git a/nms-patches/BlockLeaves.patch b/nms-patches/BlockLeaves.patch index 81ceb76dc7..685fe292fa 100644 --- a/nms-patches/BlockLeaves.patch +++ b/nms-patches/BlockLeaves.patch @@ -9,18 +9,18 @@ public class BlockLeaves extends Block { public static final BlockStateInteger DISTANCE = BlockProperties.ah; -@@ -21,6 +23,14 @@ +@@ -20,6 +22,14 @@ @Override - public void c(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + public void b(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { if (!(Boolean) iblockdata.get(BlockLeaves.PERSISTENT) && (Integer) iblockdata.get(BlockLeaves.DISTANCE) == 7) { + // CraftBukkit start -+ LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ())); -+ world.getServer().getPluginManager().callEvent(event); ++ LeavesDecayEvent event = new LeavesDecayEvent(worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ())); ++ worldserver.getServer().getPluginManager().callEvent(event); + -+ if (event.isCancelled() || world.getType(blockposition).getBlock() != this) { ++ if (event.isCancelled() || worldserver.getType(blockposition).getBlock() != this) { + return; + } + // CraftBukkit end - c(iblockdata, world, blockposition); - world.a(blockposition, false); + c(iblockdata, (World) worldserver, blockposition); + worldserver.a(blockposition, false); } diff --git a/nms-patches/BlockLever.patch b/nms-patches/BlockLever.patch index 4fe672c458..e507caebb3 100644 --- a/nms-patches/BlockLever.patch +++ b/nms-patches/BlockLever.patch @@ -10,10 +10,10 @@ public static final BlockStateBoolean POWERED = BlockProperties.w; @@ -64,6 +66,20 @@ - return true; + return EnumInteractionResult.SUCCESS; } else { + // CraftBukkit start - Interact Lever -+ boolean powered = !flag; // Old powered state ++ boolean powered = iblockdata.get(BlockLever.POWERED); // Old powered state + org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + int old = (powered) ? 15 : 0; + int current = (!powered) ? 15 : 0; @@ -22,10 +22,10 @@ + world.getServer().getPluginManager().callEvent(eventRedstone); + + if ((eventRedstone.getNewCurrent() > 0) != (!powered)) { -+ return true; ++ return EnumInteractionResult.SUCCESS; + } + // CraftBukkit end + - world.setTypeAndData(blockposition, iblockdata, 3); - float f = flag ? 0.6F : 0.5F; + iblockdata1 = this.d(iblockdata, world, blockposition); + float f = (Boolean) iblockdata1.get(BlockLever.POWERED) ? 0.6F : 0.5F; diff --git a/nms-patches/BlockMushroom.patch b/nms-patches/BlockMushroom.patch index 73da96da96..83b4998ed3 100644 --- a/nms-patches/BlockMushroom.patch +++ b/nms-patches/BlockMushroom.patch @@ -14,20 +14,28 @@ @@ -45,7 +49,7 @@ } - if (world.isEmpty(blockposition2) && iblockdata.canPlace(world, blockposition2)) { -- world.setTypeAndData(blockposition2, iblockdata, 2); -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition2, iblockdata, 2); // CraftBukkit + if (worldserver.isEmpty(blockposition2) && iblockdata.canPlace(worldserver, blockposition2)) { +- worldserver.setTypeAndData(blockposition2, iblockdata, 2); ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata, 2); // CraftBukkit } } -@@ -70,8 +74,10 @@ - WorldGenerator worldgenerator = null; +@@ -70,14 +74,16 @@ + WorldGenFeatureConfigured worldgenfeatureconfigured; if (this == Blocks.BROWN_MUSHROOM) { +- worldgenfeatureconfigured = WorldGenerator.HUGE_BROWN_MUSHROOM.b((WorldGenFeatureConfiguration) BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM); + BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit - worldgenerator = WorldGenerator.HUGE_BROWN_MUSHROOM; - } else if (this == Blocks.RED_MUSHROOM) { ++ worldgenfeatureconfigured = WorldGenerator.HUGE_BROWN_MUSHROOM.b(BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM); // CraftBukkit - decompile error + } else { + if (this != Blocks.RED_MUSHROOM) { + worldserver.setTypeAndData(blockposition, iblockdata, 3); + return false; + } + +- worldgenfeatureconfigured = WorldGenerator.HUGE_RED_MUSHROOM.b((WorldGenFeatureConfiguration) BiomeDecoratorGroups.HUGE_RED_MUSHROOM); + BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit - worldgenerator = WorldGenerator.HUGE_RED_MUSHROOM; ++ worldgenfeatureconfigured = WorldGenerator.HUGE_RED_MUSHROOM.b(BiomeDecoratorGroups.HUGE_RED_MUSHROOM); // CraftBukkit - decompile error } + if (worldgenfeatureconfigured.a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), random, blockposition)) { diff --git a/nms-patches/BlockNetherWart.patch b/nms-patches/BlockNetherWart.patch index 4fba9280b0..698bf8e67d 100644 --- a/nms-patches/BlockNetherWart.patch +++ b/nms-patches/BlockNetherWart.patch @@ -4,8 +4,8 @@ if (i < 3 && random.nextInt(10) == 0) { iblockdata = (IBlockData) iblockdata.set(BlockNetherWart.AGE, i + 1); -- world.setTypeAndData(blockposition, iblockdata, 2); -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata, 2); // CraftBukkit +- worldserver.setTypeAndData(blockposition, iblockdata, 2); ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit } - super.tick(iblockdata, world, blockposition, random); + super.tick(iblockdata, worldserver, blockposition, random); diff --git a/nms-patches/BlockNote.patch b/nms-patches/BlockNote.patch index 61ab2ef1f7..aae703400d 100644 --- a/nms-patches/BlockNote.patch +++ b/nms-patches/BlockNote.patch @@ -33,7 +33,7 @@ - this.play(world, blockposition); + this.play(world, blockposition, iblockdata); // CraftBukkit entityhuman.a(StatisticList.TUNE_NOTEBLOCK); - return true; + return EnumInteractionResult.SUCCESS; } @@ -58,7 +63,7 @@ @Override diff --git a/nms-patches/BlockObserver.patch b/nms-patches/BlockObserver.patch index 35901b134d..1b32ed39e5 100644 --- a/nms-patches/BlockObserver.patch +++ b/nms-patches/BlockObserver.patch @@ -11,20 +11,20 @@ public static final BlockStateBoolean b = BlockProperties.w; @@ -29,8 +31,18 @@ @Override - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { if ((Boolean) iblockdata.get(BlockObserver.b)) { + // CraftBukkit start -+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) { ++ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, false), 2); + worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, false), 2); } else { + // CraftBukkit start -+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) { ++ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 0, 15).getNewCurrent() != 15) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, true), 2); - world.getBlockTickList().a(blockposition, this, 2); + worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, true), 2); + worldserver.getBlockTickList().a(blockposition, this, 2); } diff --git a/nms-patches/BlockPiston.patch b/nms-patches/BlockPiston.patch index f8d0d3d3dc..1f21e4f100 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 -@@ -6,6 +6,14 @@ - import java.util.List; - import java.util.Set; +@@ -7,6 +7,14 @@ + import java.util.Map; + import java.util.Map.Entry; +// CraftBukkit start +import com.google.common.collect.ImmutableList; @@ -15,7 +15,7 @@ public class BlockPiston extends BlockDirectional { public static final BlockStateBoolean EXTENDED = BlockProperties.g; -@@ -112,6 +120,18 @@ +@@ -113,6 +121,18 @@ } } @@ -31,13 +31,13 @@ + } + // PAIL: checkME - what happened to setTypeAndData? + // CraftBukkit end - world.playBlockAction(blockposition, this, b0, enumdirection.a()); + world.playBlockAction(blockposition, this, b0, enumdirection.b()); } -@@ -281,6 +301,48 @@ +@@ -284,6 +304,48 @@ + int j = list.size() + list2.size(); IBlockData[] aiblockdata = new IBlockData[j]; EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite(); - Set set = Sets.newHashSet(list); + // CraftBukkit start + final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + diff --git a/nms-patches/BlockPortal.patch b/nms-patches/BlockPortal.patch index c713adb2cb..bf7df2b703 100644 --- a/nms-patches/BlockPortal.patch +++ b/nms-patches/BlockPortal.patch @@ -17,13 +17,13 @@ @@ -34,7 +41,8 @@ } - if (world.getType(blockposition).a((IBlockAccess) world, blockposition, EntityTypes.ZOMBIE_PIGMAN)) { -- Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(world, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false); + if (worldserver.getType(blockposition).a((IBlockAccess) worldserver, blockposition, EntityTypes.ZOMBIE_PIGMAN)) { +- Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false); + // CraftBukkit - set spawn reason to NETHER_PORTAL -+ Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(world, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL); ++ Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL); if (entity != null) { - entity.portalCooldown = entity.aX(); + entity.portalCooldown = entity.ba(); @@ -48,8 +56,10 @@ BlockPortal.Shape blockportal_shape = this.b(generatoraccess, blockposition); @@ -37,7 +37,7 @@ } else { return false; } -@@ -85,6 +95,10 @@ +@@ -80,6 +90,10 @@ @Override public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { if (!entity.isPassenger() && !entity.isVehicle() && entity.canPortal()) { @@ -48,7 +48,7 @@ entity.c(blockposition); } -@@ -177,6 +191,7 @@ +@@ -172,6 +186,7 @@ private BlockPosition position; private int height; private int width; @@ -56,7 +56,7 @@ public Shape(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) { this.a = generatoraccess; -@@ -235,6 +250,9 @@ +@@ -230,6 +245,9 @@ } protected int c() { @@ -66,7 +66,7 @@ int i; label56: -@@ -257,11 +275,21 @@ +@@ -252,11 +270,21 @@ block = this.a.getType(blockposition.shift(this.d)).getBlock(); if (block != Blocks.OBSIDIAN) { break label56; @@ -88,7 +88,7 @@ } } } -@@ -271,6 +299,11 @@ +@@ -266,6 +294,11 @@ if (this.a.getType(this.position.shift(this.c, i).up(this.height)).getBlock() != Blocks.OBSIDIAN) { this.height = 0; break; @@ -100,7 +100,7 @@ } } -@@ -294,7 +327,29 @@ +@@ -289,7 +322,29 @@ return this.position != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21; } @@ -131,7 +131,7 @@ for (int i = 0; i < this.width; ++i) { BlockPosition blockposition = this.position.shift(this.c, i); -@@ -303,6 +358,7 @@ +@@ -298,6 +353,7 @@ } } diff --git a/nms-patches/BlockPoweredRail.patch b/nms-patches/BlockPoweredRail.patch index 37989fad64..cf868872be 100644 --- a/nms-patches/BlockPoweredRail.patch +++ b/nms-patches/BlockPoweredRail.patch @@ -21,4 +21,4 @@ + // CraftBukkit end world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockPoweredRail.POWERED, flag1), 3); world.applyPhysics(blockposition.down(), this); - if (((BlockPropertyTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) { + if (((BlockPropertyTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).b()) { diff --git a/nms-patches/BlockPressurePlateAbstract.patch b/nms-patches/BlockPressurePlateAbstract.patch index 35ce273d11..147d7a3169 100644 --- a/nms-patches/BlockPressurePlateAbstract.patch +++ b/nms-patches/BlockPressurePlateAbstract.patch @@ -9,7 +9,7 @@ public abstract class BlockPressurePlateAbstract extends Block { protected static final VoxelShape a = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D); -@@ -68,6 +70,19 @@ +@@ -66,6 +68,19 @@ boolean flag = i > 0; boolean flag1 = j > 0; diff --git a/nms-patches/BlockPressurePlateWeighted.patch b/nms-patches/BlockPressurePlateWeighted.patch index a2527a5816..c629a15856 100644 --- a/nms-patches/BlockPressurePlateWeighted.patch +++ b/nms-patches/BlockPressurePlateWeighted.patch @@ -7,7 +7,7 @@ + public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract { - public static final BlockStateInteger POWER = BlockProperties.as; + public static final BlockStateInteger POWER = BlockProperties.at; @@ -13,7 +15,31 @@ @Override diff --git a/nms-patches/BlockRedstoneComparator.patch b/nms-patches/BlockRedstoneComparator.patch index e39e8b2a35..15a04c6489 100644 --- a/nms-patches/BlockRedstoneComparator.patch +++ b/nms-patches/BlockRedstoneComparator.patch @@ -8,8 +8,8 @@ + public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity { - public static final BlockStateEnum MODE = BlockProperties.ay; -@@ -64,7 +66,8 @@ + public static final BlockStateEnum MODE = BlockProperties.az; +@@ -70,7 +72,8 @@ @Nullable private EntityItemFrame a(World world, EnumDirection enumdirection, BlockPosition blockposition) { @@ -19,7 +19,7 @@ return entityitemframe != null && entityitemframe.getDirection() == enumdirection; }); -@@ -119,8 +122,18 @@ +@@ -125,8 +128,18 @@ boolean flag1 = (Boolean) iblockdata.get(BlockRedstoneComparator.c); if (flag1 && !flag) { diff --git a/nms-patches/BlockRedstoneLamp.patch b/nms-patches/BlockRedstoneLamp.patch index 422c277191..6748e20358 100644 --- a/nms-patches/BlockRedstoneLamp.patch +++ b/nms-patches/BlockRedstoneLamp.patch @@ -21,15 +21,15 @@ world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2); } } -@@ -48,6 +55,11 @@ - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { - if (!world.isClientSide) { - if ((Boolean) iblockdata.get(BlockRedstoneLamp.a) && !world.isBlockIndirectlyPowered(blockposition)) { -+ // CraftBukkit start -+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) { -+ return; -+ } -+ // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2); - } +@@ -47,6 +54,11 @@ + @Override + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + if ((Boolean) iblockdata.get(BlockRedstoneLamp.a) && !worldserver.isBlockIndirectlyPowered(blockposition)) { ++ // CraftBukkit start ++ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) { ++ return; ++ } ++ // CraftBukkit end + worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2); + } diff --git a/nms-patches/BlockRedstoneOre.patch b/nms-patches/BlockRedstoneOre.patch index 5b724cd3cc..d3623afc07 100644 --- a/nms-patches/BlockRedstoneOre.patch +++ b/nms-patches/BlockRedstoneOre.patch @@ -12,7 +12,7 @@ public class BlockRedstoneOre extends Block { public static final BlockStateBoolean a = BlockRedstoneTorch.LIT; -@@ -18,25 +23,46 @@ +@@ -18,14 +23,30 @@ @Override public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) { @@ -46,10 +46,14 @@ } @Override - public boolean interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) { -- interact(iblockdata, world, blockposition); -+ interact(iblockdata, world, blockposition, entityhuman); // CraftBukkit - add entityhuman - return super.interact(iblockdata, world, blockposition, entityhuman, enumhand, movingobjectpositionblock); +@@ -34,14 +55,19 @@ + playEffect(world, blockposition); + return EnumInteractionResult.SUCCESS; + } else { +- interact(iblockdata, world, blockposition); ++ interact(iblockdata, world, blockposition, entityhuman); // CraftBukkit - add entityhuman + return EnumInteractionResult.PASS; + } } - private static void interact(IBlockData iblockdata, World world, BlockPosition blockposition) { @@ -64,19 +68,19 @@ world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.a, true), 3); } -@@ -45,6 +71,11 @@ +@@ -50,6 +76,11 @@ @Override - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { if ((Boolean) iblockdata.get(BlockRedstoneOre.a)) { + // CraftBukkit start -+ if (CraftEventFactory.callBlockFadeEvent(world, blockposition, iblockdata.set(BlockRedstoneOre.a, false)).isCancelled()) { ++ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, iblockdata.set(BlockRedstoneOre.a, false)).isCancelled()) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.a, false), 3); + worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.a, false), 3); } -@@ -53,14 +84,27 @@ +@@ -58,12 +89,25 @@ @Override public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) { super.dropNaturally(iblockdata, world, blockposition, itemstack); @@ -87,8 +91,8 @@ this.dropExperience(world, blockposition, i); } + // */ - - } ++ ++ } + @Override + public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) { @@ -99,8 +103,6 @@ + } + return 0; + // CraftBukkit end -+ } -+ + } + private static void playEffect(World world, BlockPosition blockposition) { - double d0 = 0.5625D; - Random random = world.random; diff --git a/nms-patches/BlockReed.patch b/nms-patches/BlockReed.patch index 44c392da6b..2fe7a05ad8 100644 --- a/nms-patches/BlockReed.patch +++ b/nms-patches/BlockReed.patch @@ -4,8 +4,8 @@ int j = (Integer) iblockdata.get(BlockReed.AGE); if (j == 15) { -- world.setTypeUpdate(blockposition.up(), this.getBlockData()); -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition.up(), this.getBlockData()); // CraftBukkit - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockReed.AGE, 0), 4); +- worldserver.setTypeUpdate(blockposition.up(), this.getBlockData()); ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition.up(), this.getBlockData()); // CraftBukkit + worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockReed.AGE, 0), 4); } else { - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockReed.AGE, j + 1), 4); + worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockReed.AGE, j + 1), 4); diff --git a/nms-patches/BlockSapling.patch b/nms-patches/BlockSapling.patch index e0ee45f963..d5895cf306 100644 --- a/nms-patches/BlockSapling.patch +++ b/nms-patches/BlockSapling.patch @@ -15,7 +15,7 @@ + public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement { - public static final BlockStateInteger STAGE = BlockProperties.at; + public static final BlockStateInteger STAGE = BlockProperties.au; protected static final VoxelShape b = Block.a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D); private final WorldGenTreeProvider c; + public static TreeType treeType; // CraftBukkit @@ -23,21 +23,21 @@ protected BlockSapling(WorldGenTreeProvider worldgentreeprovider, Block.Info block_info) { super(block_info); @@ -23,7 +33,30 @@ - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { - super.tick(iblockdata, world, blockposition, random); - if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) { + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + super.tick(iblockdata, worldserver, blockposition, random); + if (worldserver.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) { + // CraftBukkit start -+ world.captureTreeGeneration = true; ++ worldserver.captureTreeGeneration = true; + // CraftBukkit end - this.grow(world, blockposition, iblockdata, random); + this.grow(worldserver, blockposition, iblockdata, random); + // CraftBukkit start -+ world.captureTreeGeneration = false; -+ if (world.capturedBlockStates.size() > 0) { ++ worldserver.captureTreeGeneration = false; ++ if (worldserver.capturedBlockStates.size() > 0) { + TreeType treeType = BlockSapling.treeType; + BlockSapling.treeType = null; -+ Location location = new Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); -+ List blocks = (List) world.capturedBlockStates.clone(); -+ world.capturedBlockStates.clear(); ++ Location location = new Location(worldserver.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); ++ List blocks = (List) worldserver.capturedBlockStates.clone(); ++ worldserver.capturedBlockStates.clear(); + StructureGrowEvent event = null; + if (treeType != null) { + event = new StructureGrowEvent(location, treeType, false, null, blocks); diff --git a/nms-patches/BlockScaffolding.patch b/nms-patches/BlockScaffolding.patch index 5b249485c3..3bc8a16b5a 100644 --- a/nms-patches/BlockScaffolding.patch +++ b/nms-patches/BlockScaffolding.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/BlockScaffolding.java +++ b/net/minecraft/server/BlockScaffolding.java -@@ -78,7 +78,7 @@ - int i = a((IBlockAccess) world, blockposition); - IBlockData iblockdata1 = (IBlockData) ((IBlockData) iblockdata.set(BlockScaffolding.a, i)).set(BlockScaffolding.c, this.a(world, blockposition, i)); +@@ -73,7 +73,7 @@ + int i = a((IBlockAccess) worldserver, blockposition); + IBlockData iblockdata1 = (IBlockData) ((IBlockData) iblockdata.set(BlockScaffolding.a, i)).set(BlockScaffolding.c, this.a(worldserver, blockposition, i)); - if ((Integer) iblockdata1.get(BlockScaffolding.a) == 7) { -+ if ((Integer) iblockdata1.get(BlockScaffolding.a) == 7 && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit - BlockFadeEvent ++ if ((Integer) iblockdata1.get(BlockScaffolding.a) == 7 && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit - BlockFadeEvent if ((Integer) iblockdata.get(BlockScaffolding.a) == 7) { - world.addEntity(new EntityFallingBlock(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (IBlockData) iblockdata1.set(BlockScaffolding.b, false))); + worldserver.addEntity(new EntityFallingBlock(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (IBlockData) iblockdata1.set(BlockScaffolding.b, false))); } else { diff --git a/nms-patches/BlockSnow.patch b/nms-patches/BlockSnow.patch index a4f4a81c2c..03feab20cf 100644 --- a/nms-patches/BlockSnow.patch +++ b/nms-patches/BlockSnow.patch @@ -2,13 +2,13 @@ +++ b/net/minecraft/server/BlockSnow.java @@ -58,6 +58,11 @@ @Override - public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { - if (world.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) { + public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + if (worldserver.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) { + // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { + return; + } + // CraftBukkit end - c(iblockdata, world, blockposition); - world.a(blockposition, false); + c(iblockdata, (World) worldserver, blockposition); + worldserver.a(blockposition, false); } diff --git a/nms-patches/BlockSoil.patch b/nms-patches/BlockSoil.patch index 7c63e84a2a..16c4f42260 100644 --- a/nms-patches/BlockSoil.patch +++ b/nms-patches/BlockSoil.patch @@ -11,19 +11,19 @@ + public class BlockSoil extends Block { - public static final BlockStateInteger MOISTURE = BlockProperties.ap; + public static final BlockStateInteger MOISTURE = BlockProperties.aq; @@ -53,12 +58,12 @@ - if (!a((IWorldReader) world, blockposition) && !world.isRainingAt(blockposition.up())) { + if (!a((IWorldReader) worldserver, blockposition) && !worldserver.isRainingAt(blockposition.up())) { if (i > 0) { -- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, i - 1), 2); -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, i - 1), 2); // CraftBukkit - } else if (!a((IBlockAccess) world, blockposition)) { - fade(iblockdata, world, blockposition); +- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, i - 1), 2); ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, i - 1), 2); // CraftBukkit + } else if (!a((IBlockAccess) worldserver, blockposition)) { + fade(iblockdata, worldserver, blockposition); } } else if (i < 7) { -- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, 7), 2); -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, 7), 2); // CraftBukkit +- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, 7), 2); ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, 7), 2); // CraftBukkit } } diff --git a/nms-patches/BlockStem.patch b/nms-patches/BlockStem.patch index d52c3f8cf2..16cde53af1 100644 --- a/nms-patches/BlockStem.patch +++ b/nms-patches/BlockStem.patch @@ -13,29 +13,29 @@ if (i < 7) { iblockdata = (IBlockData) iblockdata.set(BlockStem.AGE, i + 1); -- world.setTypeAndData(blockposition, iblockdata, 2); -+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata, 2); // CraftBukkit +- worldserver.setTypeAndData(blockposition, iblockdata, 2); ++ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit } else { EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.a(random); BlockPosition blockposition1 = blockposition.shift(enumdirection); - Block block = world.getType(blockposition1.down()).getBlock(); + Block block = worldserver.getType(blockposition1.down()).getBlock(); - if (world.getType(blockposition1).isAir() && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) { -- world.setTypeUpdate(blockposition1, this.blockFruit.getBlockData()); + if (worldserver.getType(blockposition1).isAir() && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) { +- worldserver.setTypeUpdate(blockposition1, this.blockFruit.getBlockData()); + // CraftBukkit start -+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, this.blockFruit.getBlockData())) { ++ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.blockFruit.getBlockData())) { + return; + } + // CraftBukkit end - world.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.e().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection)); + worldserver.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.d().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection)); } } @@ -66,7 +72,7 @@ - int i = Math.min(7, (Integer) iblockdata.get(BlockStem.AGE) + MathHelper.nextInt(world.random, 2, 5)); + int i = Math.min(7, (Integer) iblockdata.get(BlockStem.AGE) + MathHelper.nextInt(worldserver.random, 2, 5)); IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockStem.AGE, i); -- world.setTypeAndData(blockposition, iblockdata1, 2); -+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata1, 2); // CraftBukkit +- worldserver.setTypeAndData(blockposition, iblockdata1, 2); ++ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata1, 2); // CraftBukkit if (i == 7) { - iblockdata1.a(world, blockposition, world.random); + iblockdata1.a(worldserver, blockposition, worldserver.random); } diff --git a/nms-patches/BlockSweetBerryBush.patch b/nms-patches/BlockSweetBerryBush.patch index b275e53b94..fe3bc44455 100644 --- a/nms-patches/BlockSweetBerryBush.patch +++ b/nms-patches/BlockSweetBerryBush.patch @@ -14,14 +14,14 @@ @@ -24,7 +28,7 @@ int i = (Integer) iblockdata.get(BlockSweetBerryBush.a); - if (i < 3 && random.nextInt(5) == 0 && world.getLightLevel(blockposition.up(), 0) >= 9) { -- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, i + 1), 2); -+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, i + 1), 2); // CraftBukkit + if (i < 3 && random.nextInt(5) == 0 && worldserver.getLightLevel(blockposition.up(), 0) >= 9) { +- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, i + 1), 2); ++ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, i + 1), 2); // CraftBukkit } } @@ -38,7 +42,9 @@ - double d1 = Math.abs(entity.locZ - entity.J); + double d1 = Math.abs(entity.locZ() - entity.G); if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) { + CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit diff --git a/nms-patches/BlockTNT.patch b/nms-patches/BlockTNT.patch index 6501898526..8760831d7d 100644 --- a/nms-patches/BlockTNT.patch +++ b/nms-patches/BlockTNT.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/BlockTNT.java +++ b/net/minecraft/server/BlockTNT.java -@@ -93,6 +93,11 @@ +@@ -95,6 +95,11 @@ if (entityarrow.isBurning()) { BlockPosition blockposition = movingobjectpositionblock.getBlockPosition(); diff --git a/nms-patches/BlockTripwire.patch b/nms-patches/BlockTripwire.patch index fc625ea4ca..35d5936d46 100644 --- a/nms-patches/BlockTripwire.patch +++ b/nms-patches/BlockTripwire.patch @@ -9,7 +9,7 @@ public class BlockTripwire extends Block { public static final BlockStateBoolean POWERED = BlockProperties.w; -@@ -139,6 +141,40 @@ +@@ -132,6 +134,40 @@ } } diff --git a/nms-patches/BlockTurtleEgg.patch b/nms-patches/BlockTurtleEgg.patch index 724d4bce27..728fe6046a 100644 --- a/nms-patches/BlockTurtleEgg.patch +++ b/nms-patches/BlockTurtleEgg.patch @@ -38,28 +38,28 @@ if (i < 2) { + // CraftBukkit start - Call BlockGrowEvent -+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata.set(BlockTurtleEgg.a, i + 1), 2)) { ++ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata.set(BlockTurtleEgg.a, i + 1), 2)) { + return; + } + // CraftBukkit end - world.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); -- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2); -+ // world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2); // CraftBukkit - handled above + worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); +- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2); ++ // worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2); // CraftBukkit - handled above } else { + // CraftBukkit start - Call BlockFadeEvent -+ if (CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { ++ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { + return; + } + // CraftBukkit end - world.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); - world.a(blockposition, false); - if (!world.isClientSide) { + worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); + worldserver.a(blockposition, false); + @@ -73,7 +102,7 @@ - entityturtle.setAgeRaw(-24000); - entityturtle.g(blockposition); - entityturtle.setPositionRotation((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F); -- world.addEntity(entityturtle); -+ world.addEntity(entityturtle, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // CraftBukkit - } + entityturtle.setAgeRaw(-24000); + entityturtle.g(blockposition); + entityturtle.setPositionRotation((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F); +- worldserver.addEntity(entityturtle); ++ worldserver.addEntity(entityturtle, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // CraftBukkit } } + } diff --git a/nms-patches/BlockVine.patch b/nms-patches/BlockVine.patch index 2f0036af60..3505156ed3 100644 --- a/nms-patches/BlockVine.patch +++ b/nms-patches/BlockVine.patch @@ -9,51 +9,51 @@ public class BlockVine extends Block { public static final BlockStateBoolean UP = BlockSprawling.e; -@@ -178,20 +180,24 @@ - BlockPosition blockposition3 = blockposition2.shift(enumdirection1); - BlockPosition blockposition4 = blockposition2.shift(enumdirection2); +@@ -177,20 +179,24 @@ + BlockPosition blockposition3 = blockposition2.shift(enumdirection1); + BlockPosition blockposition4 = blockposition2.shift(enumdirection2); -+ // CraftBukkit start - Call BlockSpreadEvent -+ BlockPosition source = blockposition; ++ // CraftBukkit start - Call BlockSpreadEvent ++ BlockPosition source = blockposition; + - if (flag && a((IBlockAccess) world, blockposition3, enumdirection1)) { -- world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2); -+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2); - } else if (flag1 && a((IBlockAccess) world, blockposition4, enumdirection2)) { -- world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2); -+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2); - } else { - EnumDirection enumdirection3 = enumdirection.opposite(); + if (flag && a((IBlockAccess) worldserver, blockposition3, enumdirection1)) { +- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2); ++ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2); + } else if (flag1 && a((IBlockAccess) worldserver, blockposition4, enumdirection2)) { +- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2); ++ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2); + } else { + EnumDirection enumdirection3 = enumdirection.opposite(); - if (flag && world.isEmpty(blockposition3) && a((IBlockAccess) world, blockposition.shift(enumdirection1), enumdirection3)) { -- world.setTypeAndData(blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2); -+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2); - } else if (flag1 && world.isEmpty(blockposition4) && a((IBlockAccess) world, blockposition.shift(enumdirection2), enumdirection3)) { -- world.setTypeAndData(blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2); -+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2); - } else if ((double) world.random.nextFloat() < 0.05D && a((IBlockAccess) world, blockposition2.up(), EnumDirection.UP)) { -- world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2); -+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2); - } -+ // CraftBukkit end - } - } else if (a((IBlockAccess) world, blockposition2, enumdirection)) { - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2); -@@ -221,7 +227,7 @@ + if (flag && worldserver.isEmpty(blockposition3) && a((IBlockAccess) worldserver, blockposition.shift(enumdirection1), enumdirection3)) { +- worldserver.setTypeAndData(blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2); ++ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2); + } else if (flag1 && worldserver.isEmpty(blockposition4) && a((IBlockAccess) worldserver, blockposition.shift(enumdirection2), enumdirection3)) { +- worldserver.setTypeAndData(blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2); ++ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2); + } else if ((double) worldserver.random.nextFloat() < 0.05D && a((IBlockAccess) worldserver, blockposition2.up(), EnumDirection.UP)) { +- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2); ++ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2); } ++ // CraftBukkit end + } + } else if (a((IBlockAccess) worldserver, blockposition2, enumdirection)) { + worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2); +@@ -220,7 +226,7 @@ + } - if (this.canSpread(iblockdata3)) { -- world.setTypeAndData(blockposition1, iblockdata3, 2); -+ CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, iblockdata3, 2); // CraftBukkit - } + if (this.canSpread(iblockdata3)) { +- worldserver.setTypeAndData(blockposition1, iblockdata3, 2); ++ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata3, 2); // CraftBukkit + } - return; -@@ -236,7 +242,7 @@ - IBlockData iblockdata5 = this.a(iblockdata, iblockdata4, random); + return; +@@ -235,7 +241,7 @@ + IBlockData iblockdata5 = this.a(iblockdata, iblockdata4, random); - if (iblockdata4 != iblockdata5 && this.canSpread(iblockdata5)) { -- world.setTypeAndData(blockposition2, iblockdata5, 2); -+ CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition2, iblockdata5, 2); // CraftBukkit - } + if (iblockdata4 != iblockdata5 && this.canSpread(iblockdata5)) { +- worldserver.setTypeAndData(blockposition2, iblockdata5, 2); ++ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata5, 2); // CraftBukkit } } + } diff --git a/nms-patches/BlockWaterLily.patch b/nms-patches/BlockWaterLily.patch index 95c8f06666..0119b98d74 100644 --- a/nms-patches/BlockWaterLily.patch +++ b/nms-patches/BlockWaterLily.patch @@ -4,8 +4,8 @@ @Override public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { super.a(iblockdata, world, blockposition, entity); -- if (entity instanceof EntityBoat) { -+ if (entity instanceof EntityBoat && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit - world.b(new BlockPosition(blockposition), true); +- if (world instanceof WorldServer && entity instanceof EntityBoat) { ++ if (world instanceof WorldServer && entity instanceof EntityBoat && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit + world.a(new BlockPosition(blockposition), true, entity); } diff --git a/nms-patches/BlockWitherSkull.patch b/nms-patches/BlockWitherSkull.patch index 5c104366c7..f53ca636ea 100644 --- a/nms-patches/BlockWitherSkull.patch +++ b/nms-patches/BlockWitherSkull.patch @@ -38,8 +38,8 @@ } @@ -50,6 +58,15 @@ - entitywither.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().k() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F); - entitywither.aK = shapedetector_shapedetectorcollection.getFacing().k() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F; + entitywither.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().m() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F); + entitywither.aI = shapedetector_shapedetectorcollection.getFacing().m() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F; entitywither.l(); + // CraftBukkit start + if (!world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) { diff --git a/nms-patches/Chunk.patch b/nms-patches/Chunk.patch index 7e52717390..19e230aea0 100644 --- a/nms-patches/Chunk.patch +++ b/nms-patches/Chunk.patch @@ -18,7 +18,7 @@ + // CraftBukkit end + public Chunk(World world, ProtoChunk protochunk) { - this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.q(), protochunk.getSections(), (Consumer) null); + this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null); Iterator iterator = protochunk.y().iterator(); @@ -138,6 +149,7 @@ @@ -55,7 +55,7 @@ iblockdata.onPlace(this.world, blockposition, iblockdata1, flag); } -@@ -382,7 +402,12 @@ +@@ -377,7 +397,12 @@ @Nullable public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { @@ -69,8 +69,8 @@ if (tileentity == null) { NBTTagCompound nbttagcompound = (NBTTagCompound) this.e.remove(blockposition); -@@ -429,6 +454,13 @@ - tileentity1.V_(); +@@ -423,6 +448,13 @@ + tileentity1.ab_(); } + // CraftBukkit start @@ -83,7 +83,7 @@ } } -@@ -478,6 +510,50 @@ +@@ -472,6 +504,50 @@ } @@ -134,7 +134,16 @@ public void markDirty() { this.s = true; } -@@ -552,7 +628,7 @@ +@@ -525,7 +601,7 @@ + Iterator iterator = this.entitySlices[k].a(Entity.class).iterator(); + + while (iterator.hasNext()) { +- Entity entity = (Entity) iterator.next(); ++ T entity = (T) iterator.next(); // CraftBukkit - decompile error + + if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) { + list.add(entity); +@@ -546,7 +622,7 @@ Iterator iterator = this.entitySlices[k].a(oclass).iterator(); while (iterator.hasNext()) { @@ -143,7 +152,7 @@ if (t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { list.add(t0); -@@ -626,7 +702,7 @@ +@@ -620,7 +696,7 @@ @Override public boolean isNeedsSaving() { @@ -152,7 +161,7 @@ } public void d(boolean flag) { -@@ -767,7 +843,7 @@ +@@ -761,7 +837,7 @@ public void B() { if (this.o instanceof ProtoChunkTickList) { @@ -161,7 +170,7 @@ return this.getType(blockposition).getBlock(); }); this.o = TickListEmpty.b(); -@@ -777,7 +853,7 @@ +@@ -771,7 +847,7 @@ } if (this.p instanceof ProtoChunkTickList) { @@ -170,7 +179,7 @@ return this.getFluid(blockposition).getType(); }); this.p = TickListEmpty.b(); -@@ -789,12 +865,12 @@ +@@ -783,12 +859,12 @@ } public void a(WorldServer worldserver) { diff --git a/nms-patches/ChunkGenerator.patch b/nms-patches/ChunkGenerator.patch index 4655ec35e7..70378d5c3e 100644 --- a/nms-patches/ChunkGenerator.patch +++ b/nms-patches/ChunkGenerator.patch @@ -1,22 +1,21 @@ --- a/net/minecraft/server/ChunkGenerator.java +++ b/net/minecraft/server/ChunkGenerator.java -@@ -148,6 +148,19 @@ - ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos(); - StructureStart structurestart = StructureStart.a; +@@ -147,6 +147,18 @@ + StructureStart structurestart1 = StructureStart.a; + BiomeBase biomebase = biomemanager.a(new BlockPosition(chunkcoordintpair.d() + 9, 0, chunkcoordintpair.e() + 9)); + // CraftBukkit start + if (structuregenerator == WorldGenerator.STRONGHOLD) { + synchronized (structuregenerator) { -+ if (structuregenerator.a(chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z)) { -+ BiomeBase biomebase = this.getWorldChunkManager().getBiome(new BlockPosition(chunkcoordintpair.d() + 9, 0, chunkcoordintpair.e() + 9)); -+ StructureStart structurestart1 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, biomebase, StructureBoundingBox.a(), 0, chunkgenerator.getSeed()); ++ if (structuregenerator.a(biomemanager, chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z, biomebase)) { ++ StructureStart structurestart2 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, StructureBoundingBox.a(), i, chunkgenerator.getSeed()); + -+ structurestart1.a(this, definedstructuremanager, chunkcoordintpair.x, chunkcoordintpair.z, biomebase); -+ structurestart = structurestart1.e() ? structurestart1 : StructureStart.a; ++ structurestart2.a(this, definedstructuremanager, chunkcoordintpair.x, chunkcoordintpair.z, biomebase); ++ structurestart1 = structurestart2.e() ? structurestart2 : StructureStart.a; + } + } + } else + // CraftBukkit end - if (structuregenerator.a(chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z)) { - BiomeBase biomebase = this.getWorldChunkManager().getBiome(new BlockPosition(chunkcoordintpair.d() + 9, 0, chunkcoordintpair.e() + 9)); - StructureStart structurestart1 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, biomebase, StructureBoundingBox.a(), 0, chunkgenerator.getSeed()); + if (structuregenerator.a(biomemanager, chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z, biomebase)) { + StructureStart structurestart2 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, StructureBoundingBox.a(), i, chunkgenerator.getSeed()); + diff --git a/nms-patches/ChunkMapDistance.patch b/nms-patches/ChunkMapDistance.patch index 622c9958f6..910fb6dad4 100644 --- a/nms-patches/ChunkMapDistance.patch +++ b/nms-patches/ChunkMapDistance.patch @@ -1,24 +1,15 @@ --- a/net/minecraft/server/ChunkMapDistance.java +++ b/net/minecraft/server/ChunkMapDistance.java -@@ -32,7 +32,7 @@ - private static final Logger LOGGER = LogManager.getLogger(); - private static final int b = 33 + ChunkStatus.a(ChunkStatus.FULL) - 2; - private final Long2ObjectMap> c = new Long2ObjectOpenHashMap(); -- private final Long2ObjectOpenHashMap>> tickets = new Long2ObjectOpenHashMap(); -+ public final Long2ObjectOpenHashMap>> tickets = new Long2ObjectOpenHashMap(); // CraftBukkit - private -> public - private final ChunkMapDistance.a e = new ChunkMapDistance.a(); - private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); - private final ChunkMapDistance.c g = new ChunkMapDistance.c(33); -@@ -62,7 +62,7 @@ +@@ -59,7 +59,7 @@ while (objectiterator.hasNext()) { - Entry>> entry = (Entry) objectiterator.next(); + Entry>> entry = (Entry) objectiterator.next(); -- if (((ObjectSortedSet) entry.getValue()).removeIf((ticket) -> { -+ if ((entry.getValue()).removeIf((ticket) -> { // Craftbukkit - decompile error - return ticket.a(this.currentTick); +- if (((ArraySetSorted) entry.getValue()).removeIf((ticket) -> { ++ if ((entry.getValue()).removeIf((ticket) -> { // CraftBukkit - decompile error + return ticket.b(this.currentTick); })) { - this.e.b(entry.getLongKey(), this.a((ObjectSortedSet) entry.getValue()), false); -@@ -100,10 +100,25 @@ + this.e.b(entry.getLongKey(), a((ArraySetSorted) entry.getValue()), false); +@@ -95,10 +95,25 @@ } if (!this.pendingChunkUpdates.isEmpty()) { @@ -47,7 +38,7 @@ return true; } else { if (!this.l.isEmpty()) { -@@ -125,7 +140,7 @@ +@@ -120,7 +135,7 @@ completablefuture.thenAccept((either) -> { this.m.execute(() -> { @@ -56,86 +47,79 @@ }, j, false)); }); }); -@@ -139,7 +154,7 @@ +@@ -134,23 +149,25 @@ } } - private void addTicket(long i, Ticket ticket) { + private boolean addTicket(long i, Ticket ticket) { // CraftBukkit - void -> boolean - ObjectSortedSet> objectsortedset = this.e(i); - ObjectBidirectionalIterator> objectbidirectionaliterator = objectsortedset.iterator(); - int j; -@@ -150,21 +165,24 @@ - j = PlayerChunkMap.GOLDEN_TICKET + 1; - } - -+ boolean ret = false; // CraftBukkit - if (objectsortedset.add(ticket)) { -- ; -+ ret = true; // CraftBukkit - } + ArraySetSorted> arraysetsorted = this.e(i); + int j = a(arraysetsorted); +- Ticket ticket1 = (Ticket) arraysetsorted.a((Object) ticket); ++ Ticket ticket1 = (Ticket) arraysetsorted.a(ticket); // CraftBukkit - decompile error + ticket1.a(this.currentTick); if (ticket.b() < j) { this.e.b(i, ticket.b(), true); } -+ return ret; // CraftBukkit ++ return ticket == ticket1; // CraftBukkit } - private void removeTicket(long i, Ticket ticket) { + private boolean removeTicket(long i, Ticket ticket) { // CraftBukkit - void -> boolean - ObjectSortedSet> objectsortedset = this.e(i); + ArraySetSorted> arraysetsorted = this.e(i); + boolean removed = false; // CraftBukkit - if (objectsortedset.remove(ticket)) { + if (arraysetsorted.remove(ticket)) { - ; + removed = true; // CraftBukkit } - if (objectsortedset.isEmpty()) { -@@ -172,16 +190,29 @@ + if (arraysetsorted.isEmpty()) { +@@ -158,16 +175,29 @@ } - this.e.b(i, this.a(objectsortedset), false); + this.e.b(i, a(arraysetsorted), false); + return removed; // CraftBukkit } public void a(TicketType tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) { -- this.addTicket(chunkcoordintpair.pair(), new Ticket<>(tickettype, i, t0, this.currentTick)); +- this.addTicket(chunkcoordintpair.pair(), new Ticket<>(tickettype, i, t0)); + // CraftBukkit start + this.addTicketAtLevel(tickettype, chunkcoordintpair, i, t0); + } + + public boolean addTicketAtLevel(TicketType ticketType, ChunkCoordIntPair chunkcoordintpair, int level, T identifier) { -+ return this.addTicket(chunkcoordintpair.pair(), new Ticket<>(ticketType, level, identifier, this.currentTick)); ++ return this.addTicket(chunkcoordintpair.pair(), new Ticket<>(ticketType, level, identifier)); + // CraftBukkit end } public void b(TicketType tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) { -- Ticket ticket = new Ticket<>(tickettype, i, t0, this.currentTick); +- Ticket ticket = new Ticket<>(tickettype, i, t0); + // CraftBukkit start + this.removeTicketAtLevel(tickettype, chunkcoordintpair, i, t0); + } - this.removeTicket(chunkcoordintpair.pair(), ticket); + public boolean removeTicketAtLevel(TicketType ticketType, ChunkCoordIntPair chunkcoordintpair, int level, T identifier) { -+ Ticket ticket = new Ticket<>(ticketType, level, identifier, this.currentTick); ++ Ticket ticket = new Ticket<>(ticketType, level, identifier); + + return this.removeTicket(chunkcoordintpair.pair(), ticket); + // CraftBukkit end } public void addTicket(TicketType tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) { -@@ -265,6 +296,21 @@ +@@ -251,6 +281,21 @@ return this.i.a(); } + // CraftBukkit start + public void removeAllTicketsFor(TicketType ticketType, int ticketLevel, T ticketIdentifier) { -+ Ticket target = new Ticket<>(ticketType, ticketLevel, ticketIdentifier, this.currentTick); ++ Ticket target = new Ticket<>(ticketType, ticketLevel, ticketIdentifier); + -+ for (java.util.Iterator>> iterator = this.tickets.values().iterator(); iterator.hasNext();) { -+ ObjectSortedSet> tickets = iterator.next(); ++ for (java.util.Iterator>> iterator = this.tickets.values().iterator(); iterator.hasNext();) { ++ ArraySetSorted> tickets = iterator.next(); + tickets.remove(target); + + if (tickets.isEmpty()) { @@ -148,8 +132,8 @@ class a extends ChunkMap { public a() { -@@ -351,13 +397,13 @@ - Ticket ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i), ChunkMapDistance.this.currentTick); +@@ -331,13 +376,13 @@ + Ticket ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i)); if (flag1) { - ChunkMapDistance.this.j.a((Object) ChunkTaskQueueSorter.a(() -> { @@ -164,7 +148,7 @@ }, i, false)); } -@@ -366,7 +412,7 @@ +@@ -346,7 +391,7 @@ return j; })); } else { diff --git a/nms-patches/ChunkProviderGenerate.patch b/nms-patches/ChunkProviderGenerate.patch index 8b8d076d90..790ede79d8 100644 --- a/nms-patches/ChunkProviderGenerate.patch +++ b/nms-patches/ChunkProviderGenerate.patch @@ -9,7 +9,7 @@ for (int i = -2; i <= 2; ++i) { for (int j = -2; j <= 2; ++j) { float f = 10.0F / MathHelper.c((float) (i * i + j * j) + 0.2F); -@@ -82,6 +82,11 @@ +@@ -83,6 +83,11 @@ f4 = 1.0F + f4 * 2.0F; f5 = 1.0F + f5 * 4.0F; } @@ -19,5 +19,5 @@ + } + // CraftBukkit end - float f6 = ChunkProviderGenerate.h[k + 2 + (l + 2) * 5] / (f4 + 2.0F); + float f6 = ChunkProviderGenerate.h[l + 2 + (i1 + 2) * 5] / (f4 + 2.0F); diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch index 73c9f163ba..c1fbe506a6 100644 --- a/nms-patches/ChunkProviderServer.patch +++ b/nms-patches/ChunkProviderServer.patch @@ -130,8 +130,8 @@ + int k1 = limit * l / ChunkProviderServer.b; // CraftBukkit - use per-world limits if (object2intmap.getInt(enumcreaturetype) <= k1) { - SpawnerCreature.a(enumcreaturetype, (World) this.world, chunk, blockposition); -@@ -497,12 +547,18 @@ + SpawnerCreature.a(enumcreaturetype, this.world, chunk, blockposition); +@@ -496,12 +546,18 @@ @Override protected boolean executeNext() { diff --git a/nms-patches/CommandBlockListenerAbstract.patch b/nms-patches/CommandBlockListenerAbstract.patch index 5200399ed1..6c024518b2 100644 --- a/nms-patches/CommandBlockListenerAbstract.patch +++ b/nms-patches/CommandBlockListenerAbstract.patch @@ -8,19 +8,19 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { -@@ -15,6 +16,10 @@ +@@ -16,6 +17,10 @@ private IChatBaseComponent lastOutput; private String command = ""; - private IChatBaseComponent customName = new ChatComponentText("@"); + private IChatBaseComponent customName; + // CraftBukkit start + @Override + public abstract CommandSender getBukkitSender(CommandListenerWrapper wrapper); + // CraftBukkit end - public CommandBlockListenerAbstract() {} - -@@ -102,14 +107,7 @@ - if (minecraftserver != null && minecraftserver.F() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.command)) { + public CommandBlockListenerAbstract() { + this.customName = CommandBlockListenerAbstract.c; +@@ -105,14 +110,7 @@ + if (minecraftserver != null && minecraftserver.J() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.command)) { try { this.lastOutput = null; - CommandListenerWrapper commandlistenerwrapper = this.getWrapper().a((commandcontext, flag, i) -> { @@ -35,15 +35,3 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Executing command block"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed"); -@@ -140,6 +138,11 @@ - } - - public void setName(IChatBaseComponent ichatbasecomponent) { -+ // CraftBukkit start -+ if (ichatbasecomponent == null) { -+ ichatbasecomponent = new ChatComponentText("@"); -+ } -+ // CraftBukkit end - this.customName = ichatbasecomponent; - } - diff --git a/nms-patches/CommandDispatcher.patch b/nms-patches/CommandDispatcher.patch index de42bff4e7..82219d58cb 100644 --- a/nms-patches/CommandDispatcher.patch +++ b/nms-patches/CommandDispatcher.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CommandDispatcher.java +++ b/net/minecraft/server/CommandDispatcher.java -@@ -17,12 +17,21 @@ +@@ -19,12 +19,21 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -23,7 +23,7 @@ CommandAdvancement.a(this.b); CommandExecute.a(this.b); CommandBossBar.a(this.b); -@@ -93,14 +102,59 @@ +@@ -100,14 +109,59 @@ } this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> { @@ -84,7 +84,7 @@ StringReader stringreader = new StringReader(s); if (stringreader.canRead() && stringreader.peek() == '/') { -@@ -112,7 +166,6 @@ +@@ -119,7 +173,6 @@ byte b0; try { @@ -92,7 +92,7 @@ ChatComponentText chatcomponenttext; try { -@@ -121,52 +174,56 @@ +@@ -128,58 +181,62 @@ return i; } catch (CommandException commandexception) { commandlistenerwrapper.sendFailureMessage(commandexception.a()); @@ -144,39 +144,49 @@ } catch (Exception exception) { - chatcomponenttext = new ChatComponentText; - } -- -- chatcomponenttext.(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage()); -- ChatComponentText chatcomponenttext1 = chatcomponenttext; + ChatMessage chatmessage1 = new ChatMessage("command.failed", new Object[0]); -- if (CommandDispatcher.LOGGER.isDebugEnabled()) { -- StackTraceElement[] astacktraceelement = exception.getStackTrace(); +- chatcomponenttext.(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage()); +- ChatComponentText chatcomponenttext1 = chatcomponenttext; + chatcomponenttext = new ChatComponentText(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage()); + if (CommandDispatcher.LOGGER.isDebugEnabled()) { ++ CommandDispatcher.LOGGER.error("Command exception: {}", s, exception); + StackTraceElement[] astacktraceelement = exception.getStackTrace(); -- for(int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) { -- chatcomponenttext1.a("\n\n").a(astacktraceelement[k].getMethodName()).a("\n ").a(astacktraceelement[k].getFileName()).a(":").a(String.valueOf(astacktraceelement[k].getLineNumber())); +- if (CommandDispatcher.LOGGER.isDebugEnabled()) { +- CommandDispatcher.LOGGER.error("Command exception: {}", s, exception); +- StackTraceElement[] astacktraceelement = exception.getStackTrace(); + for (int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) { + chatcomponenttext.a("\n\n" + astacktraceelement[k].getMethodName() + "\n " + astacktraceelement[k].getFileName() + ":" + astacktraceelement[k].getLineNumber()); + } ++ } + +- for(int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) { +- chatcomponenttext1.a("\n\n").a(astacktraceelement[k].getMethodName()).a("\n ").a(astacktraceelement[k].getFileName()).a(":").a(String.valueOf(astacktraceelement[k].getLineNumber())); ++ chatmessage1.getChatModifier().setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatcomponenttext)); ++ commandlistenerwrapper.sendFailureMessage(chatmessage1); ++ if (SharedConstants.b) { ++ commandlistenerwrapper.sendFailureMessage(new ChatComponentText(SystemUtils.d(exception))); ++ CommandDispatcher.LOGGER.error("'" + s + "' threw an exception", exception); } - } - commandlistenerwrapper.sendFailureMessage((new ChatMessage("command.failed", new Object[0])).a((chatmodifier) -> { - chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatcomponenttext1)); - })); -- b0 = 0; -+ chatmessage1.getChatModifier().setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatcomponenttext)); -+ commandlistenerwrapper.sendFailureMessage(chatmessage1); +- if (SharedConstants.b) { +- commandlistenerwrapper.sendFailureMessage(new ChatComponentText(SystemUtils.d(exception))); +- CommandDispatcher.LOGGER.error("'" + s + "' threw an exception", exception); +- } + byte b1 = 0; -+ + +- b0 = 0; + return b1; + } } finally { commandlistenerwrapper.getServer().getMethodProfiler().exit(); } -@@ -175,11 +232,36 @@ +@@ -188,11 +245,36 @@ } public void a(EntityPlayer entityplayer) { @@ -214,7 +224,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode)); } -@@ -190,7 +272,7 @@ +@@ -203,7 +285,7 @@ CommandNode commandnode2 = (CommandNode) iterator.next(); if (commandnode2.canUse(commandlistenerwrapper)) { @@ -223,7 +233,7 @@ argumentbuilder.requires((icompletionprovider) -> { return true; -@@ -213,7 +295,7 @@ +@@ -226,7 +308,7 @@ argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect())); } diff --git a/nms-patches/CommandEffect.patch b/nms-patches/CommandEffect.patch index 81ee359fc1..1b97133194 100644 --- a/nms-patches/CommandEffect.patch +++ b/nms-patches/CommandEffect.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CommandEffect.java +++ b/net/minecraft/server/CommandEffect.java -@@ -60,7 +60,7 @@ +@@ -63,7 +63,7 @@ if (entity instanceof EntityLiving) { MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag); @@ -9,7 +9,7 @@ ++j; } } -@@ -86,7 +86,7 @@ +@@ -89,7 +89,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -18,7 +18,7 @@ ++i; } } -@@ -111,7 +111,7 @@ +@@ -114,7 +114,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); diff --git a/nms-patches/ContainerAnvil.patch b/nms-patches/ContainerAnvil.patch index 5f9776b6d4..2a3ca1df19 100644 --- a/nms-patches/ContainerAnvil.patch +++ b/nms-patches/ContainerAnvil.patch @@ -98,7 +98,7 @@ public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return (Boolean) this.containerAccess.a((world, blockposition) -> { - return !world.getType(blockposition).a(TagsBlock.ANVIL) ? false : entityhuman.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= 64.0D; + return !world.getType(blockposition).a(TagsBlock.ANVIL) ? false : entityhuman.g((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= 64.0D; }, true); @@ -370,4 +382,18 @@ diff --git a/nms-patches/ContainerCartography.patch b/nms-patches/ContainerCartography.patch index 788c1198e4..3566a15644 100644 --- a/nms-patches/ContainerCartography.patch +++ b/nms-patches/ContainerCartography.patch @@ -29,8 +29,8 @@ + // CraftBukkit end private final ContainerAccess containerAccess; private boolean e; - public final IInventory inventory; -@@ -26,6 +48,13 @@ + private long f; +@@ -27,6 +49,13 @@ ContainerCartography.this.a((IInventory) this); super.update(); } @@ -44,7 +44,7 @@ }; this.containerAccess = containeraccess; this.a(new Slot(this.inventory, 0, 15, 15) { -@@ -97,10 +126,12 @@ +@@ -104,10 +133,12 @@ this.a(new Slot(playerinventory, j, 8 + j * 18, 142)); } diff --git a/nms-patches/ContainerLoom.patch b/nms-patches/ContainerLoom.patch index 5042405c84..0b0f1f1f2c 100644 --- a/nms-patches/ContainerLoom.patch +++ b/nms-patches/ContainerLoom.patch @@ -30,7 +30,7 @@ private final ContainerAccess containerAccess; private final ContainerProperty d; private Runnable e; -@@ -28,6 +50,13 @@ +@@ -29,6 +51,13 @@ ContainerLoom.this.a((IInventory) this); ContainerLoom.this.e.run(); } @@ -44,7 +44,7 @@ }; this.resultInventory = new InventorySubcontainer(1) { @Override -@@ -35,6 +64,13 @@ +@@ -36,6 +65,13 @@ super.update(); ContainerLoom.this.e.run(); } @@ -58,7 +58,7 @@ }; this.containerAccess = containeraccess; this.f = this.a(new Slot(this.craftInventory, 0, 13, 26) { -@@ -89,10 +125,12 @@ +@@ -96,10 +132,12 @@ } this.a(this.d); @@ -71,7 +71,7 @@ return a(this.containerAccess, entityhuman, Blocks.LOOM); } -@@ -211,6 +249,11 @@ +@@ -218,6 +256,11 @@ if (nbttagcompound.hasKeyOfType("Patterns", 9)) { nbttaglist = nbttagcompound.getList("Patterns", 10); diff --git a/nms-patches/ContainerMerchant.patch b/nms-patches/ContainerMerchant.patch index 2b7bb57dee..1d4f7f5294 100644 --- a/nms-patches/ContainerMerchant.patch +++ b/nms-patches/ContainerMerchant.patch @@ -42,4 +42,4 @@ + if (!this.merchant.getWorld().isClientSide && this.merchant instanceof Entity) { // CraftBukkit - SPIGOT-5035 Entity entity = (Entity) this.merchant; - this.merchant.getWorld().a(entity.locX, entity.locY, entity.locZ, this.merchant.eb(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false); + this.merchant.getWorld().a(entity.locX(), entity.locY(), entity.locZ(), this.merchant.getTradeSound(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false); diff --git a/nms-patches/ContainerPlayer.patch b/nms-patches/ContainerPlayer.patch index 253de36883..72b3e02e8c 100644 --- a/nms-patches/ContainerPlayer.patch +++ b/nms-patches/ContainerPlayer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ContainerPlayer.java +++ b/net/minecraft/server/ContainerPlayer.java -@@ -1,18 +1,36 @@ +@@ -1,5 +1,10 @@ package net.minecraft.server; +// CraftBukkit start @@ -10,15 +10,18 @@ + public class ContainerPlayer extends ContainerRecipeBook { - private static final String[] d = new String[]{"item/empty_armor_slot_boots", "item/empty_armor_slot_leggings", "item/empty_armor_slot_chestplate", "item/empty_armor_slot_helmet"}; - private static final EnumItemSlot[] e = new EnumItemSlot[]{EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET}; + public static final MinecraftKey c = new MinecraftKey("textures/atlas/blocks.png"); +@@ -10,15 +15,28 @@ + public static final MinecraftKey h = new MinecraftKey("item/empty_armor_slot_shield"); + private static final MinecraftKey[] j = new MinecraftKey[]{ContainerPlayer.g, ContainerPlayer.f, ContainerPlayer.e, ContainerPlayer.d}; + private static final EnumItemSlot[] k = new EnumItemSlot[]{EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET}; - private final InventoryCrafting craftInventory = new InventoryCrafting(this, 2, 2); - private final InventoryCraftResult resultInventory = new InventoryCraftResult(); + // CraftBukkit start + private final InventoryCrafting craftInventory; + private final InventoryCraftResult resultInventory; + // CraftBukkit end - public final boolean c; + public final boolean i; private final EntityHuman owner; + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; @@ -27,7 +30,7 @@ public ContainerPlayer(PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) { super((Containers) null, 0); - this.c = flag; + this.i = flag; this.owner = entityhuman; + // CraftBukkit start + this.resultInventory = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction @@ -39,7 +42,7 @@ this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 154, 28))); int i; -@@ -79,7 +97,7 @@ +@@ -85,7 +103,7 @@ @Override public void a(IInventory iinventory) { @@ -48,7 +51,7 @@ } @Override -@@ -182,4 +200,17 @@ +@@ -188,4 +206,17 @@ public int h() { return this.craftInventory.f(); } diff --git a/nms-patches/ContainerStonecutter.patch b/nms-patches/ContainerStonecutter.patch index 13ec80d5cf..6e58fda629 100644 --- a/nms-patches/ContainerStonecutter.patch +++ b/nms-patches/ContainerStonecutter.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/ContainerStonecutter.java +++ b/net/minecraft/server/ContainerStonecutter.java -@@ -3,6 +3,11 @@ - import com.google.common.collect.ImmutableList; +@@ -2,6 +2,11 @@ + import com.google.common.collect.Lists; import java.util.List; +// CraftBukkit start @@ -12,8 +12,8 @@ public class ContainerStonecutter extends Container { -@@ -18,6 +23,21 @@ - private Runnable m; +@@ -16,6 +21,21 @@ + private Runnable l; public final IInventory inventory; private final InventoryCraftResult resultInventory; + // CraftBukkit start @@ -34,7 +34,7 @@ public ContainerStonecutter(int i, PlayerInventory playerinventory) { this(i, playerinventory, ContainerAccess.a); -@@ -83,10 +103,12 @@ +@@ -81,10 +101,12 @@ } this.a(this.containerProperty); diff --git a/nms-patches/ContainerWorkbench.patch b/nms-patches/ContainerWorkbench.patch index d78f84ead5..fd067c4653 100644 --- a/nms-patches/ContainerWorkbench.patch +++ b/nms-patches/ContainerWorkbench.patch @@ -70,7 +70,7 @@ return a(this.containerAccess, entityhuman, Blocks.CRAFTING_TABLE); } -@@ -166,4 +180,17 @@ +@@ -168,4 +182,17 @@ public int h() { return this.craftInventory.f(); } diff --git a/nms-patches/CustomFunction.patch b/nms-patches/CustomFunction.patch index 0e6666ad55..baea3d9406 100644 --- a/nms-patches/CustomFunction.patch +++ b/nms-patches/CustomFunction.patch @@ -8,4 +8,4 @@ + ParseResults parseresults = customfunctiondata.d().parse(stringreader, customfunctiondata.g()); // CraftBukkit if (parseresults.getReader().canRead()) { - if (parseresults.getExceptions().size() == 1) { + throw CommandDispatcher.a(parseresults); diff --git a/nms-patches/DamageSource.patch b/nms-patches/DamageSource.patch index b37c13656a..265ff64bb7 100644 --- a/nms-patches/DamageSource.patch +++ b/nms-patches/DamageSource.patch @@ -17,5 +17,5 @@ + } + // CraftBukkit end - public static DamageSource mobAttack(EntityLiving entityliving) { - return new EntityDamageSource("mob", entityliving); + public static DamageSource a(EntityLiving entityliving) { + return new EntityDamageSource("sting", entityliving); diff --git a/nms-patches/DedicatedServer.patch b/nms-patches/DedicatedServer.patch index 2058763f9b..6f81366289 100644 --- a/nms-patches/DedicatedServer.patch +++ b/nms-patches/DedicatedServer.patch @@ -219,7 +219,7 @@ return this.remoteControlCommandListener.getMessages(); } @@ -562,4 +673,16 @@ - public boolean b(GameProfile gameprofile) { + public boolean a(GameProfile gameprofile) { return false; } + diff --git a/nms-patches/DimensionManager.patch b/nms-patches/DimensionManager.patch index c11910c464..93d35d1ab9 100644 --- a/nms-patches/DimensionManager.patch +++ b/nms-patches/DimensionManager.patch @@ -4,34 +4,35 @@ public class DimensionManager implements MinecraftSerializable { -- public static final DimensionManager OVERWORLD = register("overworld", new DimensionManager(1, "", "", WorldProviderNormal::new, true)); -- public static final DimensionManager NETHER = register("the_nether", new DimensionManager(0, "_nether", "DIM-1", WorldProviderHell::new, false)); -- public static final DimensionManager THE_END = register("the_end", new DimensionManager(2, "_end", "DIM1", WorldProviderTheEnd::new, false)); +- public static final DimensionManager OVERWORLD = register("overworld", new DimensionManager(1, "", "", WorldProviderNormal::new, true, GenLayerZoomVoronoiFixed.INSTANCE)); +- public static final DimensionManager NETHER = register("the_nether", new DimensionManager(0, "_nether", "DIM-1", WorldProviderHell::new, false, GenLayerZoomVoronoi.INSTANCE)); +- public static final DimensionManager THE_END = register("the_end", new DimensionManager(2, "_end", "DIM1", WorldProviderTheEnd::new, false, GenLayerZoomVoronoi.INSTANCE)); + // CraftBukkit start -+ public static final DimensionManager OVERWORLD = register("overworld", new DimensionManager(1, "", "", WorldProviderNormal::new, true, null)); -+ public static final DimensionManager NETHER = register("the_nether", new DimensionManager(0, "_nether", "DIM-1", WorldProviderHell::new, false, null)); -+ public static final DimensionManager THE_END = register("the_end", new DimensionManager(2, "_end", "DIM1", WorldProviderTheEnd::new, false, null)); ++ public static final DimensionManager OVERWORLD = register("overworld", new DimensionManager(1, "", "", WorldProviderNormal::new, true, GenLayerZoomVoronoiFixed.INSTANCE, null)); ++ public static final DimensionManager NETHER = register("the_nether", new DimensionManager(0, "_nether", "DIM-1", WorldProviderHell::new, false, GenLayerZoomVoronoiFixed.INSTANCE, null)); ++ public static final DimensionManager THE_END = register("the_end", new DimensionManager(2, "_end", "DIM1", WorldProviderTheEnd::new, false, GenLayerZoomVoronoiFixed.INSTANCE, null)); + // CraftBukkit end private final int id; private final String suffix; public final String folder; -@@ -21,12 +23,14 @@ +@@ -22,13 +24,15 @@ return (DimensionManager) IRegistry.a(IRegistry.DIMENSION_TYPE, dimensionmanager.id, s, dimensionmanager); } -- public DimensionManager(int i, String s, String s1, BiFunction bifunction, boolean flag) { +- public DimensionManager(int i, String s, String s1, BiFunction bifunction, boolean flag, GenLayerZoomer genlayerzoomer) { + // CraftBukkit - add type -+ public DimensionManager(int i, String s, String s1, BiFunction bifunction, boolean flag, DimensionManager type) { ++ public DimensionManager(int i, String s, String s1, BiFunction bifunction, boolean flag, GenLayerZoomer genlayerzoomer, DimensionManager type) { this.id = i; this.suffix = s; this.folder = s1; this.providerFactory = bifunction; this.hasSkyLight = flag; + this.genLayerZoomer = genlayerzoomer; + this.type = type; // CraftBukkit } public static DimensionManager a(Dynamic dynamic) { -@@ -80,4 +84,12 @@ +@@ -86,4 +90,12 @@ public T a(DynamicOps dynamicops) { return dynamicops.createString(IRegistry.DIMENSION_TYPE.getKey(this).toString()); } diff --git a/nms-patches/DispenseBehaviorBoat.patch b/nms-patches/DispenseBehaviorBoat.patch index 41cac8cf6e..35eee4d832 100644 --- a/nms-patches/DispenseBehaviorBoat.patch +++ b/nms-patches/DispenseBehaviorBoat.patch @@ -47,7 +47,7 @@ + // CraftBukkit end entityboat.setType(this.c); - entityboat.yaw = enumdirection.l(); + entityboat.yaw = enumdirection.n(); - world.addEntity(entityboat); - itemstack.subtract(1); + if (!world.addEntity(entityboat)) itemstack.add(1); // CraftBukkit diff --git a/nms-patches/DispenserRegistry.patch b/nms-patches/DispenserRegistry.patch index f64e7ba8e9..0e35b55c7d 100644 --- a/nms-patches/DispenserRegistry.patch +++ b/nms-patches/DispenserRegistry.patch @@ -22,25 +22,25 @@ d(); } + // CraftBukkit start - easier than fixing the decompile -+ DataConverterFlattenData.a(1008, "{Name:'minecraft:oak_sign',Properties:{rotation:'0'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'0'}}"); -+ DataConverterFlattenData.a(1009, "{Name:'minecraft:oak_sign',Properties:{rotation:'1'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'1'}}"); -+ DataConverterFlattenData.a(1010, "{Name:'minecraft:oak_sign',Properties:{rotation:'2'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'2'}}"); -+ DataConverterFlattenData.a(1011, "{Name:'minecraft:oak_sign',Properties:{rotation:'3'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'3'}}"); -+ DataConverterFlattenData.a(1012, "{Name:'minecraft:oak_sign',Properties:{rotation:'4'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'4'}}"); -+ DataConverterFlattenData.a(1013, "{Name:'minecraft:oak_sign',Properties:{rotation:'5'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'5'}}"); -+ DataConverterFlattenData.a(1014, "{Name:'minecraft:oak_sign',Properties:{rotation:'6'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'6'}}"); -+ DataConverterFlattenData.a(1015, "{Name:'minecraft:oak_sign',Properties:{rotation:'7'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'7'}}"); -+ DataConverterFlattenData.a(1016, "{Name:'minecraft:oak_sign',Properties:{rotation:'8'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'8'}}"); -+ DataConverterFlattenData.a(1017, "{Name:'minecraft:oak_sign',Properties:{rotation:'9'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'9'}}"); -+ DataConverterFlattenData.a(1018, "{Name:'minecraft:oak_sign',Properties:{rotation:'10'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'10'}}"); -+ DataConverterFlattenData.a(1019, "{Name:'minecraft:oak_sign',Properties:{rotation:'11'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'11'}}"); -+ DataConverterFlattenData.a(1020, "{Name:'minecraft:oak_sign',Properties:{rotation:'12'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'12'}}"); -+ DataConverterFlattenData.a(1021, "{Name:'minecraft:oak_sign',Properties:{rotation:'13'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'13'}}"); -+ DataConverterFlattenData.a(1022, "{Name:'minecraft:oak_sign',Properties:{rotation:'14'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'14'}}"); -+ DataConverterFlattenData.a(1023, "{Name:'minecraft:oak_sign',Properties:{rotation:'15'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'15'}}"); ++ DataConverterFlattenData.map(1008, "{Name:'minecraft:oak_sign',Properties:{rotation:'0'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'0'}}"); ++ DataConverterFlattenData.map(1009, "{Name:'minecraft:oak_sign',Properties:{rotation:'1'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'1'}}"); ++ DataConverterFlattenData.map(1010, "{Name:'minecraft:oak_sign',Properties:{rotation:'2'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'2'}}"); ++ DataConverterFlattenData.map(1011, "{Name:'minecraft:oak_sign',Properties:{rotation:'3'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'3'}}"); ++ DataConverterFlattenData.map(1012, "{Name:'minecraft:oak_sign',Properties:{rotation:'4'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'4'}}"); ++ DataConverterFlattenData.map(1013, "{Name:'minecraft:oak_sign',Properties:{rotation:'5'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'5'}}"); ++ DataConverterFlattenData.map(1014, "{Name:'minecraft:oak_sign',Properties:{rotation:'6'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'6'}}"); ++ DataConverterFlattenData.map(1015, "{Name:'minecraft:oak_sign',Properties:{rotation:'7'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'7'}}"); ++ DataConverterFlattenData.map(1016, "{Name:'minecraft:oak_sign',Properties:{rotation:'8'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'8'}}"); ++ DataConverterFlattenData.map(1017, "{Name:'minecraft:oak_sign',Properties:{rotation:'9'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'9'}}"); ++ DataConverterFlattenData.map(1018, "{Name:'minecraft:oak_sign',Properties:{rotation:'10'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'10'}}"); ++ DataConverterFlattenData.map(1019, "{Name:'minecraft:oak_sign',Properties:{rotation:'11'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'11'}}"); ++ DataConverterFlattenData.map(1020, "{Name:'minecraft:oak_sign',Properties:{rotation:'12'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'12'}}"); ++ DataConverterFlattenData.map(1021, "{Name:'minecraft:oak_sign',Properties:{rotation:'13'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'13'}}"); ++ DataConverterFlattenData.map(1022, "{Name:'minecraft:oak_sign',Properties:{rotation:'14'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'14'}}"); ++ DataConverterFlattenData.map(1023, "{Name:'minecraft:oak_sign',Properties:{rotation:'15'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'15'}}"); + DataConverterMaterialId.ID_MAPPING.put(323, "minecraft:oak_sign"); + -+ DataConverterFlattenData.a(1440, "{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}", new String[]{"{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}"}); ++ DataConverterFlattenData.map(1440, "{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}", new String[]{"{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}"}); + + DataConverterMaterialId.ID_MAPPING.put(409, "minecraft:prismarine_shard"); + DataConverterMaterialId.ID_MAPPING.put(410, "minecraft:prismarine_crystals"); diff --git a/nms-patches/EnchantmentThorns.patch b/nms-patches/EnchantmentThorns.patch deleted file mode 100644 index 57d1a4af15..0000000000 --- a/nms-patches/EnchantmentThorns.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/server/EnchantmentThorns.java -+++ b/net/minecraft/server/EnchantmentThorns.java -@@ -34,7 +34,7 @@ - Random random = entityliving.getRandom(); - Entry entry = EnchantmentManager.b(Enchantments.THORNS, entityliving); - -- if (a(i, random)) { -+ if (entity != null && a(i, random)) { // CraftBukkit - if (entity != null) { - entity.damageEntity(DamageSource.a(entityliving), (float) b(i, random)); - } diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch index c1cd7c0fcd..aec4967580 100644 --- a/nms-patches/Entity.patch +++ b/nms-patches/Entity.patch @@ -58,7 +58,7 @@ protected static final Logger LOGGER = LogManager.getLogger(); private static final AtomicInteger entityCount = new AtomicInteger(); private static final List c = Collections.emptyList(); -@@ -106,6 +155,20 @@ +@@ -110,6 +159,20 @@ private long aH; private EntitySize size; private float headHeight; @@ -79,7 +79,7 @@ public Entity(EntityTypes entitytypes, World world) { this.id = Entity.entityCount.incrementAndGet(); -@@ -204,6 +267,12 @@ +@@ -214,6 +277,12 @@ } protected void setPose(EntityPose entitypose) { @@ -92,7 +92,7 @@ this.datawatcher.set(Entity.POSE, entitypose); } -@@ -212,6 +281,33 @@ +@@ -222,6 +291,33 @@ } protected void setYawPitch(float f, float f1) { @@ -126,15 +126,15 @@ this.yaw = f % 360.0F; this.pitch = f1 % 360.0F; } -@@ -224,6 +320,7 @@ +@@ -232,6 +328,7 @@ float f1 = this.size.height; this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); + if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit } - public void tick() { -@@ -234,6 +331,15 @@ + protected void Z() { +@@ -246,6 +343,15 @@ this.entityBaseTick(); } @@ -150,16 +150,16 @@ public void entityBaseTick() { this.world.getMethodProfiler().enter("entityBaseTick"); if (this.isPassenger() && this.getVehicle().dead) { -@@ -250,7 +356,7 @@ - this.lastZ = this.locZ; +@@ -259,7 +365,7 @@ + this.A = this.B; this.lastPitch = this.pitch; this.lastYaw = this.yaw; - this.doPortalTick(); + if (this instanceof EntityPlayer) this.doPortalTick(); // CraftBukkit - // Moved up to postTick - this.aA(); + this.aE(); this.m(); if (this.world.isClientSide) { -@@ -300,12 +406,44 @@ +@@ -309,12 +415,44 @@ protected void burnFromLava() { if (!this.isFireProof()) { @@ -205,8 +205,8 @@ int j = i * 20; if (this instanceof EntityLiving) { -@@ -409,6 +547,28 @@ - block1.a((IBlockAccess) this.world, this); +@@ -404,6 +542,28 @@ + block.a((IBlockAccess) this.world, this); } + // CraftBukkit start @@ -231,10 +231,10 @@ + } + // CraftBukkit end + - if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) { - double d0 = vec3d1.x; - double d1 = vec3d1.y; -@@ -462,7 +622,14 @@ + if (this.onGround && !this.bk()) { + block.stepOn(this.world, blockposition, this); + } +@@ -458,7 +618,14 @@ if (!flag) { ++this.fireTicks; if (this.fireTicks == 0) { @@ -250,15 +250,15 @@ } } -@@ -698,6 +865,7 @@ - this.locX = (axisalignedbb.minX + axisalignedbb.maxX) / 2.0D; - this.locY = axisalignedbb.minY; - this.locZ = (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D; +@@ -683,6 +850,7 @@ + AxisAlignedBB axisalignedbb = this.getBoundingBox(); + + this.setPositionRaw((axisalignedbb.minX + axisalignedbb.maxX) / 2.0D, axisalignedbb.minY, (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D); + if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit } protected SoundEffect getSoundSwim() { -@@ -869,7 +1037,7 @@ +@@ -854,7 +1022,7 @@ return null; } @@ -267,7 +267,7 @@ if (!this.isFireProof()) { this.damageEntity(DamageSource.FIRE, (float) i); } -@@ -1102,6 +1270,13 @@ +@@ -1088,6 +1256,13 @@ } public void spawnIn(World world) { @@ -281,15 +281,15 @@ this.world = world; } -@@ -1127,6 +1302,7 @@ - this.lastYaw -= 360.0F; - } - +@@ -1103,6 +1278,7 @@ + this.pitch = MathHelper.a(f1, -90.0F, 90.0F) % 360.0F; + this.lastYaw = this.yaw; + this.lastPitch = this.pitch; + world.getChunkAt((int) Math.floor(this.locX) >> 4, (int) Math.floor(this.locZ) >> 4); // CraftBukkit - this.setPosition(this.locX, this.locY, this.locZ); - this.setYawPitch(f, f1); } -@@ -1295,7 +1471,7 @@ + + public void setPositionRotation(BlockPosition blockposition, float f, float f1) { +@@ -1279,7 +1455,7 @@ public boolean c(NBTTagCompound nbttagcompound) { String s = this.getSaveID(); @@ -298,7 +298,7 @@ nbttagcompound.setString("id", s); this.save(nbttagcompound); return true; -@@ -1314,15 +1490,33 @@ +@@ -1298,15 +1474,33 @@ Vec3D vec3d = this.getMot(); nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z)); @@ -333,7 +333,7 @@ IChatBaseComponent ichatbasecomponent = this.getCustomName(); if (ichatbasecomponent != null) { -@@ -1380,6 +1574,11 @@ +@@ -1364,6 +1558,11 @@ } } @@ -345,7 +345,7 @@ return nbttagcompound; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT"); -@@ -1420,7 +1619,7 @@ +@@ -1396,7 +1595,7 @@ this.setAirTicks(nbttagcompound.getShort("Air")); this.onGround = nbttagcompound.getBoolean("OnGround"); if (nbttagcompound.hasKey("Dimension")) { @@ -354,7 +354,7 @@ } this.invulnerable = nbttagcompound.getBoolean("Invulnerable"); -@@ -1463,6 +1662,43 @@ +@@ -1439,6 +1638,43 @@ } else { throw new IllegalStateException("Entity has invalid position"); } @@ -398,7 +398,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -1538,9 +1774,22 @@ +@@ -1514,9 +1750,22 @@ } else if (this.world.isClientSide) { return null; } else { @@ -408,7 +408,7 @@ + return null; + } + // CraftBukkit end - EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack); + EntityItem entityitem = new EntityItem(this.world, this.locX(), this.locY() + (double) f, this.locZ(), itemstack); entityitem.defaultPickupDelay(); + // CraftBukkit start @@ -421,7 +421,7 @@ this.world.addEntity(entityitem); return entityitem; } -@@ -1644,7 +1893,7 @@ +@@ -1624,7 +1873,7 @@ } this.vehicle = entity; @@ -430,7 +430,7 @@ return true; } } -@@ -1669,15 +1918,36 @@ +@@ -1649,15 +1898,36 @@ Entity entity = this.vehicle; this.vehicle = null; @@ -469,7 +469,7 @@ if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) { this.passengers.add(0, entity); } else { -@@ -1685,15 +1955,33 @@ +@@ -1665,15 +1935,33 @@ } } @@ -504,15 +504,15 @@ } protected boolean q(Entity entity) { -@@ -1736,11 +2024,17 @@ +@@ -1717,11 +2005,17 @@ int i = this.ab(); - if (this.ai) { -- if (this.world.getMinecraftServer().getAllowNether() && !this.isPassenger() && this.aj++ >= i) { -+ if ((true || this.world.getMinecraftServer().getAllowNether()) && !this.isPassenger() && this.aj++ >= i) { // CraftBukkit + if (this.af) { +- if (this.world.getMinecraftServer().getAllowNether() && !this.isPassenger() && this.ag++ >= i) { ++ if ((true || this.world.getMinecraftServer().getAllowNether()) && !this.isPassenger() && this.ag++ >= i) { // CraftBukkit this.world.getMethodProfiler().enter("portal"); - this.aj = i; - this.portalCooldown = this.aX(); + this.ag = i; + this.portalCooldown = this.ba(); - this.a(this.world.worldProvider.getDimensionManager() == DimensionManager.NETHER ? DimensionManager.OVERWORLD : DimensionManager.NETHER); + // CraftBukkit start + if (this instanceof EntityPlayer) { @@ -524,7 +524,7 @@ this.world.getMethodProfiler().exit(); } -@@ -1820,6 +2114,13 @@ +@@ -1821,6 +2115,13 @@ } public void setSwimming(boolean flag) { @@ -538,7 +538,7 @@ this.setFlag(4, flag); } -@@ -1880,16 +2181,56 @@ +@@ -1881,16 +2182,56 @@ } public void setAirTicks(int i) { @@ -598,7 +598,7 @@ } public void j(boolean flag) { -@@ -2037,33 +2378,46 @@ +@@ -2042,33 +2383,46 @@ @Nullable public Entity a(DimensionManager dimensionmanager) { @@ -639,8 +639,8 @@ + } else if (dimensionmanager.getType() == DimensionManager.THE_END) { // CraftBukkit blockposition = worldserver1.getDimensionSpawn(); } else { - double d0 = this.locX; - double d1 = this.locZ; + double d0 = this.locX(); + double d1 = this.locZ(); double d2 = 8.0D; - if (dimensionmanager1 == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) { @@ -652,7 +652,7 @@ d0 *= 8.0D; d1 *= 8.0D; } -@@ -2088,6 +2442,28 @@ +@@ -2093,6 +2447,28 @@ vec3d = shapedetector_shape.velocity; f = (float) shapedetector_shape.yaw; } @@ -681,7 +681,7 @@ this.world.getMethodProfiler().exitEnter("reloading"); Entity entity = this.getEntityType().a((World) worldserver1); -@@ -2097,6 +2473,14 @@ +@@ -2102,6 +2478,14 @@ entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch); entity.setMot(vec3d); worldserver1.addEntityTeleport(entity); @@ -696,7 +696,7 @@ } this.dead = true; -@@ -2298,7 +2682,26 @@ +@@ -2308,7 +2692,26 @@ } public void a(AxisAlignedBB axisalignedbb) { diff --git a/nms-patches/EntityAgeable.patch b/nms-patches/EntityAgeable.patch index 78387ae5f8..b72e4e042a 100644 --- a/nms-patches/EntityAgeable.patch +++ b/nms-patches/EntityAgeable.patch @@ -8,16 +8,16 @@ protected EntityAgeable(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -30,7 +31,7 @@ +@@ -46,7 +47,7 @@ if (entityageable != null) { entityageable.setAgeRaw(-24000); - entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F); + entityageable.setPositionRotation(this.locX(), this.locY(), this.locZ(), 0.0F, 0.0F); - this.world.addEntity(entityageable); + this.world.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit if (itemstack.hasName()) { entityageable.setCustomName(itemstack.getName()); } -@@ -103,6 +104,7 @@ +@@ -119,6 +120,7 @@ super.b(nbttagcompound); nbttagcompound.setInt("Age", this.getAge()); nbttagcompound.setInt("ForcedAge", this.c); @@ -25,7 +25,7 @@ } @Override -@@ -110,6 +112,7 @@ +@@ -126,6 +128,7 @@ super.a(nbttagcompound); this.setAgeRaw(nbttagcompound.getInt("Age")); this.c = nbttagcompound.getInt("ForcedAge"); @@ -33,7 +33,7 @@ } @Override -@@ -124,7 +127,7 @@ +@@ -140,7 +143,7 @@ @Override public void movementTick() { super.movementTick(); @@ -41,4 +41,4 @@ + if (this.world.isClientSide || ageLocked) { // CraftBukkit if (this.d > 0) { if (this.d % 4 == 0) { - this.world.addParticle(Particles.HAPPY_VILLAGER, this.locX + (double) (this.random.nextFloat() * this.getWidth() * 2.0F) - (double) this.getWidth(), this.locY + 0.5D + (double) (this.random.nextFloat() * this.getHeight()), this.locZ + (double) (this.random.nextFloat() * this.getWidth() * 2.0F) - (double) this.getWidth(), 0.0D, 0.0D, 0.0D); + this.world.addParticle(Particles.HAPPY_VILLAGER, this.d(1.0D), this.cv() + 0.5D, this.g(1.0D), 0.0D, 0.0D, 0.0D); diff --git a/nms-patches/EntityAnimal.patch b/nms-patches/EntityAnimal.patch index 69997d63e2..723735f8d5 100644 --- a/nms-patches/EntityAnimal.patch +++ b/nms-patches/EntityAnimal.patch @@ -26,7 +26,7 @@ @Override public float a(BlockPosition blockposition, IWorldReader iworldreader) { -@@ -139,6 +144,7 @@ +@@ -140,6 +145,7 @@ if (entityhuman != null) { this.breedCause = entityhuman.getUniqueID(); } diff --git a/nms-patches/EntityArmorStand.patch b/nms-patches/EntityArmorStand.patch index 071f696d05..5137d1a208 100644 --- a/nms-patches/EntityArmorStand.patch +++ b/nms-patches/EntityArmorStand.patch @@ -15,7 +15,7 @@ + public class EntityArmorStand extends EntityLiving { - private static final Vector3f bu = new Vector3f(0.0F, 0.0F, 0.0F); + private static final Vector3f br = new Vector3f(0.0F, 0.0F, 0.0F); @@ -53,6 +62,13 @@ this.setPosition(d0, d1, d2); } @@ -28,31 +28,31 @@ + // CraftBukkit end + @Override - public void updateSize() { - double d0 = this.locX; -@@ -374,6 +390,21 @@ - if (itemstack1.isEmpty() || (this.bE & 1 << enumitemslot.c() + 8) == 0) { - if (!itemstack1.isEmpty() || (this.bE & 1 << enumitemslot.c() + 16) == 0) { - ItemStack itemstack2; -+ // CraftBukkit start -+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1); -+ org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack); + public boolean bt() { + return !this.isMarker() && super.bt(); +@@ -386,6 +402,21 @@ + return false; + } else { + ItemStack itemstack2; ++ // CraftBukkit start ++ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1); ++ org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack); + -+ Player player = (Player) entityhuman.getBukkitEntity(); -+ ArmorStand self = (ArmorStand) this.getBukkitEntity(); ++ Player player = (Player) entityhuman.getBukkitEntity(); ++ ArmorStand self = (ArmorStand) this.getBukkitEntity(); + -+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(enumitemslot); -+ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot); -+ this.world.getServer().getPluginManager().callEvent(armorStandManipulateEvent); ++ EquipmentSlot slot = CraftEquipmentSlot.getSlot(enumitemslot); ++ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot); ++ this.world.getServer().getPluginManager().callEvent(armorStandManipulateEvent); + -+ if (armorStandManipulateEvent.isCancelled()) { -+ return; -+ } -+ // CraftBukkit end ++ if (armorStandManipulateEvent.isCancelled()) { ++ return true; ++ } ++ // CraftBukkit end - if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) { - itemstack2 = itemstack.cloneItemStack(); -@@ -398,12 +429,22 @@ + if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) { + itemstack2 = itemstack.cloneItemStack(); +@@ -414,12 +445,22 @@ public boolean damageEntity(DamageSource damagesource, float f) { if (!this.world.isClientSide && !this.dead) { if (DamageSource.OUT_OF_WORLD.equals(damagesource)) { @@ -64,10 +64,10 @@ + // CraftBukkit end + this.killEntity(); // CraftBukkit - this.die() -> this.killEntity() return false; -- } else if (!this.isInvulnerable(damagesource) && !this.bD && !this.isMarker()) { -+ } else if (!this.isInvulnerable(damagesource) && (true || !this.bD) && !this.isMarker()) { // CraftBukkit +- } else if (!this.isInvulnerable(damagesource) && !this.armorStandInvisible && !this.isMarker()) { ++ } else if (!this.isInvulnerable(damagesource) && (true || !this.armorStandInvisible) && !this.isMarker()) { // CraftBukkit + // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, true, this.bD)) { // PAIL: armorStandInvisible ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, true, this.armorStandInvisible)) { + return false; + } + // CraftBukkit end @@ -78,7 +78,7 @@ return false; } else if (DamageSource.FIRE.equals(damagesource)) { if (this.isBurning()) { -@@ -428,7 +469,7 @@ +@@ -444,7 +485,7 @@ } else if (damagesource.v()) { this.F(); this.D(); @@ -87,7 +87,7 @@ return flag1; } else { long i = this.world.getTime(); -@@ -439,7 +480,7 @@ +@@ -455,7 +496,7 @@ } else { this.f(damagesource); this.D(); @@ -96,7 +96,7 @@ } return true; -@@ -466,7 +507,7 @@ +@@ -482,7 +523,7 @@ f1 -= f; if (f1 <= 0.5F) { this.g(damagesource); @@ -105,7 +105,7 @@ } else { this.setHealth(f1); } -@@ -474,13 +515,13 @@ +@@ -490,13 +531,13 @@ } private void f(DamageSource damagesource) { @@ -121,7 +121,7 @@ ItemStack itemstack; int i; -@@ -488,7 +529,7 @@ +@@ -504,7 +545,7 @@ for (i = 0; i < this.handItems.size(); ++i) { itemstack = (ItemStack) this.handItems.get(i); if (!itemstack.isEmpty()) { @@ -130,7 +130,7 @@ this.handItems.set(i, ItemStack.a); } } -@@ -496,10 +537,11 @@ +@@ -512,10 +553,11 @@ for (i = 0; i < this.armorItems.size(); ++i) { itemstack = (ItemStack) this.armorItems.get(i); if (!itemstack.isEmpty()) { @@ -143,7 +143,7 @@ } -@@ -600,8 +642,16 @@ +@@ -616,8 +658,16 @@ return this.isSmall(); } diff --git a/nms-patches/EntityArrow.patch b/nms-patches/EntityArrow.patch index 1a7f775ce1..07878deac1 100644 --- a/nms-patches/EntityArrow.patch +++ b/nms-patches/EntityArrow.patch @@ -12,8 +12,8 @@ + public abstract class EntityArrow extends Entity implements IProjectile { - private static final DataWatcherObject ar = DataWatcher.a(EntityArrow.class, DataWatcherRegistry.a); -@@ -252,6 +258,7 @@ + private static final DataWatcherObject ao = DataWatcher.a(EntityArrow.class, DataWatcherRegistry.a); +@@ -255,6 +261,7 @@ } protected void a(MovingObjectPosition movingobjectposition) { @@ -21,10 +21,10 @@ MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType(); if (movingobjectposition_enummovingobjecttype == MovingObjectPosition.EnumMovingObjectType.ENTITY) { -@@ -334,7 +341,13 @@ +@@ -336,7 +343,13 @@ int j = entity.ad(); - if (this.isBurning() && !(entity instanceof EntityEnderman)) { + if (this.isBurning() && !flag) { - entity.setOnFire(5); + // CraftBukkit start + EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5); @@ -36,7 +36,7 @@ } if (entity.damageEntity(damagesource, (float) i)) { -@@ -471,6 +484,7 @@ +@@ -477,6 +490,7 @@ public void setShooter(@Nullable Entity entity) { this.shooter = entity == null ? null : entity.getUniqueID(); @@ -44,14 +44,14 @@ if (entity instanceof EntityHuman) { this.fromPlayer = ((EntityHuman) entity).abilities.canInstantlyBuild ? EntityArrow.PickupStatus.CREATIVE_ONLY : EntityArrow.PickupStatus.ALLOWED; } -@@ -485,9 +499,23 @@ +@@ -491,9 +505,23 @@ @Override public void pickup(EntityHuman entityhuman) { if (!this.world.isClientSide && (this.inGround || this.v()) && this.shake <= 0) { + // CraftBukkit start + ItemStack itemstack = this.getItemStack(); + if (this.fromPlayer == PickupStatus.ALLOWED && !itemstack.isEmpty() && entityhuman.inventory.canHold(itemstack) > 0) { -+ EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack); ++ EntityItem item = new EntityItem(this.world, this.locX(), this.locY(), this.locZ(), itemstack); + PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity()); + // event.setCancelled(!entityhuman.canPickUpLoot); TODO + this.world.getServer().getPluginManager().callEvent(event); diff --git a/nms-patches/EntityBat.patch b/nms-patches/EntityBat.patch index 79d6d028ee..f5fa6c2dba 100644 --- a/nms-patches/EntityBat.patch +++ b/nms-patches/EntityBat.patch @@ -33,7 +33,7 @@ } else { if (this.d != null && (!this.world.isEmpty(this.d) || this.d.getY() < 1)) { @@ -134,7 +143,11 @@ - this.bd = 0.5F; + this.bb = 0.5F; this.yaw += f1; if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).isOccluding(this.world, blockposition1)) { - this.setAsleep(true); @@ -45,7 +45,7 @@ } } -@@ -162,7 +175,11 @@ +@@ -164,7 +177,11 @@ return false; } else { if (!this.world.isClientSide && this.isAsleep()) { diff --git a/nms-patches/EntityBee.patch b/nms-patches/EntityBee.patch new file mode 100644 index 0000000000..3d158e1b77 --- /dev/null +++ b/nms-patches/EntityBee.patch @@ -0,0 +1,74 @@ +--- a/net/minecraft/server/EntityBee.java ++++ b/net/minecraft/server/EntityBee.java +@@ -157,7 +157,7 @@ + } + + this.setHasStung(true); +- this.setGoalTarget((EntityLiving) null); ++ this.setGoalTarget((EntityLiving) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit + this.a(SoundEffects.ENTITY_BEE_STING, 1.0F, 1.0F); + } + +@@ -572,7 +572,7 @@ + class d extends EntityBee.a { + + private d() { +- super(null); ++ super(); // CraftBukkit - decompile error + } + + @Override +@@ -632,7 +632,7 @@ + class g extends EntityBee.a { + + private g() { +- super(null); ++ super(); // CraftBukkit - decompile error + } + + @Override +@@ -696,7 +696,7 @@ + class i extends EntityBee.a { + + private i() { +- super(null); ++ super(); // CraftBukkit - decompile error + } + + @Override +@@ -760,7 +760,7 @@ + private int h = 0; + + k() { +- super(null); ++ super(); // CraftBukkit - decompile error + this.a(EnumSet.of(PathfinderGoal.Type.MOVE)); + } + +@@ -944,7 +944,7 @@ + private int c; + + f() { +- super(null); ++ super(); // CraftBukkit - decompile error + this.c = EntityBee.this.world.random.nextInt(10); + this.a(EnumSet.of(PathfinderGoal.Type.MOVE)); + } +@@ -1001,7 +1001,7 @@ + private PathEntity e; + + e() { +- super(null); ++ super(); // CraftBukkit - decompile error + this.c = EntityBee.this.world.random.nextInt(10); + this.d = Lists.newArrayList(); + this.e = null; +@@ -1210,7 +1210,7 @@ + @Override + protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) { + if (entityinsentient instanceof EntityBee && this.e.hasLineOfSight(entityliving) && ((EntityBee) entityinsentient).a((Entity) entityliving)) { +- entityinsentient.setGoalTarget(entityliving); ++ entityinsentient.setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason + } + + } diff --git a/nms-patches/EntityBoat.patch b/nms-patches/EntityBoat.patch index d729e4149b..46d72b665e 100644 --- a/nms-patches/EntityBoat.patch +++ b/nms-patches/EntityBoat.patch @@ -17,8 +17,8 @@ private static final DataWatcherObject b = DataWatcher.a(EntityBoat.class, DataWatcherRegistry.b); @@ -37,6 +46,14 @@ - private float aO; - private float aP; + private float aL; + private float aM; + // CraftBukkit start + // PAIL: Some of these haven't worked since a few updates, and since 1.9 they are less and less applicable. @@ -30,7 +30,7 @@ + public EntityBoat(EntityTypes entitytypes, World world) { super(entitytypes, world); - this.as = new float[2]; + this.ap = new float[2]; @@ -98,6 +115,19 @@ if (damagesource instanceof EntityDamageSourceIndirect && damagesource.getEntity() != null && this.w(damagesource.getEntity())) { return false; @@ -94,14 +94,14 @@ } @@ -176,6 +231,7 @@ - return this.getDirection().e(); + return this.getDirection().f(); } + private Location lastLocation; // CraftBukkit @Override public void tick() { - this.aJ = this.aI; -@@ -219,6 +275,22 @@ + this.aG = this.aF; +@@ -216,6 +272,22 @@ this.setMot(Vec3D.a); } @@ -109,7 +109,7 @@ + org.bukkit.Server server = this.world.getServer(); + org.bukkit.World bworld = this.world.getWorld(); + -+ Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch); ++ Location to = new Location(bworld, this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch); + Vehicle vehicle = (Vehicle) this.getBukkitEntity(); + + server.getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle)); @@ -124,7 +124,7 @@ this.q(); for (int i = 0; i <= 1; ++i) { -@@ -740,6 +812,11 @@ +@@ -734,6 +806,11 @@ this.b(this.fallDistance, 1.0F); if (!this.world.isClientSide && !this.dead) { @@ -136,7 +136,7 @@ this.die(); if (this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) { int i; -@@ -753,6 +830,7 @@ +@@ -747,6 +824,7 @@ } } } diff --git a/nms-patches/EntityCat.patch b/nms-patches/EntityCat.patch index d4a56f66db..8b2a5cf813 100644 --- a/nms-patches/EntityCat.patch +++ b/nms-patches/EntityCat.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/server/EntityCat.java +++ b/net/minecraft/server/EntityCat.java @@ -16,7 +16,7 @@ - private static final DataWatcherObject bF = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i); - private static final DataWatcherObject bG = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i); - private static final DataWatcherObject bH = DataWatcher.a(EntityCat.class, DataWatcherRegistry.b); -- public static final Map bC = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { -+ public static final Map bC = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error + private static final DataWatcherObject bC = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i); + private static final DataWatcherObject bD = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i); + private static final DataWatcherObject bE = DataWatcher.a(EntityCat.class, DataWatcherRegistry.b); +- public static final Map bz = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { ++ public static final Map bz = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error hashmap.put(0, new MinecraftKey("textures/entity/cat/tabby.png")); hashmap.put(1, new MinecraftKey("textures/entity/cat/black.png")); hashmap.put(2, new MinecraftKey("textures/entity/cat/red.png")); -@@ -329,7 +329,7 @@ - } else if (this.i(itemstack)) { - this.a(entityhuman, itemstack); - if (!this.world.isClientSide) { +@@ -347,7 +347,7 @@ + } + } else if (this.i(itemstack)) { + this.a(entityhuman, itemstack); - if (this.random.nextInt(3) == 0) { + if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit this.tame(entityhuman); - this.r(true); this.goalSit.setSitting(true); -@@ -518,7 +518,7 @@ + this.world.broadcastEntityEffect(this, (byte) 7); +@@ -533,7 +533,7 @@ static class PathfinderGoalTemptChance extends PathfinderGoalTempt { @Nullable @@ -27,7 +27,7 @@ private final EntityCat d; public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) { -@@ -553,9 +553,9 @@ +@@ -568,9 +568,9 @@ private final EntityCat i; public a(EntityCat entitycat, Class oclass, float f, double d0, double d1) { diff --git a/nms-patches/EntityChicken.patch b/nms-patches/EntityChicken.patch index ef39d60dd6..bc73e72667 100644 --- a/nms-patches/EntityChicken.patch +++ b/nms-patches/EntityChicken.patch @@ -10,10 +10,10 @@ + } + // CraftBukkit end super.movementTick(); - this.bC = this.bz; - this.bB = this.bA; + this.bz = this.bw; + this.by = this.bx; @@ -62,7 +67,9 @@ - this.bz += this.bD * 2.0F; + this.bw += this.bA * 2.0F; if (!this.world.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggLayTime <= 0) { this.a(SoundEffects.ENTITY_CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + this.forceDrops = true; // CraftBukkit diff --git a/nms-patches/EntityCreeper.patch b/nms-patches/EntityCreeper.patch index 43dcff6ed9..13322d4a0c 100644 --- a/nms-patches/EntityCreeper.patch +++ b/nms-patches/EntityCreeper.patch @@ -12,7 +12,7 @@ public class EntityCreeper extends EntityMonster { -@@ -165,9 +170,19 @@ +@@ -167,9 +172,19 @@ @Override public void onLightningStrike(EntityLightning entitylightning) { super.onLightningStrike(entitylightning); @@ -33,12 +33,12 @@ @Override protected boolean a(EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); -@@ -192,10 +207,18 @@ +@@ -194,10 +209,18 @@ Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE; float f = this.isPowered() ? 2.0F : 1.0F; - this.killed = true; -- this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, explosion_effect); +- this.world.explode(this, this.locX(), this.locY(), this.locZ(), (float) this.explosionRadius * f, explosion_effect); - this.die(); - this.createEffectCloud(); + // CraftBukkit start @@ -46,7 +46,7 @@ + this.world.getServer().getPluginManager().callEvent(event); + if (!event.isCancelled()) { + this.killed = true; -+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), explosion_effect); ++ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect); + this.die(); + this.createEffectCloud(); + } else { @@ -56,15 +56,15 @@ } } -@@ -206,6 +229,7 @@ +@@ -208,6 +231,7 @@ if (!collection.isEmpty()) { - EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX, this.locY, this.locZ); + EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX(), this.locY(), this.locZ()); + entityareaeffectcloud.setSource(this); // CraftBukkit entityareaeffectcloud.setRadius(2.5F); entityareaeffectcloud.setRadiusOnUse(-0.5F); entityareaeffectcloud.setWaitTime(10); -@@ -219,7 +243,7 @@ +@@ -221,7 +245,7 @@ entityareaeffectcloud.addEffect(new MobEffect(mobeffect)); } diff --git a/nms-patches/EntityDolphin.patch b/nms-patches/EntityDolphin.patch index 11940d7ecd..ebf3f33b9b 100644 --- a/nms-patches/EntityDolphin.patch +++ b/nms-patches/EntityDolphin.patch @@ -21,7 +21,7 @@ this.setSlot(EnumItemSlot.MAINHAND, itemstack); this.dropChanceHand[EnumItemSlot.MAINHAND.b()] = 2.0F; this.receive(entityitem, itemstack.getCount()); -@@ -422,7 +427,7 @@ +@@ -425,7 +430,7 @@ @Override public void c() { @@ -30,7 +30,7 @@ } @Override -@@ -441,7 +446,7 @@ +@@ -444,7 +449,7 @@ } if (this.c.isSwimming() && this.c.world.random.nextInt(6) == 0) { diff --git a/nms-patches/EntityEgg.patch b/nms-patches/EntityEgg.patch index 5a15c5621b..f4e07d39bc 100644 --- a/nms-patches/EntityEgg.patch +++ b/nms-patches/EntityEgg.patch @@ -45,11 +45,11 @@ + } - entitychicken.setAgeRaw(-24000); -- entitychicken.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); +- entitychicken.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F); - this.world.addEntity(entitychicken); + if (hatching) { + for (int i = 0; i < b0; ++i) { -+ Entity entity = world.getWorld().createEntity(new org.bukkit.Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass()); ++ Entity entity = world.getWorld().createEntity(new org.bukkit.Location(world.getWorld(), this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F), hatchingType.getEntityClass()); + if (entity.getBukkitEntity() instanceof Ageable) { + ((Ageable) entity.getBukkitEntity()).setBaby(); + } diff --git a/nms-patches/EntityEnderCrystal.patch b/nms-patches/EntityEnderCrystal.patch index c2418e14d5..fb6204868f 100644 --- a/nms-patches/EntityEnderCrystal.patch +++ b/nms-patches/EntityEnderCrystal.patch @@ -12,7 +12,7 @@ public class EntityEnderCrystal extends Entity { private static final DataWatcherObject> c = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.m); -@@ -41,7 +46,11 @@ +@@ -38,7 +43,11 @@ BlockPosition blockposition = new BlockPosition(this); if (this.world.worldProvider instanceof WorldProviderTheEnd && this.world.getType(blockposition).isAir()) { @@ -25,7 +25,7 @@ } } -@@ -81,9 +90,22 @@ +@@ -78,9 +87,22 @@ return false; } else { if (!this.dead && !this.world.isClientSide) { @@ -36,7 +36,7 @@ + // CraftBukkit end this.die(); if (!damagesource.isExplosion()) { -- this.world.explode((Entity) null, this.locX, this.locY, this.locZ, 6.0F, Explosion.Effect.DESTROY); +- this.world.explode((Entity) null, this.locX(), this.locY(), this.locZ(), 6.0F, Explosion.Effect.DESTROY); + // CraftBukkit start + ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false); + this.world.getServer().getPluginManager().callEvent(event); @@ -44,7 +44,7 @@ + this.dead = false; + return false; + } -+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), Explosion.Effect.DESTROY); ++ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), Explosion.Effect.DESTROY); + // CraftBukkit end } diff --git a/nms-patches/EntityEnderDragon.patch b/nms-patches/EntityEnderDragon.patch index d1ec2f952f..f4a12da41c 100644 --- a/nms-patches/EntityEnderDragon.patch +++ b/nms-patches/EntityEnderDragon.patch @@ -14,23 +14,23 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { private static final Logger LOGGER = LogManager.getLogger(); -@@ -35,6 +41,7 @@ - private final PathPoint[] bT = new PathPoint[24]; - private final int[] bU = new int[24]; - private final Path bV = new Path(); +@@ -38,6 +44,7 @@ + private final PathPoint[] bR = new PathPoint[24]; + private final int[] bS = new int[24]; + private final Path bT = new Path(); + private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY); // CraftBukkit - reusable source for CraftTNTPrimed.getSource() public EntityEnderDragon(EntityTypes entitytypes, World world) { super(EntityTypes.ENDER_DRAGON, world); -@@ -173,7 +180,7 @@ +@@ -177,7 +184,7 @@ Vec3D vec3d1 = idragoncontroller.g(); - if (vec3d1 != null) { + if (vec3d1 != null && idragoncontroller.getControllerPhase() != DragonControllerPhase.HOVER) { // CraftBukkit - Don't move when hovering - d0 = vec3d1.x - this.locX; - d1 = vec3d1.y - this.locY; - d2 = vec3d1.z - this.locZ; + d0 = vec3d1.x - this.locX(); + d1 = vec3d1.y - this.locY(); + d2 = vec3d1.z - this.locZ(); @@ -315,7 +322,14 @@ if (this.currentEnderCrystal.dead) { this.currentEnderCrystal = null; @@ -47,7 +47,7 @@ } } -@@ -388,6 +402,9 @@ +@@ -390,6 +404,9 @@ int j1 = MathHelper.floor(axisalignedbb.maxZ); boolean flag = false; boolean flag1 = false; @@ -57,7 +57,7 @@ for (int k1 = i; k1 <= l; ++k1) { for (int l1 = j; l1 <= i1; ++l1) { -@@ -398,7 +415,11 @@ +@@ -400,7 +417,11 @@ if (!iblockdata.isAir() && iblockdata.getMaterial() != Material.FIRE) { if (this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) && !TagsBlock.DRAGON_IMMUNE.isTagged(block)) { @@ -70,7 +70,7 @@ } else { flag = true; } -@@ -407,6 +428,48 @@ +@@ -409,6 +430,51 @@ } } @@ -107,7 +107,10 @@ + TileEntity tileentity = nmsBlock.isTileEntity() ? this.world.getTileEntity(blockposition) : null; + LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).a(this.world.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, ItemStack.a).set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity); + -+ Block.b(craftBlock.getNMS(), loottableinfo_builder); ++ craftBlock.getNMS().a(loottableinfo_builder).forEach((itemstack) -> { ++ Block.a(world, blockposition, itemstack); ++ }); ++ craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.a); + } + nmsBlock.wasExploded(world, blockposition, explosionSource); + diff --git a/nms-patches/EntityEnderPearl.patch b/nms-patches/EntityEnderPearl.patch index 94985585fb..4098d2b4b3 100644 --- a/nms-patches/EntityEnderPearl.patch +++ b/nms-patches/EntityEnderPearl.patch @@ -19,14 +19,6 @@ if (entityplayer.playerConnection.a().isConnected() && entityplayer.world == this.world && !entityplayer.isSleeping()) { - if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) { - EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.a(this.world); -- -- entityendermite.setPlayerSpawned(true); -- entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); -- this.world.addEntity(entityendermite); -- } -- -- if (entityliving.isPassenger()) { -- entityliving.stopRiding(); + // CraftBukkit start - Fire PlayerTeleportEvent + org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity(); + org.bukkit.Location location = getBukkitEntity().getLocation(); @@ -39,12 +31,17 @@ + if (!teleEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) { + if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) { + EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.a(this.world); -+ + +- entityendermite.setPlayerSpawned(true); + entityendermite.setPlayerSpawned(true); -+ entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); + entityendermite.setPositionRotation(entityliving.locX(), entityliving.locY(), entityliving.locZ(), entityliving.yaw, entityliving.pitch); +- this.world.addEntity(entityendermite); +- } + this.world.addEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL); + } -+ + +- if (entityliving.isPassenger()) { +- entityliving.stopRiding(); + if (entityliving.isPassenger()) { + entityliving.stopRiding(); + } @@ -56,10 +53,10 @@ + CraftEventFactory.entityDamage = null; } - -- entityliving.enderTeleportTo(this.locX, this.locY, this.locZ); +- entityliving.enderTeleportTo(this.locX(), this.locY(), this.locZ()); - entityliving.fallDistance = 0.0F; - entityliving.damageEntity(DamageSource.FALL, 5.0F); + // CraftBukkit end } } else if (entityliving != null) { - entityliving.enderTeleportTo(this.locX, this.locY, this.locZ); + entityliving.enderTeleportTo(this.locX(), this.locY(), this.locZ()); diff --git a/nms-patches/EntityEnderman.patch b/nms-patches/EntityEnderman.patch index e56ac07615..7530c3ea19 100644 --- a/nms-patches/EntityEnderman.patch +++ b/nms-patches/EntityEnderman.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityEnderman.java +++ b/net/minecraft/server/EntityEnderman.java -@@ -51,7 +51,17 @@ +@@ -52,7 +52,17 @@ @Override public void setGoalTarget(@Nullable EntityLiving entityliving) { @@ -19,7 +19,7 @@ AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); if (entityliving == null) { -@@ -65,6 +75,7 @@ +@@ -67,6 +77,7 @@ attributeinstance.addModifier(EntityEnderman.c); } } @@ -27,8 +27,8 @@ } -@@ -304,8 +315,12 @@ - boolean flag = movingobjectpositionblock.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && movingobjectpositionblock.getBlockPosition().equals(blockposition); +@@ -323,8 +334,12 @@ + boolean flag = movingobjectpositionblock.getBlockPosition().equals(blockposition); if (block.a(TagsBlock.ENDERMAN_HOLDABLE) && flag) { - this.enderman.setCarried(iblockdata); @@ -42,7 +42,7 @@ } } -@@ -338,8 +353,12 @@ +@@ -357,8 +372,12 @@ IBlockData iblockdata2 = this.a.getCarried(); if (iblockdata2 != null && this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) { diff --git a/nms-patches/EntityExperienceOrb.patch b/nms-patches/EntityExperienceOrb.patch index de5e127e15..316e744b1f 100644 --- a/nms-patches/EntityExperienceOrb.patch +++ b/nms-patches/EntityExperienceOrb.patch @@ -41,11 +41,11 @@ + + if (this.targetPlayer != null && !cancelled) { + // CraftBukkit end - Vec3D vec3d = new Vec3D(this.targetPlayer.locX - this.locX, this.targetPlayer.locY + (double) this.targetPlayer.getHeadHeight() / 2.0D - this.locY, this.targetPlayer.locZ - this.locZ); + Vec3D vec3d = new Vec3D(this.targetPlayer.locX() - this.locX(), this.targetPlayer.locY() + (double) this.targetPlayer.getHeadHeight() / 2.0D - this.locY(), this.targetPlayer.locZ() - this.locZ()); double d1 = vec3d.g(); @@ -113,7 +134,7 @@ - protected void az() {} + protected void aD() {} @Override - protected void burn(int i) { diff --git a/nms-patches/EntityFallingBlock.patch b/nms-patches/EntityFallingBlock.patch index 70cf28b0e2..2429e73b4a 100644 --- a/nms-patches/EntityFallingBlock.patch +++ b/nms-patches/EntityFallingBlock.patch @@ -9,7 +9,7 @@ public class EntityFallingBlock extends Entity { private IBlockData block; -@@ -73,7 +75,7 @@ +@@ -70,7 +72,7 @@ if (this.ticksLived++ == 0) { blockposition = new BlockPosition(this); @@ -18,7 +18,7 @@ this.world.a(blockposition, false); } else if (!this.world.isClientSide) { this.die(); -@@ -124,6 +126,11 @@ +@@ -121,6 +123,11 @@ this.block = (IBlockData) this.block.set(BlockProperties.C, true); } @@ -30,7 +30,7 @@ if (this.world.setTypeAndData(blockposition, this.block, 3)) { if (block instanceof BlockFalling) { ((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata); -@@ -180,7 +187,9 @@ +@@ -177,7 +184,9 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); diff --git a/nms-patches/EntityFireball.patch b/nms-patches/EntityFireball.patch index 40721cb73b..dfbef19757 100644 --- a/nms-patches/EntityFireball.patch +++ b/nms-patches/EntityFireball.patch @@ -22,8 +22,8 @@ this(entitytypes, world); this.shooter = entityliving; + this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit - this.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); - this.setPosition(this.locX, this.locY, this.locZ); + this.setPositionRotation(entityliving.locX(), entityliving.locY(), entityliving.locZ(), entityliving.yaw, entityliving.pitch); + this.Z(); this.setMot(Vec3D.a); + // CraftBukkit start - Added setDirection method + this.setDirection(d0, d1, d2); @@ -47,7 +47,7 @@ } Vec3D vec3d = this.getMot(); -@@ -147,6 +164,11 @@ +@@ -157,6 +174,11 @@ } else { this.velocityChanged(); if (damagesource.getEntity() != null) { @@ -59,7 +59,7 @@ Vec3D vec3d = damagesource.getEntity().getLookDirection(); this.setMot(vec3d); -@@ -155,6 +177,7 @@ +@@ -165,6 +187,7 @@ this.dirZ = vec3d.z * 0.1D; if (damagesource.getEntity() instanceof EntityLiving) { this.shooter = (EntityLiving) damagesource.getEntity(); diff --git a/nms-patches/EntityFireworks.patch b/nms-patches/EntityFireworks.patch index 89b3bd1e13..534e63aa0d 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 -@@ -3,12 +3,13 @@ +@@ -3,6 +3,7 @@ import java.util.Iterator; import java.util.List; import java.util.OptionalInt; @@ -8,14 +8,7 @@ public class EntityFireworks extends Entity implements IProjectile { - public static final DataWatcherObject FIREWORK_ITEM = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.g); - private static final DataWatcherObject c = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.r); -- private static final DataWatcherObject d = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i); -+ public static final DataWatcherObject d = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i); // PAIL - private int ticksFlown; - public int expectedLifespan; - private EntityLiving ridingEntity; -@@ -133,7 +134,11 @@ +@@ -130,7 +131,11 @@ } if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) { @@ -28,7 +21,7 @@ } } -@@ -146,7 +151,11 @@ +@@ -143,7 +148,11 @@ protected void a(MovingObjectPosition movingobjectposition) { if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY && !this.world.isClientSide) { @@ -38,13 +31,13 @@ + this.explode(); + } + // CraftBukkit end - } else if (this.z) { + } else if (this.w) { BlockPosition blockposition; -@@ -158,7 +167,11 @@ +@@ -155,7 +164,11 @@ this.world.getType(blockposition).a(this.world, blockposition, (Entity) this); - if (this.l()) { + if (this.hasExplosions()) { - this.explode(); + // CraftBukkit start + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) { @@ -54,7 +47,7 @@ } } -@@ -184,7 +197,9 @@ +@@ -181,7 +194,9 @@ if (f > 0.0F) { if (this.ridingEntity != null) { @@ -64,7 +57,7 @@ } double d0 = 5.0D; -@@ -211,7 +226,9 @@ +@@ -208,7 +223,9 @@ if (flag) { float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D); diff --git a/nms-patches/EntityFishingHook.patch b/nms-patches/EntityFishingHook.patch index d93a2cdb43..462496df59 100644 --- a/nms-patches/EntityFishingHook.patch +++ b/nms-patches/EntityFishingHook.patch @@ -12,7 +12,7 @@ public class EntityFishingHook extends Entity { -@@ -207,6 +212,7 @@ +@@ -204,6 +209,7 @@ }, RayTrace.BlockCollisionOption.COLLIDER, true); if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { @@ -20,10 +20,10 @@ if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) { this.hooked = ((MovingObjectPositionEntity) movingobjectposition).getEntity(); this.n(); -@@ -239,6 +245,10 @@ - if (this.ar <= 0) { - this.as = 0; - this.at = 0; +@@ -236,6 +242,10 @@ + if (this.ao <= 0) { + this.ap = 0; + this.aq = 0; + // CraftBukkit start + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT); + this.world.getServer().getPluginManager().callEvent(playerFishEvent); @@ -31,7 +31,7 @@ } else { this.setMot(this.getMot().add(0.0D, -0.2D * (double) this.random.nextFloat() * (double) this.random.nextFloat(), 0.0D)); } -@@ -274,6 +284,13 @@ +@@ -271,6 +281,13 @@ worldserver.a(Particles.FISHING, d0, d1, d2, 0, (double) (-f4), 0.01D, (double) f3, 1.0D); } } else { @@ -45,7 +45,7 @@ Vec3D vec3d = this.getMot(); this.setMot(vec3d.x, (double) (-0.4F * MathHelper.a(this.random, 0.6F, 1.0F)), vec3d.z); -@@ -330,6 +347,14 @@ +@@ -327,6 +344,14 @@ int i = 0; if (this.hooked != null) { @@ -60,10 +60,10 @@ this.reel(); CriterionTriggers.D.a((EntityPlayer) this.owner, itemstack, this, Collections.emptyList()); this.world.broadcastEntityEffect(this, (byte) 31); -@@ -345,6 +370,15 @@ +@@ -342,6 +367,15 @@ while (iterator.hasNext()) { ItemStack itemstack1 = (ItemStack) iterator.next(); - EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack1); + EntityItem entityitem = new EntityItem(this.world, this.locX(), this.locY(), this.locZ(), itemstack1); + // CraftBukkit start + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH); + playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1); @@ -73,23 +73,23 @@ + return 0; + } + // CraftBukkit end - double d0 = this.owner.locX - this.locX; - double d1 = this.owner.locY - this.locY; - double d2 = this.owner.locZ - this.locZ; -@@ -352,7 +386,11 @@ + double d0 = this.owner.locX() - this.locX(); + double d1 = this.owner.locY() - this.locY(); + double d2 = this.owner.locZ() - this.locZ(); +@@ -349,7 +383,11 @@ entityitem.setMot(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D); this.world.addEntity(entityitem); -- this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, this.random.nextInt(6) + 1)); +- this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX(), this.owner.locY() + 0.5D, this.owner.locZ() + 0.5D, this.random.nextInt(6) + 1)); + // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop() + if (playerFishEvent.getExpToDrop() > 0) { -+ this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, playerFishEvent.getExpToDrop())); ++ this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX(), this.owner.locY() + 0.5D, this.owner.locZ() + 0.5D, playerFishEvent.getExpToDrop())); + } + // CraftBukkit end if (itemstack1.getItem().a(TagsItem.FISHES)) { this.owner.a(StatisticList.FISH_CAUGHT, 1); } -@@ -362,8 +400,25 @@ +@@ -359,8 +397,25 @@ } if (this.isInGround) { diff --git a/nms-patches/EntityFox.patch b/nms-patches/EntityFox.patch index d96d9e3156..5256c140db 100644 --- a/nms-patches/EntityFox.patch +++ b/nms-patches/EntityFox.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/server/EntityFox.java +++ b/net/minecraft/server/EntityFox.java -@@ -267,8 +267,8 @@ - private List ek() { +@@ -263,8 +263,8 @@ + private List eE() { List list = Lists.newArrayList(); -- list.add(((Optional) this.datawatcher.get(EntityFox.bB)).orElse((Object) null)); -- list.add(((Optional) this.datawatcher.get(EntityFox.bC)).orElse((Object) null)); -+ list.add(((Optional) this.datawatcher.get(EntityFox.bB)).orElse(null)); // CraftBukkit - decompile error -+ list.add(((Optional) this.datawatcher.get(EntityFox.bC)).orElse(null)); // CraftBukkit - decompile error +- list.add(((Optional) this.datawatcher.get(EntityFox.by)).orElse((Object) null)); +- list.add(((Optional) this.datawatcher.get(EntityFox.bz)).orElse((Object) null)); ++ list.add(((Optional) this.datawatcher.get(EntityFox.by)).orElse(null)); // CraftBukkit - decompile error ++ list.add(((Optional) this.datawatcher.get(EntityFox.bz)).orElse(null)); // CraftBukkit - decompile error return list; } -@@ -401,7 +401,7 @@ +@@ -397,7 +397,7 @@ protected void a(EntityItem entityitem) { ItemStack itemstack = entityitem.getItemStack(); @@ -20,7 +20,7 @@ int i = itemstack.getCount(); if (i > 1) { -@@ -944,6 +944,11 @@ +@@ -918,6 +918,11 @@ int i = (Integer) iblockdata.get(BlockSweetBerryBush.a); iblockdata.set(BlockSweetBerryBush.a, 1); @@ -32,7 +32,7 @@ int j = 1 + EntityFox.this.world.random.nextInt(2) + (i == 3 ? 1 : 0); ItemStack itemstack = EntityFox.this.getEquipment(EnumItemSlot.MAINHAND); -@@ -983,7 +988,7 @@ +@@ -957,7 +962,7 @@ private int f; public r() { @@ -41,7 +41,7 @@ this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK)); } -@@ -1035,7 +1040,7 @@ +@@ -1009,7 +1014,7 @@ private int c; public t() { @@ -50,7 +50,7 @@ this.c = EntityFox.this.random.nextInt(140); this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK, PathfinderGoal.Type.JUMP)); } -@@ -1146,7 +1151,7 @@ +@@ -1120,7 +1125,7 @@ private EntityLiving k; private int l; @@ -59,7 +59,7 @@ super(EntityFox.this, oclass, 10, flag, flag1, predicate); } -@@ -1181,7 +1186,7 @@ +@@ -1155,7 +1160,7 @@ @Override public void c() { @@ -67,8 +67,8 @@ + EntityFox.this.setGoalTarget(this.j, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit this.c = this.j; if (this.k != null) { - this.l = this.k.ct(); -@@ -1225,6 +1230,14 @@ + this.l = this.k.cI(); +@@ -1199,6 +1204,14 @@ if (entityplayer1 != null && entityplayer != entityplayer1) { entityfox.b(entityplayer1.getUniqueID()); } @@ -83,18 +83,18 @@ if (entityplayer2 != null) { entityplayer2.a(StatisticList.ANIMALS_BRED); -@@ -1239,10 +1252,14 @@ +@@ -1213,10 +1226,14 @@ this.partner.resetLove(); entityfox.setAgeRaw(-24000); - entityfox.setPositionRotation(this.animal.locX, this.animal.locY, this.animal.locZ, 0.0F, 0.0F); + entityfox.setPositionRotation(this.animal.locX(), this.animal.locY(), this.animal.locZ(), 0.0F, 0.0F); - this.b.addEntity(entityfox); + this.b.addEntity(entityfox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason this.b.broadcastEntityEffect(this.animal, (byte) 18); if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { -- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, this.animal.getRandom().nextInt(7) + 1)); +- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), this.animal.getRandom().nextInt(7) + 1)); + // CraftBukkit start - use event experience + if (experience > 0) { -+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, experience)); ++ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience)); + } + // CraftBukkit end } diff --git a/nms-patches/EntityGhast.patch b/nms-patches/EntityGhast.patch index ad96de14f9..612e4cbe21 100644 --- a/nms-patches/EntityGhast.patch +++ b/nms-patches/EntityGhast.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/server/EntityGhast.java +++ b/net/minecraft/server/EntityGhast.java -@@ -167,7 +167,8 @@ +@@ -163,7 +163,8 @@ world.a((EntityHuman) null, 1016, new BlockPosition(this.ghast), 0); EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4); - entitylargefireball.yield = this.ghast.getPower(); + // CraftBukkit - set bukkitYield when setting explosionpower + entitylargefireball.bukkitYield = entitylargefireball.yield = this.ghast.getPower(); - entitylargefireball.locX = this.ghast.locX + vec3d.x * 4.0D; - entitylargefireball.locY = this.ghast.locY + (double) (this.ghast.getHeight() / 2.0F) + 0.5D; - entitylargefireball.locZ = this.ghast.locZ + vec3d.z * 4.0D; + entitylargefireball.setPosition(this.ghast.locX() + vec3d.x * 4.0D, this.ghast.e(0.5D) + 0.5D, entitylargefireball.locZ() + vec3d.z * 4.0D); + world.addEntity(entitylargefireball); + this.a = -40; diff --git a/nms-patches/EntityHanging.patch b/nms-patches/EntityHanging.patch index 5e34d6d85c..8a6b585cf4 100644 --- a/nms-patches/EntityHanging.patch +++ b/nms-patches/EntityHanging.patch @@ -13,7 +13,7 @@ public abstract class EntityHanging extends Entity { protected static final Predicate b = (entity) -> { -@@ -37,28 +43,39 @@ +@@ -37,26 +43,37 @@ protected void updateBoundingBox() { if (this.direction != null) { @@ -43,32 +43,28 @@ + d0 -= (double) direction.getAdjacentX() * 0.46875D; + d2 -= (double) direction.getAdjacentZ() * 0.46875D; d1 += d5; -- EnumDirection enumdirection = this.direction.f(); -+ EnumDirection enumdirection = direction.f(); +- EnumDirection enumdirection = this.direction.g(); ++ EnumDirection enumdirection = direction.g(); d0 += d4 * (double) enumdirection.getAdjacentX(); d2 += d4 * (double) enumdirection.getAdjacentZ(); -- this.locX = d0; -- this.locY = d1; -- this.locZ = d2; +- this.setPositionRaw(d0, d1, d2); - double d6 = (double) this.getHangingWidth(); - double d7 = (double) this.getHangingHeight(); - double d8 = (double) this.getHangingWidth(); + if (entity != null) { -+ entity.locX = d0; -+ entity.locY = d1; -+ entity.locZ = d2; ++ entity.setPositionRaw(d0, d1, d2); + } + double d6 = (double) width; + double d7 = (double) height; + double d8 = (double) width; -- if (this.direction.k() == EnumDirection.EnumAxis.Z) { -+ if (direction.k() == EnumDirection.EnumAxis.Z) { +- if (this.direction.m() == EnumDirection.EnumAxis.Z) { ++ if (direction.m() == EnumDirection.EnumAxis.Z) { d8 = 1.0D; } else { d6 = 1.0D; -@@ -67,11 +84,12 @@ +@@ -65,11 +82,12 @@ d6 /= 32.0D; d7 /= 32.0D; d8 /= 32.0D; @@ -83,7 +79,7 @@ return i % 32 == 0 ? 0.5D : 0.0D; } -@@ -83,6 +101,24 @@ +@@ -78,6 +96,24 @@ if (this.e++ == 100 && !this.world.isClientSide) { this.e = 0; if (!this.dead && !this.survives()) { @@ -108,7 +104,7 @@ this.die(); this.a((Entity) null); } -@@ -139,6 +175,22 @@ +@@ -134,6 +170,22 @@ return false; } else { if (!this.dead && !this.world.isClientSide) { @@ -131,7 +127,7 @@ this.die(); this.velocityChanged(); this.a(damagesource.getEntity()); -@@ -151,6 +203,18 @@ +@@ -146,6 +198,18 @@ @Override public void move(EnumMoveType enummovetype, Vec3D vec3d) { if (!this.world.isClientSide && !this.dead && vec3d.g() > 0.0D) { @@ -150,10 +146,10 @@ this.die(); this.a((Entity) null); } -@@ -159,7 +223,7 @@ +@@ -154,7 +218,7 @@ @Override - public void f(double d0, double d1, double d2) { + public void h(double d0, double d1, double d2) { - if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { + if (false && !this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed this.die(); diff --git a/nms-patches/EntityHorseAbstract.patch b/nms-patches/EntityHorseAbstract.patch index 38170a0ead..a8b13321f9 100644 --- a/nms-patches/EntityHorseAbstract.patch +++ b/nms-patches/EntityHorseAbstract.patch @@ -9,14 +9,14 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, IJumpable { @@ -33,6 +34,7 @@ - private float bV; - protected boolean bG = true; - protected int bH; + private float bS; + protected boolean bD = true; + protected int bE; + public int maxDomestication = 100; // CraftBukkit - store max domestication value protected EntityHorseAbstract(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -209,7 +211,7 @@ +@@ -210,7 +212,7 @@ public void loadChest() { InventorySubcontainer inventorysubcontainer = this.inventoryChest; @@ -25,7 +25,7 @@ if (inventorysubcontainer != null) { inventorysubcontainer.b((IInventoryListener) this); int i = Math.min(inventorysubcontainer.getSize(), this.inventoryChest.getSize()); -@@ -332,7 +334,7 @@ +@@ -333,7 +335,7 @@ } public int getMaxDomestication() { @@ -34,7 +34,7 @@ } @Override -@@ -393,7 +395,7 @@ +@@ -394,7 +396,7 @@ } if (this.getHealth() < this.getMaxHealth() && f > 0.0F) { @@ -43,7 +43,7 @@ flag = true; } -@@ -469,7 +471,7 @@ +@@ -470,7 +472,7 @@ super.movementTick(); if (!this.world.isClientSide && this.isAlive()) { if (this.random.nextInt(900) == 0 && this.deathTicks == 0) { @@ -51,8 +51,8 @@ + this.heal(1.0F, RegainReason.REGEN); // CraftBukkit } - if (this.et()) { -@@ -716,6 +718,7 @@ + if (this.eO()) { +@@ -717,6 +719,7 @@ if (this.getOwnerUUID() != null) { nbttagcompound.setString("OwnerUUID", this.getOwnerUUID().toString()); } @@ -60,7 +60,7 @@ if (!this.inventoryChest.getItem(0).isEmpty()) { nbttagcompound.set("SaddleItem", this.inventoryChest.getItem(0).save(new NBTTagCompound())); -@@ -743,6 +746,11 @@ +@@ -744,6 +747,11 @@ if (!s.isEmpty()) { this.setOwnerUUID(UUID.fromString(s)); } @@ -72,7 +72,7 @@ AttributeInstance attributeinstance = this.getAttributeMap().a("Speed"); -@@ -800,6 +808,18 @@ +@@ -801,6 +809,18 @@ @Override public void b(int i) { @@ -89,5 +89,5 @@ + } + // CraftBukkit end this.canSlide = true; - this.eB(); + this.eW(); } diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch index b5d58a19a9..4620b9f29c 100644 --- a/nms-patches/EntityHuman.patch +++ b/nms-patches/EntityHuman.patch @@ -19,15 +19,15 @@ + public abstract class EntityHuman extends EntityLiving { - public static final EntitySize bs = EntitySize.b(0.6F, 1.8F); -- private static final Map b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bs).put(EntityPose.SLEEPING, EntityHuman.as).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SNEAKING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); + public static final EntitySize bp = EntitySize.b(0.6F, 1.8F); +- private static final Map b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bp).put(EntityPose.SLEEPING, EntityHuman.ap).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); + // CraftBukkit - decompile error -+ private static final Map b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bs).put(EntityPose.SLEEPING, EntityHuman.as).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SNEAKING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); ++ private static final Map b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bp).put(EntityPose.SLEEPING, EntityHuman.ap).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); private static final DataWatcherObject c = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c); private static final DataWatcherObject d = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.b); - protected static final DataWatcherObject bt = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); + protected static final DataWatcherObject bq = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); @@ -27,10 +41,10 @@ - protected static final DataWatcherObject bw = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); + protected static final DataWatcherObject bt = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); private long e; public final PlayerInventory inventory = new PlayerInventory(this); - protected InventoryEnderChest enderChest = new InventoryEnderChest(); @@ -36,9 +36,9 @@ public Container activeContainer; - protected FoodMetaData foodData = new FoodMetaData(); + protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor - protected int bC; - public float bD; - public float bE; + protected int bz; + public float bA; + public float bB; @@ -58,6 +72,17 @@ @Nullable public EntityFishingHook hookedFish; @@ -56,8 +56,8 @@ + public EntityHuman(World world, GameProfile gameprofile) { super(EntityTypes.PLAYER, world); - this.bY = ItemStack.a; -@@ -194,7 +219,7 @@ + this.bV = ItemStack.a; +@@ -206,7 +231,7 @@ ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD); if (itemstack.getItem() == Items.TURTLE_HELMET && !this.a(TagsFluid.WATER)) { @@ -66,7 +66,7 @@ } } -@@ -367,7 +392,8 @@ +@@ -379,7 +404,8 @@ if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.world.getGameRules().getBoolean(GameRules.NATURAL_REGENERATION)) { if (this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 == 0) { @@ -76,15 +76,7 @@ } if (this.foodData.c() && this.ticksLived % 10 == 0) { -@@ -512,6 +538,7 @@ - - @Nullable - public EntityItem n(boolean flag) { -+ // Called only when dropped by Q or CTRL-Q - return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && !this.inventory.getItemInHand().isEmpty() ? this.inventory.getItemInHand().getCount() : 1), false, true); - } - -@@ -552,6 +579,30 @@ +@@ -563,6 +589,30 @@ entityitem.setMot((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6); } @@ -115,7 +107,7 @@ return entityitem; } } -@@ -626,6 +677,14 @@ +@@ -637,6 +687,14 @@ } this.setScore(nbttagcompound.getInt("Score")); @@ -129,8 +121,8 @@ + if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) { this.g = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); - this.bU = nbttagcompound.getBoolean("SpawnForced"); -@@ -676,6 +735,7 @@ + this.bR = nbttagcompound.getBoolean("SpawnForced"); +@@ -687,6 +745,7 @@ if (!this.getShoulderEntityRight().isEmpty()) { nbttagcompound.set("ShoulderEntityRight", this.getShoulderEntityRight()); } @@ -138,7 +130,7 @@ } -@@ -684,16 +744,17 @@ +@@ -700,16 +759,17 @@ if (this.isInvulnerable(damagesource)) { return false; } else if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) { @@ -158,7 +150,7 @@ } if (this.world.getDifficulty() == EnumDifficulty.EASY) { -@@ -705,7 +766,13 @@ +@@ -721,7 +781,13 @@ } } @@ -173,7 +165,7 @@ } } } -@@ -720,10 +787,29 @@ +@@ -736,10 +802,29 @@ } public boolean a(EntityHuman entityhuman) { @@ -206,7 +198,7 @@ } @Override -@@ -754,8 +840,13 @@ +@@ -770,8 +855,13 @@ } @@ -221,7 +213,7 @@ if (!this.isInvulnerable(damagesource)) { f = this.applyArmorModifier(damagesource, f); f = this.applyMagicModifier(damagesource, f); -@@ -781,6 +872,7 @@ +@@ -797,6 +887,7 @@ } } @@ -229,7 +221,7 @@ } public void openSign(TileEntitySign tileentitysign) {} -@@ -911,8 +1003,15 @@ +@@ -978,8 +1069,15 @@ if (entity instanceof EntityLiving) { f3 = ((EntityLiving) entity).getHealth(); if (j > 0 && !entity.isBurning()) { @@ -247,7 +239,7 @@ } } -@@ -940,8 +1039,11 @@ +@@ -1007,8 +1105,11 @@ EntityLiving entityliving = (EntityLiving) iterator.next(); if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) { @@ -260,7 +252,7 @@ } } -@@ -950,9 +1052,26 @@ +@@ -1017,9 +1118,26 @@ } if (entity instanceof EntityPlayer && entity.velocityChanged) { @@ -287,7 +279,7 @@ } if (flag2) { -@@ -997,7 +1116,14 @@ +@@ -1064,7 +1182,14 @@ this.a(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F)); if (j > 0) { @@ -303,7 +295,7 @@ } if (this.world instanceof WorldServer && f5 > 2.0F) { -@@ -1013,6 +1139,11 @@ +@@ -1080,6 +1205,11 @@ if (flag4) { entity.extinguish(); } @@ -315,8 +307,8 @@ } } -@@ -1072,15 +1203,15 @@ - return this.bW; +@@ -1139,15 +1269,15 @@ + return this.bT; } - public Either sleep(BlockPosition blockposition) { @@ -335,7 +327,7 @@ return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE); } -@@ -1108,6 +1239,34 @@ +@@ -1176,6 +1306,34 @@ } } } @@ -368,9 +360,9 @@ + } + // CraftBukkit end - this.e(blockposition); + this.entitySleep(blockposition); this.sleepTicks = 0; -@@ -1148,6 +1307,24 @@ +@@ -1215,6 +1373,23 @@ ((WorldServer) this.world).everyoneSleeping(); } @@ -379,37 +371,36 @@ + Player player = (Player) this.getBukkitEntity(); + + org.bukkit.block.Block bed; -+ BlockPosition blockposition = optional.orElse(null); ++ BlockPosition blockposition = this.getBedPosition().orElse(null); + if (blockposition != null) { + bed = this.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + } else { + bed = this.world.getWorld().getBlockAt(player.getLocation()); + } + -+ PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed, flag2); ++ PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed, true); + this.world.getServer().getPluginManager().callEvent(event); -+ flag2 = event.shouldSetSpawnLocation(); + } + // CraftBukkit end + this.sleepTicks = flag ? 0 : 100; - if (flag2) { - optional.ifPresent((blockposition) -> { -@@ -1201,9 +1378,11 @@ - if (blockposition != null) { + } + +@@ -1266,9 +1441,11 @@ + this.g = blockposition; - this.bU = flag; + this.bR = flag; + this.spawnWorld = this.world.worldData.getName(); // CraftBukkit } else { this.g = null; - this.bU = false; + this.bR = false; + this.spawnWorld = ""; // CraftBukkit } } -@@ -1275,7 +1454,11 @@ +@@ -1340,7 +1517,11 @@ this.setMot(vec3d2.x, d3 * 0.6D, vec3d2.z); - this.aO = f; + this.aM = f; this.fallDistance = 0.0F; - this.setFlag(7, false); + // CraftBukkit start @@ -420,7 +411,25 @@ } else { super.e(vec3d); } -@@ -1597,26 +1780,31 @@ +@@ -1466,12 +1647,17 @@ + } + + public void startGliding() { ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callToggleGlideEvent(this, true).isCancelled()) // CraftBukkit + this.setFlag(7, true); + } + + public void stopGliding() { ++ // CraftBukkit start ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) { + this.setFlag(7, true); + this.setFlag(7, false); ++ } ++ // CraftBukkit end + } + + @Override +@@ -1686,26 +1872,31 @@ protected void releaseShoulderEntities() { if (this.e + 20L < this.world.getTime()) { @@ -449,7 +458,7 @@ ((EntityTameableAnimal) entity).setOwnerUUID(this.uniqueID); } - entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ); + entity.setPosition(this.locX(), this.locY() + 0.699999988079071D, this.locZ()); - ((WorldServer) this.world).addEntitySerialized(entity); - }); + return ((WorldServer) this.world).addEntitySerialized(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit diff --git a/nms-patches/EntityInsentient.patch b/nms-patches/EntityInsentient.patch index f063356f57..81dfc9ad48 100644 --- a/nms-patches/EntityInsentient.patch +++ b/nms-patches/EntityInsentient.patch @@ -21,12 +21,12 @@ private static final DataWatcherObject b = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a); @@ -27,7 +39,7 @@ public final float[] dropChanceHand; - private final NonNullList bB; + private final NonNullList by; public final float[] dropChanceArmor; - private boolean canPickUpLoot; + // private boolean canPickUpLoot; // CraftBukkit - moved up to EntityLiving public boolean persistent; - private final Map bE; + private final Map bB; public MinecraftKey lootTableKey; @@ -63,6 +75,9 @@ this.initPathfinder(); @@ -77,7 +77,7 @@ } @Override -@@ -346,11 +392,20 @@ +@@ -348,11 +394,20 @@ @Override public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); @@ -100,7 +100,7 @@ NBTTagList nbttaglist; int i; -@@ -404,6 +459,11 @@ +@@ -406,6 +461,11 @@ super.a(damagesource, flag); this.lootTableKey = null; } @@ -112,7 +112,7 @@ @Override protected LootTableInfo.Builder a(boolean flag, DamageSource damagesource) { -@@ -463,11 +523,17 @@ +@@ -465,11 +525,17 @@ ItemStack itemstack1 = this.getEquipment(enumitemslot); boolean flag = this.a(itemstack, itemstack1, enumitemslot); @@ -124,14 +124,14 @@ + // CraftBukkit end double d0 = (double) this.d(enumitemslot); - if (!itemstack1.isEmpty() && (double) (this.random.nextFloat() - 0.1F) < d0) { + if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) { + this.forceDrops = true; // CraftBukkit this.a(itemstack1); + this.forceDrops = false; // CraftBukkit } this.setSlot(enumitemslot, itemstack); -@@ -545,11 +611,11 @@ +@@ -554,11 +620,11 @@ if (entityhuman != null) { double d0 = entityhuman.h(this); @@ -145,7 +145,7 @@ this.die(); } else if (d0 < 1024.0D) { this.ticksFarFromPlayer = 0; -@@ -945,12 +1011,24 @@ +@@ -951,12 +1017,24 @@ if (!this.isAlive()) { return false; } else if (this.getLeashHolder() == entityhuman) { @@ -170,7 +170,7 @@ this.setLeashHolder(entityhuman, true); itemstack.subtract(1); return true; -@@ -996,6 +1074,7 @@ +@@ -1002,6 +1080,7 @@ if (this.leashHolder != null) { if (!this.isAlive() || !this.leashHolder.isAlive()) { @@ -178,7 +178,7 @@ this.unleash(true, true); } -@@ -1011,7 +1090,9 @@ +@@ -1017,7 +1096,9 @@ this.leashHolder = null; if (!this.world.isClientSide && flag1) { @@ -188,7 +188,7 @@ } if (!this.world.isClientSide && flag && this.world instanceof WorldServer) { -@@ -1080,6 +1161,7 @@ +@@ -1086,6 +1167,7 @@ this.setLeashHolder(EntityLeash.a(this.world, blockposition), true); } else { @@ -196,7 +196,7 @@ this.unleash(false, true); } -@@ -1187,7 +1269,14 @@ +@@ -1193,7 +1275,14 @@ int i = EnchantmentManager.getFireAspectEnchantmentLevel(this); if (i > 0) { diff --git a/nms-patches/EntityIronGolem.patch b/nms-patches/EntityIronGolem.patch index 39baa19157..de71313ec1 100644 --- a/nms-patches/EntityIronGolem.patch +++ b/nms-patches/EntityIronGolem.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/EntityIronGolem.java +++ b/net/minecraft/server/EntityIronGolem.java -@@ -52,7 +52,7 @@ +@@ -59,7 +59,7 @@ @Override - protected void D(Entity entity) { + protected void C(Entity entity) { if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.getRandom().nextInt(20) == 0) { - this.setGoalTarget((EntityLiving) entity); + this.setGoalTarget((EntityLiving) entity, org.bukkit.event.entity.EntityTargetLivingEntityEvent.TargetReason.COLLISION, true); // CraftBukkit - set reason } - super.D(entity); + super.C(entity); diff --git a/nms-patches/EntityItem.patch b/nms-patches/EntityItem.patch index 555a8fabd8..4209fe0548 100644 --- a/nms-patches/EntityItem.patch +++ b/nms-patches/EntityItem.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/EntityItem.java +++ b/net/minecraft/server/EntityItem.java -@@ -4,6 +4,10 @@ - import java.util.List; +@@ -5,6 +5,10 @@ + import java.util.Objects; import java.util.UUID; import javax.annotation.Nullable; +// CraftBukkit start @@ -11,7 +11,7 @@ public class EntityItem extends Entity { -@@ -14,6 +18,7 @@ +@@ -15,6 +19,7 @@ private UUID thrower; private UUID owner; public final float b; @@ -19,7 +19,7 @@ public EntityItem(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -49,9 +54,12 @@ +@@ -50,9 +55,12 @@ this.die(); } else { super.tick(); @@ -33,9 +33,9 @@ + this.lastTick = MinecraftServer.currentTick; + // CraftBukkit end - this.lastX = this.locX; - this.lastY = this.locY; -@@ -101,9 +109,11 @@ + this.lastX = this.locX(); + this.lastY = this.locY(); +@@ -102,9 +110,11 @@ } } @@ -45,9 +45,9 @@ } + // Craftbukkit end */ - this.impulse |= this.ay(); + this.impulse |= this.aC(); if (!this.world.isClientSide) { -@@ -115,6 +125,12 @@ +@@ -116,6 +126,12 @@ } if (!this.world.isClientSide && this.age >= 6000) { @@ -60,23 +60,20 @@ this.die(); } -@@ -175,13 +191,14 @@ +@@ -185,10 +201,11 @@ + private static void a(EntityItem entityitem, ItemStack itemstack, ItemStack itemstack1) { + ItemStack itemstack2 = a(itemstack, itemstack1, 64); + +- entityitem.setItemStack(itemstack2); ++ if (!itemstack2.isEmpty()) entityitem.setItemStack(itemstack2); // CraftBukkit - don't set empty stacks } private static void a(EntityItem entityitem, ItemStack itemstack, EntityItem entityitem1, ItemStack itemstack1) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemMergeEvent(entityitem1, entityitem).isCancelled()) return; // CraftBukkit - int i = Math.min(itemstack.getMaxStackSize() - itemstack.getCount(), itemstack1.getCount()); - ItemStack itemstack2 = itemstack.cloneItemStack(); - - itemstack2.add(i); - entityitem.setItemStack(itemstack2); - itemstack1.subtract(i); -- entityitem1.setItemStack(itemstack1); -+ if (!itemstack1.isEmpty()) entityitem1.setItemStack(itemstack1); // CraftBukkit - don't set empty stacks + a(entityitem, itemstack, itemstack1); entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay); entityitem.age = Math.min(entityitem.age, entityitem1.age); - if (itemstack1.isEmpty()) { -@@ -195,7 +212,7 @@ +@@ -199,7 +216,7 @@ } @Override @@ -85,7 +82,7 @@ this.damageEntity(DamageSource.FIRE, (float) i); } -@@ -206,6 +223,11 @@ +@@ -210,6 +227,11 @@ } else if (!this.getItemStack().isEmpty() && this.getItemStack().getItem() == Items.NETHER_STAR && damagesource.isExplosion()) { return false; } else { @@ -97,7 +94,7 @@ this.velocityChanged(); this.f = (int) ((float) this.f - f); if (this.f <= 0) { -@@ -267,6 +289,40 @@ +@@ -271,6 +293,40 @@ Item item = itemstack.getItem(); int i = itemstack.getCount(); @@ -135,10 +132,10 @@ + } + // CraftBukkit end + - if (this.pickupDelay == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) { + if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) { entityhuman.receive(this, i); if (itemstack.isEmpty()) { -@@ -309,7 +365,9 @@ +@@ -313,7 +369,9 @@ } public void setItemStack(ItemStack itemstack) { diff --git a/nms-patches/EntityItemFrame.patch b/nms-patches/EntityItemFrame.patch index 67273bddd3..e98633986e 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 -@@ -52,15 +52,29 @@ +@@ -52,16 +52,27 @@ @Override protected void updateBoundingBox() { if (this.direction != null) { @@ -14,42 +14,42 @@ + public static AxisAlignedBB calculateBoundingBox(@Nullable Entity entity, BlockPosition blockPosition, EnumDirection direction, int width, int height) { + { double d0 = 0.46875D; - -- this.locX = (double) this.blockPosition.getX() + 0.5D - (double) this.direction.getAdjacentX() * 0.46875D; -- this.locY = (double) this.blockPosition.getY() + 0.5D - (double) this.direction.getAdjacentY() * 0.46875D; -- this.locZ = (double) this.blockPosition.getZ() + 0.5D - (double) this.direction.getAdjacentZ() * 0.46875D; -- double d1 = (double) this.getHangingWidth(); -- double d2 = (double) this.getHangingHeight(); -- double d3 = (double) this.getHangingWidth(); -- EnumDirection.EnumAxis enumdirection_enumaxis = this.direction.k(); -+ double locX = (double) blockPosition.getX() + 0.5D - (double) direction.getAdjacentX() * 0.46875D; -+ double locY = (double) blockPosition.getY() + 0.5D - (double) direction.getAdjacentY() * 0.46875D; -+ double locZ = (double) blockPosition.getZ() + 0.5D - (double) direction.getAdjacentZ() * 0.46875D; +- double d1 = (double) this.blockPosition.getX() + 0.5D - (double) this.direction.getAdjacentX() * 0.46875D; +- double d2 = (double) this.blockPosition.getY() + 0.5D - (double) this.direction.getAdjacentY() * 0.46875D; +- double d3 = (double) this.blockPosition.getZ() + 0.5D - (double) this.direction.getAdjacentZ() * 0.46875D; +- +- this.setPositionRaw(d1, d2, d3); +- double d4 = (double) this.getHangingWidth(); +- double d5 = (double) this.getHangingHeight(); +- double d6 = (double) this.getHangingWidth(); +- EnumDirection.EnumAxis enumdirection_enumaxis = this.direction.m(); ++ double d1 = (double) blockPosition.getX() + 0.5D - (double) direction.getAdjacentX() * 0.46875D; ++ double d2 = (double) blockPosition.getY() + 0.5D - (double) direction.getAdjacentY() * 0.46875D; ++ double d3 = (double) blockPosition.getZ() + 0.5D - (double) direction.getAdjacentZ() * 0.46875D; ++ + if (entity != null) { -+ entity.locX = locX; -+ entity.locY = locY; -+ entity.locZ = locZ; ++ entity.setPositionRaw(d1, d2, d3); + } -+ double d1 = (double) width; -+ double d2 = (double) height; -+ double d3 = (double) width; -+ EnumDirection.EnumAxis enumdirection_enumaxis = direction.k(); ++ double d4 = (double) width; ++ double d5 = (double) height; ++ double d6 = (double) width; ++ EnumDirection.EnumAxis enumdirection_enumaxis = direction.m(); switch (enumdirection_enumaxis) { case X: -@@ -76,9 +90,10 @@ - d1 /= 32.0D; - d2 /= 32.0D; - d3 /= 32.0D; -- this.a(new AxisAlignedBB(this.locX - d1, this.locY - d2, this.locZ - d3, this.locX + d1, this.locY + d2, this.locZ + d3)); -+ return new AxisAlignedBB(locX - d1, locY - d2, locZ - d3, locX + d1, locY + d2, locZ + d3); +@@ -77,9 +88,10 @@ + d4 /= 32.0D; + d5 /= 32.0D; + d6 /= 32.0D; +- this.a(new AxisAlignedBB(d1 - d4, d2 - d5, d3 - d6, d1 + d4, d2 + d5, d3 + d6)); ++ return new AxisAlignedBB(d1 - d4, d2 - d5, d3 - d6, d1 + d4, d2 + d5, d3 + d6); } } + // CraftBukkit end @Override public boolean survives() { -@@ -108,6 +123,11 @@ +@@ -109,6 +121,11 @@ return false; } else if (!damagesource.isExplosion() && !this.getItem().isEmpty()) { if (!this.world.isClientSide) { @@ -61,7 +61,7 @@ this.b(damagesource.getEntity(), false); this.a(SoundEffects.ENTITY_ITEM_FRAME_REMOVE_ITEM, 1.0F, 1.0F); } -@@ -193,6 +213,12 @@ +@@ -194,6 +211,12 @@ } public void setItem(ItemStack itemstack, boolean flag) { @@ -74,7 +74,7 @@ if (!itemstack.isEmpty()) { itemstack = itemstack.cloneItemStack(); itemstack.setCount(1); -@@ -200,7 +226,7 @@ +@@ -201,7 +224,7 @@ } this.getDataWatcher().set(EntityItemFrame.ITEM, itemstack); diff --git a/nms-patches/EntityLargeFireball.patch b/nms-patches/EntityLargeFireball.patch index 91834c98ea..f435c057e9 100644 --- a/nms-patches/EntityLargeFireball.patch +++ b/nms-patches/EntityLargeFireball.patch @@ -20,24 +20,24 @@ } @Override -@@ -24,7 +28,15 @@ +@@ -25,7 +29,15 @@ boolean flag = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); -- this.world.createExplosion((Entity) null, this.locX, this.locY, this.locZ, (float) this.yield, flag, flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE); +- this.world.createExplosion((Entity) null, this.locX(), this.locY(), this.locZ(), (float) this.yield, flag, flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE); + // CraftBukkit start - fire ExplosionPrimeEvent + ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity()); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + // give 'this' instead of (Entity) null so we know what causes the damage -+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE); ++ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE); + } + // CraftBukkit end this.die(); } -@@ -40,7 +52,8 @@ +@@ -41,7 +53,8 @@ public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); if (nbttagcompound.hasKeyOfType("ExplosionPower", 99)) { diff --git a/nms-patches/EntityLeash.patch b/nms-patches/EntityLeash.patch index 6f40b261fb..2d415b3ba5 100644 --- a/nms-patches/EntityLeash.patch +++ b/nms-patches/EntityLeash.patch @@ -8,15 +8,15 @@ import java.util.Iterator; import java.util.List; import javax.annotation.Nullable; -@@ -31,6 +33,7 @@ - this.locX = (double) this.blockPosition.getX() + 0.5D; - this.locY = (double) this.blockPosition.getY() + 0.5D; - this.locZ = (double) this.blockPosition.getZ() + 0.5D; +@@ -29,6 +31,7 @@ + @Override + protected void updateBoundingBox() { + this.setPositionRaw((double) this.blockPosition.getX() + 0.5D, (double) this.blockPosition.getY() + 0.5D, (double) this.blockPosition.getZ() + 0.5D); + if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit } @Override -@@ -77,22 +80,42 @@ +@@ -75,22 +78,42 @@ while (iterator.hasNext()) { entityinsentient = (EntityInsentient) iterator.next(); if (entityinsentient.getLeashHolder() == entityhuman) { diff --git a/nms-patches/EntityLightning.patch b/nms-patches/EntityLightning.patch index bf0b31c97d..acbce9dfd6 100644 --- a/nms-patches/EntityLightning.patch +++ b/nms-patches/EntityLightning.patch @@ -18,33 +18,33 @@ public EntityLightning(World world, double d0, double d1, double d2, boolean flag) { super(EntityTypes.LIGHTNING_BOLT, world); + this.isEffect = flag; // CraftBukkit - this.af = true; + this.ac = true; this.setPositionRotation(d0, d1, d2, 0.0F, 0.0F); this.lifeTicks = 2; @@ -43,7 +47,24 @@ public void tick() { super.tick(); if (this.lifeTicks == 2) { -- this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); +- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); + // CraftBukkit start - Use relative location for far away sounds -+ // this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); ++ // this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); + float pitch = 0.8F + this.random.nextFloat() * 0.2F; + int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; + for (EntityPlayer player : (List) (List) this.world.getPlayers()) { -+ double deltaX = this.locX - player.locX; -+ double deltaZ = this.locZ - player.locZ; ++ double deltaX = this.locX() - player.locX(); ++ double deltaZ = this.locZ() - player.locZ(); + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; + if (distanceSquared > viewDistance * viewDistance) { + double deltaLength = Math.sqrt(distanceSquared); -+ double relativeX = player.locX + (deltaX / deltaLength) * viewDistance; -+ double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance; -+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, relativeX, this.locY, relativeZ, 10000.0F, pitch)); ++ double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance; ++ double relativeZ = player.locZ() + (deltaZ / deltaLength) * viewDistance; ++ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, relativeX, this.locY(), relativeZ, 10000.0F, pitch)); + } else { -+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, this.locX, this.locY, this.locZ, 10000.0F, pitch)); ++ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, this.locX(), this.locY(), this.locZ(), 10000.0F, pitch)); + } + } + // CraftBukkit end - this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); + this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); } @@ -59,7 +80,7 @@ diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch index 3e849ae1be..5f9a40edd3 100644 --- a/nms-patches/EntityLiving.patch +++ b/nms-patches/EntityLiving.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityLiving.java +++ b/net/minecraft/server/EntityLiving.java -@@ -16,6 +16,25 @@ +@@ -18,6 +18,25 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.tuple.Pair; @@ -26,10 +26,10 @@ public abstract class EntityLiving extends Entity { private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); -@@ -97,6 +116,20 @@ - private float bJ; - private float bK; - protected BehaviorController br; +@@ -100,6 +119,20 @@ + private float bH; + private float bI; + protected BehaviorController bo; + // CraftBukkit start + public int expToDrop; + public int maxAirTicks = 300; @@ -47,7 +47,7 @@ protected EntityLiving(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -107,7 +140,8 @@ +@@ -110,7 +143,8 @@ this.updateEffects = true; this.activeItem = ItemStack.a; this.initAttributes(); @@ -55,72 +55,33 @@ + // 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.MAX_HEALTH).getValue()); this.i = true; - this.aJ = (float) ((Math.random() + 1.0D) * 0.009999999776482582D); - this.setPosition(this.locX, this.locY, this.locZ); -@@ -166,7 +200,13 @@ + this.aH = (float) ((Math.random() + 1.0D) * 0.009999999776482582D); + this.Z(); +@@ -170,7 +204,13 @@ double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D); int i = (int) (150.0D * d1); -- ((WorldServer) this.world).a(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX, this.locY, this.locZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D); +- ((WorldServer) this.world).a(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D); + // CraftBukkit start - visiblity api + if (this instanceof EntityPlayer) { -+ ((WorldServer) this.world).sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX, this.locY, this.locZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false); ++ ((WorldServer) this.world).sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false); + } else { -+ ((WorldServer) this.world).a(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX, this.locY, this.locZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D); ++ ((WorldServer) this.world).a(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D); + } + // CraftBukkit end } } -@@ -290,6 +330,18 @@ - this.world.getMethodProfiler().exit(); - } +@@ -318,7 +358,7 @@ -+ // CraftBukkit start -+ public int getExpReward() { -+ int exp = this.getExpValue(this.killer); -+ -+ if (!this.world.isClientSide && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { -+ return exp; -+ } else { -+ return 0; -+ } -+ } -+ // CraftBukkit end -+ - protected void b(BlockPosition blockposition) { - int i = EnchantmentManager.a(Enchantments.FROST_WALKER, this); - -@@ -314,19 +366,19 @@ - - protected void co() { + protected void cD() { ++this.deathTicks; - if (this.deathTicks == 20) { + if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead) - int i; - -- if (!this.world.isClientSide && (this.alwaysGivesExp() || this.lastDamageByPlayerTime > 0 && this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT))) { -- i = this.getExpValue(this.killer); -- -- while (i > 0) { -- int j = EntityExperienceOrb.getOrbValue(i); -+ // CraftBukkit start - Update getExpReward() above if the removed if() changes! -+ i = this.expToDrop; -+ while (i > 0) { -+ int j = EntityExperienceOrb.getOrbValue(i); - -- i -= j; -- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j)); -- } -+ i -= j; -+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j)); - } -+ this.expToDrop = 0; -+ // CraftBukkit end - this.die(); -@@ -499,6 +551,17 @@ + for (int i = 0; i < 20; ++i) { +@@ -464,6 +504,17 @@ } } @@ -138,7 +99,7 @@ if (nbttagcompound.hasKeyOfType("Health", 99)) { this.setHealth(nbttagcompound.getFloat("Health")); } -@@ -536,9 +599,32 @@ +@@ -501,9 +552,32 @@ } @@ -171,7 +132,7 @@ try { while (iterator.hasNext()) { MobEffectList mobeffectlist = (MobEffectList) iterator.next(); -@@ -546,6 +632,12 @@ +@@ -511,6 +585,12 @@ if (!mobeffect.tick(this)) { if (!this.world.isClientSide) { @@ -184,7 +145,7 @@ iterator.remove(); this.b(mobeffect); } -@@ -556,6 +648,17 @@ +@@ -521,6 +601,17 @@ } catch (ConcurrentModificationException concurrentmodificationexception) { ; } @@ -202,7 +163,7 @@ if (this.updateEffects) { if (!this.world.isClientSide) { -@@ -665,7 +768,13 @@ +@@ -630,7 +721,13 @@ this.datawatcher.set(EntityLiving.e, 0); } @@ -216,7 +177,7 @@ if (this.world.isClientSide) { return false; } else { -@@ -674,7 +783,14 @@ +@@ -639,7 +736,14 @@ boolean flag; for (flag = false; iterator.hasNext(); flag = true) { @@ -232,7 +193,7 @@ iterator.remove(); } -@@ -699,18 +815,44 @@ +@@ -664,18 +768,44 @@ return (MobEffect) this.effects.get(mobeffectlist); } @@ -278,7 +239,7 @@ return true; } else { return false; -@@ -734,13 +876,39 @@ +@@ -699,13 +829,39 @@ return this.getMonsterType() == EnumMonsterType.UNDEAD; } @@ -319,7 +280,7 @@ if (mobeffect != null) { this.b(mobeffect); -@@ -777,20 +945,55 @@ +@@ -742,20 +898,55 @@ } @@ -376,16 +337,16 @@ this.datawatcher.set(EntityLiving.HEALTH, MathHelper.a(f, 0.0F, this.getMaxHealth())); } -@@ -800,7 +1003,7 @@ +@@ -765,7 +956,7 @@ return false; } else if (this.world.isClientSide) { return false; - } else if (this.getHealth() <= 0.0F) { + } else if (this.dead || this.killed || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die return false; - } else if (damagesource.p() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) { + } else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) { return false; -@@ -812,17 +1015,19 @@ +@@ -777,17 +968,19 @@ this.ticksFarFromPlayer = 0; float f1 = f; @@ -408,7 +369,7 @@ this.damageShield(f); f2 = f; f = 0.0F; -@@ -842,20 +1047,39 @@ +@@ -807,20 +1000,39 @@ if ((float) this.noDamageTicks > 10.0F) { if (f <= this.lastDamage) { @@ -447,10 +408,10 @@ + } + // CraftBukkit end + - this.az = 0.0F; + this.ax = 0.0F; Entity entity1 = damagesource.getEntity(); -@@ -976,19 +1200,29 @@ +@@ -941,19 +1153,29 @@ EnumHand[] aenumhand = EnumHand.values(); int i = aenumhand.length; @@ -484,7 +445,7 @@ EntityPlayer entityplayer = (EntityPlayer) this; entityplayer.b(StatisticList.ITEM_USED.b(Items.TOTEM_OF_UNDYING)); -@@ -996,13 +1230,15 @@ +@@ -961,13 +1183,15 @@ } this.setHealth(1.0F); @@ -504,11 +465,11 @@ } } -@@ -1112,12 +1348,19 @@ +@@ -1084,28 +1308,48 @@ boolean flag = this.lastDamageByPlayerTime > 0; -+ this.cF(); // CraftBukkit - from below // PAIL ++ this.dropInventory(); // CraftBukkit - from below if (this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { this.a(damagesource, flag); this.dropDeathLoot(damagesource, i, flag); @@ -520,27 +481,58 @@ + // CraftBukkit end } -- this.cF(); -+ // this.cF();// CraftBukkit - moved up +- this.dropInventory(); ++ // this.dropInventory();// CraftBukkit - moved up + this.dropExperience(); } - protected void cF() {} -@@ -1218,8 +1461,13 @@ - int i = MathHelper.f((f - 3.0F - f2) * f1); + protected void dropInventory() {} + +- protected void dropExperience() { ++ // CraftBukkit start ++ public int getExpReward() { + if (!this.world.isClientSide && (this.alwaysGivesExp() || this.lastDamageByPlayerTime > 0 && this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT))) { + int i = this.getExpValue(this.killer); ++ return i; ++ } else { ++ return 0; ++ } ++ } ++ // CraftBukkit end + ++ protected void dropExperience() { ++ // CraftBukkit start - Update getExpReward() above if the removed if() changes! ++ if (true) { ++ int i = this.expToDrop; + while (i > 0) { + int j = EntityExperienceOrb.getOrbValue(i); + + i -= j; + this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j)); + } ++ this.expToDrop = 0; + } ++ // CraftBukkit end + + } + +@@ -1203,9 +1447,14 @@ + int i = this.e(f, f1); if (i > 0) { + // CraftBukkit start + if (!this.damageEntity(DamageSource.FALL, (float) i)) { -+ return; ++ return true; + } + // CraftBukkit end this.a(this.getSoundFall(i), 1.0F, 1.0F); + this.cZ(); - this.damageEntity(DamageSource.FALL, (float) i); + // this.damageEntity(DamageSource.FALL, (float) i); // CraftBukkit - moved up - int j = MathHelper.floor(this.locX); - int k = MathHelper.floor(this.locY - 0.20000000298023224D); - int l = MathHelper.floor(this.locZ); -@@ -1246,7 +1494,7 @@ + return true; + } else { + return flag; +@@ -1247,7 +1496,7 @@ protected float applyArmorModifier(DamageSource damagesource, float f) { if (!damagesource.ignoresArmor()) { @@ -549,7 +541,7 @@ f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.getAttributeInstance(GenericAttributes.ARMOR_TOUGHNESS).getValue()); } -@@ -1259,7 +1507,8 @@ +@@ -1260,7 +1509,8 @@ } else { int i; @@ -559,7 +551,7 @@ i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5; int j = 25 - i; float f1 = f * (float) j; -@@ -1290,28 +1539,170 @@ +@@ -1291,28 +1541,170 @@ } } @@ -578,10 +570,7 @@ + public Double apply(Double f) { + if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !EntityLiving.this.getEquipment(EnumItemSlot.HEAD).isEmpty()) { + return -(f - (f * 0.75F)); - -- f = Math.max(f - this.getAbsorptionHearts(), 0.0F); -- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f)); -- float f2 = f1 - f; ++ + } + return -0.0; + } @@ -638,7 +627,7 @@ + } + }; + float absorptionModifier = absorption.apply((double) f).floatValue(); - ++ + EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption); + if (event.isCancelled()) { + return false; @@ -670,13 +659,16 @@ + float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT)); + this.damageArmor(armorDamage); + } -+ + +- f = Math.max(f - this.getAbsorptionHearts(), 0.0F); +- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f)); +- float f2 = f1 - f; + // Apply blocking code // PAIL: steal from above + if (event.getDamage(DamageModifier.BLOCKING) < 0) { + this.world.broadcastEntityEffect(this, (byte) 29); // SPIGOT-4635 - shield damage sound + this.damageShield((float) -event.getDamage(DamageModifier.BLOCKING)); + Entity entity = damagesource.j(); -+ + + if (entity instanceof EntityLiving) { + this.shieldBlock((EntityLiving) entity); + } @@ -740,7 +732,7 @@ } public CombatTracker getCombatTracker() { -@@ -1379,6 +1770,7 @@ +@@ -1399,6 +1791,7 @@ public AttributeMapBase getAttributeMap() { if (this.attributeMap == null) { this.attributeMap = new AttributeMapServer(); @@ -748,7 +740,7 @@ } return this.attributeMap; -@@ -1725,6 +2117,7 @@ +@@ -1769,6 +2162,7 @@ } if (this.onGround && !this.world.isClientSide) { @@ -756,7 +748,7 @@ this.setFlag(7, false); } } else { -@@ -2106,6 +2499,7 @@ +@@ -2166,6 +2560,7 @@ } if (!this.world.isClientSide) { @@ -764,7 +756,7 @@ this.setFlag(7, flag); } -@@ -2234,12 +2628,12 @@ +@@ -2294,12 +2689,12 @@ @Override public boolean isInteractable() { @@ -779,45 +771,45 @@ } @Override -@@ -2410,7 +2804,27 @@ - protected void q() { - if (!this.activeItem.isEmpty() && this.isHandRaised()) { - this.b(this.activeItem, 16); -- this.a(this.getRaisedHand(), this.activeItem.a(this.world, this)); -+ // CraftBukkit start - fire PlayerItemConsumeEvent -+ ItemStack itemstack; -+ if (this instanceof EntityPlayer) { -+ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.activeItem); -+ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem); -+ world.getServer().getPluginManager().callEvent(event); +@@ -2482,7 +2877,27 @@ + } else { + if (!this.activeItem.isEmpty() && this.isHandRaised()) { + this.b(this.activeItem, 16); +- this.a(this.getRaisedHand(), this.activeItem.a(this.world, this)); ++ // CraftBukkit start - fire PlayerItemConsumeEvent ++ ItemStack itemstack; ++ if (this instanceof EntityPlayer) { ++ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.activeItem); ++ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem); ++ world.getServer().getPluginManager().callEvent(event); + -+ if (event.isCancelled()) { -+ // Update client -+ ((EntityPlayer) this).getBukkitEntity().updateInventory(); -+ ((EntityPlayer) this).getBukkitEntity().updateScaledHealth(); -+ return; ++ if (event.isCancelled()) { ++ // Update client ++ ((EntityPlayer) this).getBukkitEntity().updateInventory(); ++ ((EntityPlayer) this).getBukkitEntity().updateScaledHealth(); ++ return; ++ } ++ ++ itemstack = (craftItem.equals(event.getItem())) ? this.activeItem.a(this.world, this) : CraftItemStack.asNMSCopy(event.getItem()).a(world, this); ++ } else { ++ itemstack = this.activeItem.a(this.world, this); + } + -+ itemstack = (craftItem.equals(event.getItem())) ? this.activeItem.a(this.world, this) : CraftItemStack.asNMSCopy(event.getItem()).a(world, this); -+ } else { -+ itemstack = this.activeItem.a(this.world, this); -+ } -+ -+ this.a(this.getRaisedHand(), itemstack); -+ // CraftBukkit end - this.dp(); - } ++ this.a(this.getRaisedHand(), itemstack); ++ // CraftBukkit end + this.dH(); + } -@@ -2495,10 +2909,18 @@ +@@ -2569,10 +2984,18 @@ } if (flag2) { -- this.enderTeleportTo(this.locX, this.locY, this.locZ); +- this.enderTeleportTo(d0, d6, d2); - if (world.getCubes(this) && !world.containsLiquid(this.getBoundingBox())) { - flag1 = true; + // CraftBukkit start - Teleport event -+ // this.enderTeleportTo(this.locX, this.locY, this.locZ); -+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ)); ++ // this.enderTeleportTo(d0, d6, d2); ++ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), d0, d6, d2)); + this.world.getServer().getPluginManager().callEvent(teleport); + if (!teleport.isCancelled()) { + Location to = teleport.getTo(); @@ -830,16 +822,16 @@ } } -@@ -2585,7 +3007,7 @@ +@@ -2659,7 +3082,7 @@ } - public void dy() { + public void entityWakeup() { - Optional optional = this.getBedPosition(); + Optional optional = this.getBedPosition(); // CraftBukkit - decompile error World world = this.world; this.world.getClass(); -@@ -2647,7 +3069,7 @@ +@@ -2723,7 +3146,7 @@ Pair pair = (Pair) iterator.next(); if (!world.isClientSide && pair.getLeft() != null && world.random.nextFloat() < (Float) pair.getRight()) { diff --git a/nms-patches/EntityLlamaTrader.patch b/nms-patches/EntityLlamaTrader.patch index dcbc28fa03..47f6d27feb 100644 --- a/nms-patches/EntityLlamaTrader.patch +++ b/nms-patches/EntityLlamaTrader.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityLlamaTrader.java +++ b/net/minecraft/server/EntityLlamaTrader.java -@@ -125,7 +125,7 @@ +@@ -128,7 +128,7 @@ @Override public void c() { diff --git a/nms-patches/EntityMinecartAbstract.patch b/nms-patches/EntityMinecartAbstract.patch index 7c169fc25a..6a7ae50161 100644 --- a/nms-patches/EntityMinecartAbstract.patch +++ b/nms-patches/EntityMinecartAbstract.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/EntityMinecartAbstract.java +++ b/net/minecraft/server/EntityMinecartAbstract.java -@@ -4,6 +4,15 @@ - import java.util.List; +@@ -8,6 +8,15 @@ + import java.util.Map; import javax.annotation.Nullable; +// CraftBukkit start @@ -16,9 +16,18 @@ public abstract class EntityMinecartAbstract extends Entity { private static final DataWatcherObject b = DataWatcher.a(EntityMinecartAbstract.class, DataWatcherRegistry.b); -@@ -21,6 +30,17 @@ - private double ax; - private double ay; +@@ -17,7 +26,7 @@ + private static final DataWatcherObject f = DataWatcher.a(EntityMinecartAbstract.class, DataWatcherRegistry.b); + private static final DataWatcherObject g = DataWatcher.a(EntityMinecartAbstract.class, DataWatcherRegistry.i); + private boolean ao; +- private static final Map> ap = (Map) SystemUtils.a((Object) Maps.newEnumMap(BlockPropertyTrackPosition.class), (enummap) -> { ++ private static final Map> ap = (Map) SystemUtils.a(Maps.newEnumMap(BlockPropertyTrackPosition.class), (enummap) -> { // CraftBukkit - decompile error + BaseBlockPosition baseblockposition = EnumDirection.WEST.p(); + BaseBlockPosition baseblockposition1 = EnumDirection.EAST.p(); + BaseBlockPosition baseblockposition2 = EnumDirection.NORTH.p(); +@@ -45,6 +54,17 @@ + private double au; + private double av; + // CraftBukkit start + public boolean slowWhenEmpty = true; @@ -34,7 +43,7 @@ protected EntityMinecartAbstract(EntityTypes entitytypes, World world) { super(entitytypes, world); this.i = true; -@@ -76,6 +96,19 @@ +@@ -100,6 +120,19 @@ if (this.isInvulnerable(damagesource)) { return false; } else { @@ -54,7 +63,7 @@ this.d(-this.n()); this.c(10); this.velocityChanged(); -@@ -83,6 +116,15 @@ +@@ -107,6 +140,15 @@ boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild; if (flag || this.getDamage() > 40.0F) { @@ -70,14 +79,14 @@ this.ejectPassengers(); if (flag && !this.hasCustomName()) { this.die(); -@@ -124,6 +166,14 @@ +@@ -152,6 +194,14 @@ @Override public void tick() { + // CraftBukkit start -+ double prevX = this.locX; -+ double prevY = this.locY; -+ double prevZ = this.locZ; ++ double prevX = this.locX(); ++ double prevY = this.locY(); ++ double prevZ = this.locZ(); + float prevYaw = this.yaw; + float prevPitch = this.pitch; + // CraftBukkit end @@ -85,23 +94,23 @@ if (this.getType() > 0) { this.c(this.getType() - 1); } -@@ -136,7 +186,7 @@ +@@ -164,7 +214,7 @@ this.af(); } - this.doPortalTick(); + // this.doPortalTick(); // CraftBukkit - handled in postTick if (this.world.isClientSide) { - if (this.at > 0) { - double d0 = this.locX + (this.au - this.locX) / (double) this.at; -@@ -202,6 +252,18 @@ + if (this.aq > 0) { + double d0 = this.locX() + (this.ar - this.locX()) / (double) this.aq; +@@ -227,6 +277,18 @@ } this.setYawPitch(this.yaw, this.pitch); + // CraftBukkit start + org.bukkit.World bworld = this.world.getWorld(); + Location from = new Location(bworld, prevX, prevY, prevZ, prevYaw, prevPitch); -+ Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch); ++ Location to = new Location(bworld, this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch); + Vehicle vehicle = (Vehicle) this.getBukkitEntity(); + + this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle)); @@ -113,7 +122,7 @@ if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && b(this.getMot()) > 0.01D) { List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.a(this)); -@@ -210,8 +272,24 @@ +@@ -235,8 +297,24 @@ Entity entity = (Entity) list.get(l); if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) { @@ -138,7 +147,7 @@ entity.collide(this); } } -@@ -223,6 +301,14 @@ +@@ -248,6 +326,14 @@ Entity entity1 = (Entity) iterator.next(); if (!this.w(entity1) && entity1.isCollidable() && entity1 instanceof EntityMinecartAbstract) { @@ -153,7 +162,7 @@ entity1.collide(this); } } -@@ -233,7 +319,7 @@ +@@ -258,7 +344,7 @@ } protected double getMaxSpeed() { @@ -162,7 +171,7 @@ } public void a(int i, int j, int k, boolean flag) {} -@@ -244,12 +330,16 @@ +@@ -269,12 +355,16 @@ this.setMot(MathHelper.a(vec3d.x, -d0, d0), vec3d.y, MathHelper.a(vec3d.z, -d0, d0)); if (this.onGround) { @@ -181,7 +190,7 @@ } } -@@ -433,7 +523,7 @@ +@@ -461,7 +551,7 @@ } protected void decelerate() { @@ -190,7 +199,7 @@ this.setMot(this.getMot().d(d0, 0.0D, d0)); } -@@ -516,6 +606,14 @@ +@@ -544,6 +634,14 @@ if (!this.world.isClientSide) { if (!entity.noclip && !this.noclip) { if (!this.w(entity)) { @@ -202,10 +211,10 @@ + return; + } + // CraftBukkit end - double d0 = entity.locX - this.locX; - double d1 = entity.locZ - this.locZ; + double d0 = entity.locX() - this.locX(); + double d1 = entity.locZ() - this.locZ(); double d2 = d0 * d0 + d1 * d1; -@@ -651,4 +749,26 @@ +@@ -679,4 +777,26 @@ private EnumMinecartType() {} } diff --git a/nms-patches/EntityMinecartCommandBlock.patch b/nms-patches/EntityMinecartCommandBlock.patch index 43ea8bc2fb..7dae1a82ba 100644 --- a/nms-patches/EntityMinecartCommandBlock.patch +++ b/nms-patches/EntityMinecartCommandBlock.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/server/EntityMinecartCommandBlock.java @@ -104,5 +104,12 @@ public CommandListenerWrapper getWrapper() { - return new CommandListenerWrapper(this, new Vec3D(EntityMinecartCommandBlock.this.locX, EntityMinecartCommandBlock.this.locY, EntityMinecartCommandBlock.this.locZ), EntityMinecartCommandBlock.this.aU(), this.d(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getScoreboardDisplayName(), this.d().getMinecraftServer(), EntityMinecartCommandBlock.this); + return new CommandListenerWrapper(this, EntityMinecartCommandBlock.this.getPositionVector(), EntityMinecartCommandBlock.this.aX(), this.d(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getScoreboardDisplayName(), this.d().getMinecraftServer(), EntityMinecartCommandBlock.this); } + + // CraftBukkit start diff --git a/nms-patches/EntityMushroomCow.patch b/nms-patches/EntityMushroomCow.patch index 62eb5dd1b4..83850b4a8c 100644 --- a/nms-patches/EntityMushroomCow.patch +++ b/nms-patches/EntityMushroomCow.patch @@ -15,7 +15,7 @@ @@ -81,9 +86,17 @@ int i; - if (itemstack.getItem() == Items.SHEARS && this.getAge() >= 0) { + if (itemstack.getItem() == Items.SHEARS && !this.isBaby()) { + // CraftBukkit start + PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity()); + this.world.getServer().getPluginManager().callEvent(event); @@ -24,17 +24,17 @@ + return false; + } + // CraftBukkit end - this.world.addParticle(Particles.EXPLOSION, this.locX, this.locY + (double) (this.getHeight() / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D); + this.world.addParticle(Particles.EXPLOSION, this.locX(), this.e(0.5D), this.locZ(), 0.0D, 0.0D, 0.0D); if (!this.world.isClientSide) { - this.die(); + // this.die(); // CraftBukkit - moved down EntityCow entitycow = (EntityCow) EntityTypes.COW.a(this.world); - entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch); -@@ -93,7 +106,14 @@ - entitycow.setCustomName(this.getCustomName()); + entitycow.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch); +@@ -99,7 +112,14 @@ } + entitycow.setInvulnerable(this.isInvulnerable()); - this.world.addEntity(entitycow); + // CraftBukkit start + if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) { @@ -46,4 +46,4 @@ + // CraftBukkit end for (i = 0; i < 5; ++i) { - this.world.addEntity(new EntityItem(this.world, this.locX, this.locY + (double) this.getHeight(), this.locZ, new ItemStack(this.getVariant().d.getBlock()))); + this.world.addEntity(new EntityItem(this.world, this.locX(), this.e(1.0D), this.locZ(), new ItemStack(this.getVariant().d.getBlock()))); diff --git a/nms-patches/EntityOcelot.patch b/nms-patches/EntityOcelot.patch index 0e7e8a79dc..ef1bc5ce63 100644 --- a/nms-patches/EntityOcelot.patch +++ b/nms-patches/EntityOcelot.patch @@ -9,8 +9,8 @@ } @Override -@@ -132,7 +132,8 @@ - if ((this.bC == null || this.bC.h()) && !this.isTrusting() && this.i(itemstack) && entityhuman.h((Entity) this) < 9.0D) { +@@ -139,7 +139,8 @@ + if ((this.bz == null || this.bz.h()) && !this.isTrusting() && this.i(itemstack) && entityhuman.h((Entity) this) < 9.0D) { this.a(entityhuman, itemstack); if (!this.world.isClientSide) { - if (this.random.nextInt(3) == 0) { @@ -19,16 +19,7 @@ this.setTrusting(true); this.s(true); this.world.broadcastEntityEffect(this, (byte) 41); -@@ -217,7 +218,7 @@ - - entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); - entityocelot.setAgeRaw(-24000); -- this.world.addEntity(entityocelot); -+ this.world.addEntity(entityocelot, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OCELOT_BABY); // CraftBukkit - add SpawnReason - } - - } -@@ -253,9 +254,9 @@ +@@ -249,9 +250,9 @@ private final EntityOcelot i; public a(EntityOcelot entityocelot, Class oclass, float f, double d0, double d1) { diff --git a/nms-patches/EntityPanda.patch b/nms-patches/EntityPanda.patch index 4d78363cf0..07edbb9fb7 100644 --- a/nms-patches/EntityPanda.patch +++ b/nms-patches/EntityPanda.patch @@ -8,8 +8,8 @@ + public class EntityPanda extends EntityAnimal { - private static final DataWatcherObject bA = DataWatcher.a(EntityPanda.class, DataWatcherRegistry.b); -@@ -445,7 +447,7 @@ + private static final DataWatcherObject bx = DataWatcher.a(EntityPanda.class, DataWatcherRegistry.b); +@@ -448,7 +450,7 @@ @Override protected void a(EntityItem entityitem) { @@ -18,16 +18,16 @@ ItemStack itemstack = entityitem.getItemStack(); this.setSlot(EnumItemSlot.MAINHAND, itemstack); -@@ -673,7 +675,7 @@ +@@ -672,7 +674,7 @@ @Override protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) { - if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).dR()) { + if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).em()) { - entityinsentient.setGoalTarget(entityliving); + entityinsentient.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit } } -@@ -777,9 +779,9 @@ +@@ -776,9 +778,9 @@ private final EntityPanda i; public c(EntityPanda entitypanda, Class oclass, float f, double d0, double d1) { @@ -39,15 +39,3 @@ this.i = entitypanda; } -@@ -808,9 +810,9 @@ - this.e.s(32); - this.f = this.e.ticksLived + 600; - if (this.e.df()) { -- EntityHuman entityhuman = this.b.a(EntityPanda.d.d, (EntityLiving) this.e); -+ EntityHuman entityhuman = this.b.a(d, (EntityLiving) this.e); // CraftBukkit - decompile error - -- this.e.setGoalTarget(entityhuman); -+ this.e.setGoalTarget(entityhuman, EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - } - } - diff --git a/nms-patches/EntityParrot.patch b/nms-patches/EntityParrot.patch index 677cff36f6..530d24c68a 100644 --- a/nms-patches/EntityParrot.patch +++ b/nms-patches/EntityParrot.patch @@ -2,23 +2,23 @@ +++ b/net/minecraft/server/EntityParrot.java @@ -21,7 +21,7 @@ }; - private static final Item bJ = Items.COOKIE; - private static final Set bK = Sets.newHashSet(new Item[]{Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS}); -- private static final Map, SoundEffect> bL = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { -+ private static final Map, SoundEffect> bL = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error + private static final Item bF = Items.COOKIE; + private static final Set bG = Sets.newHashSet(new Item[]{Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS}); +- private static final Map, SoundEffect> bH = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { ++ private static final Map, SoundEffect> bH = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error hashmap.put(EntityTypes.BLAZE, SoundEffects.ENTITY_PARROT_IMITATE_BLAZE); hashmap.put(EntityTypes.CAVE_SPIDER, SoundEffects.ENTITY_PARROT_IMITATE_SPIDER); hashmap.put(EntityTypes.CREEPER, SoundEffects.ENTITY_PARROT_IMITATE_CREEPER); -@@ -180,7 +180,7 @@ +@@ -185,7 +185,7 @@ } if (!this.world.isClientSide) { - if (this.random.nextInt(10) == 0) { + if (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit this.tame(entityhuman); - this.r(true); this.world.broadcastEntityEffect(this, (byte) 7); -@@ -196,7 +196,7 @@ + } else { +@@ -199,7 +199,7 @@ itemstack.subtract(1); } @@ -27,7 +27,7 @@ if (entityhuman.isCreative() || !this.isInvulnerable()) { this.damageEntity(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE); } -@@ -329,7 +329,8 @@ +@@ -336,7 +336,8 @@ return false; } else { if (this.goalSit != null) { diff --git a/nms-patches/EntityPhantom.patch b/nms-patches/EntityPhantom.patch index 35390e1301..3548537728 100644 --- a/nms-patches/EntityPhantom.patch +++ b/nms-patches/EntityPhantom.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityPhantom.java +++ b/net/minecraft/server/EntityPhantom.java -@@ -213,7 +213,7 @@ +@@ -214,7 +214,7 @@ EntityHuman entityhuman = (EntityHuman) iterator.next(); if (EntityPhantom.this.a((EntityLiving) entityhuman, PathfinderTargetCondition.a)) { diff --git a/nms-patches/EntityPig.patch b/nms-patches/EntityPig.patch index 86afe0bcae..7336cab5af 100644 --- a/nms-patches/EntityPig.patch +++ b/nms-patches/EntityPig.patch @@ -10,8 +10,8 @@ + public class EntityPig extends EntityAnimal { - private static final DataWatcherObject bz = DataWatcher.a(EntityPig.class, DataWatcherRegistry.i); -@@ -163,7 +167,13 @@ + private static final DataWatcherObject bw = DataWatcher.a(EntityPig.class, DataWatcherRegistry.i); +@@ -160,7 +164,13 @@ entitypigzombie.setCustomNameVisible(this.getCustomNameVisible()); } diff --git a/nms-patches/EntityPigZombie.patch b/nms-patches/EntityPigZombie.patch index aa73f3a5d5..a8ebd1217a 100644 --- a/nms-patches/EntityPigZombie.patch +++ b/nms-patches/EntityPigZombie.patch @@ -9,7 +9,7 @@ + boolean result = super.damageEntity(damagesource, f); + + if (result && entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) { - this.a(entity); + this.i((EntityLiving) entity); } - return super.damageEntity(damagesource, f); @@ -18,10 +18,10 @@ } } - private boolean a(Entity entity) { -- this.angerLevel = this.ee(); + private boolean i(EntityLiving entityliving) { +- this.angerLevel = this.ez(); + // CraftBukkit start -+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), this.ee()); ++ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entityliving == null) ? null : entityliving.getBukkitEntity(), this.ez()); + this.world.getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + return false; @@ -29,12 +29,12 @@ + this.angerLevel = event.getNewAnger(); + // CraftBukkit end this.soundDelay = this.random.nextInt(40); - if (entity instanceof EntityLiving) { - this.setLastDamager((EntityLiving) entity); -@@ -217,7 +228,7 @@ + this.setLastDamager(entityliving); + return true; +@@ -209,7 +220,7 @@ @Override protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) { - if (entityinsentient instanceof EntityPigZombie && this.e.hasLineOfSight(entityliving) && ((EntityPigZombie) entityinsentient).a((Entity) entityliving)) { + if (entityinsentient instanceof EntityPigZombie && this.e.hasLineOfSight(entityliving) && ((EntityPigZombie) entityinsentient).i(entityliving)) { - entityinsentient.setGoalTarget(entityliving); + entityinsentient.setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit } diff --git a/nms-patches/EntityPillager.patch b/nms-patches/EntityPillager.patch index 5c27789549..ddc035e5a2 100644 --- a/nms-patches/EntityPillager.patch +++ b/nms-patches/EntityPillager.patch @@ -9,11 +9,3 @@ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true)); -@@ -258,6 +258,6 @@ - - @Override - public boolean isTypeNotPersistent(double d0) { -- return super.isTypeNotPersistent(d0) && this.getInventory().isNotEmpty(); -+ return super.isTypeNotPersistent(d0) && this.getInventory() != null && this.getInventory().isNotEmpty(); // CraftBukkit - null in constructor - } - } diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch index 8a1ce81689..de89163e19 100644 --- a/nms-patches/EntityPlayer.patch +++ b/nms-patches/EntityPlayer.patch @@ -56,7 +56,7 @@ playerinteractmanager.player = this; @@ -62,8 +97,50 @@ this.advancementDataPlayer = minecraftserver.getPlayerList().f(this); - this.K = 1.0F; + this.H = 1.0F; this.a(worldserver); + + // CraftBukkit start @@ -83,7 +83,7 @@ + } + + int k = (i * 2 + 1) * (i * 2 + 1); -+ int l = this.t(k); ++ int l = this.u(k); + int i1 = (new Random()).nextInt(k); + + for (int j1 = 0; j1 < k; ++j1) { @@ -112,7 +112,7 @@ + this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit if (this.isSleeping()) { - this.dy(); + this.entityWakeup(); @@ -157,7 +235,20 @@ Entity entity = this.getRootVehicle(); Entity entity1 = this.getVehicle(); @@ -300,7 +300,7 @@ EntityLiving entityliving = this.getKillingEntity(); if (entityliving != null) { -@@ -433,10 +614,12 @@ +@@ -416,10 +597,12 @@ String s = this.getName(); String s1 = entity.getName(); @@ -315,7 +315,7 @@ } else { this.a(StatisticList.MOB_KILLS); } -@@ -454,7 +637,8 @@ +@@ -437,7 +620,8 @@ int i = scoreboardteam.getColor().b(); if (i >= 0 && i < aiscoreboardcriteria.length) { @@ -325,7 +325,7 @@ } } -@@ -498,16 +682,26 @@ +@@ -481,16 +665,26 @@ } private boolean canPvP() { @@ -355,38 +355,38 @@ this.decouple(); this.getWorldServer().removePlayer(this); if (!this.viewingCredits) { -@@ -520,10 +714,12 @@ +@@ -503,10 +697,12 @@ } else { WorldServer worldserver = this.server.getWorldServer(dimensionmanager1); - this.dimension = dimensionmanager; + // this.dimension = dimensionmanager; // CraftBukkit WorldServer worldserver1 = this.server.getWorldServer(dimensionmanager); - WorldData worlddata = this.world.getWorldData(); + WorldData worlddata = worldserver1.getWorldData(); + // CraftBukkit start + /* - this.playerConnection.sendPacket(new PacketPlayOutRespawn(dimensionmanager, worlddata.getType(), this.playerInteractManager.getGameMode())); + this.playerConnection.sendPacket(new PacketPlayOutRespawn(dimensionmanager, WorldData.c(worlddata.getSeed()), worlddata.getType(), this.playerInteractManager.getGameMode())); this.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); PlayerList playerlist = this.server.getPlayerList(); -@@ -531,6 +727,8 @@ +@@ -514,6 +710,8 @@ playerlist.d(this); worldserver.removePlayer(this); this.dead = false; + */ + // CraftBukkit end - double d0 = this.locX; - double d1 = this.locY; - double d2 = this.locZ; -@@ -540,6 +738,7 @@ + double d0 = this.locX(); + double d1 = this.locY(); + double d2 = this.locZ(); +@@ -523,6 +721,7 @@ float f2 = f1; worldserver.getMethodProfiler().enter("moving"); + if (worldserver1 == null) { } else // CraftBukkit - empty to fall through to null to event if (dimensionmanager1 == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) { - this.cu = new Vec3D(this.locX, this.locY, this.locZ); + this.cr = this.getPositionVector(); d0 /= 8.0D; -@@ -557,6 +756,52 @@ +@@ -540,6 +739,52 @@ f = 0.0F; } @@ -427,7 +427,7 @@ + // CraftBukkit start + this.dimension = dimensionmanager; + -+ this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.worldProvider.getDimensionManager().getType(), this.world.getWorldData().getType(), this.playerInteractManager.getGameMode())); ++ this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.worldProvider.getDimensionManager().getType(), WorldData.c(this.world.getWorldData().getSeed()), this.world.getWorldData().getType(), this.playerInteractManager.getGameMode())); + this.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(this.world.getDifficulty(), this.world.getWorldData().isDifficultyLocked())); + PlayerList playerlist = this.server.getPlayerList(); + @@ -439,22 +439,22 @@ this.setPositionRotation(d0, d1, d2, f1, f); worldserver.getMethodProfiler().exit(); worldserver.getMethodProfiler().enter("placing"); -@@ -568,12 +813,13 @@ +@@ -551,12 +796,13 @@ d0 = MathHelper.a(d0, d4, d6); d2 = MathHelper.a(d2, d5, d7); this.setPositionRotation(d0, d1, d2, f1, f); - if (dimensionmanager == DimensionManager.THE_END) { + if (dimensionmanager.getType() == DimensionManager.THE_END) { // CraftBukkit - getType() - int i = MathHelper.floor(this.locX); - int j = MathHelper.floor(this.locY) - 1; - int k = MathHelper.floor(this.locZ); + int i = MathHelper.floor(this.locX()); + int j = MathHelper.floor(this.locY()) - 1; + int k = MathHelper.floor(this.locZ()); boolean flag = true; boolean flag1 = false; + org.bukkit.craftbukkit.util.BlockStateListPopulator blockList = new org.bukkit.craftbukkit.util.BlockStateListPopulator(worldserver1); // CraftBukkit - Use BlockStateListPopulator for (int l = -2; l <= 2; ++l) { for (int i1 = -2; i1 <= 2; ++i1) { -@@ -583,11 +829,20 @@ +@@ -566,11 +812,20 @@ int i2 = k + i1 * 0 - l * 1; boolean flag2 = j1 < 0; @@ -476,7 +476,7 @@ this.setPositionRotation((double) i, (double) j, (double) k, f1, 0.0F); this.setMot(Vec3D.a); } else if (!worldserver1.getTravelAgent().a(this, f2)) { -@@ -616,11 +871,16 @@ +@@ -599,6 +854,11 @@ this.lastSentExp = -1; this.lastHealthSent = -1.0F; this.lastFoodSent = -1; @@ -488,13 +488,7 @@ return this; } } - -- private void b(WorldServer worldserver) { -+ public void b(WorldServer worldserver) { // PAIL - DimensionManager dimensionmanager = worldserver.worldProvider.getDimensionManager(); - DimensionManager dimensionmanager1 = this.world.worldProvider.getDimensionManager(); - -@@ -657,9 +917,16 @@ +@@ -640,9 +900,16 @@ this.activeContainer.c(); } @@ -513,15 +507,15 @@ this.a(StatisticList.SLEEP_IN_BED); CriterionTriggers.q.a(this); }); -@@ -667,6 +934,7 @@ +@@ -650,6 +917,7 @@ @Override - public void wakeup(boolean flag, boolean flag1, boolean flag2) { + public void wakeup(boolean flag, boolean flag1) { + if (!this.isSleeping()) return; // CraftBukkit - Can't leave bed if not in one! if (this.isSleeping()) { this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2)); } -@@ -754,8 +1022,9 @@ +@@ -723,8 +991,9 @@ this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition())); } @@ -532,7 +526,7 @@ } @Override -@@ -770,6 +1039,24 @@ +@@ -739,6 +1008,24 @@ this.nextContainerCounter(); Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this); @@ -557,7 +551,7 @@ if (container == null) { if (this.isSpectator()) { this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true); -@@ -777,9 +1064,11 @@ +@@ -746,9 +1033,11 @@ return OptionalInt.empty(); } else { @@ -571,7 +565,7 @@ return OptionalInt.of(this.containerCounter); } } -@@ -792,13 +1081,24 @@ +@@ -761,13 +1050,24 @@ @Override public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) { @@ -598,7 +592,7 @@ this.activeContainer.addSlotListener(this); } -@@ -843,6 +1143,11 @@ +@@ -812,6 +1112,11 @@ public void a(Container container, NonNullList nonnulllist) { this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist)); this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried())); @@ -610,7 +604,7 @@ } @Override -@@ -852,6 +1157,7 @@ +@@ -821,6 +1126,7 @@ @Override public void closeInventory() { @@ -618,7 +612,7 @@ this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId)); this.m(); } -@@ -886,7 +1192,7 @@ +@@ -855,7 +1161,7 @@ @Override public void a(Statistic statistic, int i) { this.serverStatisticManager.b(this, statistic, i); @@ -627,7 +621,7 @@ scoreboardscore.addScore(i); }); } -@@ -894,7 +1200,7 @@ +@@ -863,7 +1169,7 @@ @Override public void a(Statistic statistic) { this.serverStatisticManager.setStatistic(this, statistic, 0); @@ -636,7 +630,7 @@ } @Override -@@ -943,7 +1249,16 @@ +@@ -912,7 +1218,16 @@ public void triggerHealthUpdate() { this.lastHealthSent = -1.0E8F; @@ -653,15 +647,15 @@ @Override public void a(IChatBaseComponent ichatbasecomponent, boolean flag) { -@@ -998,12 +1313,14 @@ +@@ -967,12 +1282,14 @@ this.lastSentExp = -1; this.lastHealthSent = -1.0F; this.lastFoodSent = -1; - this.recipeBook.a((RecipeBook) entityplayer.recipeBook); + // this.recipeBook.a((RecipeBook) entityplayer.recipeBook); // CraftBukkit this.removeQueue.addAll(entityplayer.removeQueue); - this.cp = entityplayer.cp; - this.cu = entityplayer.cu; + this.cm = entityplayer.cm; + this.cr = entityplayer.cr; this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft()); this.setShoulderEntityRight(entityplayer.getShoulderEntityRight()); + @@ -669,7 +663,7 @@ } @Override -@@ -1065,6 +1382,18 @@ +@@ -1040,6 +1357,18 @@ @Override public void a(EnumGamemode enumgamemode) { @@ -688,7 +682,7 @@ this.playerInteractManager.setGameMode(enumgamemode); this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId())); if (enumgamemode == EnumGamemode.SPECTATOR) { -@@ -1115,6 +1444,17 @@ +@@ -1090,6 +1419,17 @@ } public void a(PacketPlayInSettings packetplayinsettings) { @@ -704,9 +698,9 @@ + this.clientViewDistance = packetplayinsettings.viewDistance; + // CraftBukkit end this.locale = packetplayinsettings.b(); - this.ck = packetplayinsettings.d(); - this.cl = packetplayinsettings.e(); -@@ -1151,13 +1491,13 @@ + this.ch = packetplayinsettings.d(); + this.ci = packetplayinsettings.e(); +@@ -1126,13 +1466,13 @@ if (entity instanceof EntityHuman) { this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()})); } else { @@ -722,16 +716,16 @@ } @Override -@@ -1181,7 +1521,7 @@ +@@ -1156,7 +1496,7 @@ this.spectatedEntity = (Entity) (entity == null ? this : entity); if (entity1 != this.spectatedEntity) { this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity)); -- this.enderTeleportTo(this.spectatedEntity.locX, this.spectatedEntity.locY, this.spectatedEntity.locZ); -+ this.playerConnection.a(this.spectatedEntity.locX, this.spectatedEntity.locY, this.spectatedEntity.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit +- this.enderTeleportTo(this.spectatedEntity.locX(), this.spectatedEntity.locY(), this.spectatedEntity.locZ()); ++ this.playerConnection.a(this.spectatedEntity.locX(), this.spectatedEntity.locY(), this.spectatedEntity.locZ(), this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit } } -@@ -1210,7 +1550,7 @@ +@@ -1185,7 +1525,7 @@ @Nullable public IChatBaseComponent getPlayerListName() { @@ -740,24 +734,7 @@ } @Override -@@ -1228,21 +1568,33 @@ - } - - public void J() { -+ if (!CraftEventFactory.callToggleGlideEvent(this, true).isCancelled()) // CraftBukkit - this.setFlag(7, true); - } - - public void K() { -+ // CraftBukkit start -+ if (!CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) { - this.setFlag(7, true); - this.setFlag(7, false); -+ } -+ // CraftBukkit end - } - - public AdvancementDataPlayer getAdvancementData() { +@@ -1206,9 +1546,16 @@ return this.advancementDataPlayer; } @@ -774,7 +751,7 @@ if (worldserver == this.world) { this.playerConnection.a(d0, d1, d2, f, f1); } else { -@@ -1265,6 +1617,9 @@ +@@ -1231,6 +1578,9 @@ this.server.getPlayerList().a(this, worldserver); this.server.getPlayerList().updateClient(this); } @@ -784,7 +761,7 @@ } -@@ -1316,4 +1671,144 @@ +@@ -1285,4 +1635,144 @@ return entityitem; } } @@ -870,7 +847,7 @@ + + @Override + public String toString() { -+ return super.toString() + "(" + this.getName() + " at " + this.locX + "," + this.locY + "," + this.locZ + ")"; ++ return super.toString() + "(" + this.getName() + " at " + this.locX() + "," + this.locY() + "," + this.locZ() + ")"; + } + + // SPIGOT-1903, MC-98153 diff --git a/nms-patches/EntityProjectile.patch b/nms-patches/EntityProjectile.patch index c45df4f023..a079704758 100644 --- a/nms-patches/EntityProjectile.patch +++ b/nms-patches/EntityProjectile.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/server/EntityProjectile.java +++ b/net/minecraft/server/EntityProjectile.java @@ -32,6 +32,7 @@ - this(entitytypes, entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D, entityliving.locZ, world); + this(entitytypes, entityliving.locX(), entityliving.getHeadY() - 0.10000000149011612D, entityliving.locZ(), world); this.shooter = entityliving; this.shooterId = entityliving.getUniqueID(); + this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit } public void a(Entity entity, float f, float f1, float f2, float f3, float f4) { -@@ -86,7 +87,7 @@ +@@ -83,7 +84,7 @@ break; } -- if (this.shooter != null && this.ticksLived < 2 && this.as == null) { -+ if (this.shooter != null && this.ticksLived < 2 && this.as == null && this.shooter == entity) { // CraftBukkit - MC-88491 - this.as = entity; - this.at = 3; +- if (this.shooter != null && this.ticksLived < 2 && this.ap == null) { ++ if (this.shooter != null && this.ticksLived < 2 && this.ap == null && this.shooter == entity) { // CraftBukkit - MC-88491 + this.ap = entity; + this.aq = 3; break; -@@ -106,6 +107,11 @@ +@@ -103,6 +104,11 @@ this.c(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition()); } else { this.a(movingobjectposition); diff --git a/nms-patches/EntityRabbit.patch b/nms-patches/EntityRabbit.patch index 0ae946b517..c79a4394e8 100644 --- a/nms-patches/EntityRabbit.patch +++ b/nms-patches/EntityRabbit.patch @@ -2,14 +2,14 @@ +++ b/net/minecraft/server/EntityRabbit.java @@ -17,8 +17,14 @@ super(entitytypes, world); - this.bt = new EntityRabbit.ControllerJumpRabbit(this); + this.bq = new EntityRabbit.ControllerJumpRabbit(this); this.moveController = new EntityRabbit.ControllerMoveRabbit(this); + this.initializePathFinderGoals(); // CraftBukkit - moved code + } + + // CraftBukkit start - code from constructor + public void initializePathFinderGoals(){ - this.d(0.0D); + this.i(0.0D); } + // CraftBukkit end @@ -24,7 +24,7 @@ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityWolf.class, true)); if (!this.hasCustomName()) { -@@ -409,9 +415,23 @@ +@@ -402,9 +408,23 @@ Integer integer = (Integer) iblockdata.get(BlockCarrots.AGE); if (integer == 0) { @@ -34,7 +34,7 @@ + } + // CraftBukkit end world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 2); - world.b(blockposition, true); + world.a(blockposition, true, this.entity); } else { + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent( diff --git a/nms-patches/EntityRaider.patch b/nms-patches/EntityRaider.patch index 4b97647e37..2d89fc266b 100644 --- a/nms-patches/EntityRaider.patch +++ b/nms-patches/EntityRaider.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityRaider.java +++ b/net/minecraft/server/EntityRaider.java -@@ -399,7 +399,7 @@ +@@ -397,7 +397,7 @@ while (iterator.hasNext()) { EntityRaider entityraider = (EntityRaider) iterator.next(); @@ -9,7 +9,7 @@ } } -@@ -416,7 +416,7 @@ +@@ -414,7 +414,7 @@ while (iterator.hasNext()) { EntityRaider entityraider = (EntityRaider) iterator.next(); @@ -18,7 +18,7 @@ entityraider.q(true); } -@@ -490,7 +490,7 @@ +@@ -488,7 +488,7 @@ private final T b; diff --git a/nms-patches/EntityRavager.patch b/nms-patches/EntityRavager.patch index 6cdbcf52a4..c6c1265c8c 100644 --- a/nms-patches/EntityRavager.patch +++ b/nms-patches/EntityRavager.patch @@ -15,6 +15,6 @@ - if (block instanceof BlockLeaves) { + if (block instanceof BlockLeaves && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit - flag = this.world.b(blockposition, true) || flag; + flag = this.world.a(blockposition, true, this) || flag; } } diff --git a/nms-patches/EntitySheep.patch b/nms-patches/EntitySheep.patch index 94e8f28de9..75b4507d2c 100644 --- a/nms-patches/EntitySheep.patch +++ b/nms-patches/EntitySheep.patch @@ -12,9 +12,9 @@ + public class EntitySheep extends EntityAnimal { - private static final DataWatcherObject bz = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.a); -- private static final Map bA = (Map) SystemUtils.a((Object) Maps.newEnumMap(EnumColor.class), (enummap) -> { -+ private static final Map bA = (Map) SystemUtils.a(Maps.newEnumMap(EnumColor.class), (enummap) -> { // CraftBukkit - decompile error + private static final DataWatcherObject bw = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.a); +- private static final Map bx = (Map) SystemUtils.a((Object) Maps.newEnumMap(EnumColor.class), (enummap) -> { ++ private static final Map bx = (Map) SystemUtils.a(Maps.newEnumMap(EnumColor.class), (enummap) -> { // CraftBukkit - decompile error enummap.put(EnumColor.WHITE, Blocks.WHITE_WOOL); enummap.put(EnumColor.ORANGE, Blocks.ORANGE_WOOL); enummap.put(EnumColor.MAGENTA, Blocks.MAGENTA_WOOL); @@ -34,17 +34,17 @@ this.shear(); if (!this.world.isClientSide) { itemstack.damage(1, entityhuman, (entityhuman1) -> { -@@ -158,7 +173,9 @@ +@@ -160,7 +175,9 @@ int i = 1 + this.random.nextInt(3); for (int j = 0; j < i; ++j) { + this.forceDrops = true; // CraftBukkit - EntityItem entityitem = this.a((IMaterial) EntitySheep.bA.get(this.getColor()), 1); + EntityItem entityitem = this.a((IMaterial) EntitySheep.bx.get(this.getColor()), 1); + this.forceDrops = false; // CraftBukkit if (entityitem != null) { entityitem.setMot(entityitem.getMot().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F))); -@@ -245,6 +262,12 @@ +@@ -247,6 +264,12 @@ @Override public void blockEaten() { @@ -57,7 +57,7 @@ this.setSheared(false); if (this.isBaby()) { this.setAge(60); -@@ -264,7 +287,7 @@ +@@ -265,7 +288,7 @@ EnumColor enumcolor = ((EntitySheep) entityanimal).getColor(); EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor(); InventoryCrafting inventorycrafting = a(enumcolor, enumcolor1); @@ -66,7 +66,7 @@ return recipecrafting.a(inventorycrafting); }).map(ItemStack::getItem); -@@ -282,10 +305,18 @@ +@@ -283,10 +306,18 @@ public boolean canUse(EntityHuman entityhuman) { return false; } diff --git a/nms-patches/EntityShulker.patch b/nms-patches/EntityShulker.patch index 651ddae97a..c7db62e8a0 100644 --- a/nms-patches/EntityShulker.patch +++ b/nms-patches/EntityShulker.patch @@ -20,7 +20,7 @@ this.targetSelector.a(2, new EntityShulker.d(this)); this.targetSelector.a(3, new EntityShulker.c(this)); } -@@ -308,8 +312,17 @@ +@@ -300,8 +304,17 @@ EnumDirection enumdirection = aenumdirection[k]; if (this.world.a(blockposition1.shift(enumdirection), (Entity) this)) { @@ -40,11 +40,11 @@ break; } } -@@ -354,6 +367,7 @@ - this.locX = (double) blockposition.getX() + 0.5D; - this.locY = (double) blockposition.getY(); - this.locZ = (double) blockposition.getZ() + 0.5D; +@@ -344,6 +357,7 @@ + } + + this.f((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D); + if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit - this.lastX = this.locX; - this.lastY = this.locY; - this.lastZ = this.locZ; + } + } + diff --git a/nms-patches/EntityShulkerBullet.patch b/nms-patches/EntityShulkerBullet.patch index 7d2d50ba91..33d778a9b7 100644 --- a/nms-patches/EntityShulkerBullet.patch +++ b/nms-patches/EntityShulkerBullet.patch @@ -30,7 +30,7 @@ @Override public SoundCategory getSoundCategory() { return SoundCategory.HOSTILE; -@@ -294,6 +315,7 @@ +@@ -298,6 +319,7 @@ } protected void a(MovingObjectPosition movingobjectposition) { @@ -38,7 +38,7 @@ if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) { Entity entity = ((MovingObjectPositionEntity) movingobjectposition).getEntity(); boolean flag = entity.damageEntity(DamageSource.a(this, this.shooter).c(), 4.0F); -@@ -301,7 +323,7 @@ +@@ -305,7 +327,7 @@ if (flag) { this.a(this.shooter, entity); if (entity instanceof EntityLiving) { diff --git a/nms-patches/EntitySilverfish.patch b/nms-patches/EntitySilverfish.patch index 96cd5ac67d..e6b810bf44 100644 --- a/nms-patches/EntitySilverfish.patch +++ b/nms-patches/EntitySilverfish.patch @@ -12,13 +12,13 @@ @@ -160,6 +160,11 @@ IBlockData iblockdata = world.getType(blockposition); - if (BlockMonsterEggs.j(iblockdata)) { + if (BlockMonsterEggs.h(iblockdata)) { + // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, BlockMonsterEggs.e(iblockdata.getBlock())).isCancelled()) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, BlockMonsterEggs.d(iblockdata.getBlock())).isCancelled()) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, BlockMonsterEggs.e(iblockdata.getBlock()), 3); + world.setTypeAndData(blockposition, BlockMonsterEggs.d(iblockdata.getBlock()), 3); this.a.doSpawnEffect(); this.a.die(); @@ -206,6 +211,11 @@ @@ -31,5 +31,5 @@ + } + // CraftBukkit end if (world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) { - world.b(blockposition1, true); + world.a(blockposition1, true, this.silverfish); } else { diff --git a/nms-patches/EntitySlime.patch b/nms-patches/EntitySlime.patch index 0fb38bce66..29b456d8db 100644 --- a/nms-patches/EntitySlime.patch +++ b/nms-patches/EntitySlime.patch @@ -14,7 +14,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { -@@ -139,7 +146,7 @@ +@@ -153,7 +160,7 @@ @Override public EntityTypes getEntityType() { @@ -23,7 +23,7 @@ } @Override -@@ -149,6 +156,19 @@ +@@ -163,6 +170,19 @@ if (!this.world.isClientSide && i > 1 && this.getHealth() <= 0.0F) { int j = 2 + this.random.nextInt(3); @@ -43,10 +43,10 @@ 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; -@@ -164,8 +184,18 @@ - +@@ -179,8 +199,18 @@ + entityslime.setInvulnerable(this.isInvulnerable()); entityslime.setSize(i / 2, true); - entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F); + entityslime.setPositionRotation(this.locX() + (double) f, this.locY() + 0.5D, this.locZ() + (double) f1, this.random.nextFloat() * 360.0F, 0.0F); - this.world.addEntity(entityslime); + + slimes.add(entityslime); // CraftBukkit diff --git a/nms-patches/EntitySmallFireball.patch b/nms-patches/EntitySmallFireball.patch index 9daf031ca7..00a87999f9 100644 --- a/nms-patches/EntitySmallFireball.patch +++ b/nms-patches/EntitySmallFireball.patch @@ -20,7 +20,7 @@ } public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) { -@@ -23,7 +30,16 @@ +@@ -24,7 +31,16 @@ if (!entity.isFireProof()) { int i = entity.ad(); @@ -38,7 +38,7 @@ boolean flag = entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F); if (flag) { -@@ -32,11 +48,11 @@ +@@ -33,11 +49,11 @@ entity.g(i); } } diff --git a/nms-patches/EntitySnowman.patch b/nms-patches/EntitySnowman.patch index 2eaaee0231..77e09b49e7 100644 --- a/nms-patches/EntitySnowman.patch +++ b/nms-patches/EntitySnowman.patch @@ -29,19 +29,18 @@ } } } -@@ -109,6 +113,15 @@ - ItemStack itemstack = entityhuman.b(enumhand); +@@ -110,6 +114,14 @@ - if (itemstack.getItem() == Items.SHEARS && this.hasPumpkin() && !this.world.isClientSide) { -+ // CraftBukkit start -+ PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity()); -+ this.world.getServer().getPluginManager().callEvent(event); + if (itemstack.getItem() == Items.SHEARS && this.hasPumpkin()) { + if (!this.world.isClientSide) { ++ // CraftBukkit start ++ PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity()); ++ this.world.getServer().getPluginManager().callEvent(event); + -+ if (event.isCancelled()) { -+ return false; -+ } -+ // CraftBukkit end -+ - this.setHasPumpkin(false); - itemstack.damage(1, entityhuman, (entityhuman1) -> { - entityhuman1.d(enumhand); ++ if (event.isCancelled()) { ++ return false; ++ } ++ // CraftBukkit end + this.setHasPumpkin(false); + itemstack.damage(1, entityhuman, (entityhuman1) -> { + entityhuman1.d(enumhand); diff --git a/nms-patches/EntitySpider.patch b/nms-patches/EntitySpider.patch index 6c1420aa5b..fb84bc387c 100644 --- a/nms-patches/EntitySpider.patch +++ b/nms-patches/EntitySpider.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/server/EntitySpider.java @@ -125,7 +125,7 @@ - entityskeleton.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); + entityskeleton.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F); entityskeleton.prepare(generatoraccess, difficultydamagescaler, enummobspawn, (GroupDataEntity) null, (NBTTagCompound) null); - generatoraccess.addEntity(entityskeleton); + generatoraccess.addEntity(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit - add SpawnReason diff --git a/nms-patches/EntityTNTPrimed.patch b/nms-patches/EntityTNTPrimed.patch index a73c80beb7..bc8f7c3d38 100644 --- a/nms-patches/EntityTNTPrimed.patch +++ b/nms-patches/EntityTNTPrimed.patch @@ -17,7 +17,7 @@ public EntityTNTPrimed(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -60,10 +63,13 @@ +@@ -57,10 +60,13 @@ --this.fuseTicks; if (this.fuseTicks <= 0) { @@ -30,9 +30,9 @@ + this.die(); + // CraftBukkit end } else { - this.ay(); - this.world.addParticle(Particles.SMOKE, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D); -@@ -72,9 +78,16 @@ + this.aC(); + if (this.world.isClientSide) { +@@ -71,9 +77,16 @@ } private void explode() { @@ -40,12 +40,12 @@ + // CraftBukkit start + // float f = 4.0F; -- this.world.explode(this, this.locX, this.locY + (double) (this.getHeight() / 16.0F), this.locZ, 4.0F, Explosion.Effect.BREAK); +- this.world.explode(this, this.locX(), this.e(0.0625D), this.locZ(), 4.0F, Explosion.Effect.BREAK); + ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity()); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { -+ this.world.createExplosion(this, this.locX, this.locY + (double) (this.getHeight() / 16.0F), this.locZ, event.getRadius(), event.getFire(), Explosion.Effect.BREAK); ++ this.world.createExplosion(this, this.locX(), this.e(0.0625D), this.locZ(), event.getRadius(), event.getFire(), Explosion.Effect.BREAK); + } + // CraftBukkit end } diff --git a/nms-patches/EntityThrownTrident.patch b/nms-patches/EntityThrownTrident.patch index de5f702466..5849b96952 100644 --- a/nms-patches/EntityThrownTrident.patch +++ b/nms-patches/EntityThrownTrident.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityThrownTrident.java +++ b/net/minecraft/server/EntityThrownTrident.java -@@ -122,7 +122,7 @@ +@@ -131,7 +131,7 @@ EntityLightning entitylightning = new EntityLightning(this.world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, false); entitylightning.d(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null); diff --git a/nms-patches/EntityTippedArrow.patch b/nms-patches/EntityTippedArrow.patch index 95c24b1325..6e9ecd854e 100644 --- a/nms-patches/EntityTippedArrow.patch +++ b/nms-patches/EntityTippedArrow.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityTippedArrow.java +++ b/net/minecraft/server/EntityTippedArrow.java -@@ -117,6 +117,25 @@ +@@ -122,6 +122,25 @@ } } @@ -26,7 +26,7 @@ public int getColor() { return (Integer) this.datawatcher.get(EntityTippedArrow.COLOR); } -@@ -184,7 +203,7 @@ +@@ -189,7 +208,7 @@ while (iterator.hasNext()) { mobeffect = (MobEffect) iterator.next(); @@ -35,7 +35,7 @@ } if (!this.effects.isEmpty()) { -@@ -192,7 +211,7 @@ +@@ -197,7 +216,7 @@ while (iterator.hasNext()) { mobeffect = (MobEffect) iterator.next(); diff --git a/nms-patches/EntityTrackerEntry.patch b/nms-patches/EntityTrackerEntry.patch index 8914685d7a..8cee802d79 100644 --- a/nms-patches/EntityTrackerEntry.patch +++ b/nms-patches/EntityTrackerEntry.patch @@ -34,14 +34,14 @@ + this.broadcastIncludingSelf(new PacketPlayOutMount(this.tracker)); // CraftBukkit } -- if (this.tracker instanceof EntityItemFrame && this.n % 10 == 0) { +- if (this.tracker instanceof EntityItemFrame && this.tickCounter % 10 == 0) { + // PAIL : rename -+ if (this.tracker instanceof EntityItemFrame /*&& this.n % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block ++ if (this.tracker instanceof EntityItemFrame /*&& this.tickCounter % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker; ItemStack itemstack = entityitemframe.getItem(); - if (itemstack.getItem() instanceof ItemWorldMap) { -+ if (this.n % 10 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.n % 10 logic here so item frames do not enter the other blocks ++ if (this.tickCounter % 10 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks WorldMap worldmap = ItemWorldMap.getSavedMap(itemstack, this.b); - Iterator iterator = this.b.getPlayers().iterator(); + Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit @@ -49,7 +49,7 @@ while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); @@ -104,6 +114,17 @@ - boolean flag2 = flag1 || this.n % 60 == 0; + boolean flag2 = flag1 || this.tickCounter % 60 == 0; boolean flag3 = Math.abs(i - this.yRot) >= 1 || Math.abs(j - this.xRot) >= 1; + // CraftBukkit start - Code moved from below @@ -63,7 +63,7 @@ + } + // CraftBukkit end + - if (this.n > 0 || this.tracker instanceof EntityArrow) { + if (this.tickCounter > 0 || this.tracker instanceof EntityArrow) { long k = PacketPlayOutEntity.a(vec3d.x); long l = PacketPlayOutEntity.a(vec3d.y); @@ -142,6 +163,7 @@ @@ -84,7 +84,7 @@ } @@ -165,7 +188,27 @@ - ++this.n; + ++this.tickCounter; if (this.tracker.velocityChanged) { - this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.tracker)); + // CraftBukkit start - Create PlayerVelocity event @@ -131,7 +131,7 @@ + // CraftBukkit end } - Packet packet = this.tracker.N(); + Packet packet = this.tracker.L(); @@ -204,6 +250,12 @@ AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) this.tracker).getAttributeMap(); Collection collection = attributemapserver.c(); @@ -157,7 +157,7 @@ if (this.tracker instanceof EntityLiving) { EntityLiving entityliving = (EntityLiving) this.tracker; Iterator iterator = entityliving.getEffects().iterator(); -@@ -265,6 +322,11 @@ +@@ -273,6 +330,11 @@ Set set = attributemapserver.getAttributes(); if (!set.isEmpty()) { diff --git a/nms-patches/EntityTurtle.patch b/nms-patches/EntityTurtle.patch index 9c60bce5db..1d0a372c69 100644 --- a/nms-patches/EntityTurtle.patch +++ b/nms-patches/EntityTurtle.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityTurtle.java +++ b/net/minecraft/server/EntityTurtle.java -@@ -254,7 +254,9 @@ +@@ -255,7 +255,9 @@ protected void l() { super.l(); if (!this.isBaby() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { @@ -10,7 +10,7 @@ } } -@@ -281,7 +283,9 @@ +@@ -282,7 +284,9 @@ @Override public void onLightningStrike(EntityLightning entitylightning) { @@ -20,8 +20,8 @@ } static class g extends NavigationGuardian { -@@ -441,8 +445,12 @@ - } else if (this.g.bG > 200) { +@@ -443,8 +447,12 @@ + } else if (this.g.bD > 200) { World world = this.g.world; + // CraftBukkit start @@ -33,7 +33,7 @@ this.g.r(false); this.g.s(false); this.g.setLoveTicks(600); -@@ -528,7 +536,7 @@ +@@ -530,7 +538,7 @@ --this.e; return false; } else { diff --git a/nms-patches/EntityTypes.patch b/nms-patches/EntityTypes.patch index 46072e822b..b0a0ec0155 100644 --- a/nms-patches/EntityTypes.patch +++ b/nms-patches/EntityTypes.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/EntityTypes.java +++ b/net/minecraft/server/EntityTypes.java -@@ -129,7 +129,7 @@ - private MinecraftKey bh; - private final EntitySize bi; +@@ -130,7 +130,7 @@ + private MinecraftKey bi; + private final EntitySize bj; - private static EntityTypes a(String s, EntityTypes.a entitytypes_a) { + private static EntityTypes a(String s, EntityTypes.a entitytypes_a) { // CraftBukkit - decompile error return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_a.a(s)); } -@@ -158,10 +158,16 @@ +@@ -159,10 +159,16 @@ @Nullable public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) { @@ -28,7 +28,7 @@ } @Nullable -@@ -327,7 +333,7 @@ +@@ -328,7 +334,7 @@ } return entity; @@ -37,7 +37,7 @@ } private static Optional b(NBTTagCompound nbttagcompound, World world) { -@@ -344,7 +350,8 @@ +@@ -345,7 +351,8 @@ } public int getUpdateInterval() { @@ -47,7 +47,7 @@ } public boolean isDeltaTracking() { -@@ -376,7 +383,7 @@ +@@ -377,7 +384,7 @@ this.f = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC; } diff --git a/nms-patches/EntityVillager.patch b/nms-patches/EntityVillager.patch index b38cc5c1ae..0c0d32adb7 100644 --- a/nms-patches/EntityVillager.patch +++ b/nms-patches/EntityVillager.patch @@ -33,10 +33,10 @@ - this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this); + this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error this.world.getMethodProfiler().exit(); - if (!this.dY() && this.bE > 0) { - --this.bE; + if (!this.et() && this.bB > 0) { + --this.bB; @@ -134,7 +144,7 @@ - this.bF = false; + this.bC = false; } - this.addEffect(new MobEffect(MobEffects.REGENERATION, 200, 0)); @@ -44,7 +44,7 @@ } } -@@ -351,7 +361,14 @@ +@@ -353,7 +363,14 @@ while (iterator.hasNext()) { MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next(); @@ -60,7 +60,7 @@ } } -@@ -673,7 +690,12 @@ +@@ -658,7 +675,12 @@ entitywitch.setCustomNameVisible(this.getCustomNameVisible()); } @@ -74,16 +74,16 @@ this.die(); } -@@ -823,7 +845,7 @@ +@@ -808,7 +830,7 @@ } private void b(long i) { -- this.br.setMemory(MemoryModuleType.GOLEM_LAST_SEEN_TIME, (Object) i); -+ this.br.setMemory(MemoryModuleType.GOLEM_LAST_SEEN_TIME, i); // CraftBukkit - decompile error +- this.bo.setMemory(MemoryModuleType.GOLEM_LAST_SEEN_TIME, (Object) i); ++ this.bo.setMemory(MemoryModuleType.GOLEM_LAST_SEEN_TIME, i); // CraftBukkit - decompile error } private boolean c(long i) { -@@ -872,7 +894,7 @@ +@@ -857,7 +879,7 @@ if (entityirongolem != null) { if (entityirongolem.a((GeneratorAccess) this.world, EnumMobSpawn.MOB_SUMMONED) && entityirongolem.a((IWorldReader) this.world)) { @@ -92,12 +92,19 @@ return entityirongolem; } -@@ -933,7 +955,7 @@ +@@ -919,13 +941,13 @@ @Override - public void e(BlockPosition blockposition) { - super.e(blockposition); -- this.br.setMemory(MemoryModuleType.LAST_SLEPT, (Object) MinecraftSerializableLong.a(this.world.getTime())); -+ this.br.setMemory(MemoryModuleType.LAST_SLEPT, MinecraftSerializableLong.a(this.world.getTime())); // CraftBukkit - decompile error + public void entitySleep(BlockPosition blockposition) { + super.entitySleep(blockposition); +- this.bo.setMemory(MemoryModuleType.LAST_SLEPT, (Object) MinecraftSerializableLong.a(this.world.getTime())); ++ this.bo.setMemory(MemoryModuleType.LAST_SLEPT, MinecraftSerializableLong.a(this.world.getTime())); // CraftBukkit - decompile error + } + + @Override + public void entityWakeup() { + super.entityWakeup(); +- this.bo.setMemory(MemoryModuleType.LAST_WOKEN, (Object) MinecraftSerializableLong.a(this.world.getTime())); ++ this.bo.setMemory(MemoryModuleType.LAST_WOKEN, MinecraftSerializableLong.a(this.world.getTime())); // CraftBukkit - decompile error } private boolean d(long i) { diff --git a/nms-patches/EntityVillagerAbstract.patch b/nms-patches/EntityVillagerAbstract.patch index 1e4f05de76..aa226200f8 100644 --- a/nms-patches/EntityVillagerAbstract.patch +++ b/nms-patches/EntityVillagerAbstract.patch @@ -22,7 +22,7 @@ + return (craftMerchant == null) ? craftMerchant = new CraftMerchant(this) : craftMerchant; + } + // CraftBukkit end - private static final DataWatcherObject bA = DataWatcher.a(EntityVillagerAbstract.class, DataWatcherRegistry.b); + private static final DataWatcherObject bx = DataWatcher.a(EntityVillagerAbstract.class, DataWatcherRegistry.b); @Nullable private EntityHuman tradingPlayer; @Nullable @@ -32,7 +32,7 @@ public EntityVillagerAbstract(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -221,7 +236,16 @@ +@@ -231,7 +246,16 @@ MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.a(this, this.random); if (merchantrecipe != null) { diff --git a/nms-patches/EntityWither.patch b/nms-patches/EntityWither.patch index 4b8e0af43a..224030f988 100644 --- a/nms-patches/EntityWither.patch +++ b/nms-patches/EntityWither.patch @@ -15,41 +15,41 @@ private static final DataWatcherObject b = DataWatcher.a(EntityWither.class, DataWatcherRegistry.b); @@ -188,14 +195,38 @@ - i = this.dV() - 1; + i = this.eq() - 1; if (i <= 0) { Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE; + // CraftBukkit start -+ // this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, explosion_effect); ++ // this.world.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), 7.0F, false, explosion_effect); + ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { -+ this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, event.getRadius(), event.getFire(), explosion_effect); ++ this.world.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect); + } + // CraftBukkit end -- this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, explosion_effect); +- this.world.createExplosion(this, this.locX(), this.getHeadY(), this.locZ(), 7.0F, false, explosion_effect); - this.world.b(1023, new BlockPosition(this), 0); + // CraftBukkit start - Use relative location for far away sounds + // this.world.b(1023, new BlockPosition(this), 0); + int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; + for (EntityPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { -+ double deltaX = this.locX - player.locX; -+ double deltaZ = this.locZ - player.locZ; ++ double deltaX = this.locX() - player.locX(); ++ double deltaZ = this.locZ() - player.locZ(); + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; + if (distanceSquared > viewDistance * viewDistance) { + double deltaLength = Math.sqrt(distanceSquared); -+ double relativeX = player.locX + (deltaX / deltaLength) * viewDistance; -+ double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance; -+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1023, new BlockPosition((int) relativeX, (int) this.locY, (int) relativeZ), 0, true)); ++ double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance; ++ double relativeZ = player.locZ() + (deltaZ / deltaLength) * viewDistance; ++ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1023, new BlockPosition((int) relativeX, (int) this.locY(), (int) relativeZ), 0, true)); + } else { -+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1023, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0, true)); ++ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1023, new BlockPosition((int) this.locX(), (int) this.locY(), (int) this.locZ()), 0, true)); + } + } + // CraftBukkit end } - this.r(i); + this.s(i); if (this.ticksLived % 10 == 0) { - this.heal(10.0F); + this.heal(10.0F, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit @@ -77,7 +77,7 @@ + continue; + } + // CraftBukkit end - flag = this.world.b(blockposition, true) || flag; + flag = this.world.a(blockposition, true, this) || flag; } } @@ -298,7 +336,7 @@ diff --git a/nms-patches/EntityWitherSkull.patch b/nms-patches/EntityWitherSkull.patch index ae6c43fcad..e8a79ed50d 100644 --- a/nms-patches/EntityWitherSkull.patch +++ b/nms-patches/EntityWitherSkull.patch @@ -8,7 +8,7 @@ public class EntityWitherSkull extends EntityFireball { private static final DataWatcherObject f = DataWatcher.a(EntityWitherSkull.class, DataWatcherRegistry.i); -@@ -34,11 +36,11 @@ +@@ -35,11 +37,11 @@ Entity entity = ((MovingObjectPositionEntity) movingobjectposition).getEntity(); if (this.shooter != null) { @@ -22,7 +22,7 @@ } } } else { -@@ -55,14 +57,22 @@ +@@ -56,14 +58,22 @@ } if (b0 > 0) { @@ -34,14 +34,14 @@ Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE; -- this.world.createExplosion(this, this.locX, this.locY, this.locZ, 1.0F, false, explosion_effect); +- this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), 1.0F, false, explosion_effect); + // CraftBukkit start -+ // this.world.createExplosion(this, this.locX, this.locY, this.locZ, 1.0F, false, explosion_effect); ++ // this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), 1.0F, false, explosion_effect); + ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { -+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), explosion_effect); ++ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect); + } + // CraftBukkit end this.die(); diff --git a/nms-patches/EntityWolf.patch b/nms-patches/EntityWolf.patch index 33f76992f6..62cbbf9a33 100644 --- a/nms-patches/EntityWolf.patch +++ b/nms-patches/EntityWolf.patch @@ -11,17 +11,17 @@ + public class EntityWolf extends EntityTameableAnimal { - private static final DataWatcherObject DATA_HEALTH = DataWatcher.a(EntityWolf.class, DataWatcherRegistry.c); -@@ -42,7 +47,7 @@ + private static final DataWatcherObject bA = DataWatcher.a(EntityWolf.class, DataWatcherRegistry.i); +@@ -41,7 +46,7 @@ this.goalSelector.a(10, new PathfinderGoalRandomLookaround(this)); this.targetSelector.a(1, new PathfinderGoalOwnerHurtByTarget(this)); this.targetSelector.a(2, new PathfinderGoalOwnerHurtTarget(this)); - this.targetSelector.a(3, (new PathfinderGoalHurtByTarget(this, new Class[0])).a()); + this.targetSelector.a(3, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // CraftBukkit - decompile error - this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed<>(this, EntityAnimal.class, false, EntityWolf.bC)); - this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed<>(this, EntityTurtle.class, false, EntityTurtle.bz)); + this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed<>(this, EntityAnimal.class, false, EntityWolf.bz)); + this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed<>(this, EntityTurtle.class, false, EntityTurtle.bw)); this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntitySkeletonAbstract.class, false)); -@@ -61,6 +66,22 @@ +@@ -60,6 +65,22 @@ this.getAttributeMap().b(GenericAttributes.ATTACK_DAMAGE).setValue(2.0D); } @@ -44,7 +44,7 @@ @Override public void setGoalTarget(@Nullable EntityLiving entityliving) { super.setGoalTarget(entityliving); -@@ -101,6 +122,11 @@ +@@ -94,6 +115,11 @@ public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); this.setAngry(nbttagcompound.getBoolean("Angry")); @@ -56,7 +56,7 @@ if (nbttagcompound.hasKeyOfType("CollarColor", 99)) { this.setCollarColor(EnumColor.fromColorIndex(nbttagcompound.getInt("CollarColor"))); } -@@ -137,7 +163,7 @@ +@@ -130,7 +156,7 @@ this.world.broadcastEntityEffect(this, (byte) 8); } @@ -65,7 +65,7 @@ this.setAngry(false); } -@@ -217,7 +243,8 @@ +@@ -210,7 +236,8 @@ Entity entity = damagesource.getEntity(); if (this.goalSit != null) { @@ -75,37 +75,39 @@ } if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) { -@@ -264,7 +291,7 @@ - itemstack.subtract(1); - } - -- this.heal((float) item.getFoodInfo().getNutrition()); -+ this.heal((float) item.getFoodInfo().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit - return true; +@@ -237,7 +264,7 @@ + super.setTamed(flag); + if (flag) { + this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(20.0D); +- this.setHealth(20.0F); ++ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth() + } else { + this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(8.0D); + } +@@ -261,7 +288,7 @@ + itemstack.subtract(1); } - } else if (item instanceof ItemDye) { -@@ -285,7 +312,7 @@ - this.goalSit.setSitting(!this.isSitting()); - this.jumping = false; - this.navigation.o(); -- this.setGoalTarget((EntityLiving) null); -+ this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason - } - } else if (item == Items.BONE && !this.isAngry()) { - if (!entityhuman.abilities.canInstantlyBuild) { -@@ -293,12 +320,13 @@ - } - if (!this.world.isClientSide) { +- this.heal((float) item.getFoodInfo().getNutrition()); ++ this.heal((float) item.getFoodInfo().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit + return true; + } + +@@ -290,14 +317,15 @@ + this.goalSit.setSitting(!this.isSitting()); + this.jumping = false; + this.navigation.o(); +- this.setGoalTarget((EntityLiving) null); ++ this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason + } + } else if (item == Items.BONE && !this.isAngry()) { + if (!entityhuman.abilities.canInstantlyBuild) { + itemstack.subtract(1); + } + - if (this.random.nextInt(3) == 0) { + // CraftBukkit - added event call and isCancelled check. + if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { this.tame(entityhuman); this.navigation.o(); this.setGoalTarget((EntityLiving) null); - this.goalSit.setSitting(true); -- this.setHealth(20.0F); -+ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth() - this.r(true); - this.world.broadcastEntityEffect(this, (byte) 7); - } else { diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch index c57b66bef1..fa1f5b6f76 100644 --- a/nms-patches/EntityZombie.patch +++ b/nms-patches/EntityZombie.patch @@ -17,8 +17,8 @@ protected static final IAttribute d = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); @@ -23,6 +32,7 @@ - private boolean bE; - private int bF; + private boolean bB; + private int bC; public int drownedConversionTime; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field @@ -35,7 +35,7 @@ + this.drownedConversionTime -= elapsedTicks; + // CraftBukkit end if (this.drownedConversionTime < 0) { - this.ea(); + this.ev(); } @@ -193,6 +207,7 @@ } @@ -45,10 +45,10 @@ this.drownedConversionTime = i; this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, true); } -@@ -231,7 +246,13 @@ - entityzombie.setCustomNameVisible(this.getCustomNameVisible()); +@@ -236,7 +251,13 @@ } + entityzombie.setInvulnerable(this.isInvulnerable()); - this.world.addEntity(entityzombie); + // CraftBukkit start + if (CraftEventFactory.callEntityTransformEvent(this, entityzombie, EntityTransformEvent.TransformReason.DROWNED).isCancelled()) { @@ -60,7 +60,7 @@ this.die(); } } -@@ -264,8 +285,8 @@ +@@ -298,8 +319,8 @@ if (this.world.getType(blockposition).a((IBlockAccess) this.world, blockposition, (Entity) entityzombie) && 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.i((Entity) entityzombie) && this.world.getCubes(entityzombie) && !this.world.containsLiquid(entityzombie.getBoundingBox())) { @@ -71,7 +71,7 @@ entityzombie.prepare(this.world, this.world.getDamageScaler(new BlockPosition(entityzombie)), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null, (NBTTagCompound) null); this.getAttributeInstance(EntityZombie.d).addModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION)); entityzombie.getAttributeInstance(EntityZombie.d).addModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION)); -@@ -289,7 +310,14 @@ +@@ -323,7 +344,14 @@ float f = this.world.getDamageScaler(new BlockPosition(this)).b(); if (this.getItemInMainHand().isEmpty() && this.isBurning() && this.random.nextFloat() < f * 0.3F) { @@ -87,7 +87,7 @@ } } -@@ -379,7 +407,7 @@ +@@ -413,7 +441,7 @@ EntityZombieVillager entityzombievillager = (EntityZombieVillager) EntityTypes.ZOMBIE_VILLAGER.a(this.world); entityzombievillager.u(entityvillager); @@ -95,11 +95,11 @@ + // entityvillager.die(); // CraftBukkit - moved down entityzombievillager.prepare(this.world, this.world.getDamageScaler(new BlockPosition(entityzombievillager)), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false), (NBTTagCompound) null); entityzombievillager.setVillagerData(entityvillager.getVillagerData()); - entityzombievillager.a((NBTBase) entityvillager.es().a((DynamicOps) DynamicOpsNBT.a).getValue()); -@@ -392,7 +420,13 @@ - entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible()); + entityzombievillager.a((NBTBase) entityvillager.eN().a((DynamicOps) DynamicOpsNBT.a).getValue()); +@@ -431,7 +459,13 @@ } + entityzombievillager.setInvulnerable(this.isInvulnerable()); - this.world.addEntity(entityzombievillager); + // CraftBukkit start + if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) { @@ -111,8 +111,8 @@ this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0); } -@@ -439,7 +473,7 @@ - entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); +@@ -478,7 +512,7 @@ + entitychicken1.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F); entitychicken1.prepare(generatoraccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null); entitychicken1.r(true); - generatoraccess.addEntity(entitychicken1); diff --git a/nms-patches/EntityZombieVillager.patch b/nms-patches/EntityZombieVillager.patch index 3a07435667..472bb84d2d 100644 --- a/nms-patches/EntityZombieVillager.patch +++ b/nms-patches/EntityZombieVillager.patch @@ -13,9 +13,9 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder { @@ -13,6 +18,7 @@ - private NBTBase bB; - private NBTTagCompound bC; - private int bD; + private NBTBase by; + private NBTTagCompound bz; + private int bA; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field public EntityZombieVillager(EntityTypes entitytypes, World world) { @@ -32,7 +32,7 @@ this.conversionTime -= i; if (this.conversionTime <= 0) { -@@ -122,8 +133,11 @@ +@@ -123,8 +134,11 @@ this.conversionPlayer = uuid; this.conversionTime = i; this.getDataWatcher().set(EntityZombieVillager.CONVERTING, true); @@ -46,7 +46,7 @@ this.world.broadcastEntityEffect(this, (byte) 16); } -@@ -146,14 +160,21 @@ +@@ -166,7 +180,7 @@ entityvillager.setAgeRaw(-24000); } @@ -55,9 +55,10 @@ entityvillager.setNoAI(this.isNoAI()); if (this.hasCustomName()) { entityvillager.setCustomName(this.getCustomName()); - entityvillager.setCustomNameVisible(this.getCustomNameVisible()); +@@ -178,7 +192,14 @@ } + entityvillager.setInvulnerable(this.isInvulnerable()); - worldserver.addEntity(entityvillager); + // CraftBukkit start + if (CraftEventFactory.callEntityTransformEvent(this, entityvillager, EntityTransformEvent.TransformReason.CURED).isCancelled()) { @@ -70,7 +71,7 @@ if (this.conversionPlayer != null) { EntityHuman entityhuman = worldserver.b(this.conversionPlayer); -@@ -163,7 +184,7 @@ +@@ -188,7 +209,7 @@ } } diff --git a/nms-patches/Explosion.patch b/nms-patches/Explosion.patch index c15369bfaf..4cfeaa11a5 100644 --- a/nms-patches/Explosion.patch +++ b/nms-patches/Explosion.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Explosion.java +++ b/net/minecraft/server/Explosion.java -@@ -10,6 +10,13 @@ +@@ -14,6 +14,13 @@ import java.util.Set; import javax.annotation.Nullable; @@ -14,7 +14,7 @@ public class Explosion { private final boolean a; -@@ -24,11 +31,12 @@ +@@ -29,11 +36,12 @@ private DamageSource j; private final List blocks = Lists.newArrayList(); private final Map l = Maps.newHashMap(); @@ -28,7 +28,7 @@ this.posX = d0; this.posY = d1; this.posZ = d2; -@@ -73,6 +81,11 @@ +@@ -78,6 +86,11 @@ } public void a() { @@ -40,7 +40,7 @@ Set set = Sets.newHashSet(); boolean flag = true; -@@ -111,7 +124,7 @@ +@@ -116,7 +129,7 @@ f -= (f2 + 0.3F) * 0.3F; } @@ -49,7 +49,7 @@ set.add(blockposition); } -@@ -155,7 +168,16 @@ +@@ -160,7 +173,16 @@ double d12 = (double) a(vec3d, entity); double d13 = (1.0D - d7) * d12; @@ -67,10 +67,10 @@ double d14 = d13; if (entity instanceof EntityLiving) { -@@ -191,6 +213,50 @@ - BlockPosition blockposition; +@@ -202,6 +224,51 @@ - if (flag1) { + Collections.shuffle(this.blocks, this.world.random); + Iterator iterator = this.blocks.iterator(); + // CraftBukkit start + org.bukkit.World bworld = this.world.getWorld(); + org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity(); @@ -115,12 +115,13 @@ + return; + } + // CraftBukkit end - iterator = this.blocks.iterator(); ++ iterator = this.blocks.iterator(); while (iterator.hasNext()) { -@@ -225,8 +291,8 @@ + BlockPosition blockposition = (BlockPosition) iterator.next(); +@@ -216,8 +283,8 @@ TileEntity tileentity = block.isTileEntity() ? this.world.getTileEntity(blockposition) : null; - LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).a(this.world.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, ItemStack.a).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity); + LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).a(this.world.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, ItemStack.a).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity).setOptional(LootContextParameters.THIS_ENTITY, this.source); - if (this.b == Explosion.Effect.DESTROY) { - loottableinfo_builder.set(LootContextParameters.EXPLOSION_RADIUS, this.size); @@ -128,28 +129,17 @@ + loottableinfo_builder.set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield } - Block.b(iblockdata, loottableinfo_builder); -@@ -244,7 +310,11 @@ - while (iterator.hasNext()) { - blockposition = (BlockPosition) iterator.next(); - if (this.world.getType(blockposition).isAir() && this.world.getType(blockposition.down()).g(this.world, blockposition.down()) && this.c.nextInt(3) == 0) { -- this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); + iblockdata.a(loottableinfo_builder).forEach((itemstack) -> { +@@ -247,7 +314,11 @@ + BlockPosition blockposition2 = (BlockPosition) iterator1.next(); + + if (this.c.nextInt(3) == 0 && this.world.getType(blockposition2).isAir() && this.world.getType(blockposition2.down()).g(this.world, blockposition2.down())) { +- this.world.setTypeUpdate(blockposition2, Blocks.FIRE.getBlockData()); + // CraftBukkit start - Ignition by explosion -+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this).isCancelled()) { -+ this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ(), this).isCancelled()) { ++ this.world.setTypeUpdate(blockposition2, Blocks.FIRE.getBlockData()); + } + // CraftBukkit end } } } -@@ -265,7 +335,9 @@ - - @Nullable - public EntityLiving getSource() { -- return this.source == null ? null : (this.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) this.source).getSource() : (this.source instanceof EntityLiving ? (EntityLiving) this.source : null)); -+ // CraftBukkit start - obtain Fireball shooter for explosion tracking -+ return this.source == null ? null : (this.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) this.source).getSource() : (this.source instanceof EntityLiving ? (EntityLiving) this.source : (this.source instanceof EntityFireball ? ((EntityFireball) this.source).shooter : null))); -+ // CraftBukkit end - } - - public void clearBlocks() { diff --git a/nms-patches/FoodMetaData.patch b/nms-patches/FoodMetaData.patch index 316c443b12..9e7382397a 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.dP()) { + } else if (flag && this.foodLevel >= 18 && entityhuman.eo()) { ++this.foodTickTimer; if (this.foodTickTimer >= 80) { - entityhuman.heal(1.0F); diff --git a/nms-patches/GameRules.patch b/nms-patches/GameRules.patch index 2b8d891fc2..0aa582ee12 100644 --- a/nms-patches/GameRules.patch +++ b/nms-patches/GameRules.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/GameRules.java +++ b/net/minecraft/server/GameRules.java -@@ -78,7 +78,7 @@ +@@ -92,7 +92,7 @@ } public > T get(GameRules.GameRuleKey gamerules_gamerulekey) { -- return (GameRules.GameRuleValue) this.A.get(gamerules_gamerulekey); -+ return (T) this.A.get(gamerules_gamerulekey); // CraftBukkit - decompile error +- return (GameRules.GameRuleValue) this.F.get(gamerules_gamerulekey); ++ return (T) this.F.get(gamerules_gamerulekey); // CraftBukkit - decompile error } public NBTTagCompound a() { -@@ -103,7 +103,7 @@ +@@ -120,7 +120,7 @@ } private static > void a(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey gamerules_gamerulekey, GameRules.GameRuleDefinition gamerules_gameruledefinition) { @@ -18,7 +18,7 @@ } public boolean getBoolean(GameRules.GameRuleKey gamerules_gamerulekey) { -@@ -154,7 +154,7 @@ +@@ -171,7 +171,7 @@ } @Override @@ -27,7 +27,7 @@ this.a = Boolean.parseBoolean(s); } -@@ -204,7 +204,7 @@ +@@ -221,7 +221,7 @@ } @Override @@ -36,7 +36,7 @@ this.a = b(s); } -@@ -253,7 +253,7 @@ +@@ -270,7 +270,7 @@ } @@ -45,7 +45,7 @@ protected abstract String getValue(); -@@ -283,7 +283,7 @@ +@@ -300,7 +300,7 @@ } public T getValue() { diff --git a/nms-patches/HandshakeListener.patch b/nms-patches/HandshakeListener.patch index d74cd5ed13..f41446d0cd 100644 --- a/nms-patches/HandshakeListener.patch +++ b/nms-patches/HandshakeListener.patch @@ -57,8 +57,8 @@ + } + // CraftBukkit end + - if (packethandshakinginsetprotocol.c() > SharedConstants.a().getProtocolVersion()) { - chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[]{SharedConstants.a().getName()}); + if (packethandshakinginsetprotocol.c() > SharedConstants.getGameVersion().getProtocolVersion()) { + chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[]{SharedConstants.getGameVersion().getName()}); this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); @@ -27,6 +72,7 @@ this.b.close(chatmessage); diff --git a/nms-patches/IChunkLoader.patch b/nms-patches/IChunkLoader.patch index a70e9f1dbb..b9e728ffe5 100644 --- a/nms-patches/IChunkLoader.patch +++ b/nms-patches/IChunkLoader.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/IChunkLoader.java +++ b/net/minecraft/server/IChunkLoader.java -@@ -17,15 +17,56 @@ - this.b = datafixer; +@@ -18,15 +18,54 @@ + this.a = new IOWorker(new RegionFileCache(file), "chunk"); } - public NBTTagCompound getChunkData(DimensionManager dimensionmanager, Supplier supplier, NBTTagCompound nbttagcompound) { @@ -15,18 +15,16 @@ + } + } + -+ if (this.chunkExists(pos)) { -+ NBTTagCompound nbt = read(pos); -+ if (nbt != null) { -+ NBTTagCompound level = nbt.getCompound("Level"); -+ if (level.getBoolean("TerrainPopulated")) { -+ return true; -+ } ++ NBTTagCompound nbt = read(pos); ++ if (nbt != null) { ++ NBTTagCompound level = nbt.getCompound("Level"); ++ if (level.getBoolean("TerrainPopulated")) { ++ return true; ++ } + -+ ChunkStatus status = ChunkStatus.a(level.getString("Status")); -+ if (status != null && status.b(ChunkStatus.FEATURES)) { -+ return true; -+ } ++ ChunkStatus status = ChunkStatus.a(level.getString("Status")); ++ if (status != null && status.b(ChunkStatus.FEATURES)) { ++ return true; + } + } + @@ -53,9 +51,9 @@ if (i < 1493) { nbttagcompound = GameProfileSerializer.a(this.b, DataFixTypes.CHUNK, nbttagcompound, i, 1493); if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) { - if (this.a == null) { -- this.a = PersistentStructureLegacy.a(dimensionmanager, (WorldPersistentData) supplier.get()); -+ this.a = PersistentStructureLegacy.a(dimensionmanager.getType(), (WorldPersistentData) supplier.get()); // CraftBukkit - getType + if (this.c == null) { +- this.c = PersistentStructureLegacy.a(dimensionmanager, (WorldPersistentData) supplier.get()); ++ this.c = PersistentStructureLegacy.a(dimensionmanager.getType(), (WorldPersistentData) supplier.get()); // CraftBukkit - getType } - nbttagcompound = this.a.a(nbttagcompound); + nbttagcompound = this.c.a(nbttagcompound); diff --git a/nms-patches/IDispenseBehavior.patch b/nms-patches/IDispenseBehavior.patch index 7d4677d6a0..aafe038a29 100644 --- a/nms-patches/IDispenseBehavior.patch +++ b/nms-patches/IDispenseBehavior.patch @@ -99,10 +99,52 @@ return itemstack; } }; -@@ -147,9 +184,37 @@ - double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX(); - double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F); - double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ(); +@@ -146,12 +183,40 @@ + EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING); + BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection); + World world = isourceblock.getWorld(); ++ ++ // CraftBukkit start ++ ItemStack itemstack1 = itemstack.cloneAndSubtract(1); ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ itemstack.add(1); ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ itemstack.add(1); ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { ++ idispensebehavior.dispense(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ // CraftBukkit end ++ + EntityArmorStand entityarmorstand = new EntityArmorStand(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D); + + EntityTypes.a(world, (EntityHuman) null, (Entity) entityarmorstand, itemstack.getTag()); + entityarmorstand.yaw = enumdirection.n(); + world.addEntity(entityarmorstand); +- itemstack.subtract(1); ++ // itemstack.subtract(1); // CraftBukkit - Handled during event processing + return itemstack; + } + })); +@@ -165,11 +230,40 @@ + double d3 = isourceblock.getX() + d0; + double d4 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F); + double d5 = isourceblock.getZ() + d2; + // CraftBukkit start + World world = isourceblock.getWorld(); + ItemStack itemstack1 = itemstack.cloneAndSubtract(1); @@ -118,9 +160,7 @@ + itemstack.add(1); + return itemstack; + } - -- isourceblock.getWorld().addEntity(new EntityFireworks(isourceblock.getWorld(), d0, d1, d2, itemstack)); -- itemstack.subtract(1); ++ + if (!event.getItem().equals(craftItem)) { + itemstack.add(1); + // Chain to handler for new item @@ -133,13 +173,17 @@ + } + + itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); -+ isourceblock.getWorld().addEntity(new EntityFireworks(isourceblock.getWorld(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), itemstack1)); + EntityFireworks entityfireworks = new EntityFireworks(isourceblock.getWorld(), itemstack, d3, d4, d5, true); + + entityfireworks.shoot(d0, d1, d2, 0.5F, 1.0F); + isourceblock.getWorld().addEntity(entityfireworks); +- itemstack.subtract(1); + // itemstack.subtract(1); // Handled during event processing + // CraftBukkit end return itemstack; } -@@ -172,10 +237,39 @@ +@@ -192,10 +286,39 @@ double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY(); double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ(); @@ -183,7 +227,7 @@ return itemstack; } -@@ -199,9 +293,52 @@ +@@ -219,9 +342,52 @@ BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING)); World world = isourceblock.getWorld(); @@ -237,7 +281,7 @@ } else { return this.b.dispense(isourceblock, itemstack); } -@@ -225,13 +362,39 @@ +@@ -245,13 +411,39 @@ Block block = iblockdata.getBlock(); if (block instanceof IFluidSource) { @@ -247,7 +291,7 @@ if (!(fluidtype instanceof FluidTypeFlowing)) { return super.a(isourceblock, itemstack); } else { - Item item = fluidtype.b(); + Item item = fluidtype.a(); + // CraftBukkit start + org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); @@ -278,7 +322,7 @@ itemstack.subtract(1); if (itemstack.isEmpty()) { return new ItemStack(item); -@@ -253,12 +416,40 @@ +@@ -273,12 +465,40 @@ protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.getWorld(); @@ -320,7 +364,7 @@ } else if (ItemFlintAndSteel.a(iblockdata)) { world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockProperties.r, true)); } else if (iblockdata.getBlock() instanceof BlockTNT) { -@@ -281,12 +472,57 @@ +@@ -301,12 +521,57 @@ this.dispensed = true; World world = isourceblock.getWorld(); BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING)); @@ -378,7 +422,7 @@ return itemstack; } -@@ -296,11 +532,40 @@ +@@ -316,11 +581,40 @@ protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.getWorld(); BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING)); @@ -415,13 +459,13 @@ + // CraftBukkit end world.addEntity(entitytntprimed); - world.playSound((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound((EntityHuman) null, entitytntprimed.locX(), entitytntprimed.locY(), entitytntprimed.locZ(), SoundEffects.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F); - itemstack.subtract(1); + // itemstack.subtract(1); // CraftBukkit - handled above return itemstack; } })); -@@ -324,6 +589,30 @@ +@@ -344,6 +638,30 @@ EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING); BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection); @@ -449,10 +493,10 @@ + } + // CraftBukkit end + - this.dispensed = true; if (world.isEmpty(blockposition) && BlockWitherSkull.b(world, blockposition, itemstack)) { - world.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.a, enumdirection.k() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.opposite().get2DRotationValue() * 4), 3); -@@ -348,6 +637,30 @@ + world.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.a, enumdirection.m() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.opposite().get2DRotationValue() * 4), 3); + TileEntity tileentity = world.getTileEntity(blockposition); +@@ -368,6 +686,30 @@ BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING)); BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN; @@ -480,10 +524,41 @@ + } + // CraftBukkit end + - this.dispensed = true; if (world.isEmpty(blockposition) && blockpumpkincarved.a((IWorldReader) world, blockposition)) { if (!world.isClientSide) { -@@ -380,6 +693,29 @@ + world.setTypeAndData(blockposition, blockpumpkincarved.getBlockData(), 3); +@@ -416,6 +758,30 @@ + IBlockData iblockdata = world.getType(blockposition); + Block block = iblockdata.getBlock(); + ++ // CraftBukkit start ++ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { ++ idispensebehavior.dispense(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ // CraftBukkit end ++ + if (block.a(TagsBlock.BEEHIVES) && (Integer) iblockdata.get(BlockBeehive.c) >= 5) { + ((BlockBeehive) iblockdata.getBlock()).a(world.getMinecraftWorld(), iblockdata, blockposition, (EntityHuman) null, TileEntityBeehive.ReleaseStatus.BEE_RELEASED); + this.dispensed = true; +@@ -432,6 +798,29 @@ @Override protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.getWorld(); @@ -511,9 +586,9 @@ + } + // CraftBukkit end - if (!world.e()) { + if (!world.p_()) { this.dispensed = false; -@@ -391,6 +727,11 @@ +@@ -443,6 +832,11 @@ EntitySheep entitysheep = (EntitySheep) iterator1.next(); if (entitysheep.isAlive() && !entitysheep.isSheared() && !entitysheep.isBaby()) { diff --git a/nms-patches/IRecipeComplex.patch b/nms-patches/IRecipeComplex.patch new file mode 100644 index 0000000000..ed9068af22 --- /dev/null +++ b/nms-patches/IRecipeComplex.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/server/IRecipeComplex.java ++++ b/net/minecraft/server/IRecipeComplex.java +@@ -22,4 +22,11 @@ + public ItemStack getResult() { + return ItemStack.a; + } ++ ++ // CraftBukkit start ++ @Override ++ public org.bukkit.inventory.Recipe toBukkitRecipe() { ++ return new org.bukkit.craftbukkit.inventory.CraftComplexRecipe(this); ++ } ++ // CraftBukkit end + } diff --git a/nms-patches/IWorldWriter.patch b/nms-patches/IWorldWriter.patch index 5a7b809ac8..4c6eae9240 100644 --- a/nms-patches/IWorldWriter.patch +++ b/nms-patches/IWorldWriter.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/IWorldWriter.java +++ b/net/minecraft/server/IWorldWriter.java -@@ -11,4 +11,10 @@ +@@ -17,4 +17,10 @@ default boolean addEntity(Entity entity) { return false; } diff --git a/nms-patches/ItemArmor.patch b/nms-patches/ItemArmor.patch index cd50e067a0..b81c7771c1 100644 --- a/nms-patches/ItemArmor.patch +++ b/nms-patches/ItemArmor.patch @@ -12,7 +12,7 @@ public class ItemArmor extends Item { private static final UUID[] k = new UUID[]{UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")}; -@@ -30,6 +35,32 @@ +@@ -28,6 +33,32 @@ EntityLiving entityliving = (EntityLiving) list.get(0); EnumItemSlot enumitemslot = EntityInsentient.h(itemstack); ItemStack itemstack1 = itemstack.cloneAndSubtract(1); @@ -28,7 +28,7 @@ + + if (event.isCancelled()) { + itemstack.add(1); -+ return itemstack; ++ return false; + } + + if (!event.getItem().equals(craftItem)) { @@ -38,7 +38,7 @@ + IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); + if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != ItemArmor.a) { + idispensebehavior.dispense(isourceblock, eventStack); -+ return itemstack; ++ return true; + } + } + // CraftBukkit end diff --git a/nms-patches/ItemArmorStand.patch b/nms-patches/ItemArmorStand.patch index 960ea52a6e..f527613776 100644 --- a/nms-patches/ItemArmorStand.patch +++ b/nms-patches/ItemArmorStand.patch @@ -10,5 +10,5 @@ + } + // CraftBukkit end world.addEntity(entityarmorstand); - world.playSound((EntityHuman) null, entityarmorstand.locX, entityarmorstand.locY, entityarmorstand.locZ, SoundEffects.ENTITY_ARMOR_STAND_PLACE, SoundCategory.BLOCKS, 0.75F, 0.8F); + world.playSound((EntityHuman) null, entityarmorstand.locX(), entityarmorstand.locY(), entityarmorstand.locZ(), SoundEffects.ENTITY_ARMOR_STAND_PLACE, SoundCategory.BLOCKS, 0.75F, 0.8F); } diff --git a/nms-patches/ItemBlock.patch b/nms-patches/ItemBlock.patch index 5e08b5f294..1bef5bfce6 100644 --- a/nms-patches/ItemBlock.patch +++ b/nms-patches/ItemBlock.patch @@ -60,15 +60,15 @@ EntityHuman entityhuman = blockactioncontext.getEntity(); VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.a() : VoxelShapeCollision.a((Entity) entityhuman); + // CraftBukkit start - store default return -+ boolean defaultReturn = (!this.d() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision); ++ boolean defaultReturn = (!this.T_() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision); + org.bukkit.entity.Player player = (blockactioncontext.getEntity() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getEntity().getBukkitEntity() : null; + + BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn); + blockactioncontext.getWorld().getServer().getPluginManager().callEvent(event); -- return (!this.d() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision); +- return (!this.T_() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision); + return event.isBuildable(); + // CraftBukkit end } - protected boolean d() { + protected boolean T_() { diff --git a/nms-patches/ItemBoat.patch b/nms-patches/ItemBoat.patch index f8539e2eb3..3382277d27 100644 --- a/nms-patches/ItemBoat.patch +++ b/nms-patches/ItemBoat.patch @@ -16,11 +16,11 @@ entityboat.setType(this.b); @@ -49,7 +57,7 @@ - return new InteractionResultWrapper<>(EnumInteractionResult.FAIL, itemstack); + return InteractionResultWrapper.d(itemstack); } else { if (!world.isClientSide) { - world.addEntity(entityboat); + if (!world.addEntity(entityboat)) return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); // CraftBukkit - } - - if (!entityhuman.abilities.canInstantlyBuild) { + if (!entityhuman.abilities.canInstantlyBuild) { + itemstack.subtract(1); + } diff --git a/nms-patches/ItemBow.patch b/nms-patches/ItemBow.patch index e344c3cd82..d6e435e7f5 100644 --- a/nms-patches/ItemBow.patch +++ b/nms-patches/ItemBow.patch @@ -7,10 +7,10 @@ + // CraftBukkit start - obfuscator went a little crazy + /* this.a(new MinecraftKey("pull"), (itemstack, world, entityliving) -> { - return entityliving == null ? 0.0F : (entityliving.dl().getItem() != Items.BOW ? 0.0F : (float) (itemstack.k() - entityliving.dm()) / 20.0F); + return entityliving == null ? 0.0F : (entityliving.dD().getItem() != Items.BOW ? 0.0F : (float) (itemstack.k() - entityliving.dE()) / 20.0F); }); this.a(new MinecraftKey("pulling"), (itemstack, world, entityliving) -> { - return entityliving != null && entityliving.isHandRaised() && entityliving.dl() == itemstack ? 1.0F : 0.0F; + return entityliving != null && entityliving.isHandRaised() && entityliving.dD() == itemstack ? 1.0F : 0.0F; }); + */ + // CraftBukkit end @@ -48,4 +48,4 @@ + // CraftBukkit end } - world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F); + world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F); diff --git a/nms-patches/ItemBucket.patch b/nms-patches/ItemBucket.patch index 990f7cea4d..a0975c9a0f 100644 --- a/nms-patches/ItemBucket.patch +++ b/nms-patches/ItemBucket.patch @@ -14,13 +14,13 @@ public class ItemBucket extends Item { -@@ -30,12 +37,22 @@ +@@ -32,12 +39,22 @@ if (this.fluidType == FluidTypes.EMPTY) { iblockdata = world.getType(blockposition); if (iblockdata.getBlock() instanceof IFluidSource) { + // CraftBukkit start + FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); -+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.b()); ++ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a()); + + if (event.isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) @@ -33,21 +33,21 @@ if (fluidtype != FluidTypes.EMPTY) { entityhuman.b(StatisticList.ITEM_USED.b(this)); entityhuman.a(fluidtype.a(TagsFluid.LAVA) ? SoundEffects.ITEM_BUCKET_FILL_LAVA : SoundEffects.ITEM_BUCKET_FILL, 1.0F, 1.0F); -- ItemStack itemstack1 = this.a(itemstack, entityhuman, fluidtype.b()); -+ ItemStack itemstack1 = this.a(itemstack, entityhuman, fluidtype.b(), event.getItemStack()); // CraftBukkit +- ItemStack itemstack1 = this.a(itemstack, entityhuman, fluidtype.a()); ++ ItemStack itemstack1 = this.a(itemstack, entityhuman, fluidtype.a(), event.getItemStack()); // CraftBukkit if (!world.isClientSide) { - CriterionTriggers.j.a((EntityPlayer) entityhuman, new ItemStack(fluidtype.b())); -@@ -50,7 +67,7 @@ + CriterionTriggers.j.a((EntityPlayer) entityhuman, new ItemStack(fluidtype.a())); +@@ -52,7 +69,7 @@ iblockdata = world.getType(blockposition); - BlockPosition blockposition1 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()); + BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : blockposition1; -- if (this.a(entityhuman, world, blockposition1, movingobjectpositionblock)) { -+ if (this.a(entityhuman, world, blockposition1, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit - this.a(world, itemstack, blockposition1); +- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock)) { ++ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit + this.a(world, itemstack, blockposition2); if (entityhuman instanceof EntityPlayer) { - CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition1, itemstack); -@@ -74,16 +91,19 @@ + CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition2, itemstack); +@@ -76,16 +93,19 @@ public void a(World world, ItemStack itemstack, BlockPosition blockposition) {} @@ -71,7 +71,7 @@ } return itemstack; -@@ -91,7 +111,13 @@ +@@ -93,7 +113,13 @@ } } @@ -85,10 +85,10 @@ if (!(this.fluidType instanceof FluidTypeFlowing)) { return false; } else { -@@ -101,8 +127,18 @@ - boolean flag1 = material.isReplaceable(); +@@ -102,8 +128,18 @@ + boolean flag = iblockdata.a(this.fluidType); - if (!world.isEmpty(blockposition) && !flag && !flag1 && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) { + if (!iblockdata.isAir() && !flag && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) { - return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null); + return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit } else { diff --git a/nms-patches/ItemChorusFruit.patch b/nms-patches/ItemChorusFruit.patch index c8ea31302c..5991670c68 100644 --- a/nms-patches/ItemChorusFruit.patch +++ b/nms-patches/ItemChorusFruit.patch @@ -13,8 +13,8 @@ public ItemChorusFruit(Item.Info item_info) { @@ -20,6 +26,20 @@ - double d4 = MathHelper.a(entityliving.locY + (double) (entityliving.getRandom().nextInt(16) - 8), 0.0D, (double) (world.getHeight() - 1)); - double d5 = entityliving.locZ + (entityliving.getRandom().nextDouble() - 0.5D) * 16.0D; + double d4 = MathHelper.a(entityliving.locY() + (double) (entityliving.getRandom().nextInt(16) - 8), 0.0D, (double) (world.getHeight() - 1)); + double d5 = entityliving.locZ() + (entityliving.getRandom().nextDouble() - 0.5D) * 16.0D; + // CraftBukkit start + if (entityliving instanceof EntityPlayer) { diff --git a/nms-patches/ItemCrossbow.patch b/nms-patches/ItemCrossbow.patch index 5a495fc7c9..637d09953b 100644 --- a/nms-patches/ItemCrossbow.patch +++ b/nms-patches/ItemCrossbow.patch @@ -7,7 +7,7 @@ + // CraftBukkit start - obfuscator went a little crazy + /* this.a(new MinecraftKey("pull"), (itemstack, world, entityliving) -> { - return entityliving != null && itemstack.getItem() == this ? (d(itemstack) ? 0.0F : (float) (itemstack.k() - entityliving.dm()) / (float) e(itemstack)) : 0.0F; + return entityliving != null && itemstack.getItem() == this ? (d(itemstack) ? 0.0F : (float) (itemstack.k() - entityliving.dE()) / (float) e(itemstack)) : 0.0F; }); @@ -24,6 +26,8 @@ this.a(new MinecraftKey("firework"), (itemstack, world, entityliving) -> { @@ -56,6 +56,6 @@ + } + } + // CraftBukkit end - world.playSound((EntityHuman) null, entityliving.locX, entityliving.locY, entityliving.locZ, SoundEffects.ITEM_CROSSBOW_SHOOT, SoundCategory.PLAYERS, 1.0F, f); + world.playSound((EntityHuman) null, entityliving.locX(), entityliving.locY(), entityliving.locZ(), SoundEffects.ITEM_CROSSBOW_SHOOT, SoundCategory.PLAYERS, 1.0F, f); } } diff --git a/nms-patches/ItemEndCrystal.patch b/nms-patches/ItemEndCrystal.patch index 174120bb2e..c3318df4df 100644 --- a/nms-patches/ItemEndCrystal.patch +++ b/nms-patches/ItemEndCrystal.patch @@ -11,4 +11,4 @@ + // CraftBukkit end world.addEntity(entityendercrystal); if (world.worldProvider instanceof WorldProviderTheEnd) { - EnderDragonBattle enderdragonbattle = ((WorldProviderTheEnd) world.worldProvider).q(); + EnderDragonBattle enderdragonbattle = ((WorldProviderTheEnd) world.worldProvider).o(); diff --git a/nms-patches/ItemEnderPearl.patch b/nms-patches/ItemEnderPearl.patch index 09a5322140..530e419b64 100644 --- a/nms-patches/ItemEnderPearl.patch +++ b/nms-patches/ItemEnderPearl.patch @@ -1,14 +1,10 @@ --- a/net/minecraft/server/ItemEnderPearl.java +++ b/net/minecraft/server/ItemEnderPearl.java -@@ -10,20 +10,28 @@ +@@ -10,16 +10,24 @@ public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); -- if (!entityhuman.abilities.canInstantlyBuild) { -- itemstack.subtract(1); -- } -- -- world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F)); +- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F)); - entityhuman.getCooldownTracker().setCooldown(this, 20); + // CraftBukkit start - change order if (!world.isClientSide) { @@ -25,14 +21,10 @@ + } } -+ if (!entityhuman.abilities.canInstantlyBuild) { -+ itemstack.subtract(1); -+ } -+ -+ world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F)); -+ entityhuman.getCooldownTracker().a(this, 20); ++ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F)); ++ entityhuman.getCooldownTracker().setCooldown(this, 20); + // CraftBukkit end + entityhuman.b(StatisticList.ITEM_USED.b(this)); - return new InteractionResultWrapper<>(EnumInteractionResult.SUCCESS, itemstack); - } + if (!entityhuman.abilities.canInstantlyBuild) { + itemstack.subtract(1); diff --git a/nms-patches/ItemFireball.patch b/nms-patches/ItemFireball.patch index c2cd1e497d..2cafb967bd 100644 --- a/nms-patches/ItemFireball.patch +++ b/nms-patches/ItemFireball.patch @@ -1,31 +1,32 @@ --- a/net/minecraft/server/ItemFireball.java +++ b/net/minecraft/server/ItemFireball.java -@@ -18,12 +18,28 @@ +@@ -15,6 +15,14 @@ - if (iblockdata.getBlock() == Blocks.CAMPFIRE) { - if (!(Boolean) iblockdata.get(BlockCampfire.b) && !(Boolean) iblockdata.get(BlockCampfire.d)) { -+ // CraftBukkit start - fire BlockIgniteEvent -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getEntity()).isCancelled()) { -+ if (!itemactioncontext.getEntity().abilities.canInstantlyBuild) { -+ itemactioncontext.getItemStack().subtract(1); -+ } -+ return EnumInteractionResult.PASS; + if (iblockdata.getBlock() == Blocks.CAMPFIRE) { + if (!(Boolean) iblockdata.get(BlockCampfire.b) && !(Boolean) iblockdata.get(BlockCampfire.d)) { ++ // CraftBukkit start - fire BlockIgniteEvent ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getEntity()).isCancelled()) { ++ if (!itemactioncontext.getEntity().abilities.canInstantlyBuild) { ++ itemactioncontext.getItemStack().subtract(1); + } -+ // CraftBukkit end - this.a(world, blockposition); - world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockCampfire.b, true)); - } - } else { - blockposition = blockposition.shift(itemactioncontext.getClickedFace()); - if (world.getType(blockposition).isAir()) { -+ // CraftBukkit start - fire BlockIgniteEvent -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getEntity()).isCancelled()) { -+ if (!itemactioncontext.getEntity().abilities.canInstantlyBuild) { -+ itemactioncontext.getItemStack().subtract(1); -+ } -+ return EnumInteractionResult.PASS; ++ return EnumInteractionResult.PASS; ++ } ++ // CraftBukkit end + this.a(world, blockposition); + world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockCampfire.b, true)); + flag = true; +@@ -22,6 +30,14 @@ + } else { + blockposition = blockposition.shift(itemactioncontext.getClickedFace()); + if (world.getType(blockposition).isAir()) { ++ // CraftBukkit start - fire BlockIgniteEvent ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getEntity()).isCancelled()) { ++ if (!itemactioncontext.getEntity().abilities.canInstantlyBuild) { ++ itemactioncontext.getItemStack().subtract(1); + } -+ // CraftBukkit end - this.a(world, blockposition); - world.setTypeUpdate(blockposition, ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition)); - } ++ return EnumInteractionResult.PASS; ++ } ++ // CraftBukkit end + this.a(world, blockposition); + world.setTypeUpdate(blockposition, ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition)); + flag = true; diff --git a/nms-patches/ItemFishingRod.patch b/nms-patches/ItemFishingRod.patch index c4619b26af..d590159894 100644 --- a/nms-patches/ItemFishingRod.patch +++ b/nms-patches/ItemFishingRod.patch @@ -23,12 +23,12 @@ } @Override -@@ -36,12 +42,23 @@ - entityhuman.a(enumhand); - world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); +@@ -35,12 +41,23 @@ + + world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); } else { -- world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); -+ // world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); +- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); ++ // world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); if (!world.isClientSide) { i = EnchantmentManager.c(itemstack); int j = EnchantmentManager.b(itemstack); @@ -43,9 +43,9 @@ + entityhuman.hookedFish = null; + return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); + } -+ world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); ++ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); + world.addEntity(entityfishinghook); + // CraftBukkit end } - entityhuman.a(enumhand); + entityhuman.b(StatisticList.ITEM_USED.b(this)); diff --git a/nms-patches/ItemFlintAndSteel.patch b/nms-patches/ItemFlintAndSteel.patch index 04e7a467b1..98842569f2 100644 --- a/nms-patches/ItemFlintAndSteel.patch +++ b/nms-patches/ItemFlintAndSteel.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/server/ItemFlintAndSteel.java +++ b/net/minecraft/server/ItemFlintAndSteel.java -@@ -17,6 +17,14 @@ - IBlockData iblockdata; +@@ -29,6 +29,14 @@ + BlockPosition blockposition1 = blockposition.shift(itemactioncontext.getClickedFace()); + + if (a(world.getType(blockposition1), (GeneratorAccess) world, blockposition1)) { ++ // CraftBukkit start - Store the clicked block ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition1, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) { ++ itemactioncontext.getItemStack().damage(1, entityhuman, (entityhuman1) -> { ++ entityhuman1.d(itemactioncontext.n()); ++ }); ++ return EnumInteractionResult.PASS; ++ } ++ // CraftBukkit end + world.playSound(entityhuman, blockposition1, SoundEffects.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.i.nextFloat() * 0.4F + 0.8F); + IBlockData iblockdata1 = ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition1); - if (a(world.getType(blockposition1), (GeneratorAccess) world, blockposition1)) { -+ // CraftBukkit start - Store the clicked block -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition1, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) { -+ itemactioncontext.getItemStack().damage(1, entityhuman, (entityhuman1) -> { -+ entityhuman1.d(itemactioncontext.n()); -+ }); -+ return EnumInteractionResult.PASS; -+ } -+ // CraftBukkit end - world.playSound(entityhuman, blockposition1, SoundEffects.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.i.nextFloat() * 0.4F + 0.8F); - iblockdata = ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition1); - world.setTypeAndData(blockposition1, iblockdata, 11); diff --git a/nms-patches/ItemLeash.patch b/nms-patches/ItemLeash.patch index bd27c40df0..0f7293f521 100644 --- a/nms-patches/ItemLeash.patch +++ b/nms-patches/ItemLeash.patch @@ -20,7 +20,7 @@ + + if (event.isCancelled()) { + entityleash.die(); -+ return false; ++ return EnumInteractionResult.PASS; + } + // CraftBukkit end + } diff --git a/nms-patches/ItemPotion.patch b/nms-patches/ItemPotion.patch index 348ff484ce..8969268aca 100644 --- a/nms-patches/ItemPotion.patch +++ b/nms-patches/ItemPotion.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ItemPotion.java +++ b/net/minecraft/server/ItemPotion.java -@@ -31,7 +31,7 @@ +@@ -27,7 +27,7 @@ if (mobeffect.getMobEffect().isInstant()) { mobeffect.getMobEffect().applyInstantEffect(entityhuman, entityhuman, entityliving, mobeffect.getAmplifier(), 1.0D); } else { diff --git a/nms-patches/ItemSnowball.patch b/nms-patches/ItemSnowball.patch index 325f51598c..376f560082 100644 --- a/nms-patches/ItemSnowball.patch +++ b/nms-patches/ItemSnowball.patch @@ -1,17 +1,12 @@ --- a/net/minecraft/server/ItemSnowball.java +++ b/net/minecraft/server/ItemSnowball.java -@@ -10,18 +10,30 @@ +@@ -10,19 +10,31 @@ public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); -+ // CraftBukkit start - moved down -+ /* - if (!entityhuman.abilities.canInstantlyBuild) { - itemstack.subtract(1); - } - - world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F)); -+ */ +- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F)); ++ // CraftBukkit - moved down ++ // world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F)); if (!world.isClientSide) { EntitySnowball entitysnowball = new EntitySnowball(world, entityhuman); @@ -23,12 +18,19 @@ + itemstack.subtract(1); + } + -+ world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F)); -+ } else if (entityhuman instanceof EntityPlayer) { ++ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F)); } else if (entityhuman instanceof EntityPlayer) { + ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + } } + // CraftBukkit end entityhuman.b(StatisticList.ITEM_USED.b(this)); - return new InteractionResultWrapper<>(EnumInteractionResult.SUCCESS, itemstack); ++ // CraftBukkit start - moved up ++ /* + if (!entityhuman.abilities.canInstantlyBuild) { + itemstack.subtract(1); + } ++ */ + + return InteractionResultWrapper.a(itemstack); + } diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch index 7c4895b311..dd08a662b4 100644 --- a/nms-patches/ItemStack.patch +++ b/nms-patches/ItemStack.patch @@ -25,7 +25,7 @@ public final class ItemStack { private static final Logger LOGGER = LogManager.getLogger(); -@@ -50,23 +68,42 @@ +@@ -54,23 +72,42 @@ this.checkEmpty(); } @@ -71,7 +71,7 @@ this.checkEmpty(); } -@@ -96,7 +133,7 @@ +@@ -100,7 +137,7 @@ return this.h ? Items.AIR : this.item; } @@ -80,7 +80,7 @@ EntityHuman entityhuman = itemactioncontext.getEntity(); BlockPosition blockposition = itemactioncontext.getClickPosition(); ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false); -@@ -104,12 +141,153 @@ +@@ -108,12 +145,153 @@ if (entityhuman != null && !entityhuman.abilities.mayBuild && !this.b(itemactioncontext.getWorld().t(), shapedetectorblock)) { return EnumInteractionResult.PASS; } else { @@ -235,29 +235,7 @@ return enuminteractionresult; } -@@ -133,7 +311,7 @@ - nbttagcompound.setString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString()); - nbttagcompound.setByte("Count", (byte) this.count); - if (this.tag != null) { -- nbttagcompound.set("tag", this.tag); -+ nbttagcompound.set("tag", this.tag.clone()); // CraftBukkit - make defensive copy, data is going to another thread - } - - return nbttagcompound; -@@ -166,6 +344,12 @@ - } - - public void setDamage(int i) { -+ // CraftBukkit start - remove Damage tag if 0 -+ if (i <= 0) { -+ this.removeTag("Damage"); -+ return; -+ } -+ // CraftBukkit end - this.getOrCreateTag().setInt("Damage", Math.max(0, i)); - } - -@@ -190,6 +374,21 @@ +@@ -194,6 +372,21 @@ } i -= k; @@ -279,7 +257,7 @@ if (i <= 0) { return false; } -@@ -211,6 +410,11 @@ +@@ -215,6 +408,11 @@ if (this.isDamaged(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) { consumer.accept(t0); Item item = this.getItem(); @@ -291,7 +269,7 @@ this.subtract(1); if (t0 instanceof EntityHuman) { -@@ -338,6 +542,17 @@ +@@ -346,6 +544,17 @@ return this.tag; } @@ -309,7 +287,19 @@ public NBTTagCompound getOrCreateTag() { if (this.tag == null) { this.setTag(new NBTTagCompound()); -@@ -482,6 +697,12 @@ +@@ -386,6 +595,11 @@ + + public void setTag(@Nullable NBTTagCompound nbttagcompound) { + this.tag = nbttagcompound; ++ // CraftBukkit start - ensure null tags do not get inappropriately used (SpigotCraft#463) ++ if (this.tag == null && this.item != null && this.item.usesDurability()) { ++ this.setDamage(this.getDamage()); ++ } ++ // CraftBukkit end + } + + public IChatBaseComponent getName() { +@@ -494,6 +708,12 @@ } public void setRepairCost(int i) { @@ -322,7 +312,16 @@ this.getOrCreateTag().setInt("RepairCost", i); } -@@ -524,6 +745,13 @@ +@@ -516,7 +736,7 @@ + object = this.getItem().a(enumitemslot); + } + +- ((Multimap) object).values().forEach((attributemodifier1) -> { ++ ((Multimap) object).values().forEach((attributemodifier1) -> { // CraftBukkit - decompile error + attributemodifier1.a(false); + }); + return (Multimap) object; +@@ -539,6 +759,13 @@ nbttaglist.add(nbttagcompound); } diff --git a/nms-patches/ItemTrident.patch b/nms-patches/ItemTrident.patch index 0117734de4..e4e2b608e2 100644 --- a/nms-patches/ItemTrident.patch +++ b/nms-patches/ItemTrident.patch @@ -7,7 +7,7 @@ + // CraftBukkit start - obfuscator went a little crazy + /* this.a(new MinecraftKey("throwing"), (itemstack, world, entityliving) -> { - return entityliving != null && entityliving.isHandRaised() && entityliving.dl() == itemstack ? 1.0F : 0.0F; + return entityliving != null && entityliving.isHandRaised() && entityliving.dD() == itemstack ? 1.0F : 0.0F; }); + */ + // CraftBukkit end diff --git a/nms-patches/LootItemConditionRandomChanceWithLooting.patch b/nms-patches/LootItemConditionRandomChanceWithLooting.patch index 0809262ca9..b3c870a3e3 100644 --- a/nms-patches/LootItemConditionRandomChanceWithLooting.patch +++ b/nms-patches/LootItemConditionRandomChanceWithLooting.patch @@ -10,5 +10,5 @@ + } + // CraftBukkit end - return loottableinfo.b().nextFloat() < this.a + (float) i * this.b; + return loottableinfo.a().nextFloat() < this.a + (float) i * this.b; } diff --git a/nms-patches/LootItemConditionSurvivesExplosion.patch b/nms-patches/LootItemConditionSurvivesExplosion.patch index d485ef357f..4d3d219b78 100644 --- a/nms-patches/LootItemConditionSurvivesExplosion.patch +++ b/nms-patches/LootItemConditionSurvivesExplosion.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/LootItemConditionSurvivesExplosion.java +++ b/net/minecraft/server/LootItemConditionSurvivesExplosion.java @@ -25,7 +25,8 @@ - Random random = loottableinfo.b(); + Random random = loottableinfo.a(); float f = 1.0F / ofloat; - return random.nextFloat() <= f; diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch index 62e89f5021..3724ab19c3 100644 --- a/nms-patches/MinecraftServer.patch +++ b/nms-patches/MinecraftServer.patch @@ -32,9 +32,9 @@ thread.setUncaughtExceptionHandler((thread1, throwable) -> { MinecraftServer.LOGGER.error(throwable); }); -@@ -142,7 +149,21 @@ +@@ -145,7 +152,21 @@ @Nullable - private String av; + private String ax; - public MinecraftServer(File file, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory, String s) { + // CraftBukkit start @@ -55,9 +55,9 @@ super("Server"); this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread); this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new); -@@ -155,15 +176,15 @@ - this.ao = new CustomFunctionData(this); - this.ap = new CircularTimer(); +@@ -159,15 +180,15 @@ + this.customFunctionData = new CustomFunctionData(this); + this.circularTimer = new CircularTimer(); this.proxy = proxy; - this.commandDispatcher = commanddispatcher; + this.commandDispatcher = this.vanillaCommandDispatcher = commanddispatcher; // CraftBukkit @@ -73,10 +73,10 @@ - this.convertable = new Convertable(file.toPath(), file.toPath().resolve("../backups"), datafixer); + // this.convertable = new Convertable(file.toPath(), file.toPath().resolve("../backups"), datafixer); // CraftBukkit - moved to DedicatedServer.init this.dataConverterManager = datafixer; - this.ae.a((IReloadListener) this.aj); - this.ae.a((IReloadListener) this.ai); -@@ -172,7 +193,32 @@ - this.ae.a((IReloadListener) this.an); + this.ae.a((IReloadListener) this.tagRegistry); + this.ae.a((IReloadListener) this.lootPredicateManager); +@@ -177,7 +198,32 @@ + this.ae.a((IReloadListener) this.advancementDataWorld); this.executorService = SystemUtils.e(); this.K = s; + // CraftBukkit start @@ -108,7 +108,7 @@ private void initializeScoreboards(WorldPersistentData worldpersistentdata) { PersistentScoreboard persistentscoreboard = (PersistentScoreboard) worldpersistentdata.a(PersistentScoreboard::new, "scoreboard"); -@@ -208,11 +254,11 @@ +@@ -213,11 +259,11 @@ } if (this.forceUpgrade) { @@ -123,7 +123,7 @@ IChatBaseComponent ichatbasecomponent = null; while (!worldupgrader.b()) { -@@ -251,8 +297,9 @@ +@@ -256,8 +302,9 @@ } protected void a(String s, String s1, long i, WorldType worldtype, JsonElement jsonelement) { @@ -134,7 +134,7 @@ WorldNBTStorage worldnbtstorage = this.getConvertable().a(s, this); this.a(this.getWorld(), worldnbtstorage); -@@ -277,24 +324,135 @@ +@@ -282,27 +329,137 @@ } this.a(worldnbtstorage.getDirectory(), worlddata); @@ -158,7 +158,10 @@ + continue; + } + } -+ + +- protected void a(WorldNBTStorage worldnbtstorage, WorldData worlddata, WorldSettings worldsettings, WorldLoadListener worldloadlistener) { +- if (this.isDemoMode()) { +- worlddata.a(MinecraftServer.c); + if (j == 2) { + if (server.getAllowEnd()) { + dimension = 1; @@ -190,8 +193,10 @@ + } + world = new WorldServer(this, this.executorService, worldnbtstorage, worlddata, DimensionManager.OVERWORLD, this.methodProfiler, worldloadlistener, org.bukkit.World.Environment.getEnvironment(dimension), gen); + -+ this.initializeScoreboards(world.getWorldPersistentData()); ++ WorldPersistentData worldpersistentdata = world.getWorldPersistentData(); ++ this.initializeScoreboards(worldpersistentdata); + this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard()); ++ this.persistentCommandStorage = new PersistentCommandStorage(worldpersistentdata); + } else { + String dim = "DIM" + dimension; + @@ -228,10 +233,7 @@ + MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder failed ----"); + } + } - -- protected void a(WorldNBTStorage worldnbtstorage, WorldData worlddata, WorldSettings worldsettings, WorldLoadListener worldloadlistener) { -- if (this.isDemoMode()) { -- worlddata.a(MinecraftServer.c); ++ + WorldNBTStorage worldnbtstorage = new WorldNBTStorage(server.getWorldContainer(), name, this, this.dataConverterManager); + // world =, b0 to dimension, s1 to name, added Environment and gen + worlddata = worldnbtstorage.getWorldData(); @@ -250,7 +252,7 @@ + this.getPlayerList().setPlayerFileData(world); + + if (worlddata.getCustomBossEvents() != null) { -+ this.getBossBattleCustomData().a(worlddata.getCustomBossEvents()); ++ this.getBossBattleCustomData().load(worlddata.getCustomBossEvents()); + } + } + this.a(this.getDifficulty(), true); @@ -266,11 +268,13 @@ + // CraftBukkit end - this.worldServer.put(DimensionManager.OVERWORLD, worldserver); -- this.initializeScoreboards(worldserver.getWorldPersistentData()); +- WorldPersistentData worldpersistentdata = worldserver.getWorldPersistentData(); ++ } + +- this.initializeScoreboards(worldpersistentdata); +- this.persistentCommandStorage = new PersistentCommandStorage(worldpersistentdata); - worldserver.getWorldBorder().b(worlddata); - WorldServer worldserver1 = this.getWorldServer(DimensionManager.OVERWORLD); -+ } -+ + // CraftBukkit start + public void initWorld(WorldServer worldserver1, WorldData worlddata, WorldSettings worldsettings) { + worldserver1.getWorldBorder().b(worlddata); @@ -283,14 +287,14 @@ if (!worlddata.u()) { try { -@@ -318,23 +476,8 @@ +@@ -326,23 +483,8 @@ worlddata.d(true); } - - this.getPlayerList().setPlayerFileData(worldserver1); - if (worlddata.getCustomBossEvents() != null) { -- this.getBossBattleCustomData().a(worlddata.getCustomBossEvents()); +- this.getBossBattleCustomData().load(worlddata.getCustomBossEvents()); - } - - Iterator iterator = DimensionManager.a().iterator(); @@ -308,7 +312,7 @@ private void a(WorldData worlddata) { worlddata.f(false); -@@ -353,6 +496,23 @@ +@@ -361,6 +503,23 @@ protected void a(File file, WorldData worlddata) { this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla())); this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks")); @@ -322,7 +326,7 @@ + com.google.common.io.Files.write("{\n" + + " \"pack\": {\n" + + " \"description\": \"Data pack for resources provided by Bukkit plugins\",\n" -+ + " \"pack_format\": " + SharedConstants.a().getPackVersion() + "\n" ++ + " \"pack_format\": " + SharedConstants.getGameVersion().getPackVersion() + "\n" + + " }\n" + + "}\n", mcMeta, com.google.common.base.Charsets.UTF_8); + } catch (IOException ex) { @@ -332,8 +336,8 @@ this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder); this.resourcePackRepository.a(); List list = Lists.newArrayList(); -@@ -373,11 +533,18 @@ - this.b(worlddata); +@@ -382,11 +541,18 @@ + this.ba(); } - public void loadSpawn(WorldLoadListener worldloadlistener) { @@ -354,7 +358,7 @@ BlockPosition blockposition = worldserver.getSpawn(); worldloadlistener.a(new ChunkCoordIntPair(blockposition)); -@@ -388,17 +555,21 @@ +@@ -397,17 +563,21 @@ chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE); while (chunkproviderserver.b() != 441) { @@ -385,7 +389,7 @@ if (forcedchunk != null) { WorldServer worldserver1 = this.getWorldServer(dimensionmanager); -@@ -413,10 +584,16 @@ +@@ -422,10 +592,16 @@ } } @@ -404,7 +408,7 @@ } protected void a(String s, WorldNBTStorage worldnbtstorage) { -@@ -463,12 +640,16 @@ +@@ -472,12 +648,16 @@ } } @@ -413,15 +417,15 @@ WorldServer worldserver1 = this.getWorldServer(DimensionManager.OVERWORLD); WorldData worlddata = worldserver1.getWorldData(); - worldserver1.getWorldBorder().a(worlddata); - worlddata.c(this.getBossBattleCustomData().c()); - worldserver1.getDataManager().saveWorldData(worlddata, this.getPlayerList().r()); + worldserver1.getWorldBorder().save(worlddata); + worlddata.setCustomBossEvents(this.getBossBattleCustomData().save()); + worldserver1.getDataManager().saveWorldData(worlddata, this.getPlayerList().save()); + */ + // CraftBukkit end return flag3; } -@@ -477,8 +658,29 @@ +@@ -486,8 +666,29 @@ this.stop(); } @@ -451,7 +455,7 @@ if (this.getServerConnection() != null) { this.getServerConnection().b(); } -@@ -487,6 +689,7 @@ +@@ -496,6 +697,7 @@ MinecraftServer.LOGGER.info("Saving players"); this.playerList.savePlayers(); this.playerList.shutdown(); @@ -459,7 +463,7 @@ } MinecraftServer.LOGGER.info("Saving worlds"); -@@ -556,14 +759,16 @@ +@@ -565,14 +767,16 @@ while (this.isRunning) { long i = SystemUtils.getMonotonicMillis() - this.nextTick; @@ -477,7 +481,7 @@ this.nextTick += 50L; if (this.T) { this.T = false; -@@ -610,6 +815,12 @@ +@@ -619,6 +823,12 @@ } catch (Throwable throwable1) { MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); } finally { @@ -490,7 +494,7 @@ this.exit(); } -@@ -618,8 +829,15 @@ +@@ -627,8 +837,15 @@ } private boolean canSleepForTick() { @@ -507,7 +511,7 @@ protected void sleepForTick() { this.executeAll(); -@@ -720,7 +938,7 @@ +@@ -729,7 +946,7 @@ this.serverPing.b().a(agameprofile); } @@ -516,7 +520,7 @@ MinecraftServer.LOGGER.debug("Autosave started"); this.methodProfiler.enter("save"); this.playerList.savePlayers(); -@@ -750,23 +968,40 @@ +@@ -759,23 +976,40 @@ } protected void b(BooleanSupplier booleansupplier) { @@ -558,7 +562,7 @@ this.methodProfiler.enter("tick"); -@@ -805,7 +1040,8 @@ +@@ -818,7 +1052,8 @@ this.tickables.add(runnable); } @@ -568,7 +572,7 @@ OptionParser optionparser = new OptionParser(); OptionSpec optionspec = optionparser.accepts("nogui"); OptionSpec optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits"); -@@ -828,15 +1064,17 @@ +@@ -841,15 +1076,17 @@ optionparser.printHelpOn(System.err); return; } @@ -588,7 +592,7 @@ MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'"); return; } -@@ -848,14 +1086,15 @@ +@@ -861,14 +1098,15 @@ DispenserRegistry.init(); DispenserRegistry.c(); @@ -607,7 +611,7 @@ dedicatedserver.i((String) optionset.valueOf(optionspec7)); dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10)); dedicatedserver.e(optionset.has(optionspec2)); -@@ -878,6 +1117,29 @@ +@@ -891,6 +1129,29 @@ thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER)); Runtime.getRuntime().addShutdownHook(thread); @@ -637,7 +641,7 @@ } catch (Exception exception) { MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); } -@@ -897,7 +1159,9 @@ +@@ -910,7 +1171,9 @@ } public void startServerThread() { @@ -647,7 +651,7 @@ } public File d(String s) { -@@ -952,7 +1216,7 @@ +@@ -965,7 +1228,7 @@ } public String getServerModName() { @@ -656,18 +660,18 @@ } public CrashReport b(CrashReport crashreport) { -@@ -991,7 +1255,7 @@ +@@ -1004,7 +1267,7 @@ } - public boolean F() { + public boolean J() { - return this.universe != null; + return true; // CraftBukkit } @Override -@@ -1690,4 +1954,16 @@ - } - +@@ -1720,4 +1983,16 @@ + private void ba() { + Block.REGISTRY_ID.forEach(IBlockData::c); } + + // CraftBukkit start diff --git a/nms-patches/MobEffectList.patch b/nms-patches/MobEffectList.patch index a36ff31d9d..3645f6b32d 100644 --- a/nms-patches/MobEffectList.patch +++ b/nms-patches/MobEffectList.patch @@ -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.cC()) && (this != MobEffects.HARM || !entityliving.cC())) { - if (this == MobEffects.HARM && !entityliving.cC() || this == MobEffects.HEAL && entityliving.cC()) { + } else if ((this != MobEffects.HEAL || entityliving.cR()) && (this != MobEffects.HARM || !entityliving.cR())) { + if (this == MobEffects.HARM && !entityliving.cR() || this == MobEffects.HEAL && entityliving.cR()) { entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i)); } } else { diff --git a/nms-patches/MobSpawnerAbstract.patch b/nms-patches/MobSpawnerAbstract.patch index 2b2c2b5961..6703cfdee5 100644 --- a/nms-patches/MobSpawnerAbstract.patch +++ b/nms-patches/MobSpawnerAbstract.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MobSpawnerAbstract.java +++ b/net/minecraft/server/MobSpawnerAbstract.java -@@ -42,6 +42,7 @@ +@@ -43,6 +43,7 @@ public void setMobName(EntityTypes entitytypes) { this.spawnData.getEntity().setString("id", IRegistry.ENTITY_TYPE.getKey(entitytypes).toString()); @@ -8,7 +8,7 @@ } private boolean h() { -@@ -147,7 +148,7 @@ +@@ -148,7 +149,7 @@ } private void a(Entity entity) { diff --git a/nms-patches/MobSpawnerPatrol.patch b/nms-patches/MobSpawnerPatrol.patch index 7f6335daad..996a8ae579 100644 --- a/nms-patches/MobSpawnerPatrol.patch +++ b/nms-patches/MobSpawnerPatrol.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MobSpawnerPatrol.java +++ b/net/minecraft/server/MobSpawnerPatrol.java -@@ -96,7 +96,7 @@ +@@ -99,7 +99,7 @@ entitymonsterpatrolling.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); entitymonsterpatrolling.prepare(world, world.getDamageScaler(blockposition), EnumMobSpawn.PATROL, (GroupDataEntity) null, (NBTTagCompound) null); diff --git a/nms-patches/MobSpawnerPhantom.patch b/nms-patches/MobSpawnerPhantom.patch index fc91a324c3..194164ecef 100644 --- a/nms-patches/MobSpawnerPhantom.patch +++ b/nms-patches/MobSpawnerPhantom.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MobSpawnerPhantom.java +++ b/net/minecraft/server/MobSpawnerPhantom.java -@@ -54,7 +54,7 @@ +@@ -56,7 +56,7 @@ entityphantom.setPositionRotation(blockposition1, 0.0F, 0.0F); groupdataentity = entityphantom.prepare(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); diff --git a/nms-patches/MobSpawnerTrader.patch b/nms-patches/MobSpawnerTrader.patch index 1cd3336232..7f0c3ef5be 100644 --- a/nms-patches/MobSpawnerTrader.patch +++ b/nms-patches/MobSpawnerTrader.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MobSpawnerTrader.java +++ b/net/minecraft/server/MobSpawnerTrader.java -@@ -75,7 +75,7 @@ +@@ -76,7 +76,7 @@ return false; } @@ -9,7 +9,7 @@ if (entityvillagertrader != null) { for (int i = 0; i < 2; ++i) { -@@ -98,7 +98,7 @@ +@@ -99,7 +99,7 @@ BlockPosition blockposition = this.a(new BlockPosition(entityvillagertrader), i); if (blockposition != null) { diff --git a/nms-patches/PacketStatusListener.patch b/nms-patches/PacketStatusListener.patch index 1d9950d88b..1717fdefe9 100644 --- a/nms-patches/PacketStatusListener.patch +++ b/nms-patches/PacketStatusListener.patch @@ -106,7 +106,7 @@ + ping.setFavicon(event.icon.value); + ping.setMOTD(new ChatComponentText(event.getMotd())); + ping.setPlayerSample(playerSample); -+ int version = SharedConstants.a().getProtocolVersion(); ++ int version = SharedConstants.getGameVersion().getProtocolVersion(); + ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version)); + + this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping)); diff --git a/nms-patches/PathfinderGoalBreed.patch b/nms-patches/PathfinderGoalBreed.patch index 439bde2e32..87874dc763 100644 --- a/nms-patches/PathfinderGoalBreed.patch +++ b/nms-patches/PathfinderGoalBreed.patch @@ -28,15 +28,15 @@ @@ -99,10 +112,14 @@ this.partner.resetLove(); entityageable.setAgeRaw(-24000); - entityageable.setPositionRotation(this.animal.locX, this.animal.locY, this.animal.locZ, 0.0F, 0.0F); + entityageable.setPositionRotation(this.animal.locX(), this.animal.locY(), this.animal.locZ(), 0.0F, 0.0F); - this.b.addEntity(entityageable); + this.b.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason this.b.broadcastEntityEffect(this.animal, (byte) 18); if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { -- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, this.animal.getRandom().nextInt(7) + 1)); +- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), this.animal.getRandom().nextInt(7) + 1)); + // CraftBukkit start - use event experience + if (experience > 0) { -+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, experience)); ++ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience)); + } + // CraftBukkit end } diff --git a/nms-patches/PathfinderGoalDefendVillage.patch b/nms-patches/PathfinderGoalDefendVillage.patch index f12edb2999..e27bce567c 100644 --- a/nms-patches/PathfinderGoalDefendVillage.patch +++ b/nms-patches/PathfinderGoalDefendVillage.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/PathfinderGoalDefendVillage.java +++ b/net/minecraft/server/PathfinderGoalDefendVillage.java -@@ -43,7 +43,7 @@ +@@ -49,7 +49,7 @@ @Override public void c() { diff --git a/nms-patches/PathfinderGoalFollowOwner.patch b/nms-patches/PathfinderGoalFollowOwner.patch index 9b59024045..7de5e50013 100644 --- a/nms-patches/PathfinderGoalFollowOwner.patch +++ b/nms-patches/PathfinderGoalFollowOwner.patch @@ -12,23 +12,23 @@ public class PathfinderGoalFollowOwner extends PathfinderGoal { -@@ -80,7 +85,18 @@ - for (int l = 0; l <= 4; ++l) { - for (int i1 = 0; i1 <= 4; ++i1) { - if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.a(new BlockPosition(i + l, k - 1, j + i1))) { -- this.a.setPositionRotation((double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.a.yaw, this.a.pitch); -+ // CraftBukkit start -+ CraftEntity entity = this.a.getBukkitEntity(); -+ Location to = new Location(entity.getWorld(), (double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.a.yaw, this.a.pitch); -+ EntityTeleportEvent event = new EntityTeleportEvent(entity, entity.getLocation(), to); -+ this.a.world.getServer().getPluginManager().callEvent(event); -+ if (event.isCancelled()) { -+ return; -+ } -+ to = event.getTo(); +@@ -104,7 +109,18 @@ + } else if (!this.a(new BlockPosition(i, j, k))) { + return false; + } else { +- this.a.setPositionRotation((double) ((float) i + 0.5F), (double) j, (double) ((float) k + 0.5F), this.a.yaw, this.a.pitch); ++ // CraftBukkit start ++ CraftEntity entity = this.a.getBukkitEntity(); ++ Location to = new Location(entity.getWorld(), (double) ((float) i + 0.5F), (double) j, (double) ((float) k + 0.5F), this.a.yaw, this.a.pitch); ++ EntityTeleportEvent event = new EntityTeleportEvent(entity, entity.getLocation(), to); ++ this.a.world.getServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ return false; ++ } ++ to = event.getTo(); + -+ this.a.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch()); -+ // CraftBukkit end - this.e.o(); - return; - } ++ this.a.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch()); ++ // CraftBukkit end + this.e.o(); + return true; + } diff --git a/nms-patches/PathfinderGoalHorseTrap.patch b/nms-patches/PathfinderGoalHorseTrap.patch index 0a910162ac..628d80ac16 100644 --- a/nms-patches/PathfinderGoalHorseTrap.patch +++ b/nms-patches/PathfinderGoalHorseTrap.patch @@ -4,8 +4,8 @@ this.a.r(false); this.a.setTamed(true); this.a.setAgeRaw(0); -- ((WorldServer) this.a.world).strikeLightning(new EntityLightning(this.a.world, this.a.locX, this.a.locY, this.a.locZ, true)); -+ ((WorldServer) this.a.world).strikeLightning(new EntityLightning(this.a.world, this.a.locX, this.a.locY, this.a.locZ, true), org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit +- ((WorldServer) this.a.world).strikeLightning(new EntityLightning(this.a.world, this.a.locX(), this.a.locY(), this.a.locZ(), true)); ++ ((WorldServer) this.a.world).strikeLightning(new EntityLightning(this.a.world, this.a.locX(), this.a.locY(), this.a.locZ(), true), org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit EntitySkeleton entityskeleton = this.a(difficultydamagescaler, this.a); - entityskeleton.startRiding(this.a); @@ -18,7 +18,7 @@ - entityskeleton1.startRiding(entityhorseabstract); + if (entityskeleton1 != null) entityskeleton1.startRiding(entityhorseabstract); // CraftBukkit - entityhorseabstract.f(this.a.getRandom().nextGaussian() * 0.5D, 0.0D, this.a.getRandom().nextGaussian() * 0.5D); + entityhorseabstract.h(this.a.getRandom().nextGaussian() * 0.5D, 0.0D, this.a.getRandom().nextGaussian() * 0.5D); } @@ -44,7 +45,7 @@ diff --git a/nms-patches/PathfinderGoalHurtByTarget.patch b/nms-patches/PathfinderGoalHurtByTarget.patch index 65e82f3f6c..35f5060720 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.c = this.e.ct(); + this.c = this.e.cI(); this.h = 300; @@ -95,6 +95,6 @@ } diff --git a/nms-patches/PathfinderGoalPanic.patch b/nms-patches/PathfinderGoalPanic.patch index d74ec5644a..1df6e52fe1 100644 --- a/nms-patches/PathfinderGoalPanic.patch +++ b/nms-patches/PathfinderGoalPanic.patch @@ -10,6 +10,6 @@ + return false; + } + // CraftBukkit end - return !this.a.getNavigation().n(); + return !this.a.getNavigation().m(); } diff --git a/nms-patches/PathfinderGoalSit.patch b/nms-patches/PathfinderGoalSit.patch index e9a31a98fb..4105f1d26e 100644 --- a/nms-patches/PathfinderGoalSit.patch +++ b/nms-patches/PathfinderGoalSit.patch @@ -6,6 +6,6 @@ if (!this.entity.isTamed()) { - return false; + return this.willSit && this.entity.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals - } else if (this.entity.av()) { + } else if (this.entity.az()) { return false; } else if (!this.entity.onGround) { diff --git a/nms-patches/PersistentRaid.patch b/nms-patches/PersistentRaid.patch index 0de163c2a6..c7c258acab 100644 --- a/nms-patches/PersistentRaid.patch +++ b/nms-patches/PersistentRaid.patch @@ -1,28 +1,19 @@ --- a/net/minecraft/server/PersistentRaid.java +++ b/net/minecraft/server/PersistentRaid.java -@@ -9,7 +9,7 @@ - - public class PersistentRaid extends PersistentBase { - -- private final Map a = Maps.newHashMap(); -+ public final Map a = Maps.newHashMap(); // PAIL rename raids, private -> public - private final WorldServer b; - private int c; - private int d; @@ -92,19 +92,33 @@ boolean flag = false; - if (!raid.j()) { + if (!raid.isStarted()) { + /* CraftBukkit - moved down - if (!this.a.containsKey(raid.u())) { - this.a.put(raid.u(), raid); + if (!this.raids.containsKey(raid.getId())) { + this.raids.put(raid.getId(), raid); } + */ flag = true; -- } else if (raid.m() < raid.l()) { +- } else if (raid.getBadOmenLevel() < raid.getMaxBadOmenLevel()) { + // CraftBukkit start - fixed a bug with raid: players could add up Bad Omen level even when the raid had finished -+ } else if (raid.isInProgress() && raid.m() < raid.l()) { ++ } else if (raid.isInProgress() && raid.getBadOmenLevel() < raid.getMaxBadOmenLevel()) { flag = true; + // CraftBukkit end } else { @@ -37,8 +28,8 @@ + return null; + } + -+ if (!this.a.containsKey(raid.u())) { -+ this.a.put(raid.u(), raid); ++ if (!this.raids.containsKey(raid.getId())) { ++ this.raids.put(raid.getId(), raid); + } + // CraftBukkit end raid.a((EntityHuman) entityplayer); diff --git a/nms-patches/PlayerChunkMap.patch b/nms-patches/PlayerChunkMap.patch index 86ce550742..2cb57d0cc1 100644 --- a/nms-patches/PlayerChunkMap.patch +++ b/nms-patches/PlayerChunkMap.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/PlayerChunkMap.java +++ b/net/minecraft/server/PlayerChunkMap.java -@@ -42,6 +42,7 @@ +@@ -43,6 +43,7 @@ import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -8,8 +8,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { -@@ -72,6 +73,31 @@ - private final Queue A; +@@ -73,6 +74,31 @@ + private final Queue z; private int viewDistance; + // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() @@ -40,7 +40,7 @@ public PlayerChunkMap(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier supplier, int i) { super(new File(worldserver.getWorldProvider().getDimensionManager().a(file), "region"), datafixer); this.visibleChunks = this.updatingChunks.clone(); -@@ -191,9 +217,12 @@ +@@ -192,9 +218,12 @@ return completablefuture1.thenApply((list1) -> { List list2 = Lists.newArrayList(); @@ -55,8 +55,8 @@ final Either either = (Either) iterator.next(); Optional optional = either.left(); -@@ -291,7 +320,7 @@ - PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.x.getName()); +@@ -293,7 +322,7 @@ + PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName()); } else { this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> { - IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow((Object) null); @@ -64,7 +64,7 @@ if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) { this.saveChunk(ichunkaccess); -@@ -302,7 +331,6 @@ +@@ -304,7 +333,6 @@ } } @@ -72,7 +72,7 @@ protected void unloadChunks(BooleanSupplier booleansupplier) { GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler(); -@@ -341,7 +369,7 @@ +@@ -343,7 +371,7 @@ private void a(long i, PlayerChunk playerchunk) { CompletableFuture completablefuture = playerchunk.getChunkSave(); @@ -81,7 +81,7 @@ CompletableFuture completablefuture1 = playerchunk.getChunkSave(); if (completablefuture1 != completablefuture) { -@@ -490,7 +518,7 @@ +@@ -492,7 +520,7 @@ return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); }, (runnable) -> { @@ -90,7 +90,7 @@ }); } -@@ -548,8 +576,15 @@ +@@ -550,8 +578,15 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -107,7 +107,7 @@ if (list == null) { list = Lists.newArrayList(new Entity[]{entity}); } else { -@@ -571,7 +606,7 @@ +@@ -573,7 +608,7 @@ long i = playerchunk.i().pair(); playerchunk.getClass(); @@ -116,7 +116,7 @@ }); } -@@ -588,7 +623,7 @@ +@@ -590,7 +625,7 @@ return Either.left(chunk); }); }, (runnable) -> { @@ -125,7 +125,7 @@ }); completablefuture1.thenAcceptAsync((either) -> { -@@ -602,7 +637,7 @@ +@@ -604,7 +639,7 @@ return Either.left(chunk); }); }, (runnable) -> { @@ -134,7 +134,7 @@ }); return completablefuture1; } -@@ -616,7 +651,7 @@ +@@ -618,7 +653,7 @@ return chunk; }); }, (runnable) -> { @@ -143,7 +143,7 @@ }); } -@@ -740,7 +775,8 @@ +@@ -742,7 +777,8 @@ return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty(); }); @@ -153,7 +153,7 @@ return Stream.of(chunk.getEntitySlices()).mapToInt(EntitySlice::size).sum(); }).orElse(0), optional1.map((chunk) -> { return chunk.getTileEntities().size(); -@@ -751,7 +787,7 @@ +@@ -753,7 +789,7 @@ private static String a(CompletableFuture> completablefuture) { try { @@ -162,16 +162,16 @@ return either != null ? (String) either.map((chunk) -> { return "done"; -@@ -769,7 +805,7 @@ +@@ -771,7 +807,7 @@ private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); -- return nbttagcompound == null ? null : this.getChunkData(this.world.getWorldProvider().getDimensionManager(), this.m, nbttagcompound); -+ return nbttagcompound == null ? null : this.getChunkData(this.world.getWorldProvider().getDimensionManager(), this.m, nbttagcompound, chunkcoordintpair, world); // CraftBukkit +- return nbttagcompound == null ? null : this.getChunkData(this.world.getWorldProvider().getDimensionManager(), this.l, nbttagcompound); ++ return nbttagcompound == null ? null : this.getChunkData(this.world.getWorldProvider().getDimensionManager(), this.l, nbttagcompound, chunkcoordintpair, world); // CraftBukkit } boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { -@@ -1101,7 +1137,7 @@ +@@ -1105,7 +1141,7 @@ public final Set trackedPlayers = Sets.newHashSet(); public EntityTracker(Entity entity, int i, int j, boolean flag) { @@ -180,16 +180,16 @@ this.tracker = entity; this.trackingDistance = i; this.e = SectionPosition.a(entity); -@@ -1154,7 +1190,7 @@ +@@ -1158,7 +1194,7 @@ public void updatePlayer(EntityPlayer entityplayer) { if (entityplayer != this.tracker) { -- Vec3D vec3d = (new Vec3D(entityplayer.locX, entityplayer.locY, entityplayer.locZ)).d(this.trackerEntry.b()); -+ Vec3D vec3d = (new Vec3D(entityplayer.locX, entityplayer.locY, entityplayer.locZ)).d(this.tracker.getPositionVector()); // MC-155077, SPIGOT-5113 - int i = Math.min(this.trackingDistance, (PlayerChunkMap.this.viewDistance - 1) * 16); +- Vec3D vec3d = entityplayer.getPositionVector().d(this.trackerEntry.b()); ++ Vec3D vec3d = entityplayer.getPositionVector().d(this.tracker.getPositionVector()); // MC-155077, SPIGOT-5113 + int i = Math.min(this.b(), (PlayerChunkMap.this.viewDistance - 1) * 16); boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.tracker.a(entityplayer); -@@ -1170,6 +1206,17 @@ +@@ -1174,6 +1210,17 @@ } } diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 02f2ca2bb9..2748a08685 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -95,7 +95,7 @@ public void tick() { this.syncPosition(); -@@ -106,7 +177,7 @@ +@@ -109,7 +180,7 @@ this.minecraftServer.getMethodProfiler().enter("keepAlive"); long i = SystemUtils.getMonotonicMillis(); @@ -104,7 +104,7 @@ if (this.awaitingKeepAlive) { this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); } else { -@@ -118,15 +189,21 @@ +@@ -121,15 +192,21 @@ } this.minecraftServer.getMethodProfiler().exit(); @@ -126,8 +126,8 @@ this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0])); } -@@ -150,16 +227,46 @@ - return this.minecraftServer.b(this.player.getProfile()); +@@ -153,16 +230,46 @@ + return this.minecraftServer.a(this.player.getProfile()); } + // CraftBukkit start @@ -174,7 +174,7 @@ } @Override -@@ -200,7 +307,34 @@ +@@ -203,7 +310,34 @@ double d9 = entity.getMot().g(); double d10 = d6 * d6 + d7 * d7 + d8 * d8; @@ -210,7 +210,7 @@ PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8); this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); return; -@@ -230,14 +364,72 @@ +@@ -233,14 +367,72 @@ } entity.setLocation(d3, d4, d5, f, f1); @@ -281,9 +281,9 @@ + // CraftBukkit end + this.player.getWorldServer().getChunkProvider().movePlayer(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.a(entity.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -252,7 +444,7 @@ + this.player.checkMovement(this.player.locX() - d0, this.player.locY() - d1, this.player.locZ() - d2); + this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && !worldserver.b(entity.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); +@@ -255,7 +447,7 @@ @Override public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) { PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer()); @@ -292,7 +292,7 @@ this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); this.o = this.teleportPos.x; this.p = this.teleportPos.y; -@@ -262,6 +454,7 @@ +@@ -265,6 +457,7 @@ } this.teleportPos = null; @@ -300,7 +300,7 @@ } } -@@ -270,7 +463,7 @@ +@@ -273,7 +466,7 @@ public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) { PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.getWorldServer()); if (packetplayinrecipedisplayed.b() == PacketPlayInRecipeDisplayed.Status.SHOWN) { @@ -309,7 +309,7 @@ RecipeBookServer recipebookserver = this.player.B(); optional.ifPresent(recipebookserver::e); -@@ -304,6 +497,12 @@ +@@ -307,6 +500,12 @@ @Override public void a(PacketPlayInTabComplete packetplayintabcomplete) { PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); @@ -322,7 +322,7 @@ StringReader stringreader = new StringReader(packetplayintabcomplete.c()); if (stringreader.canRead() && stringreader.peek() == '/') { -@@ -313,7 +512,8 @@ +@@ -316,7 +515,8 @@ ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { @@ -332,7 +332,7 @@ }); } -@@ -518,6 +718,7 @@ +@@ -526,6 +726,7 @@ if (container instanceof ContainerMerchant) { ContainerMerchant containermerchant = (ContainerMerchant) container; @@ -340,12 +340,11 @@ containermerchant.d(i); containermerchant.g(i); -@@ -527,6 +728,15 @@ - +@@ -536,6 +737,14 @@ @Override public void a(PacketPlayInBEdit packetplayinbedit) { + PlayerConnectionUtils.ensureMainThread(packetplayinbedit, this, this.player.getWorldServer()); + // CraftBukkit start -+ PlayerConnectionUtils.ensureMainThread(packetplayinbedit, this, this.player.getWorldServer()); + if (this.lastBookTick + 20 > MinecraftServer.currentTick) { + this.disconnect("Book edited too quickly!"); + return; @@ -356,7 +355,7 @@ ItemStack itemstack = packetplayinbedit.b(); if (!itemstack.isEmpty()) { -@@ -555,9 +765,11 @@ +@@ -564,9 +773,11 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -369,7 +368,7 @@ } } -@@ -599,7 +811,7 @@ +@@ -608,7 +819,7 @@ } else { WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); @@ -378,7 +377,7 @@ if (this.e == 0) { this.syncPosition(); } -@@ -609,13 +821,21 @@ +@@ -618,13 +829,21 @@ this.A = this.e; this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); } @@ -387,21 +386,21 @@ } else { this.A = this.e; if (this.player.isPassenger()) { - this.player.setLocation(this.player.locX, this.player.locY, this.player.locZ, packetplayinflying.a(this.player.yaw), packetplayinflying.b(this.player.pitch)); + this.player.setLocation(this.player.locX(), this.player.locY(), this.player.locZ(), packetplayinflying.a(this.player.yaw), packetplayinflying.b(this.player.pitch)); this.player.getWorldServer().getChunkProvider().movePlayer(this.player); + this.allowedPlayerTicks = 20; // CraftBukkit } else { + // CraftBukkit - Make sure the move is valid but then reset it for plugins to modify -+ double prevX = player.locX; -+ double prevY = player.locY; -+ double prevZ = player.locZ; ++ double prevX = player.locX(); ++ double prevY = player.locY(); ++ double prevZ = player.locZ(); + float prevYaw = player.yaw; + float prevPitch = player.pitch; + // CraftBukkit end - double d0 = this.player.locX; - double d1 = this.player.locY; - double d2 = this.player.locZ; -@@ -640,15 +860,33 @@ + double d0 = this.player.locX(); + double d1 = this.player.locY(); + double d2 = this.player.locZ(); +@@ -649,15 +868,33 @@ ++this.receivedMovePackets; int i = this.receivedMovePackets - this.processedMovePackets; @@ -435,9 +434,9 @@ + if (d11 - d10 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isExemptPlayer()) { + // CraftBukkit end PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9); - this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); + this.a(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch); return; -@@ -694,6 +932,69 @@ +@@ -707,6 +944,69 @@ } } @@ -504,10 +503,10 @@ + this.player.setLocation(d4, d5, d6, f, f1); // Copied from above + // CraftBukkit end + - this.B = d12 >= -0.03125D && this.player.playerInteractManager.getGameMode() != EnumGamemode.SPECTATOR && !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isGliding() && !worldserver.a(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); + this.B = d12 >= -0.03125D && this.player.playerInteractManager.getGameMode() != EnumGamemode.SPECTATOR && !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isGliding() && !worldserver.b(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); this.player.onGround = packetplayinflying.b(); this.player.getWorldServer().getChunkProvider().movePlayer(this.player); -@@ -713,10 +1014,66 @@ +@@ -726,10 +1026,66 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -572,10 +571,10 @@ + + this.justTeleported = true; + // CraftBukkit end - double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX : 0.0D; - double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY : 0.0D; - double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ : 0.0D; -@@ -728,6 +1085,14 @@ + double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX() : 0.0D; + double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY() : 0.0D; + double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ() : 0.0D; +@@ -741,6 +1097,14 @@ this.teleportAwait = 0; } @@ -590,7 +589,7 @@ this.A = this.e; this.player.setLocation(d0, d1, d2, f, f1); this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); -@@ -736,6 +1101,7 @@ +@@ -749,6 +1113,7 @@ @Override public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer()); @@ -598,7 +597,7 @@ BlockPosition blockposition = packetplayinblockdig.b(); this.player.resetIdleTimer(); -@@ -746,13 +1112,45 @@ +@@ -759,13 +1124,45 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); @@ -646,7 +645,7 @@ this.player.n(false); } -@@ -779,6 +1177,7 @@ +@@ -792,6 +1189,7 @@ @Override public void a(PacketPlayInUseItem packetplayinuseitem) { PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.getWorldServer()); @@ -654,10 +653,10 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinuseitem.b(); ItemStack itemstack = this.player.b(enumhand); -@@ -792,6 +1191,14 @@ +@@ -805,6 +1203,14 @@ this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, ChatMessageType.GAME_INFO)); - } 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 && worldserver.a((EntityHuman) this.player, blockposition)) { + } else if (this.teleportPos == null && this.player.g((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) { + // CraftBukkit start - Check if we can actually do something over this large a distance + Location eyeLoc = this.getPlayer().getEyeLocation(); + double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ()); @@ -666,10 +665,10 @@ + } + this.player.clearActiveItem(); // SPIGOT-4706 + // CraftBukkit end - this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); - } + EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); -@@ -802,13 +1209,53 @@ + if (enuminteractionresult.b()) { +@@ -819,13 +1225,53 @@ @Override public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer()); @@ -685,9 +684,9 @@ + // Raytrace to look for 'rogue armswings' + float f1 = this.player.pitch; + float f2 = this.player.yaw; -+ double d0 = this.player.locX; -+ double d1 = this.player.locY + (double) this.player.getHeadHeight(); -+ double d2 = this.player.locZ; ++ double d0 = this.player.locX(); ++ double d1 = this.player.locY() + (double) this.player.getHeadHeight(); ++ double d2 = this.player.locZ(); + Vec3D vec3d = new Vec3D(d0, d1, d2); + + float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F); @@ -724,16 +723,16 @@ } } -@@ -823,7 +1270,7 @@ +@@ -840,7 +1286,7 @@ Entity entity = packetplayinspectate.a(worldserver); if (entity != null) { -- this.player.a(worldserver, entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch); -+ this.player.a(worldserver, entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE); // CraftBukkit +- this.player.a(worldserver, entity.locX(), entity.locY(), entity.locZ(), entity.yaw, entity.pitch); ++ this.player.a(worldserver, entity.locX(), entity.locY(), entity.locZ(), entity.yaw, entity.pitch, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE); // CraftBukkit return; } } -@@ -832,7 +1279,12 @@ +@@ -849,7 +1295,12 @@ } @Override @@ -747,7 +746,7 @@ @Override public void a(PacketPlayInBoatMove packetplayinboatmove) { -@@ -847,11 +1299,26 @@ +@@ -864,11 +1315,26 @@ @Override public void a(IChatBaseComponent ichatbasecomponent) { @@ -775,7 +774,7 @@ if (this.isExemptPlayer()) { PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); this.minecraftServer.safeShutdown(false); -@@ -877,6 +1344,15 @@ +@@ -894,6 +1360,15 @@ } } @@ -791,7 +790,7 @@ try { this.networkManager.sendPacket(packet, genericfuturelistener); } catch (Throwable throwable) { -@@ -893,18 +1369,38 @@ +@@ -910,18 +1385,38 @@ @Override public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer()); @@ -832,7 +831,7 @@ this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend", new Object[0])).a(EnumChatFormat.RED))); } else { this.player.resetIdleTimer(); -@@ -914,41 +1410,257 @@ +@@ -931,41 +1426,257 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -1040,9 +1039,9 @@ + // CraftBukkit start - Raytrace to look for 'rogue armswings' + float f1 = this.player.pitch; + float f2 = this.player.yaw; -+ double d0 = this.player.locX; -+ double d1 = this.player.locY + (double) this.player.getHeadHeight(); -+ double d2 = this.player.locZ; ++ double d0 = this.player.locX(); ++ double d1 = this.player.locY() + (double) this.player.getHeadHeight(); ++ double d2 = this.player.locZ(); + Vec3D vec3d = new Vec3D(d0, d1, d2); + + float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F); @@ -1074,9 +1073,9 @@ + // CraftBukkit start + if (this.player.dead) return; + switch (packetplayinentityaction.c()) { -+ case START_SNEAKING: -+ case STOP_SNEAKING: -+ PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packetplayinentityaction.c() == PacketPlayInEntityAction.EnumPlayerAction.START_SNEAKING); ++ case PRESS_SHIFT_KEY: ++ case RELEASE_SHIFT_KEY: ++ PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packetplayinentityaction.c() == PacketPlayInEntityAction.EnumPlayerAction.PRESS_SHIFT_KEY); + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { @@ -1097,7 +1096,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -1012,6 +1724,7 @@ +@@ -1023,6 +1734,7 @@ @Override public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer()); @@ -1105,7 +1104,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -1027,20 +1740,74 @@ +@@ -1038,9 +1750,52 @@ if (this.player.h(entity) < d0) { EnumHand enumhand; @@ -1157,7 +1156,11 @@ + // CraftBukkit end } else if (packetplayinuseentity.b() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT_AT) { enumhand = packetplayinuseentity.c(); - entity.a((EntityHuman) this.player, packetplayinuseentity.d(), enumhand); + EnumInteractionResult enuminteractionresult = entity.a((EntityHuman) this.player, packetplayinuseentity.d(), enumhand); +@@ -1048,14 +1803,25 @@ + if (enuminteractionresult.b()) { + this.player.a(enumhand, true); + } + // CraftBukkit start + if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) { + this.player.updateInventory(this.player.activeContainer); @@ -1181,7 +1184,7 @@ } } } -@@ -1080,15 +1847,21 @@ +@@ -1095,15 +1861,21 @@ @Override public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer()); @@ -1205,7 +1208,7 @@ NonNullList nonnulllist = NonNullList.a(); for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) { -@@ -1097,8 +1870,274 @@ +@@ -1112,8 +1884,274 @@ this.player.a(this.player.activeContainer, nonnulllist); } else { @@ -1481,7 +1484,7 @@ if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true)); this.player.e = true; -@@ -1138,6 +2177,7 @@ +@@ -1153,6 +2191,7 @@ @Override public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer()); @@ -1489,7 +1492,7 @@ this.player.resetIdleTimer(); if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { this.player.activeContainer.a((EntityHuman) this.player, packetplayinenchantitem.c()); -@@ -1170,6 +2210,43 @@ +@@ -1185,6 +2224,43 @@ boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45; boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty(); @@ -1533,7 +1536,7 @@ if (flag1 && flag2) { if (itemstack.isEmpty()) { -@@ -1195,6 +2272,7 @@ +@@ -1206,6 +2282,7 @@ @Override public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer()); @@ -1541,7 +1544,7 @@ int i = this.player.activeContainer.windowId; if (i == packetplayintransaction.b() && this.k.getOrDefault(i, (short) (packetplayintransaction.c() + 1)) == packetplayintransaction.c() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { -@@ -1206,6 +2284,7 @@ +@@ -1217,6 +2294,7 @@ @Override public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer()); @@ -1549,7 +1552,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.b(); -@@ -1222,14 +2301,30 @@ +@@ -1233,14 +2311,30 @@ if (!tileentitysign.d() || tileentitysign.f() != this.player) { this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign"); @@ -1581,7 +1584,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -1239,6 +2334,7 @@ +@@ -1250,6 +2344,7 @@ @Override public void a(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -1589,7 +1592,7 @@ if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) { int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive); -@@ -1253,7 +2349,17 @@ +@@ -1264,7 +2359,17 @@ @Override public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer()); @@ -1608,7 +1611,7 @@ } @Override -@@ -1262,8 +2368,50 @@ +@@ -1273,8 +2378,50 @@ this.player.a(packetplayinsettings); } diff --git a/nms-patches/PlayerInteractManager.patch b/nms-patches/PlayerInteractManager.patch index 7f1ce0bbd7..6b2c5801f9 100644 --- a/nms-patches/PlayerInteractManager.patch +++ b/nms-patches/PlayerInteractManager.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/PlayerInteractManager.java +++ b/net/minecraft/server/PlayerInteractManager.java -@@ -2,6 +2,15 @@ - +@@ -3,6 +3,15 @@ + import java.util.Objects; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +// CraftBukkit start @@ -16,7 +16,7 @@ public class PlayerInteractManager { -@@ -30,7 +39,7 @@ +@@ -31,7 +40,7 @@ this.gamemode = enumgamemode; enumgamemode.a(this.player.abilities); this.player.updateAbilities(); @@ -25,7 +25,7 @@ this.world.everyoneSleeping(); } -@@ -55,7 +64,7 @@ +@@ -56,7 +65,7 @@ } public void a() { @@ -34,13 +34,13 @@ IBlockData iblockdata; if (this.i) { -@@ -111,9 +120,31 @@ +@@ -112,9 +121,31 @@ if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) { if (!this.world.a((EntityHuman) this.player, blockposition)) { + // CraftBukkit start - fire PlayerInteractEvent + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND); - this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false)); + this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, "may not interact")); + // Update any tile entity data for this block + TileEntity tileentity = world.getTileEntity(blockposition); + if (tileentity != null) { @@ -66,7 +66,7 @@ if (this.isCreative()) { if (!this.world.douseFire((EntityHuman) null, blockposition, enumdirection)) { -@@ -130,15 +161,49 @@ +@@ -131,16 +162,50 @@ return; } @@ -94,8 +94,8 @@ f = iblockdata.getDamage(this.player, this.player.world, blockposition); + // Allow fire punching to be blocked + this.world.douseFire((EntityHuman) null, blockposition, enumdirection); -+ } -+ + } + + if (event.useItemInHand() == Event.Result.DENY) { + // If we 'insta destroyed' then the client needs to be informed. + if (f > 1.0f) { @@ -113,16 +113,17 @@ + + if (blockEvent.getInstaBreak()) { + f = 2.0f; - } ++ } + // CraftBukkit end - ++ if (!iblockdata.isAir() && f >= 1.0F) { - this.a(blockposition, packetplayinblockdig_enumplayerdigtype); -@@ -189,17 +254,73 @@ + this.a(blockposition, packetplayinblockdig_enumplayerdigtype, "insta mine"); + } else { +@@ -200,17 +265,73 @@ if (this.breakBlock(blockposition)) { - this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true)); + this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, s)); } else { -- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false)); +- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, s)); + this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); // CraftBukkit - SPIGOT-5196 } @@ -194,7 +195,7 @@ TileEntity tileentity = this.world.getTileEntity(blockposition); Block block = iblockdata.getBlock(); -@@ -209,6 +330,10 @@ +@@ -220,6 +341,10 @@ } else if (this.player.a((World) this.world, blockposition, this.gamemode)) { return false; } else { @@ -205,7 +206,7 @@ block.a((World) this.world, blockposition, iblockdata, (EntityHuman) this.player); boolean flag = this.world.a(blockposition, false); -@@ -217,20 +342,33 @@ +@@ -228,19 +353,32 @@ } if (this.isCreative()) { @@ -213,13 +214,12 @@ + // return true; // CraftBukkit } else { ItemStack itemstack = this.player.getItemInMainHand(); + ItemStack itemstack1 = itemstack.cloneItemStack(); boolean flag1 = this.player.hasBlock(iblockdata); itemstack.a(this.world, iblockdata, blockposition, this.player); - if (flag && flag1) { + if (flag && flag1 && event.isDropItems()) { // CraftBukkit - Check if block should drop items - ItemStack itemstack1 = itemstack.isEmpty() ? ItemStack.a : itemstack.cloneItemStack(); - block.a(this.world, this.player, blockposition, iblockdata, tileentity, itemstack1); } @@ -242,7 +242,7 @@ } } } -@@ -272,12 +410,40 @@ +@@ -282,12 +420,40 @@ } } @@ -283,27 +283,30 @@ if (itileinventory != null) { entityhuman.openContainer(itileinventory); -@@ -289,24 +455,26 @@ - boolean flag = !entityhuman.getItemInMainHand().isEmpty() || !entityhuman.getItemInOffHand().isEmpty(); - boolean flag1 = entityhuman.isSneaking() && flag; +@@ -300,29 +466,29 @@ + boolean flag1 = entityhuman.dT() && flag; -- if (!flag1 && iblockdata.interact(world, entityhuman, enumhand, movingobjectpositionblock)) { -- return EnumInteractionResult.SUCCESS; -- } else if (!itemstack.isEmpty() && !entityhuman.getCooldownTracker().hasCooldown(itemstack.getItem())) { -+ if (!flag1) { -+ enuminteractionresult = iblockdata.interact(world, entityhuman, enumhand, movingobjectpositionblock) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.FAIL; -+ } -+ + if (!flag1) { +- EnumInteractionResult enuminteractionresult = iblockdata.interact(world, entityhuman, enumhand, movingobjectpositionblock); ++ enuminteractionresult = iblockdata.interact(world, entityhuman, enumhand, movingobjectpositionblock); + + if (enuminteractionresult.a()) { + return enuminteractionresult; + } + } + +- if (!itemstack.isEmpty() && !entityhuman.getCooldownTracker().hasCooldown(itemstack.getItem())) { + if (!itemstack.isEmpty() && enuminteractionresult != EnumInteractionResult.SUCCESS && !interactResult) { // add !interactResult SPIGOT-764 ItemActionContext itemactioncontext = new ItemActionContext(entityhuman, enumhand, movingobjectpositionblock); if (this.isCreative()) { int i = itemstack.getCount(); -- EnumInteractionResult enuminteractionresult = itemstack.placeItem(itemactioncontext); +- EnumInteractionResult enuminteractionresult1 = itemstack.placeItem(itemactioncontext); + enuminteractionresult = itemstack.placeItem(itemactioncontext, enumhand); itemstack.setCount(i); - return enuminteractionresult; +- return enuminteractionresult1; ++ return enuminteractionresult; } else { - return itemstack.placeItem(itemactioncontext); + return itemstack.placeItem(itemactioncontext, enumhand); diff --git a/nms-patches/PlayerInventory.patch b/nms-patches/PlayerInventory.patch index 43da74f470..3b85ccef86 100644 --- a/nms-patches/PlayerInventory.patch +++ b/nms-patches/PlayerInventory.patch @@ -80,13 +80,13 @@ + ItemStack itemstack1 = this.getItem(i); + if (itemstack1.isEmpty()) return itemstack.getCount(); + -+ if (this.a(itemstack1, itemstack)) { // PAIL rename isSimilarAndNotFull ++ if (this.isSimilarAndNotFull(itemstack1, itemstack)) { + remains -= (itemstack1.getMaxStackSize() < this.getMaxStackSize() ? itemstack1.getMaxStackSize() : this.getMaxStackSize()) - itemstack1.getCount(); + } + if (remains <= 0) return itemstack.getCount(); + } + ItemStack offhandItemStack = this.getItem(this.items.size() + this.armor.size()); -+ if (this.a(offhandItemStack, itemstack)) { ++ if (this.isSimilarAndNotFull(offhandItemStack, itemstack)) { + remains -= (offhandItemStack.getMaxStackSize() < this.getMaxStackSize() ? offhandItemStack.getMaxStackSize() : this.getMaxStackSize()) - offhandItemStack.getCount(); + } + if (remains <= 0) return itemstack.getCount(); diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index f65d303a10..82134c8d50 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -27,7 +27,7 @@ + public abstract class PlayerList { - public static final File a = new File("banned-players.json"); + public static final File b = new File("banned-players.json"); @@ -28,14 +49,16 @@ private static final Logger LOGGER = LogManager.getLogger(); private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); @@ -61,10 +61,10 @@ + minecraftserver.reader.addCompleter(new org.bukkit.craftbukkit.command.ConsoleCommandCompleter(minecraftserver.server)); + // CraftBukkit end + - this.k = new GameProfileBanList(PlayerList.a); - this.l = new IpBanList(PlayerList.b); - this.operators = new OpList(PlayerList.c); - this.whitelist = new WhiteList(PlayerList.d); + this.k = new GameProfileBanList(PlayerList.b); + this.l = new IpBanList(PlayerList.c); + this.operators = new OpList(PlayerList.d); + this.whitelist = new WhiteList(PlayerList.e); - this.o = Maps.newHashMap(); - this.p = Maps.newHashMap(); + // CraftBukkit start @@ -87,26 +87,28 @@ entityplayer.spawnIn(worldserver); entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); -@@ -75,13 +114,16 @@ +@@ -75,7 +114,8 @@ s1 = networkmanager.getSocketAddress().toString(); } -- PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); +- PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ()); + // CraftBukkit - Moved message to after join -+ // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); ++ // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ()); WorldData worlddata = worldserver.getWorldData(); this.a(entityplayer, (EntityPlayer) null, worldserver); - PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, entityplayer); +@@ -84,7 +124,9 @@ + boolean flag = gamerules.getBoolean(GameRules.DO_IMMEDIATE_RESPAWN); + boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO); -- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager(), this.getMaxPlayers(), worlddata.getType(), this.viewDistance, worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO))); +- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), WorldData.c(worlddata.getSeed()), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager(), this.getMaxPlayers(), worlddata.getType(), this.viewDistance, flag1, !flag)); + // CraftBukkit - getType() -+ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), this.viewDistance, worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO))); ++ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), WorldData.c(worlddata.getSeed()), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), this.viewDistance, flag1, !flag)); + entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName()))); playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities)); -@@ -100,19 +142,61 @@ +@@ -103,19 +145,61 @@ } else { chatmessage = new ChatMessage("multiplayer.player.joined.renamed", new Object[]{entityplayer.getScoreboardDisplayName(), s}); } @@ -115,7 +117,7 @@ + String joinMessage = CraftChatMessage.fromComponent(chatmessage); - this.sendMessage(chatmessage.a(EnumChatFormat.YELLOW)); - playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); + playerconnection.a(entityplayer.locX(), entityplayer.locY(), entityplayer.locZ(), entityplayer.yaw, entityplayer.pitch); this.players.add(entityplayer); this.j.put(entityplayer.getUniqueID(), entityplayer); - this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); @@ -173,7 +175,7 @@ this.a(entityplayer, worldserver); if (!this.server.getResourcePack().isEmpty()) { entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash()); -@@ -128,8 +212,11 @@ +@@ -131,8 +215,11 @@ if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) { NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); @@ -187,16 +189,16 @@ }); if (entity != null) { -@@ -165,6 +252,8 @@ +@@ -168,6 +255,8 @@ } entityplayer.syncInventory(); + // CraftBukkit - Moved from above, added world -+ PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); ++ PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ()); } public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { -@@ -197,31 +286,32 @@ +@@ -200,31 +289,32 @@ } public void setPlayerFileData(WorldServer worldserver) { @@ -234,7 +236,7 @@ } @Override -@@ -249,14 +339,15 @@ +@@ -252,14 +342,15 @@ } protected void savePlayerFile(EntityPlayer entityplayer) { @@ -252,7 +254,7 @@ if (advancementdataplayer != null) { advancementdataplayer.c(); -@@ -264,10 +355,21 @@ +@@ -267,10 +358,21 @@ } @@ -275,7 +277,7 @@ this.savePlayerFile(entityplayer); if (entityplayer.isPassenger()) { Entity entity = entityplayer.getRootVehicle(); -@@ -298,18 +400,66 @@ +@@ -301,18 +403,66 @@ if (entityplayer1 == entityplayer) { this.j.remove(uuid); @@ -348,7 +350,7 @@ GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile); chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()}); -@@ -317,10 +467,12 @@ +@@ -320,10 +470,12 @@ chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.g.format(gameprofilebanentry.getExpires())})); } @@ -364,7 +366,7 @@ IpBanEntry ipbanentry = this.l.get(socketaddress); chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[]{ipbanentry.getReason()}); -@@ -328,13 +480,25 @@ +@@ -331,13 +483,25 @@ chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[]{PlayerList.g.format(ipbanentry.getExpires())})); } @@ -393,7 +395,7 @@ UUID uuid = EntityHuman.a(gameprofile); List list = Lists.newArrayList(); -@@ -369,14 +533,24 @@ +@@ -372,14 +536,24 @@ } return new EntityPlayer(this.server, this.server.getWorldServer(DimensionManager.OVERWORLD), gameprofile, (PlayerInteractManager) object); @@ -418,7 +420,7 @@ entityplayer.dimension = dimensionmanager; Object object; -@@ -387,6 +561,11 @@ +@@ -390,6 +564,11 @@ } EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object); @@ -430,7 +432,7 @@ entityplayer1.playerConnection = entityplayer.playerConnection; entityplayer1.copyFrom(entityplayer, flag); -@@ -400,42 +579,100 @@ +@@ -403,42 +582,100 @@ entityplayer1.addScoreboardTag(s); } @@ -452,7 +454,7 @@ + Optional optional = EntityHuman.getBed(cworld.getHandle(), blockposition, flag1); - entityplayer1.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, 0.0F, 0.0F); -- entityplayer1.setRespawnPosition(blockposition, flag1); +- entityplayer1.setRespawnPosition(blockposition, flag1, false); - } else { - entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(0, 0.0F)); + if (optional.isPresent()) { @@ -461,7 +463,7 @@ + isBedSpawn = true; + location = new Location(cworld, vec3d.x, vec3d.y, vec3d.z); + } else { -+ entityplayer1.setRespawnPosition(null, true); ++ entityplayer1.setRespawnPosition(null, true, false); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(0, 0.0F)); + } } @@ -485,29 +487,29 @@ + entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + // CraftBukkit end -- while (!worldserver.getCubes(entityplayer1) && entityplayer1.locY < 256.0D) { -+ while (avoidSuffocation && !worldserver.getCubes(entityplayer1) && entityplayer1.locY < 256.0D) { - entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ); +- while (!worldserver.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { ++ while (avoidSuffocation && !worldserver.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { + entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); } + // CraftBukkit start + // Force the client to refresh their chunk cache + if (fromWorld.getEnvironment() == worldserver.getWorld().getEnvironment()) { -+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.worldProvider.getDimensionManager().getDimensionID() >= 0 ? DimensionManager.NETHER : DimensionManager.OVERWORLD, worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode())); ++ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.worldProvider.getDimensionManager().getDimensionID() >= 0 ? DimensionManager.NETHER : DimensionManager.OVERWORLD, WorldData.c(worldserver.getWorldData().getSeed()), worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode())); + } - WorldData worlddata = entityplayer1.world.getWorldData(); + WorldData worlddata = worldserver.getWorldData(); -- entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(entityplayer1.dimension, worlddata.getType(), entityplayer1.playerInteractManager.getGameMode())); -+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.worldProvider.getDimensionManager().getType(), worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode())); +- entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(entityplayer1.dimension, WorldData.c(worlddata.getSeed()), worlddata.getType(), entityplayer1.playerInteractManager.getGameMode())); ++ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.worldProvider.getDimensionManager().getType(), WorldData.c(worldserver.getWorldData().getSeed()), worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode())); + entityplayer1.spawnIn(worldserver); + entityplayer1.dead = false; -+ entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch)); ++ entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch)); + entityplayer1.setSneaking(false); BlockPosition blockposition1 = worldserver.getSpawn(); -- entityplayer1.playerConnection.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); -+ // entityplayer1.playerConnection.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); +- entityplayer1.playerConnection.a(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch); ++ // entityplayer1.playerConnection.a(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch); entityplayer1.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition1)); entityplayer1.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); entityplayer1.playerConnection.sendPacket(new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel)); @@ -533,7 +535,7 @@ + } + + // Fire advancement trigger -+ entityplayer.b(((CraftWorld) fromWorld).getHandle()); ++ entityplayer.triggerDimensionAdvancements(((CraftWorld) fromWorld).getHandle()); + + // Don't fire on respawn + if (fromWorld != location.getWorld()) { @@ -549,7 +551,7 @@ return entityplayer1; } -@@ -448,7 +685,18 @@ +@@ -451,7 +688,18 @@ public void tick() { if (++this.v > 600) { @@ -569,7 +571,7 @@ this.v = 0; } -@@ -461,6 +709,25 @@ +@@ -464,6 +712,25 @@ } @@ -595,7 +597,7 @@ public void a(Packet packet, DimensionManager dimensionmanager) { for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); -@@ -561,6 +828,7 @@ +@@ -564,6 +831,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0)); } @@ -603,7 +605,7 @@ this.server.getCommandDispatcher().a(entityplayer); } -@@ -593,6 +861,12 @@ +@@ -596,6 +864,12 @@ for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); @@ -614,9 +616,9 @@ + // CraftBukkit end + if (entityplayer != entityhuman && entityplayer.dimension == dimensionmanager) { - double d4 = d0 - entityplayer.locX; - double d5 = d1 - entityplayer.locY; -@@ -632,7 +906,7 @@ + double d4 = d0 - entityplayer.locX(); + double d5 = d1 - entityplayer.locY(); +@@ -635,7 +909,7 @@ public void reloadWhitelist() {} public void a(EntityPlayer entityplayer, WorldServer worldserver) { @@ -625,17 +627,17 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE)); entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); -@@ -640,17 +914,26 @@ +@@ -643,17 +917,26 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition)); if (worldserver.isRaining()) { - entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0.0F)); -- entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, worldserver.h(1.0F))); -- entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, worldserver.f(1.0F))); +- entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, worldserver.d(1.0F))); +- entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, worldserver.b(1.0F))); + // CraftBukkit start - handle player weather + // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0.0F)); -+ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, worldserver.h(1.0F))); -+ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, worldserver.f(1.0F))); ++ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, worldserver.d(1.0F))); ++ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, worldserver.b(1.0F))); + entityplayer.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false); + entityplayer.updateWeather(-worldserver.rainLevel, worldserver.rainLevel, -worldserver.thunderLevel, worldserver.thunderLevel); + // CraftBukkit end @@ -656,7 +658,7 @@ } public int getPlayerCount() { -@@ -707,26 +990,39 @@ +@@ -710,26 +993,39 @@ } public void shutdown() { @@ -701,7 +703,7 @@ if (serverstatisticmanager == null) { File file = new File(this.server.getWorldServer(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "stats"); -@@ -741,7 +1037,7 @@ +@@ -744,7 +1040,7 @@ } serverstatisticmanager = new ServerStatisticManager(this.server, file1); @@ -710,7 +712,7 @@ } return serverstatisticmanager; -@@ -749,14 +1045,14 @@ +@@ -752,14 +1048,14 @@ public AdvancementDataPlayer f(EntityPlayer entityplayer) { UUID uuid = entityplayer.getUniqueID(); @@ -727,7 +729,7 @@ } advancementdataplayer.a(entityplayer); -@@ -792,13 +1088,20 @@ +@@ -795,13 +1091,20 @@ } public void reload() { diff --git a/nms-patches/PortalTravelAgent.patch b/nms-patches/PortalTravelAgent.patch index 0984637330..a524e53ecd 100644 --- a/nms-patches/PortalTravelAgent.patch +++ b/nms-patches/PortalTravelAgent.patch @@ -1,6 +1,24 @@ --- a/net/minecraft/server/PortalTravelAgent.java +++ b/net/minecraft/server/PortalTravelAgent.java -@@ -258,6 +258,7 @@ +@@ -43,7 +43,7 @@ + List list = (List) villageplace.b((villageplacetype) -> { + return villageplacetype == VillagePlaceType.u; + }, blockposition, 128, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); +- Optional optional = list.stream().min(Comparator.comparingDouble((villageplacerecord) -> { ++ Optional optional = list.stream().min(Comparator.comparingDouble((villageplacerecord) -> { // CraftBukkit - decompile error + return villageplacerecord.f().m(blockposition); + }).thenComparingInt((villageplacerecord) -> { + return villageplacerecord.f().getY(); +@@ -56,7 +56,7 @@ + ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = BlockPortal.c((GeneratorAccess) this.world, blockposition1); + + return shapedetector_shapedetectorcollection.a(enumdirection, blockposition1, d1, vec3d, d0); +- }).orElse((Object) null); ++ }).orElse(null); // CraftBukkit - decompile error + } + + public boolean a(Entity entity) { +@@ -197,6 +197,7 @@ l5 = -l5; } @@ -8,7 +26,7 @@ if (d0 < 0.0D) { i1 = MathHelper.clamp(i1, 70, this.world.getHeight() - 10); j5 = i1; -@@ -271,7 +272,7 @@ +@@ -210,7 +211,7 @@ boolean flag1 = l2 < 0; blockposition_mutableblockposition.d(j3, l3, i4); @@ -17,7 +35,7 @@ } } } -@@ -281,7 +282,7 @@ +@@ -220,7 +221,7 @@ for (i3 = -1; i3 < 4; ++i3) { if (k2 == -1 || k2 == 2 || i3 == -1 || i3 == 3) { blockposition_mutableblockposition.d(i5 + k2 * k5, j5 + i3, j2 + k2 * l5); @@ -26,7 +44,7 @@ } } } -@@ -291,10 +292,19 @@ +@@ -230,10 +231,19 @@ for (i3 = 0; i3 < 2; ++i3) { for (l2 = 0; l2 < 3; ++l2) { blockposition_mutableblockposition.d(i5 + i3 * k5, j5 + l2, j2 + i3 * l5); @@ -46,4 +64,4 @@ + // CraftBukkit end return true; } - + } diff --git a/nms-patches/Raid.patch b/nms-patches/Raid.patch index 40e5bf0911..95a762db12 100644 --- a/nms-patches/Raid.patch +++ b/nms-patches/Raid.patch @@ -1,68 +1,41 @@ --- a/net/minecraft/server/Raid.java +++ b/net/minecraft/server/Raid.java -@@ -26,21 +26,21 @@ - private static final IChatBaseComponent e = Raid.a.g().a(" - ").addSibling(Raid.c); - private final Map f = Maps.newHashMap(); - private final Map> g = Maps.newHashMap(); -- private final Set h = Sets.newHashSet(); -- private long i; -+ public final Set h = Sets.newHashSet(); // PAIL rename heroes, private -> public -+ public long i; // PAIL rename activeTicks, private -> public - private BlockPosition j; - private final WorldServer k; - private boolean l; - private final int m; -- private float n; -- private int o; -+ public float n; // PAIL rename originTotalHealth, private -> public -+ public int o; // PAIL rename badOmenLevel, private -> public - private boolean p; - private int q; - private final BossBattleServer r; - private int s; - private int t; - private final Random u; -- private final int v; -+ public final int v; // PAIL rename totalWaves, private -> public - private Raid.Status w; - private int x; - private Optional y; @@ -114,6 +114,12 @@ - return this.w == Raid.Status.LOSS; + return this.status == Raid.Status.LOSS; } + // CraftBukkit start + public boolean isInProgress() { -+ return this.w == Status.ONGOING; ++ return this.status == Status.ONGOING; + } + // CraftBukkit end + - public World i() { - return this.k; + public World getWorld() { + return this.world; } @@ -189,6 +195,7 @@ - this.p = this.k.isLoaded(this.j); - if (this.k.getDifficulty() == EnumDifficulty.PEACEFUL) { + this.active = this.world.isLoaded(this.center); + if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL) { + org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.PEACE); // CraftBukkit - this.n(); + this.stop(); return; } @@ -208,13 +215,16 @@ - if (!this.k.b_(this.j)) { - if (this.q > 0) { - this.w = Raid.Status.LOSS; + if (!this.world.b_(this.center)) { + if (this.groupsSpawned > 0) { + this.status = Raid.Status.LOSS; + org.bukkit.craftbukkit.event.CraftEventFactory.callRaidFinishEvent(this, new java.util.ArrayList<>()); // CraftBukkit } else { + org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.NOT_IN_VILLAGE); // CraftBukkit - this.n(); + this.stop(); } } - ++this.i; - if (this.i >= 48000L) { + ++this.ticksActive; + if (this.ticksActive >= 48000L) { + org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.TIMEOUT); // CraftBukkit - this.n(); + this.stop(); return; } @@ -288,6 +298,7 @@ @@ -70,17 +43,17 @@ if (j > 3) { + org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.UNSPAWNABLE); // CraftBukkit - this.n(); + this.stop(); break; } @@ -300,6 +311,7 @@ - this.w = Raid.Status.VICTORY; - Iterator iterator = this.h.iterator(); + this.status = Raid.Status.VICTORY; + Iterator iterator = this.heroes.iterator(); + List winners = new java.util.ArrayList<>(); // CraftBukkit while (iterator.hasNext()) { UUID uuid = (UUID) iterator.next(); - Entity entity = this.k.getEntity(uuid); + Entity entity = this.world.getEntity(uuid); @@ -313,9 +325,11 @@ entityplayer.a(StatisticList.RAID_WIN); @@ -98,10 +71,10 @@ ++this.x; if (this.x >= 600) { + org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.FINISHED); // CraftBukkit - this.n(); + this.stop(); return; } -@@ -456,6 +471,10 @@ +@@ -457,6 +472,10 @@ Raid.Wave[] araid_wave = Raid.Wave.f; int j = araid_wave.length; @@ -111,8 +84,8 @@ + // CraftBukkit end for (int k = 0; k < j; ++k) { Raid.Wave raid_wave = araid_wave[k]; - int l = this.a(raid_wave, i, flag1) + this.a(raid_wave, this.u, i, difficultydamagescaler, flag1); -@@ -468,9 +487,11 @@ + int l = this.a(raid_wave, i, flag1) + this.a(raid_wave, this.random, i, difficultydamagescaler, flag1); +@@ -469,9 +488,11 @@ entityraider.setPatrolLeader(true); this.a(i, entityraider); flag = true; @@ -124,7 +97,7 @@ if (raid_wave.g == EntityTypes.RAVAGER) { EntityRaider entityraider1 = null; -@@ -489,6 +510,7 @@ +@@ -490,6 +511,7 @@ this.a(i, entityraider1, blockposition, false); entityraider1.setPositionRotation(blockposition, 0.0F, 0.0F); entityraider1.startRiding(entityraider); @@ -132,30 +105,30 @@ } } } -@@ -498,6 +520,7 @@ - ++this.q; - this.p(); +@@ -499,6 +521,7 @@ + ++this.groupsSpawned; + this.updateProgress(); this.H(); + org.bukkit.craftbukkit.event.CraftEventFactory.callRaidSpawnWaveEvent(this, leader, raiders); // CraftBukkit } public void a(int i, EntityRaider entityraider, @Nullable BlockPosition blockposition, boolean flag) { -@@ -513,7 +536,7 @@ - entityraider.prepare(this.k, this.k.getDamageScaler(blockposition), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); +@@ -514,7 +537,7 @@ + entityraider.prepare(this.world, this.world.getDamageScaler(blockposition), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); entityraider.a(i, false); entityraider.onGround = true; -- this.k.addEntity(entityraider); -+ this.k.addEntity(entityraider, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.RAID); // CraftBukkit +- this.world.addEntity(entityraider); ++ this.world.addEntity(entityraider, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.RAID); // CraftBukkit } } -@@ -759,6 +782,12 @@ - this.h.add(entity.getUniqueID()); +@@ -760,6 +783,12 @@ + this.heroes.add(entity.getUniqueID()); } + // CraftBukkit start - a method to get all raiders + public java.util.Collection getRaiders() { -+ return this.g.values().stream().flatMap(Set::stream).collect(java.util.stream.Collectors.toSet()); ++ return this.raiders.values().stream().flatMap(Set::stream).collect(java.util.stream.Collectors.toSet()); + } + // CraftBukkit end + diff --git a/nms-patches/RecipeArmorDye.patch b/nms-patches/RecipeArmorDye.patch deleted file mode 100644 index 2972222704..0000000000 --- a/nms-patches/RecipeArmorDye.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/net/minecraft/server/RecipeArmorDye.java -+++ b/net/minecraft/server/RecipeArmorDye.java -@@ -3,11 +3,13 @@ - import com.google.common.collect.Lists; - import java.util.List; - --public class RecipeArmorDye extends IRecipeComplex { -+public class RecipeArmorDye extends ShapelessRecipes { // CraftBukkit - added extends - -+ // CraftBukkit start - Delegate to new parent class with bogus info - public RecipeArmorDye(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Items.LEATHER_HELMET), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.BONE_MEAL))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - ItemStack itemstack = ItemStack.a; diff --git a/nms-patches/RecipeBannerDuplicate.patch b/nms-patches/RecipeBannerDuplicate.patch deleted file mode 100644 index 9e63028681..0000000000 --- a/nms-patches/RecipeBannerDuplicate.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/server/RecipeBannerDuplicate.java -+++ b/net/minecraft/server/RecipeBannerDuplicate.java -@@ -1,10 +1,12 @@ - package net.minecraft.server; - --public class RecipeBannerDuplicate extends IRecipeComplex { -+public class RecipeBannerDuplicate extends ShapelessRecipes { // CraftBukkit - added extends - -+ // CraftBukkit start - Delegate to new parent class with bogus info - public RecipeBannerDuplicate(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Items.WHITE_BANNER), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.WHITE_BANNER))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - EnumColor enumcolor = null; diff --git a/nms-patches/RecipeBookClone.patch b/nms-patches/RecipeBookClone.patch deleted file mode 100644 index 8928787141..0000000000 --- a/nms-patches/RecipeBookClone.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/server/RecipeBookClone.java -+++ b/net/minecraft/server/RecipeBookClone.java -@@ -1,10 +1,12 @@ - package net.minecraft.server; - --public class RecipeBookClone extends IRecipeComplex { -+public class RecipeBookClone extends ShapelessRecipes { // CraftBukkit - added extends - -+ // CraftBukkit start - Delegate to new parent class with bogus info - public RecipeBookClone(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Items.WRITTEN_BOOK), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.WRITABLE_BOOK))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - int i = 0; diff --git a/nms-patches/RecipeBookServer.patch b/nms-patches/RecipeBookServer.patch index 0243896037..148f70a7bd 100644 --- a/nms-patches/RecipeBookServer.patch +++ b/nms-patches/RecipeBookServer.patch @@ -15,7 +15,7 @@ - if (!this.a.contains(minecraftkey) && !irecipe.isComplex()) { + if (!this.a.contains(minecraftkey) && !irecipe.isComplex() && CraftEventFactory.handlePlayerRecipeListUpdateEvent(entityplayer, minecraftkey)) { // CraftBukkit this.a(minecraftkey); - this.c(minecraftkey); + this.d(minecraftkey); list.add(minecraftkey); @@ -62,6 +63,7 @@ } diff --git a/nms-patches/RecipeFireworks.patch b/nms-patches/RecipeFireworks.patch deleted file mode 100644 index 0d81d749c5..0000000000 --- a/nms-patches/RecipeFireworks.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/server/RecipeFireworks.java -+++ b/net/minecraft/server/RecipeFireworks.java -@@ -1,14 +1,16 @@ - package net.minecraft.server; - --public class RecipeFireworks extends IRecipeComplex { -+public class RecipeFireworks extends ShapelessRecipes { // CraftBukkit - added extends - - private static final RecipeItemStack a = RecipeItemStack.a(Items.PAPER); - private static final RecipeItemStack b = RecipeItemStack.a(Items.GUNPOWDER); - private static final RecipeItemStack c = RecipeItemStack.a(Items.FIREWORK_STAR); - -+ // CraftBukkit start - Delegate to new parent class with bogus info - public RecipeFireworks(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Items.FIREWORK_ROCKET, 3), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.GUNPOWDER))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - boolean flag = false; diff --git a/nms-patches/RecipeFireworksFade.patch b/nms-patches/RecipeFireworksFade.patch deleted file mode 100644 index 3a86236205..0000000000 --- a/nms-patches/RecipeFireworksFade.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/server/RecipeFireworksFade.java -+++ b/net/minecraft/server/RecipeFireworksFade.java -@@ -3,13 +3,15 @@ - import com.google.common.collect.Lists; - import java.util.List; - --public class RecipeFireworksFade extends IRecipeComplex { -+public class RecipeFireworksFade extends ShapelessRecipes { // CraftBukkit - added extends - - private static final RecipeItemStack a = RecipeItemStack.a(Items.FIREWORK_STAR); - -+ // CraftBukkit start - Delegate to new parent class with bogus info - public RecipeFireworksFade(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Items.FIREWORK_STAR), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.FIREWORK_STAR, Items.BONE_MEAL))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - boolean flag = false; diff --git a/nms-patches/RecipeFireworksStar.patch b/nms-patches/RecipeFireworksStar.patch deleted file mode 100644 index c512cf13ab..0000000000 --- a/nms-patches/RecipeFireworksStar.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/net/minecraft/server/RecipeFireworksStar.java -+++ b/net/minecraft/server/RecipeFireworksStar.java -@@ -6,12 +6,12 @@ - import java.util.List; - import java.util.Map; - --public class RecipeFireworksStar extends IRecipeComplex { -+public class RecipeFireworksStar extends ShapelessRecipes { // CraftBukkit - added extends - - private static final RecipeItemStack a = RecipeItemStack.a(Items.FIRE_CHARGE, Items.FEATHER, Items.GOLD_NUGGET, Items.SKELETON_SKULL, Items.WITHER_SKELETON_SKULL, Items.CREEPER_HEAD, Items.PLAYER_HEAD, Items.DRAGON_HEAD, Items.ZOMBIE_HEAD); - private static final RecipeItemStack b = RecipeItemStack.a(Items.DIAMOND); - private static final RecipeItemStack c = RecipeItemStack.a(Items.GLOWSTONE_DUST); -- private static final Map d = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { -+ private static final Map d = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error - hashmap.put(Items.FIRE_CHARGE, ItemFireworks.EffectType.LARGE_BALL); - hashmap.put(Items.FEATHER, ItemFireworks.EffectType.BURST); - hashmap.put(Items.GOLD_NUGGET, ItemFireworks.EffectType.STAR); -@@ -24,9 +24,11 @@ - }); - private static final RecipeItemStack e = RecipeItemStack.a(Items.GUNPOWDER); - -+ // CraftBukkit start - Delegate to new parent class with bogus info - public RecipeFireworksStar(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Items.FIREWORK_STAR), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.GUNPOWDER))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - boolean flag = false; diff --git a/nms-patches/RecipeMapClone.patch b/nms-patches/RecipeMapClone.patch deleted file mode 100644 index 7b046b18d4..0000000000 --- a/nms-patches/RecipeMapClone.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/server/RecipeMapClone.java -+++ b/net/minecraft/server/RecipeMapClone.java -@@ -1,10 +1,12 @@ - package net.minecraft.server; - --public class RecipeMapClone extends IRecipeComplex { -+public class RecipeMapClone extends ShapelessRecipes { // CraftBukkit - added extends - -+ // CraftBukkit start - Delegate to new parent class - public RecipeMapClone(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Items.MAP), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.MAP))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - int i = 0; diff --git a/nms-patches/RecipeRepair.patch b/nms-patches/RecipeRepair.patch deleted file mode 100644 index 613d7b6e7e..0000000000 --- a/nms-patches/RecipeRepair.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/net/minecraft/server/RecipeRepair.java -+++ b/net/minecraft/server/RecipeRepair.java -@@ -2,12 +2,15 @@ - - import com.google.common.collect.Lists; - import java.util.List; -+import java.util.stream.Stream; // CraftBukkit - --public class RecipeRepair extends IRecipeComplex { -+public class RecipeRepair extends ShapelessRecipes { // CraftBukkit - added extends - -+ // CraftBukkit start - Delegate to new parent class - public RecipeRepair(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Items.LEATHER_HELMET), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.LEATHER_HELMET))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - List list = Lists.newArrayList(); -@@ -67,6 +70,14 @@ - ItemStack itemstack3 = new ItemStack(itemstack2.getItem()); - - itemstack3.setDamage(i1); -+ // CraftBukkit start - Construct a dummy repair recipe -+ NonNullList ingredients = NonNullList.a(); -+ ingredients.add(new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(itemstack2.cloneItemStack())))); -+ ingredients.add(new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(itemstack.cloneItemStack())))); -+ ShapelessRecipes recipe = new ShapelessRecipes(new MinecraftKey("repairitem"), "", itemstack3.cloneItemStack(), ingredients); -+ inventorycrafting.setCurrentRecipe(recipe); -+ itemstack3 = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, inventorycrafting.resultInventory, itemstack3, inventorycrafting.container.getBukkitView(), true); -+ // CraftBukkit end - return itemstack3; - } - } diff --git a/nms-patches/RecipeShulkerBox.patch b/nms-patches/RecipeShulkerBox.patch deleted file mode 100644 index 38ee2b54f6..0000000000 --- a/nms-patches/RecipeShulkerBox.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/server/RecipeShulkerBox.java -+++ b/net/minecraft/server/RecipeShulkerBox.java -@@ -1,10 +1,12 @@ - package net.minecraft.server; - --public class RecipeShulkerBox extends IRecipeComplex { -+public class RecipeShulkerBox extends ShapelessRecipes { // CraftBukkit - added extends - -+ // CraftBukkit start - Delegate to new parent class with bogus info - public RecipeShulkerBox(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Blocks.WHITE_SHULKER_BOX), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.BONE_MEAL))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - int i = 0; diff --git a/nms-patches/RecipeSuspiciousStew.patch b/nms-patches/RecipeSuspiciousStew.patch deleted file mode 100644 index 091de9f709..0000000000 --- a/nms-patches/RecipeSuspiciousStew.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/server/RecipeSuspiciousStew.java -+++ b/net/minecraft/server/RecipeSuspiciousStew.java -@@ -1,10 +1,12 @@ - package net.minecraft.server; - --public class RecipeSuspiciousStew extends IRecipeComplex { -+public class RecipeSuspiciousStew extends ShapelessRecipes { // CraftBukkit - added extends - -+ // CraftBukkit start - Delegate to new parent class with bogus info - public RecipeSuspiciousStew(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Items.SUSPICIOUS_STEW), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.BOWL))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - boolean flag = false; diff --git a/nms-patches/RecipeTippedArrow.patch b/nms-patches/RecipeTippedArrow.patch deleted file mode 100644 index 1050c0ca35..0000000000 --- a/nms-patches/RecipeTippedArrow.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/net/minecraft/server/RecipeTippedArrow.java -+++ b/net/minecraft/server/RecipeTippedArrow.java -@@ -2,11 +2,17 @@ - - import java.util.Collection; - --public class RecipeTippedArrow extends IRecipeComplex { -+public class RecipeTippedArrow extends ShapedRecipes { // CraftBukkit - -+ // CraftBukkit start - public RecipeTippedArrow(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", 3, 3, NonNullList.a(RecipeItemStack.a, -+ RecipeItemStack.a(Items.ARROW), RecipeItemStack.a(Items.ARROW), RecipeItemStack.a(Items.ARROW), -+ RecipeItemStack.a(Items.ARROW), RecipeItemStack.a(Items.LINGERING_POTION), RecipeItemStack.a(Items.ARROW), -+ RecipeItemStack.a(Items.ARROW), RecipeItemStack.a(Items.ARROW), RecipeItemStack.a(Items.ARROW)), -+ new ItemStack(Items.TIPPED_ARROW, 8)); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - if (inventorycrafting.g() == 3 && inventorycrafting.f() == 3) { diff --git a/nms-patches/RecipiesShield.patch b/nms-patches/RecipiesShield.patch deleted file mode 100644 index aec0af7366..0000000000 --- a/nms-patches/RecipiesShield.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/server/RecipiesShield.java -+++ b/net/minecraft/server/RecipiesShield.java -@@ -1,10 +1,12 @@ - package net.minecraft.server; - --public class RecipiesShield extends IRecipeComplex { -+public class RecipiesShield extends ShapelessRecipes { // CraftBukkit - added extends - -+ // CraftBukkit start - Delegate to new parent class with bogus info - public RecipiesShield(MinecraftKey minecraftkey) { -- super(minecraftkey); -+ super(minecraftkey, "", new ItemStack(Items.SHIELD), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.WHITE_BANNER))); - } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - ItemStack itemstack = ItemStack.a; diff --git a/nms-patches/RegionFileCache.patch b/nms-patches/RegionFileCache.patch index 47dc254ccb..05bb3f941b 100644 --- a/nms-patches/RegionFileCache.patch +++ b/nms-patches/RegionFileCache.patch @@ -1,28 +1,28 @@ --- a/net/minecraft/server/RegionFileCache.java +++ b/net/minecraft/server/RegionFileCache.java @@ -18,7 +18,7 @@ - this.a = file; + this.b = file; } -- private RegionFile a(ChunkCoordIntPair chunkcoordintpair) throws IOException { -+ private RegionFile a(ChunkCoordIntPair chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit +- private RegionFile getFile(ChunkCoordIntPair chunkcoordintpair) throws IOException { ++ private RegionFile getFile(ChunkCoordIntPair chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit long i = ChunkCoordIntPair.pair(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()); RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i); @@ -34,6 +34,7 @@ } - File file = new File(this.a, "r." + chunkcoordintpair.getRegionX() + "." + chunkcoordintpair.getRegionZ() + ".mca"); + File file = new File(this.b, "r." + chunkcoordintpair.getRegionX() + "." + chunkcoordintpair.getRegionZ() + ".mca"); + if (existingOnly && !file.exists()) return null; // CraftBukkit - RegionFile regionfile1 = new RegionFile(file); + RegionFile regionfile1 = new RegionFile(file, this.b); this.cache.putAndMoveToFirst(i, regionfile1); @@ -43,7 +44,7 @@ @Nullable public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { -- RegionFile regionfile = this.a(chunkcoordintpair); -+ RegionFile regionfile = this.a(chunkcoordintpair, false); // CraftBukkit +- RegionFile regionfile = this.getFile(chunkcoordintpair); ++ RegionFile regionfile = this.getFile(chunkcoordintpair, false); // CraftBukkit DataInputStream datainputstream = regionfile.a(chunkcoordintpair); Throwable throwable = null; @@ -30,8 +30,8 @@ } protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { -- RegionFile regionfile = this.a(chunkcoordintpair); -+ RegionFile regionfile = this.a(chunkcoordintpair, false); // CraftBukkit +- RegionFile regionfile = this.getFile(chunkcoordintpair); ++ RegionFile regionfile = this.getFile(chunkcoordintpair, false); // CraftBukkit DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair); Throwable throwable = null; @@ -42,9 +42,9 @@ + + // CraftBukkit start + public boolean chunkExists(ChunkCoordIntPair pos) throws IOException { -+ RegionFile regionfile = a(pos, true); ++ RegionFile regionfile = getFile(pos, true); + -+ return regionfile != null ? regionfile.d(pos) : false; ++ return regionfile != null ? regionfile.chunkExists(pos) : false; + } + // CraftBukkit end } diff --git a/nms-patches/RegionLimitedWorldAccess.patch b/nms-patches/RegionLimitedWorldAccess.patch index 054707cb15..bd7a8c2210 100644 --- a/nms-patches/RegionLimitedWorldAccess.patch +++ b/nms-patches/RegionLimitedWorldAccess.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/RegionLimitedWorldAccess.java +++ b/net/minecraft/server/RegionLimitedWorldAccess.java -@@ -243,6 +243,13 @@ +@@ -239,6 +239,13 @@ @Override public boolean addEntity(Entity entity) { @@ -11,6 +11,6 @@ + @Override + public boolean addEntity(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { + // CraftBukkit end - int i = MathHelper.floor(entity.locX / 16.0D); - int j = MathHelper.floor(entity.locZ / 16.0D); + int i = MathHelper.floor(entity.locX() / 16.0D); + int j = MathHelper.floor(entity.locZ() / 16.0D); diff --git a/nms-patches/SpawnerCreature.patch b/nms-patches/SpawnerCreature.patch index 7bd0fe1c08..73ac93311e 100644 --- a/nms-patches/SpawnerCreature.patch +++ b/nms-patches/SpawnerCreature.patch @@ -12,19 +12,19 @@ private static final Logger LOGGER = LogManager.getLogger(); @@ -88,9 +92,12 @@ - entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, world.random.nextFloat() * 360.0F, 0.0F); - if ((d0 <= 16384.0D || !entityinsentient.isTypeNotPersistent(d0)) && entityinsentient.a((GeneratorAccess) world, EnumMobSpawn.NATURAL) && entityinsentient.a((IWorldReader) world)) { - groupdataentity = entityinsentient.prepare(world, world.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); + entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, worldserver.random.nextFloat() * 360.0F, 0.0F); + if ((d0 <= 16384.0D || !entityinsentient.isTypeNotPersistent(d0)) && entityinsentient.a((GeneratorAccess) worldserver, EnumMobSpawn.NATURAL) && entityinsentient.a((IWorldReader) worldserver)) { + groupdataentity = entityinsentient.prepare(worldserver, worldserver.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); - ++i; - ++i2; -- world.addEntity(entityinsentient); +- worldserver.addEntity(entityinsentient); + // CraftBukkit start -+ if (world.addEntity(entityinsentient, SpawnReason.NATURAL)) { ++ if (worldserver.addEntity(entityinsentient, SpawnReason.NATURAL)) { + ++i; + ++i2; + } + // CraftBukkit end - if (i >= entityinsentient.dC()) { + if (i >= entityinsentient.getMaxSpawnGroup()) { return; } @@ -216,7 +223,7 @@ diff --git a/nms-patches/StructureGenerator.patch b/nms-patches/StructureGenerator.patch index 505cddd3ea..445c0a88fe 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 -@@ -144,7 +144,7 @@ +@@ -149,7 +149,7 @@ while (longiterator.hasNext()) { long k = longiterator.nextLong(); diff --git a/nms-patches/TicketType.patch b/nms-patches/TicketType.patch index 96325e6082..9d083d9571 100644 --- a/nms-patches/TicketType.patch +++ b/nms-patches/TicketType.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/TicketType.java +++ b/net/minecraft/server/TicketType.java @@ -19,6 +19,8 @@ - public static final TicketType PORTAL = a("portal", Comparator.comparingLong(BlockPosition2D::b)); + public static final TicketType PORTAL = a("portal", BaseBlockPosition::compareTo, 300); public static final TicketType POST_TELEPORT = a("post_teleport", Integer::compareTo, 5); public static final TicketType UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1); + public static final TicketType PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit diff --git a/nms-patches/TileEntity.patch b/nms-patches/TileEntity.patch index ed6077af61..664bdd1915 100644 --- a/nms-patches/TileEntity.patch +++ b/nms-patches/TileEntity.patch @@ -17,9 +17,9 @@ + public CraftPersistentDataContainer persistentDataContainer; + // CraftBukkit end private static final Logger LOGGER = LogManager.getLogger(); - private final TileEntityTypes b; + private final TileEntityTypes tileType; @Nullable -@@ -37,6 +46,14 @@ +@@ -38,6 +47,14 @@ public void load(NBTTagCompound nbttagcompound) { this.position = new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")); @@ -34,7 +34,7 @@ } public NBTTagCompound save(NBTTagCompound nbttagcompound) { -@@ -53,6 +70,11 @@ +@@ -54,6 +71,11 @@ nbttagcompound.setInt("x", this.position.getX()); nbttagcompound.setInt("y", this.position.getY()); nbttagcompound.setInt("z", this.position.getZ()); @@ -46,7 +46,7 @@ return nbttagcompound; } } -@@ -168,4 +190,13 @@ +@@ -169,4 +191,13 @@ }, this::getPosition}); } } diff --git a/nms-patches/TileEntityBanner.patch b/nms-patches/TileEntityBanner.patch index 0be4abf7ca..89327c8a19 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 -@@ -67,6 +67,11 @@ +@@ -69,6 +69,11 @@ } this.patterns = nbttagcompound.getList("Patterns", 10); diff --git a/nms-patches/TileEntityBarrel.patch b/nms-patches/TileEntityBarrel.patch index 2a7391905a..9445480e53 100644 --- a/nms-patches/TileEntityBarrel.patch +++ b/nms-patches/TileEntityBarrel.patch @@ -1,8 +1,7 @@ --- a/net/minecraft/server/TileEntityBarrel.java +++ b/net/minecraft/server/TileEntityBarrel.java -@@ -2,8 +2,55 @@ - - import java.util.Iterator; +@@ -1,7 +1,54 @@ + package net.minecraft.server; +// CraftBukkit start +import java.util.ArrayList; diff --git a/nms-patches/TileEntityBeacon.patch b/nms-patches/TileEntityBeacon.patch index 4ef4276fe8..3fca71d0fe 100644 --- a/nms-patches/TileEntityBeacon.patch +++ b/nms-patches/TileEntityBeacon.patch @@ -31,7 +31,7 @@ public TileEntityBeacon() { super(TileEntityTypes.BEACON); @@ -194,39 +210,78 @@ - super.V_(); + super.ab_(); } - private void applyEffects() { diff --git a/nms-patches/TileEntityBrewingStand.patch b/nms-patches/TileEntityBrewingStand.patch index 953bb5f12a..7a84c06cee 100644 --- a/nms-patches/TileEntityBrewingStand.patch +++ b/nms-patches/TileEntityBrewingStand.patch @@ -92,10 +92,10 @@ + // CraftBukkit end if (flag2 && flag) { - this.s(); + this.j(); @@ -168,6 +224,16 @@ - private void s() { + private void j() { ItemStack itemstack = (ItemStack) this.items.get(3); + // CraftBukkit start + InventoryHolder owner = this.getOwner(); diff --git a/nms-patches/TileEntityCampfire.patch b/nms-patches/TileEntityCampfire.patch index d252bb8568..145e8e378f 100644 --- a/nms-patches/TileEntityCampfire.patch +++ b/nms-patches/TileEntityCampfire.patch @@ -32,4 +32,4 @@ + // CraftBukkit end InventoryUtils.dropItem(this.world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1); this.items.set(i, ItemStack.a); - this.t(); + this.k(); diff --git a/nms-patches/TileEntityChest.patch b/nms-patches/TileEntityChest.patch index e71a22ceef..d2e11f98b0 100644 --- a/nms-patches/TileEntityChest.patch +++ b/nms-patches/TileEntityChest.patch @@ -48,7 +48,7 @@ protected TileEntityChest(TileEntityTypes tileentitytypes) { super(tileentitytypes); this.items = NonNullList.a(27, ItemStack.a); -@@ -172,8 +206,20 @@ +@@ -155,8 +189,20 @@ if (this.viewingCount < 0) { this.viewingCount = 0; } @@ -69,7 +69,7 @@ this.onOpen(); } -@@ -182,7 +228,18 @@ +@@ -165,7 +211,18 @@ @Override public void closeContainer(EntityHuman entityhuman) { if (!entityhuman.isSpectator()) { @@ -88,7 +88,7 @@ this.onOpen(); } -@@ -233,4 +290,11 @@ +@@ -216,4 +273,11 @@ protected Container createContainer(int i, PlayerInventory playerinventory) { return ContainerChest.a(i, playerinventory, this); } diff --git a/nms-patches/TileEntityConduit.patch b/nms-patches/TileEntityConduit.patch index 3c1027d3e9..0a0c297258 100644 --- a/nms-patches/TileEntityConduit.patch +++ b/nms-patches/TileEntityConduit.patch @@ -24,8 +24,8 @@ this.target = this.x(); this.k = null; } else if (this.target == null) { -- List list = this.world.a(EntityLiving.class, this.v(), (entityliving1) -> { -+ List list = this.world.a(EntityLiving.class, this.v(), (java.util.function.Predicate) (entityliving1) -> { // CraftBukkit - decompile error +- List list = this.world.a(EntityLiving.class, this.m(), (entityliving1) -> { ++ List list = this.world.a(EntityLiving.class, this.m(), (java.util.function.Predicate) (entityliving1) -> { // CraftBukkit - decompile error return entityliving1 instanceof IMonster && entityliving1.isInWaterOrRain(); }); @@ -33,12 +33,12 @@ } if (this.target != null) { -- this.world.playSound((EntityHuman) null, this.target.locX, this.target.locY, this.target.locZ, SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F); +- this.world.playSound((EntityHuman) null, this.target.locX(), this.target.locY(), this.target.locZ(), SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F); - this.target.damageEntity(DamageSource.MAGIC, 4.0F); + // CraftBukkit start + CraftEventFactory.blockDamage = CraftBlock.at(this.world, this.position); + if (this.target.damageEntity(DamageSource.MAGIC, 4.0F)) { -+ this.world.playSound((EntityHuman) null, this.target.locX, this.target.locY, this.target.locZ, SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F); ++ this.world.playSound((EntityHuman) null, this.target.locX(), this.target.locY(), this.target.locZ(), SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F); + } + CraftEventFactory.blockDamage = null; + // CraftBukkit end @@ -49,8 +49,8 @@ @Nullable private EntityLiving x() { -- List list = this.world.a(EntityLiving.class, this.v(), (entityliving) -> { -+ List list = this.world.a(EntityLiving.class, this.v(), (java.util.function.Predicate) (entityliving) -> { // CraftBukkit - decompile error +- List list = this.world.a(EntityLiving.class, this.m(), (entityliving) -> { ++ List list = this.world.a(EntityLiving.class, this.m(), (java.util.function.Predicate) (entityliving) -> { // CraftBukkit - decompile error return entityliving.getUniqueID().equals(this.k); }); diff --git a/nms-patches/TileEntityDispenser.patch b/nms-patches/TileEntityDispenser.patch index 3eabd2c2a1..9b7964dceb 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,48 @@ +@@ -1,12 +1,48 @@ + package net.minecraft.server; - import java.util.Iterator; import java.util.Random; +// CraftBukkit start +import java.util.List; diff --git a/nms-patches/TileEntityEndGateway.patch b/nms-patches/TileEntityEndGateway.patch index 0a00321ab0..41115416cd 100644 --- a/nms-patches/TileEntityEndGateway.patch +++ b/nms-patches/TileEntityEndGateway.patch @@ -13,9 +13,9 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITickable { -@@ -119,6 +125,26 @@ +@@ -120,6 +126,26 @@ if (this.exitPortal != null) { - BlockPosition blockposition = this.exactTeleport ? this.exitPortal : this.t(); + BlockPosition blockposition = this.exactTeleport ? this.exitPortal : this.k(); + // CraftBukkit start - Fire PlayerTeleportEvent + if (entity instanceof EntityPlayer) { @@ -40,3 +40,21 @@ entity.enderTeleportAndLoad((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D); } +@@ -155,7 +181,7 @@ + if (this.exitPortal == null) { + this.exitPortal = new BlockPosition(vec3d1.x + 0.5D, 75.0D, vec3d1.z + 0.5D); + TileEntityEndGateway.LOGGER.debug("Failed to find suitable block, settling on {}", this.exitPortal); +- WorldGenerator.END_ISLAND.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.e).a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), new Random(this.exitPortal.asLong()), this.exitPortal); ++ WorldGenerator.END_ISLAND.b(WorldGenFeatureConfiguration.e).a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), new Random(this.exitPortal.asLong()), this.exitPortal); // CraftBukkit - decompile error + } else { + TileEntityEndGateway.LOGGER.debug("Found block at {}", this.exitPortal); + } +@@ -223,7 +249,7 @@ + } + + private void a(WorldServer worldserver, BlockPosition blockposition) { +- WorldGenerator.END_GATEWAY.b((WorldGenFeatureConfiguration) WorldGenEndGatewayConfiguration.a(this.getPosition(), false)).a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), new Random(), blockposition); ++ WorldGenerator.END_GATEWAY.b(WorldGenEndGatewayConfiguration.a(this.getPosition(), false)).a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), new Random(), blockposition); // CraftBukkit - decompile error + } + + public void a(BlockPosition blockposition, boolean flag) { diff --git a/nms-patches/TileEntityFurnace.patch b/nms-patches/TileEntityFurnace.patch index 5bdbc52759..87facb8617 100644 --- a/nms-patches/TileEntityFurnace.patch +++ b/nms-patches/TileEntityFurnace.patch @@ -82,7 +82,7 @@ if (!itemstack.isEmpty()) { Item item = itemstack.getItem(); @@ -278,11 +329,38 @@ - ItemStack itemstack1 = irecipe.c(); + ItemStack itemstack1 = irecipe.getResult(); ItemStack itemstack2 = (ItemStack) this.items.get(2); + // CraftBukkit start - fire FurnaceSmeltEvent diff --git a/nms-patches/TileEntityHopper.patch b/nms-patches/TileEntityHopper.patch index 43e629004c..3dc647cb11 100644 --- a/nms-patches/TileEntityHopper.patch +++ b/nms-patches/TileEntityHopper.patch @@ -52,7 +52,7 @@ public TileEntityHopper() { super(TileEntityTypes.HOPPER); this.items = NonNullList.a(5, ItemStack.a); -@@ -159,7 +198,28 @@ +@@ -138,7 +177,28 @@ for (int i = 0; i < this.getSize(); ++i) { if (!this.getItem(i).isEmpty()) { ItemStack itemstack = this.getItem(i).cloneItemStack(); @@ -82,7 +82,7 @@ if (itemstack1.isEmpty()) { iinventory.update(); -@@ -224,7 +284,34 @@ +@@ -203,7 +263,34 @@ if (!itemstack.isEmpty() && b(iinventory, itemstack, i, enumdirection)) { ItemStack itemstack1 = itemstack.cloneItemStack(); @@ -118,7 +118,7 @@ if (itemstack2.isEmpty()) { iinventory.update(); -@@ -239,6 +326,13 @@ +@@ -218,6 +305,13 @@ public static boolean a(IInventory iinventory, EntityItem entityitem) { boolean flag = false; diff --git a/nms-patches/TileEntityShulkerBox.patch b/nms-patches/TileEntityShulkerBox.patch index 15e79d57ef..ab6a6b7ba3 100644 --- a/nms-patches/TileEntityShulkerBox.patch +++ b/nms-patches/TileEntityShulkerBox.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/TileEntityShulkerBox.java +++ b/net/minecraft/server/TileEntityShulkerBox.java -@@ -4,6 +4,10 @@ +@@ -3,6 +3,10 @@ import java.util.List; import java.util.stream.IntStream; import javax.annotation.Nullable; diff --git a/nms-patches/TileEntitySign.patch b/nms-patches/TileEntitySign.patch index dc61748c51..0572f8e8fa 100644 --- a/nms-patches/TileEntitySign.patch +++ b/nms-patches/TileEntitySign.patch @@ -8,8 +8,8 @@ +public class TileEntitySign extends TileEntity implements ICommandListener { // CraftBukkit - implements public final IChatBaseComponent[] lines = new IChatBaseComponent[]{new ChatComponentText(""), new ChatComponentText(""), new ChatComponentText(""), new ChatComponentText("")}; - private int c = -1; -@@ -29,6 +29,12 @@ + public boolean isEditable = true; +@@ -26,6 +26,12 @@ nbttagcompound.setString("Text" + (i + 1), s); } @@ -22,7 +22,7 @@ nbttagcompound.setString("Color", this.color.b()); return nbttagcompound; } -@@ -39,18 +45,38 @@ +@@ -36,18 +42,38 @@ super.load(nbttagcompound); this.color = EnumColor.a(nbttagcompound.getString("Color"), EnumColor.BLACK); @@ -67,8 +67,8 @@ + this.lines[i] = new ChatComponentText(s); } - this.k[i] = null; -@@ -111,11 +137,37 @@ + this.g[i] = null; +@@ -108,11 +134,37 @@ return true; } @@ -107,7 +107,7 @@ } public EnumColor getColor() { -@@ -126,7 +178,7 @@ +@@ -123,7 +175,7 @@ if (enumcolor != this.getColor()) { this.color = enumcolor; this.update(); diff --git a/nms-patches/World.patch b/nms-patches/World.patch index 8e7d1a7a67..260f3cc424 100644 --- a/nms-patches/World.patch +++ b/nms-patches/World.patch @@ -20,21 +20,21 @@ +import org.bukkit.event.weather.LightningStrikeEvent; +// CraftBukkit end + - public abstract class World implements IIBlockAccess, GeneratorAccess, AutoCloseable { + public abstract class World implements GeneratorAccess, AutoCloseable { protected static final Logger LOGGER = LogManager.getLogger(); -@@ -23,7 +39,7 @@ +@@ -22,7 +38,7 @@ + public final List tileEntityListTick = Lists.newArrayList(); protected final List tileEntityListPending = Lists.newArrayList(); protected final List tileEntityListUnload = Lists.newArrayList(); - private final long b = 16777215L; - private final Thread serverThread; -+ final Thread serverThread; // CraftBukkit - package private - private int u; ++ final Thread serverThread; // CraftBukkit - package private // PAIL + private int c; protected int i = (new Random()).nextInt(); protected final int j = 1013904223; -@@ -41,7 +57,51 @@ - protected boolean tickingTileEntities; +@@ -40,7 +56,51 @@ private final WorldBorder worldBorder; + private final BiomeManager biomeManager; - protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction bifunction, GameProfilerFiller gameprofilerfiller, boolean flag) { + // CraftBukkit start Added the following @@ -86,9 +86,9 @@ this.worldData = worlddata; this.worldProvider = dimensionmanager.getWorldProvider(this); @@ -49,6 +109,35 @@ - this.isClientSide = flag; this.worldBorder = this.worldProvider.getWorldBorder(); this.serverThread = Thread.currentThread(); + this.biomeManager = new BiomeManager(this, flag ? worlddata.getSeed() : WorldData.c(worlddata.getSeed()), dimensionmanager.getGenLayerZoomer()); + // CraftBukkit start + getWorldBorder().world = (WorldServer) this; + // From PlayerList.setPlayerFileData @@ -121,7 +121,7 @@ } @Override -@@ -119,6 +208,26 @@ +@@ -105,6 +194,26 @@ @Override public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { @@ -148,7 +148,7 @@ if (isOutsideWorld(blockposition)) { return false; } else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { -@@ -126,9 +235,23 @@ +@@ -112,9 +221,23 @@ } else { Chunk chunk = this.getChunkAtWorldCoords(blockposition); Block block = iblockdata.getBlock(); @@ -173,7 +173,7 @@ return false; } else { IBlockData iblockdata2 = this.getType(blockposition); -@@ -139,6 +262,7 @@ +@@ -125,6 +248,7 @@ this.methodProfiler.exit(); } @@ -181,7 +181,7 @@ if (iblockdata2 == iblockdata) { if (iblockdata1 != iblockdata2) { this.b(blockposition, iblockdata1, iblockdata2); -@@ -165,12 +289,65 @@ +@@ -151,12 +275,65 @@ this.a(blockposition, iblockdata1, iblockdata2); } @@ -247,7 +247,7 @@ public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} @Override -@@ -209,6 +386,11 @@ +@@ -195,6 +372,11 @@ @Override public void update(BlockPosition blockposition, Block block) { if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) { @@ -259,7 +259,7 @@ this.applyPhysics(blockposition, block); } -@@ -257,6 +439,17 @@ +@@ -243,6 +425,17 @@ IBlockData iblockdata = this.getType(blockposition); try { @@ -277,7 +277,7 @@ iblockdata.doPhysics(this, blockposition, block, blockposition1, false); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); -@@ -316,6 +509,17 @@ +@@ -285,6 +478,17 @@ @Override public IBlockData getType(BlockPosition blockposition) { @@ -295,7 +295,7 @@ if (isOutsideWorld(blockposition)) { return Blocks.VOID_AIR.getBlockData(); } else { -@@ -459,9 +663,11 @@ +@@ -432,9 +636,11 @@ TileEntity tileentity1 = (TileEntity) this.tileEntityListPending.get(i); if (!tileentity1.isRemoved()) { @@ -307,7 +307,7 @@ if (this.isLoaded(tileentity1.getPosition())) { Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition()); -@@ -469,6 +675,12 @@ +@@ -442,6 +648,12 @@ chunk.setTileEntity(tileentity1.getPosition(), tileentity1); this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3); @@ -320,7 +320,7 @@ } } } -@@ -631,6 +843,7 @@ +@@ -604,6 +816,7 @@ } } @@ -328,7 +328,7 @@ @Nullable @Override public TileEntity getTileEntity(BlockPosition blockposition) { -@@ -639,6 +852,12 @@ +@@ -612,6 +825,12 @@ } else if (!this.isClientSide && Thread.currentThread() != this.serverThread) { return null; } else { @@ -341,18 +341,17 @@ TileEntity tileentity = null; if (this.tickingTileEntities) { -@@ -673,6 +892,14 @@ +@@ -646,6 +865,13 @@ public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) { if (!isOutsideWorld(blockposition)) { if (tileentity != null && !tileentity.isRemoved()) { + // CraftBukkit start + if (captureBlockStates) { -+ tileentity.setWorld(this); -+ tileentity.setPosition(blockposition); ++ tileentity.setLocation(this, blockposition); + capturedTileEntities.put(blockposition, tileentity); + return; + } + // CraftBukkit end if (this.tickingTileEntities) { - tileentity.setPosition(blockposition); + tileentity.setLocation(this, blockposition); Iterator iterator = this.tileEntityListPending.iterator(); diff --git a/nms-patches/WorldData.patch b/nms-patches/WorldData.patch index 56712528d2..d6f6f2a872 100644 --- a/nms-patches/WorldData.patch +++ b/nms-patches/WorldData.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/WorldData.java +++ b/net/minecraft/server/WorldData.java -@@ -11,6 +11,11 @@ +@@ -12,6 +12,11 @@ import java.util.UUID; import java.util.Map.Entry; import javax.annotation.Nullable; @@ -12,7 +12,7 @@ public class WorldData { -@@ -67,6 +72,7 @@ +@@ -68,6 +73,7 @@ private UUID W; private final GameRules X; private final CustomFunctionCallbackTimerQueue Y; @@ -20,7 +20,7 @@ protected WorldData() { this.f = WorldType.NORMAL; -@@ -418,6 +424,7 @@ +@@ -419,6 +425,7 @@ nbttagcompound.setString("WanderingTraderId", this.W.toString()); } @@ -28,7 +28,7 @@ } public long getSeed() { -@@ -506,6 +513,20 @@ +@@ -511,6 +518,20 @@ } public void setThundering(boolean flag) { @@ -49,7 +49,7 @@ this.thundering = flag; } -@@ -522,6 +543,20 @@ +@@ -527,6 +548,20 @@ } public void setStorm(boolean flag) { @@ -70,7 +70,7 @@ this.raining = flag; } -@@ -671,6 +706,12 @@ +@@ -676,6 +711,12 @@ public void setDifficulty(EnumDifficulty enumdifficulty) { this.F = enumdifficulty; @@ -83,7 +83,7 @@ } public boolean isDifficultyLocked() { -@@ -775,4 +816,12 @@ +@@ -780,4 +821,12 @@ public void a(UUID uuid) { this.W = uuid; } diff --git a/nms-patches/WorldGenGroundBush.patch b/nms-patches/WorldGenGroundBush.patch index 30ce0ce6fe..950656c8a0 100644 --- a/nms-patches/WorldGenGroundBush.patch +++ b/nms-patches/WorldGenGroundBush.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/WorldGenGroundBush.java +++ b/net/minecraft/server/WorldGenGroundBush.java -@@ -43,7 +43,12 @@ +@@ -29,8 +29,19 @@ } } } @@ -9,7 +9,14 @@ + return false; } + // CraftBukkit end -+ return true; } ++ ++ // CraftBukkit start - decompile error ++ @Override ++ public boolean generate(GeneratorAccess generatoraccess, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureTreeConfiguration fc) { ++ return super.a(generatoraccess, chunkgenerator, random, blockposition, fc); ++ } ++ // CraftBukkit end + } diff --git a/nms-patches/WorldGenMegaTreeProvider.patch b/nms-patches/WorldGenMegaTreeProvider.patch index e632efeccd..8d1026f9de 100644 --- a/nms-patches/WorldGenMegaTreeProvider.patch +++ b/nms-patches/WorldGenMegaTreeProvider.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/server/WorldGenMegaTreeProvider.java +++ b/net/minecraft/server/WorldGenMegaTreeProvider.java @@ -29,6 +29,7 @@ - if (worldgentreeabstract == null) { + if (worldgenfeatureconfigured == null) { return false; } else { -+ setTreeType(worldgentreeabstract); // CraftBukkit ++ setTreeType(worldgenfeatureconfigured); // CraftBukkit IBlockData iblockdata1 = Blocks.AIR.getBlockData(); generatoraccess.setTypeAndData(blockposition.b(i, 0, j), iblockdata1, 4); diff --git a/nms-patches/WorldGenTreeProvider.patch b/nms-patches/WorldGenTreeProvider.patch index ba2116c74c..9deab7676c 100644 --- a/nms-patches/WorldGenTreeProvider.patch +++ b/nms-patches/WorldGenTreeProvider.patch @@ -9,38 +9,54 @@ public abstract class WorldGenTreeProvider { @@ -16,6 +17,7 @@ - if (worldgentreeabstract == null) { + if (worldgenfeatureconfigured == null) { return false; } else { -+ setTreeType(worldgentreeabstract); // CraftBukkit ++ setTreeType(worldgenfeatureconfigured); // CraftBukkit generatoraccess.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 4); - if (worldgentreeabstract.generate(generatoraccess, generatoraccess.getChunkProvider().getChunkGenerator(), random, blockposition, WorldGenFeatureConfiguration.e)) { - return true; -@@ -25,4 +27,30 @@ + ((WorldGenFeatureSmallTreeConfigurationConfiguration) worldgenfeatureconfigured.c).a(); + if (worldgenfeatureconfigured.a(generatoraccess, chunkgenerator, random, blockposition)) { +@@ -26,4 +28,46 @@ } } } + + // CraftBukkit start -+ protected void setTreeType(WorldGenTreeAbstract worldgentreeabstract) { -+ if (worldgentreeabstract instanceof WorldGenAcaciaTree) { -+ BlockSapling.treeType = TreeType.ACACIA; -+ } else if (worldgentreeabstract instanceof WorldGenBigTree) { -+ BlockSapling.treeType = TreeType.BIG_TREE; -+ } else if (worldgentreeabstract instanceof WorldGenForest) { -+ BlockSapling.treeType = TreeType.BIRCH; -+ } else if (worldgentreeabstract instanceof WorldGenForestTree) { -+ BlockSapling.treeType = TreeType.DARK_OAK; -+ } else if (worldgentreeabstract instanceof WorldGenJungleTree) { -+ BlockSapling.treeType = TreeType.JUNGLE; -+ } else if (worldgentreeabstract instanceof WorldGenMegaTree) { -+ BlockSapling.treeType = TreeType.MEGA_REDWOOD; -+ } else if (worldgentreeabstract instanceof WorldGenTaiga1) { -+ BlockSapling.treeType = TreeType.REDWOOD; -+ } else if (worldgentreeabstract instanceof WorldGenTaiga2) { -+ BlockSapling.treeType = TreeType.REDWOOD; -+ } else if (worldgentreeabstract instanceof WorldGenTrees) { ++ protected void setTreeType(WorldGenFeatureConfigured worldgentreeabstract) { ++ if (worldgentreeabstract.c == BiomeDecoratorGroups.NORMAL_TREE) { + BlockSapling.treeType = TreeType.TREE; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.HUGE_RED_MUSHROOM) { ++ BlockSapling.treeType = TreeType.RED_MUSHROOM; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM) { ++ BlockSapling.treeType = TreeType.BROWN_MUSHROOM; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.JUNGLE_TREE) { ++ BlockSapling.treeType = TreeType.COCOA_TREE; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.JUNGLE_TREE_NOVINE) { ++ BlockSapling.treeType = TreeType.SMALL_JUNGLE; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.PINE_TREE) { ++ BlockSapling.treeType = TreeType.TALL_REDWOOD; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.SPRUCE_TREE) { ++ BlockSapling.treeType = TreeType.REDWOOD; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.ACACIA_TREE) { ++ BlockSapling.treeType = TreeType.ACACIA; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.BIRCH_TREE) { ++ BlockSapling.treeType = TreeType.BIRCH; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.TALL_BIRCH_TREE) { ++ BlockSapling.treeType = TreeType.TALL_BIRCH; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.SWAMP_TREE) { ++ BlockSapling.treeType = TreeType.SWAMP; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.FANCY_TREE) { ++ BlockSapling.treeType = TreeType.BIG_TREE; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.JUNGLE_BUSH) { ++ BlockSapling.treeType = TreeType.JUNGLE_BUSH; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.DARK_OAK_TREE) { ++ BlockSapling.treeType = TreeType.DARK_OAK; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.MEGA_SPRUCE_TREE) { ++ BlockSapling.treeType = TreeType.MEGA_REDWOOD; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.MEGA_PINE_TREE) { ++ BlockSapling.treeType = TreeType.MEGA_REDWOOD; ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.MEGA_JUNGLE_TREE) { ++ BlockSapling.treeType = TreeType.JUNGLE; + } else { + throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract); + } diff --git a/nms-patches/WorldMap.patch b/nms-patches/WorldMap.patch index 4ebff530ad..fe1d5dba28 100644 --- a/nms-patches/WorldMap.patch +++ b/nms-patches/WorldMap.patch @@ -55,7 +55,7 @@ + if (world == null) { + /* All Maps which do not have their valid world loaded are set to a dimension which hopefully won't be reached. + This is to prevent them being corrupted with the wrong map data. */ -+ dimensionmanager = new DimensionManager(127, null, null, null, false, DimensionManager.OVERWORLD); ++ dimensionmanager = new DimensionManager(127, null, null, null, false, null, DimensionManager.OVERWORLD); + } else { + dimensionmanager = world.getHandle().getWorldProvider().getDimensionManager(); + } diff --git a/nms-patches/WorldProvider.patch b/nms-patches/WorldProvider.patch index 6436430848..a541a34b4b 100644 --- a/nms-patches/WorldProvider.patch +++ b/nms-patches/WorldProvider.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/WorldProvider.java +++ b/net/minecraft/server/WorldProvider.java -@@ -76,5 +76,5 @@ +@@ -72,5 +72,5 @@ public abstract boolean canRespawn(); diff --git a/nms-patches/WorldProviderHell.patch b/nms-patches/WorldProviderHell.patch index f89d72f55a..40664495c9 100644 --- a/nms-patches/WorldProviderHell.patch +++ b/nms-patches/WorldProviderHell.patch @@ -1,6 +1,15 @@ --- a/net/minecraft/server/WorldProviderHell.java +++ b/net/minecraft/server/WorldProviderHell.java -@@ -63,18 +63,22 @@ +@@ -18,7 +18,7 @@ + + generatorsettingsnether.a(Blocks.NETHERRACK.getBlockData()); + generatorsettingsnether.b(Blocks.LAVA.getBlockData()); +- return ChunkGeneratorType.b.create(this.b, BiomeLayout.b.a((BiomeLayoutConfiguration) ((BiomeLayoutFixedConfiguration) BiomeLayout.b.a(this.b.getWorldData())).a(Biomes.NETHER)), generatorsettingsnether); ++ return ChunkGeneratorType.b.create(this.b, BiomeLayout.b.a(((BiomeLayoutFixedConfiguration) BiomeLayout.b.a(this.b.getWorldData())).a(Biomes.NETHER)), generatorsettingsnether); // CraftBukkit - decompile error + } + + @Override +@@ -53,18 +53,22 @@ return new WorldBorder() { @Override public double getCenterX() { diff --git a/nms-patches/WorldProviderNormal.patch b/nms-patches/WorldProviderNormal.patch index 5304bf93dd..d0049ee61f 100644 --- a/nms-patches/WorldProviderNormal.patch +++ b/nms-patches/WorldProviderNormal.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/WorldProviderNormal.java +++ b/net/minecraft/server/WorldProviderNormal.java @@ -13,10 +13,14 @@ - super(world, dimensionmanager); + super(world, dimensionmanager, 0.0F); } + // CraftBukkit start @@ -15,3 +15,53 @@ @Override public ChunkGenerator getChunkGenerator() { +@@ -34,16 +38,16 @@ + GeneratorSettingsFlat generatorsettingsflat = GeneratorSettingsFlat.a(new Dynamic(DynamicOpsNBT.a, this.b.getWorldData().getGeneratorOptions())); + BiomeLayoutFixedConfiguration biomelayoutfixedconfiguration = ((BiomeLayoutFixedConfiguration) biomelayout.a(this.b.getWorldData())).a(generatorsettingsflat.v()); + +- return chunkgeneratortype.create(this.b, biomelayout.a((BiomeLayoutConfiguration) biomelayoutfixedconfiguration), generatorsettingsflat); ++ return chunkgeneratortype.create(this.b, biomelayout.a(biomelayoutfixedconfiguration), generatorsettingsflat); // CraftBukkit - decompile error + } else if (worldtype == WorldType.DEBUG_ALL_BLOCK_STATES) { + BiomeLayoutFixedConfiguration biomelayoutfixedconfiguration1 = ((BiomeLayoutFixedConfiguration) biomelayout.a(this.b.getWorldData())).a(Biomes.PLAINS); + +- return chunkgeneratortype1.create(this.b, biomelayout.a((BiomeLayoutConfiguration) biomelayoutfixedconfiguration1), chunkgeneratortype1.a()); ++ return chunkgeneratortype1.create(this.b, biomelayout.a(biomelayoutfixedconfiguration1), chunkgeneratortype1.a()); // CraftBukkit - decompile error + } else if (worldtype != WorldType.g) { + GeneratorSettingsOverworld generatorsettingsoverworld = (GeneratorSettingsOverworld) chunkgeneratortype4.a(); + BiomeLayoutOverworldConfiguration biomelayoutoverworldconfiguration = ((BiomeLayoutOverworldConfiguration) biomelayout1.a(this.b.getWorldData())).a(generatorsettingsoverworld); + +- return chunkgeneratortype4.create(this.b, biomelayout1.a((BiomeLayoutConfiguration) biomelayoutoverworldconfiguration), generatorsettingsoverworld); ++ return chunkgeneratortype4.create(this.b, biomelayout1.a(biomelayoutoverworldconfiguration), generatorsettingsoverworld); // CraftBukkit - decompile error + } else { + WorldChunkManager worldchunkmanager = null; + JsonElement jsonelement = (JsonElement) Dynamic.convert(DynamicOpsNBT.a, JsonOps.INSTANCE, this.b.getWorldData().getGeneratorOptions()); +@@ -68,25 +72,25 @@ + if (BiomeLayout.b == biomelayout3) { + BiomeLayoutFixedConfiguration biomelayoutfixedconfiguration2 = ((BiomeLayoutFixedConfiguration) biomelayout.a(this.b.getWorldData())).a(abiomebase[0]); + +- worldchunkmanager = biomelayout.a((BiomeLayoutConfiguration) biomelayoutfixedconfiguration2); ++ worldchunkmanager = biomelayout.a(biomelayoutfixedconfiguration2); // CraftBukkit - decompile error + } + + if (BiomeLayout.a == biomelayout3) { + int j = jsonobject2.has("size") ? jsonobject2.getAsJsonPrimitive("size").getAsInt() : 2; + BiomeLayoutCheckerboardConfiguration biomelayoutcheckerboardconfiguration = ((BiomeLayoutCheckerboardConfiguration) biomelayout2.a(this.b.getWorldData())).a(abiomebase).a(j); + +- worldchunkmanager = biomelayout2.a((BiomeLayoutConfiguration) biomelayoutcheckerboardconfiguration); ++ worldchunkmanager = biomelayout2.a(biomelayoutcheckerboardconfiguration); // CraftBukkit - decompile error + } + + if (BiomeLayout.c == biomelayout3) { + BiomeLayoutOverworldConfiguration biomelayoutoverworldconfiguration1 = (BiomeLayoutOverworldConfiguration) biomelayout1.a(this.b.getWorldData()); + +- worldchunkmanager = biomelayout1.a((BiomeLayoutConfiguration) biomelayoutoverworldconfiguration1); ++ worldchunkmanager = biomelayout1.a(biomelayoutoverworldconfiguration1); // CraftBukkit - decompile error + } + } + + if (worldchunkmanager == null) { +- worldchunkmanager = biomelayout.a((BiomeLayoutConfiguration) ((BiomeLayoutFixedConfiguration) biomelayout.a(this.b.getWorldData())).a(Biomes.OCEAN)); ++ worldchunkmanager = biomelayout.a(((BiomeLayoutFixedConfiguration) biomelayout.a(this.b.getWorldData())).a(Biomes.OCEAN)); // CraftBukkit - decompile error + } + + IBlockData iblockdata = Blocks.STONE.getBlockData(); diff --git a/nms-patches/WorldProviderTheEnd.patch b/nms-patches/WorldProviderTheEnd.patch index b9fae43a63..5a3102fc38 100644 --- a/nms-patches/WorldProviderTheEnd.patch +++ b/nms-patches/WorldProviderTheEnd.patch @@ -14,4 +14,4 @@ + // CraftBukkit end @Override - public void k() { + public void i() { diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index d4928da948..53cd12e9d5 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 -@@ -34,6 +34,16 @@ +@@ -36,6 +36,16 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -17,7 +17,7 @@ public class WorldServer extends World { private static final Logger LOGGER = LogManager.getLogger(); -@@ -58,12 +68,29 @@ +@@ -60,12 +70,29 @@ @Nullable private final MobSpawnerTrader mobSpawnerTrader; @@ -50,7 +50,7 @@ this.nextTickListBlock = new TickListServer<>(this, (block) -> { return block == null || block.getBlockData().isAir(); }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b); -@@ -85,9 +112,44 @@ +@@ -87,9 +114,44 @@ this.getWorldData().setGameType(minecraftserver.getGamemode()); } @@ -70,7 +70,7 @@ + Block type = getType(pos).getBlock(); + + if (result != null && type != Blocks.AIR) { -+ if (!result.q().a(type)) { ++ if (!result.getTileType().isValidBlock(type)) { + result = fixTileEntity(pos, type, result); + } + } @@ -93,10 +93,10 @@ + } + // CraftBukkit end + - public void doTick(BooleanSupplier booleansupplier) { - GameProfilerFiller gameprofilerfiller = this.getMethodProfiler(); - -@@ -162,6 +224,7 @@ + @Override + public BiomeBase a(int i, int j, int k) { + return this.getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(i, j, k); +@@ -169,6 +231,7 @@ this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F); } @@ -104,7 +104,7 @@ if (this.lastRainLevel != this.rainLevel) { this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.rainLevel)), this.worldProvider.getDimensionManager()); } -@@ -180,13 +243,34 @@ +@@ -187,13 +250,34 @@ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.rainLevel)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.thunderLevel)); } @@ -140,8 +140,8 @@ })) { this.C = false; if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { -@@ -225,7 +309,7 @@ - this.ae(); +@@ -228,7 +312,7 @@ + this.ad(); this.ticking = false; gameprofilerfiller.exitEnter("entities"); - boolean flag3 = !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty(); @@ -149,7 +149,7 @@ if (flag3) { this.resetEmptyTime(); -@@ -239,6 +323,11 @@ +@@ -242,6 +326,11 @@ for (i = 0; i < this.globalEntityList.size(); ++i) { entity = (Entity) this.globalEntityList.get(i); @@ -161,7 +161,7 @@ this.a((entity1) -> { ++entity1.ticksLived; entity1.tick(); -@@ -257,6 +346,7 @@ +@@ -260,6 +349,7 @@ Entity entity1 = (Entity) entry.getValue(); Entity entity2 = entity1.getVehicle(); @@ -169,15 +169,24 @@ if (!this.server.getSpawnAnimals() && (entity1 instanceof EntityAnimal || entity1 instanceof EntityWaterAnimal)) { entity1.die(); } -@@ -264,6 +354,7 @@ +@@ -267,6 +357,7 @@ if (!this.server.getSpawnNPCs() && entity1 instanceof NPC) { entity1.die(); } + // CraftBukkit end */ - if (entity2 != null) { - if (!entity2.dead && entity2.w(entity1)) { -@@ -324,10 +415,10 @@ + gameprofilerfiller.enter("checkDespawn"); + if (!entity1.dead) { +@@ -312,7 +403,7 @@ + } + + private void ab() { +- ((List) this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> { ++ (this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> { // CraftBukkit - decompile error + entityplayer.wakeup(false, false); + }); + } +@@ -339,10 +430,10 @@ entityhorseskeleton.r(true); entityhorseskeleton.setAgeRaw(0); entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); @@ -190,7 +199,7 @@ } } -@@ -338,11 +429,11 @@ +@@ -353,11 +444,11 @@ BiomeBase biomebase = this.getBiome(blockposition); if (biomebase.a((IWorldReader) this, blockposition1)) { @@ -203,8 +212,8 @@ + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.getBlockData(), null); // CraftBukkit } - if (flag && this.getBiome(blockposition1).b() == BiomeBase.Precipitation.RAIN) { -@@ -389,7 +480,7 @@ + if (flag && this.getBiome(blockposition1).d() == BiomeBase.Precipitation.RAIN) { +@@ -404,7 +495,7 @@ protected BlockPosition a(BlockPosition blockposition) { BlockPosition blockposition1 = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, blockposition); AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockposition1, new BlockPosition(blockposition1.getX(), this.getBuildHeight(), blockposition1.getZ()))).g(3.0D); @@ -213,7 +222,7 @@ return entityliving != null && entityliving.isAlive() && this.f(entityliving.getChunkCoordinates()); }); -@@ -418,7 +509,7 @@ +@@ -433,7 +524,7 @@ while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); @@ -222,7 +231,7 @@ ++i; } else if (entityplayer.isSleeping()) { ++j; -@@ -436,10 +527,22 @@ +@@ -451,10 +542,22 @@ } private void clearWeather() { @@ -247,7 +256,7 @@ } public void resetEmptyTime() { -@@ -477,6 +580,7 @@ +@@ -490,6 +593,7 @@ return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType()).toString(); }); entity.tick(); @@ -255,8 +264,8 @@ this.getMethodProfiler().exit(); } -@@ -562,6 +666,22 @@ - BlockPosition blockposition = worldchunkmanager.a(0, 0, 256, list, random); +@@ -573,6 +677,22 @@ + BlockPosition blockposition = worldchunkmanager.a(0, this.getSeaLevel(), 0, 256, list, random); ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); + // CraftBukkit start @@ -278,7 +287,16 @@ if (blockposition == null) { WorldServer.LOGGER.warn("Unable to find spawn biome"); } -@@ -637,6 +757,7 @@ +@@ -625,7 +745,7 @@ + } + + protected void g() { +- WorldGenFeatureConfigured worldgenfeatureconfigured = WorldGenerator.BONUS_CHEST.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.e); ++ WorldGenFeatureConfigured worldgenfeatureconfigured = WorldGenerator.BONUS_CHEST.b(WorldGenFeatureConfiguration.e); // CraftBukkit - decompile error + + worldgenfeatureconfigured.a(this, this.getChunkProvider().getChunkGenerator(), this.random, new BlockPosition(this.worldData.b(), this.worldData.c(), this.worldData.d())); + } +@@ -639,6 +759,7 @@ ChunkProviderServer chunkproviderserver = this.getChunkProvider(); if (!flag1) { @@ -286,24 +304,23 @@ if (iprogressupdate != null) { iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0])); } -@@ -648,6 +769,16 @@ +@@ -650,6 +771,15 @@ chunkproviderserver.save(flag); } + + // CraftBukkit start - moved from MinecraftServer.saveChunks -+ // PAIL - rename + WorldServer worldserver1 = this; + WorldData worlddata = worldserver1.getWorldData(); + -+ worldserver1.getWorldBorder().a(worlddata); -+ worlddata.c(this.server.getBossBattleCustomData().c()); -+ worldserver1.getDataManager().saveWorldData(worlddata, this.server.getPlayerList().r()); ++ worldserver1.getWorldBorder().save(worlddata); ++ worlddata.setCustomBossEvents(this.server.getBossBattleCustomData().save()); ++ worldserver1.getDataManager().saveWorldData(worlddata, this.server.getPlayerList().save()); + // CraftBukkit end } - protected void k_() throws ExceptionWorldConflict { -@@ -719,7 +850,8 @@ + protected void m_() throws ExceptionWorldConflict { +@@ -721,7 +851,8 @@ if (entity instanceof EntityInsentient) { EntityInsentient entityinsentient = (EntityInsentient) entity; @@ -313,7 +330,7 @@ continue; } } -@@ -736,11 +868,24 @@ +@@ -738,11 +869,24 @@ @Override public boolean addEntity(Entity entity) { @@ -340,7 +357,7 @@ } public void addEntityTeleport(Entity entity) { -@@ -790,13 +935,18 @@ +@@ -792,13 +936,18 @@ this.registerEntity(entityplayer); } @@ -358,10 +375,10 @@ + return false; + } + // CraftBukkit end - IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX / 16.0D), MathHelper.floor(entity.locZ / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer); + IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer); if (!(ichunkaccess instanceof Chunk)) { -@@ -824,7 +974,7 @@ +@@ -826,7 +975,7 @@ if (entity1 == null) { return false; } else { @@ -370,42 +387,42 @@ return true; } } -@@ -875,10 +1025,17 @@ +@@ -877,10 +1026,17 @@ } this.getScoreboard().a(entity); + // CraftBukkit start - SPIGOT-5278 + if (entity instanceof EntityDrowned) { -+ this.H.remove(((EntityDrowned) entity).b); -+ this.H.remove(((EntityDrowned) entity).c); ++ this.navigators.remove(((EntityDrowned) entity).navigationWater); ++ this.navigators.remove(((EntityDrowned) entity).navigationLand); + } else + // CraftBukkit end if (entity instanceof EntityInsentient) { - this.H.remove(((EntityInsentient) entity).getNavigation()); + this.navigators.remove(((EntityInsentient) entity).getNavigation()); } + entity.valid = false; // CraftBukkit } private void registerEntity(Entity entity) { -@@ -899,9 +1056,16 @@ +@@ -901,9 +1057,16 @@ this.entitiesByUUID.put(entity.getUniqueID(), entity); this.getChunkProvider().addEntity(entity); + // CraftBukkit start - SPIGOT-5278 + if (entity instanceof EntityDrowned) { -+ this.H.add(((EntityDrowned) entity).b); -+ this.H.add(((EntityDrowned) entity).c); ++ this.navigators.add(((EntityDrowned) entity).navigationWater); ++ this.navigators.add(((EntityDrowned) entity).navigationLand); + } else + // CraftBukkit end if (entity instanceof EntityInsentient) { - this.H.add(((EntityInsentient) entity).getNavigation()); + this.navigators.add(((EntityInsentient) entity).getNavigation()); } + entity.valid = true; // CraftBukkit } } -@@ -932,6 +1096,18 @@ +@@ -934,6 +1097,18 @@ } public void strikeLightning(EntityLightning entitylightning) { @@ -422,9 +439,9 @@ + } + // CraftBukkit end this.globalEntityList.add(entitylightning); - this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning)); + this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning)); } -@@ -940,6 +1116,12 @@ +@@ -942,6 +1117,12 @@ public void a(int i, BlockPosition blockposition, int j) { Iterator iterator = this.server.getPlayerList().getPlayers().iterator(); @@ -437,9 +454,9 @@ while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); -@@ -948,6 +1130,12 @@ - double d1 = (double) blockposition.getY() - entityplayer.locY; - double d2 = (double) blockposition.getZ() - entityplayer.locZ; +@@ -950,6 +1131,12 @@ + double d1 = (double) blockposition.getY() - entityplayer.locY(); + double d2 = (double) blockposition.getZ() - entityplayer.locZ(); + // CraftBukkit start + if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) { @@ -450,10 +467,10 @@ if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); } -@@ -1008,6 +1196,14 @@ +@@ -1010,6 +1197,14 @@ @Override - public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) { + public Explosion createExplosion(@Nullable Entity entity, @Nullable DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) { + // CraftBukkit start + Explosion explosion = super.createExplosion(entity, damagesource, d0, d1, d2, f, flag, explosion_effect); + @@ -465,7 +482,7 @@ Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, explosion_effect); if (damagesource != null) { -@@ -1016,6 +1212,8 @@ +@@ -1018,6 +1213,8 @@ explosion.a(); explosion.a(false); @@ -474,17 +491,17 @@ if (explosion_effect == Explosion.Effect.NONE) { explosion.clearBlocks(); } -@@ -1080,13 +1278,20 @@ +@@ -1082,13 +1279,20 @@ } public int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { -- PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, false, (float) d0, (float) d1, (float) d2, (float) d3, (float) d4, (float) d5, (float) d6, i); +- PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, false, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i); + // CraftBukkit - visibility api support + return sendParticles(null, t0, d0, d1, d2, i, d3, d4, d5, d6, false); + } + + public int sendParticles(EntityPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { -+ PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, force, (float) d0, (float) d1, (float) d2, (float) d3, (float) d4, (float) d5, (float) d6, i); ++ PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, force, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i); + // CraftBukkit end int j = 0; @@ -497,7 +514,7 @@ ++j; } } -@@ -1169,7 +1374,13 @@ +@@ -1170,7 +1374,13 @@ @Override public WorldMap a(String s) { return (WorldMap) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().b(() -> { diff --git a/nms-patches/WorldUpgrader.patch b/nms-patches/WorldUpgrader.patch index a6d80b3113..38e8c64796 100644 --- a/nms-patches/WorldUpgrader.patch +++ b/nms-patches/WorldUpgrader.patch @@ -6,6 +6,6 @@ return this.q; - }, nbttagcompound); + }, nbttagcompound, chunkcoordintpair, null); // CraftBukkit - boolean flag2 = j < SharedConstants.a().getWorldVersion(); + NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompound("Level"); + ChunkCoordIntPair chunkcoordintpair1 = new ChunkCoordIntPair(nbttagcompound2.getInt("xPos"), nbttagcompound2.getInt("zPos")); - if (this.d) { diff --git a/pom.xml b/pom.xml index 98406afa98..bd679d38d6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.bukkit craftbukkit jar - 1.14.4-R0.1-SNAPSHOT + 1.15-R0.1-SNAPSHOT CraftBukkit https://www.spigotmc.org/ @@ -12,8 +12,8 @@ true UTF-8 unknown - 1.14.4 - 1_14_R1 + 1.15 + 1_15_R1 git-Bukkit- yyyyMMdd-HHmm @@ -43,7 +43,7 @@ org.ow2.asm asm - 7.1 + 7.2 compile @@ -62,7 +62,7 @@ mysql mysql-connector-java - 5.1.47 + 5.1.48 runtime @@ -160,7 +160,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.1.1 + 3.2.1 package @@ -225,7 +225,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.8.1 eclipse @@ -271,7 +271,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.0.0 + 3.1.0 process-classes @@ -288,14 +288,14 @@ com.puppycrawl.tools checkstyle - 8.19 + 8.27 org.codehaus.mojo animal-sniffer-maven-plugin - 1.17 + 1.18 process-classes diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 2f8a399cc1..e423bc8e7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -203,14 +203,14 @@ public class CraftChunk implements Chunk { @Override public long getInhabitedTime() { - return getHandle().q(); + return getHandle().getInhabitedTime(); } @Override public void setInhabitedTime(long ticks) { Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative"); - getHandle().b(ticks); + getHandle().setInhabitedTime(ticks); } @Override @@ -219,7 +219,7 @@ public class CraftChunk implements Chunk { IBlockData nms = ((CraftBlockData) block).getState(); for (ChunkSection section : getHandle().getSections()) { - if (section != null && section.getBlocks().a(nms)) { + if (section != null && section.getBlocks().contains(nms)) { return true; } } @@ -291,7 +291,7 @@ public class CraftChunk implements Chunk { if (includeBiome) { biome = new BiomeBase[256]; for (int i = 0; i < 256; i++) { - biome[i] = chunk.getBiome(new BlockPosition(i & 0xF, 0, i >> 4)); + biome[i] = chunk.getBiomeIndex().getBiome(i & 0xF, 0, i >> 4); } } @@ -351,11 +351,10 @@ public class CraftChunk implements Chunk { } private static float[] getTemperatures(WorldChunkManager chunkmanager, int chunkX, int chunkZ) { - BiomeBase[] biomes = chunkmanager.getBiomeBlock(chunkX, chunkZ, 16, 16); - float[] temps = new float[biomes.length]; + float[] temps = new float[256]; - for (int i = 0; i < biomes.length; i++) { - float temp = biomes[i].getTemperature(); // Vanilla of olde: ((int) biomes[i].temperature * 65536.0F) / 65536.0F + for (int i = 0; i < 256; i++) { + float temp = chunkmanager.getBiome((chunkX << 4) + (i & 0xF), 0, (chunkZ << 4) + (i >> 4)).getTemperature(); // Vanilla of olde: ((int) biomes[i].temperature * 65536.0F) / 65536.0F if (temp > 1F) { temp = 1F; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java index 8cf0502af0..2e5d457f8c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java @@ -64,7 +64,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { IBlockData nms = ((CraftBlockData) block).getState(); for (DataPaletteBlock palette : blockids) { - if (palette.a(nms)) { + if (palette.contains(nms)) { return true; } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java index 0064d93274..90b227cce1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java @@ -74,7 +74,7 @@ public class CraftLootTable implements org.bukkit.loot.LootTable { WorldServer handle = ((CraftWorld) loc.getWorld()).getHandle(); LootTableInfo.Builder builder = new LootTableInfo.Builder(handle); - if (getHandle() != LootTable.a) { // PAIL - empty + if (getHandle() != LootTable.EMPTY) { // builder.luck(context.getLuck()); if (context.getLootedEntity() != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftParticle.java b/src/main/java/org/bukkit/craftbukkit/CraftParticle.java index 99377033b8..65c1492c38 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftParticle.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftParticle.java @@ -84,6 +84,10 @@ public enum CraftParticle { FALLING_LAVA("falling_lava"), LANDING_LAVA("landing_lava"), FALLING_WATER("falling_water"), + DRIPPING_HONEY("dripping_honey"), + FALLING_HONEY("falling_honey"), + LANDING_HONEY("landing_honey"), + FALLING_NECTAR("falling_nectar"), // ----- Legacy Separator ----- LEGACY_BLOCK_CRACK("block"), LEGACY_BLOCK_DUST("block"), diff --git a/src/main/java/org/bukkit/craftbukkit/CraftProfileBanList.java b/src/main/java/org/bukkit/craftbukkit/CraftProfileBanList.java index 3938d920b8..d35b600de7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftProfileBanList.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftProfileBanList.java @@ -104,6 +104,6 @@ public class CraftProfileBanList implements org.bukkit.BanList { // } - return (uuid != null) ? MinecraftServer.getServer().getUserCache().a(uuid) : MinecraftServer.getServer().getUserCache().getProfile(target); + return (uuid != null) ? MinecraftServer.getServer().getUserCache().getProfile(uuid) : MinecraftServer.getServer().getUserCache().getProfile(target); } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRaid.java b/src/main/java/org/bukkit/craftbukkit/CraftRaid.java index d17cdcb1d3..df40138f10 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRaid.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRaid.java @@ -24,40 +24,40 @@ public final class CraftRaid implements Raid { @Override public boolean isStarted() { - return handle.j(); // PAIL rename isStarted + return handle.isStarted(); } @Override public long getActiveTicks() { - return handle.i; + return handle.ticksActive; } @Override public int getBadOmenLevel() { - return handle.o; + return handle.badOmenLevel; } @Override public void setBadOmenLevel(int badOmenLevel) { - int max = handle.l(); // PAIL rename getMaxBadOmenLevel + int max = handle.getMaxBadOmenLevel(); Preconditions.checkArgument(0 <= badOmenLevel && badOmenLevel <= max, "Bad Omen level must be between 0 and %s", max); - handle.o = badOmenLevel; + handle.badOmenLevel = badOmenLevel; } @Override public Location getLocation() { - BlockPosition pos = handle.t(); // PAIL rename getCenterLocation - World world = handle.i(); // PAIL rename getWorld + BlockPosition pos = handle.getCenter(); + World world = handle.getWorld(); return new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()); } @Override public RaidStatus getStatus() { - if (handle.d()) { // PAIL rename isStopped + if (handle.isStopped()) { return RaidStatus.STOPPED; - } else if (handle.e()) { // PAIL rename isVictory + } else if (handle.isVictory()) { return RaidStatus.VICTORY; - } else if (handle.f()) { // PAIL rename isLoss + } else if (handle.isLoss()) { return RaidStatus.LOSS; } else { return RaidStatus.ONGOING; @@ -66,27 +66,27 @@ public final class CraftRaid implements Raid { @Override public int getSpawnedGroups() { - return handle.k(); // PAIL rename countSpawnedGroups + return handle.getGroupsSpawned(); } @Override public int getTotalGroups() { - return handle.v + (handle.o > 1 ? 1 : 0); + return handle.numGroups + (handle.badOmenLevel > 1 ? 1 : 0); } @Override public int getTotalWaves() { - return handle.v; + return handle.numGroups; } @Override public float getTotalHealth() { - return handle.q(); // PAIL rename sumMobHealth + return handle.sumMobHealth(); } @Override public Set getHeroes() { - return Collections.unmodifiableSet(handle.h); + return Collections.unmodifiableSet(handle.heroes); } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index ef62a9ffe6..87d0ab609f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -161,6 +161,7 @@ import org.bukkit.generator.ChunkGenerator; import org.bukkit.help.HelpMap; import org.bukkit.inventory.BlastingRecipe; import org.bukkit.inventory.CampfireRecipe; +import org.bukkit.inventory.ComplexRecipe; import org.bukkit.inventory.FurnaceRecipe; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; @@ -928,7 +929,7 @@ public final class CraftServer implements Server { } DimensionManager actualDimension = DimensionManager.a(creator.environment().getId()); - DimensionManager internalDimension = DimensionManager.register(name.toLowerCase(java.util.Locale.ENGLISH), new DimensionManager(dimension, actualDimension.getSuffix(), actualDimension.folder, (w, manager) -> actualDimension.providerFactory.apply(w, manager), actualDimension.hasSkyLight(), actualDimension)); + DimensionManager internalDimension = DimensionManager.register(name.toLowerCase(java.util.Locale.ENGLISH), new DimensionManager(dimension, actualDimension.getSuffix(), actualDimension.folder, (w, manager) -> actualDimension.providerFactory.apply(w, manager), actualDimension.hasSkyLight(), actualDimension.getGenLayerZoomer(), actualDimension)); WorldServer internal = (WorldServer) new WorldServer(console, console.executorService, sdm, worlddata, internalDimension, console.getMethodProfiler(), getServer().worldLoadListenerFactory.create(11), creator.environment(), generator); if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) { @@ -1072,6 +1073,8 @@ public final class CraftServer implements Server { toAdd = CraftSmokingRecipe.fromBukkitRecipe((SmokingRecipe) recipe); } else if (recipe instanceof StonecuttingRecipe) { toAdd = CraftStonecuttingRecipe.fromBukkitRecipe((StonecuttingRecipe) recipe); + } else if (recipe instanceof ComplexRecipe) { + throw new UnsupportedOperationException("Cannot add custom complex recipe"); } else { return false; } @@ -1778,7 +1781,7 @@ public final class CraftServer implements Server { @Override public Iterator advancementIterator() { - return Iterators.unmodifiableIterator(Iterators.transform(console.getAdvancementData().a().iterator(), new Function() { // PAIL: rename + return Iterators.unmodifiableIterator(Iterators.transform(console.getAdvancementData().getAdvancements().iterator(), new Function() { @Override public org.bukkit.advancement.Advancement apply(Advancement advancement) { return advancement.bukkit; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java index 73cb64e09d..90fdf89c81 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java @@ -38,6 +38,11 @@ public enum CraftSound { BLOCK_BEACON_AMBIENT("block.beacon.ambient"), BLOCK_BEACON_DEACTIVATE("block.beacon.deactivate"), BLOCK_BEACON_POWER_SELECT("block.beacon.power_select"), + BLOCK_BEEHIVE_DRIP("block.beehive.drip"), + BLOCK_BEEHIVE_ENTER("block.beehive.enter"), + BLOCK_BEEHIVE_EXIT("block.beehive.exit"), + BLOCK_BEEHIVE_SHEAR("block.beehive.shear"), + BLOCK_BEEHIVE_WORK("block.beehive.work"), BLOCK_BELL_RESONATE("block.bell.resonate"), BLOCK_BELL_USE("block.bell.use"), BLOCK_BLASTFURNACE_FIRE_CRACKLE("block.blastfurnace.fire_crackle"), @@ -99,6 +104,12 @@ public enum CraftSound { BLOCK_GRAVEL_PLACE("block.gravel.place"), BLOCK_GRAVEL_STEP("block.gravel.step"), BLOCK_GRINDSTONE_USE("block.grindstone.use"), + BLOCK_HONEY_BLOCK_BREAK("block.honey_block.break"), + BLOCK_HONEY_BLOCK_FALL("block.honey_block.fall"), + BLOCK_HONEY_BLOCK_HIT("block.honey_block.hit"), + BLOCK_HONEY_BLOCK_PLACE("block.honey_block.place"), + BLOCK_HONEY_BLOCK_SLIDE("block.honey_block.slide"), + BLOCK_HONEY_BLOCK_STEP("block.honey_block.step"), BLOCK_IRON_DOOR_CLOSE("block.iron_door.close"), BLOCK_IRON_DOOR_OPEN("block.iron_door.open"), BLOCK_IRON_TRAPDOOR_CLOSE("block.iron_trapdoor.close"), @@ -224,6 +235,12 @@ public enum CraftSound { ENTITY_BAT_HURT("entity.bat.hurt"), ENTITY_BAT_LOOP("entity.bat.loop"), ENTITY_BAT_TAKEOFF("entity.bat.takeoff"), + ENTITY_BEE_DEATH("entity.bee.death"), + ENTITY_BEE_HURT("entity.bee.hurt"), + ENTITY_BEE_LOOP("entity.bee.loop"), + ENTITY_BEE_LOOP_AGGRESSIVE("entity.bee.loop_aggressive"), + ENTITY_BEE_POLLINATE("entity.bee.pollinate"), + ENTITY_BEE_STING("entity.bee.sting"), ENTITY_BLAZE_AMBIENT("entity.blaze.ambient"), ENTITY_BLAZE_BURN("entity.blaze.burn"), ENTITY_BLAZE_DEATH("entity.blaze.death"), @@ -400,8 +417,10 @@ public enum CraftSound { ENTITY_ILLUSIONER_PREPARE_BLINDNESS("entity.illusioner.prepare_blindness"), ENTITY_ILLUSIONER_PREPARE_MIRROR("entity.illusioner.prepare_mirror"), ENTITY_IRON_GOLEM_ATTACK("entity.iron_golem.attack"), + ENTITY_IRON_GOLEM_DAMAGE("entity.iron_golem.damage"), ENTITY_IRON_GOLEM_DEATH("entity.iron_golem.death"), ENTITY_IRON_GOLEM_HURT("entity.iron_golem.hurt"), + ENTITY_IRON_GOLEM_REPAIR("entity.iron_golem.repair"), ENTITY_IRON_GOLEM_STEP("entity.iron_golem.step"), ENTITY_ITEM_BREAK("entity.item.break"), ENTITY_ITEM_FRAME_ADD_ITEM("entity.item_frame.add_item"), @@ -467,7 +486,6 @@ public enum CraftSound { ENTITY_PARROT_IMITATE_CREEPER("entity.parrot.imitate.creeper"), ENTITY_PARROT_IMITATE_DROWNED("entity.parrot.imitate.drowned"), ENTITY_PARROT_IMITATE_ELDER_GUARDIAN("entity.parrot.imitate.elder_guardian"), - ENTITY_PARROT_IMITATE_ENDERMAN("entity.parrot.imitate.enderman"), ENTITY_PARROT_IMITATE_ENDERMITE("entity.parrot.imitate.endermite"), ENTITY_PARROT_IMITATE_ENDER_DRAGON("entity.parrot.imitate.ender_dragon"), ENTITY_PARROT_IMITATE_EVOKER("entity.parrot.imitate.evoker"), @@ -476,10 +494,8 @@ public enum CraftSound { ENTITY_PARROT_IMITATE_HUSK("entity.parrot.imitate.husk"), ENTITY_PARROT_IMITATE_ILLUSIONER("entity.parrot.imitate.illusioner"), ENTITY_PARROT_IMITATE_MAGMA_CUBE("entity.parrot.imitate.magma_cube"), - ENTITY_PARROT_IMITATE_PANDA("entity.parrot.imitate.panda"), ENTITY_PARROT_IMITATE_PHANTOM("entity.parrot.imitate.phantom"), ENTITY_PARROT_IMITATE_PILLAGER("entity.parrot.imitate.pillager"), - ENTITY_PARROT_IMITATE_POLAR_BEAR("entity.parrot.imitate.polar_bear"), ENTITY_PARROT_IMITATE_RAVAGER("entity.parrot.imitate.ravager"), ENTITY_PARROT_IMITATE_SHULKER("entity.parrot.imitate.shulker"), ENTITY_PARROT_IMITATE_SILVERFISH("entity.parrot.imitate.silverfish"), @@ -492,9 +508,7 @@ public enum CraftSound { ENTITY_PARROT_IMITATE_WITCH("entity.parrot.imitate.witch"), ENTITY_PARROT_IMITATE_WITHER("entity.parrot.imitate.wither"), ENTITY_PARROT_IMITATE_WITHER_SKELETON("entity.parrot.imitate.wither_skeleton"), - ENTITY_PARROT_IMITATE_WOLF("entity.parrot.imitate.wolf"), ENTITY_PARROT_IMITATE_ZOMBIE("entity.parrot.imitate.zombie"), - ENTITY_PARROT_IMITATE_ZOMBIE_PIGMAN("entity.parrot.imitate.zombie_pigman"), ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER("entity.parrot.imitate.zombie_villager"), ENTITY_PARROT_STEP("entity.parrot.step"), ENTITY_PHANTOM_AMBIENT("entity.phantom.ambient"), @@ -759,6 +773,7 @@ public enum CraftSound { ITEM_FIRECHARGE_USE("item.firecharge.use"), ITEM_FLINTANDSTEEL_USE("item.flintandsteel.use"), ITEM_HOE_TILL("item.hoe.till"), + ITEM_HONEY_BOTTLE_DRINK("item.honey_bottle.drink"), ITEM_NETHER_WART_PLANT("item.nether_wart.plant"), ITEM_SHIELD_BLOCK("item.shield.block"), ITEM_SHIELD_BREAK("item.shield.break"), diff --git a/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java b/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java index 4536b70dc0..50524e286c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java @@ -91,7 +91,9 @@ public enum CraftStatistic { INTERACT_WITH_STONECUTTER(StatisticList.INTERACT_WITH_STONECUTTER), BELL_RING(StatisticList.BELL_RING), RAID_TRIGGER(StatisticList.RAID_TRIGGER), - RAID_WIN(StatisticList.RAID_WIN); + RAID_WIN(StatisticList.RAID_WIN), + INTERACT_WITH_ANVIL(StatisticList.INTERACT_WITH_ANVIL), + INTERACT_WITH_GRINDSTONE(StatisticList.INTERACT_WITH_GRINDSTONE); private final MinecraftKey minecraftKey; private final org.bukkit.Statistic bukkit; private static final BiMap statistics; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 3c3da751ae..0602970d95 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -21,9 +21,10 @@ import java.util.UUID; import java.util.function.Predicate; import java.util.stream.Collectors; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; -import it.unimi.dsi.fastutil.objects.ObjectSortedSet; +import net.minecraft.server.ArraySetSorted; import net.minecraft.server.AxisAlignedBB; import net.minecraft.server.BiomeBase; +import net.minecraft.server.BiomeDecoratorGroups; import net.minecraft.server.BlockChorusFlower; import net.minecraft.server.BlockDiodeAbstract; import net.minecraft.server.BlockPosition; @@ -88,7 +89,6 @@ import net.minecraft.server.TicketType; import net.minecraft.server.Unit; import net.minecraft.server.Vec3D; import net.minecraft.server.WorldGenFeatureEmptyConfiguration; -import net.minecraft.server.WorldGenHugeMushroomConfiguration; import net.minecraft.server.WorldGenerator; import net.minecraft.server.WorldServer; import org.apache.commons.lang.Validate; @@ -133,6 +133,7 @@ import org.bukkit.entity.AreaEffectCloud; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Arrow; import org.bukkit.entity.Bat; +import org.bukkit.entity.Bee; import org.bukkit.entity.Blaze; import org.bukkit.entity.Boat; import org.bukkit.entity.Cat; @@ -345,7 +346,7 @@ public class CraftWorld implements World { @Override public boolean isChunkGenerated(int x, int z) { try { - return isChunkLoaded(x, z) || world.getChunkProvider().playerChunkMap.chunkExists(new ChunkCoordIntPair(x, z)); + return isChunkLoaded(x, z) || world.getChunkProvider().playerChunkMap.read(new ChunkCoordIntPair(x, z)) != null; } catch (IOException ex) { throw new RuntimeException(ex); } @@ -514,7 +515,7 @@ public class CraftWorld implements World { @Override public Collection getPluginChunkTickets(int x, int z) { ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager; - ObjectSortedSet> tickets = chunkDistanceManager.tickets.get(ChunkCoordIntPair.pair(x, z)); + ArraySetSorted> tickets = chunkDistanceManager.tickets.get(ChunkCoordIntPair.pair(x, z)); if (tickets == null) { return Collections.emptyList(); @@ -535,9 +536,9 @@ public class CraftWorld implements World { Map> ret = new HashMap<>(); ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager; - for (Long2ObjectMap.Entry>> chunkTickets : chunkDistanceManager.tickets.long2ObjectEntrySet()) { + for (Long2ObjectMap.Entry>> chunkTickets : chunkDistanceManager.tickets.long2ObjectEntrySet()) { long chunkKey = chunkTickets.getLongKey(); - ObjectSortedSet> tickets = chunkTickets.getValue(); + ArraySetSorted> tickets = chunkTickets.getValue(); Chunk chunk = null; for (Ticket ticket : tickets) { @@ -657,54 +658,67 @@ public class CraftWorld implements World { BlockPosition pos = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); net.minecraft.server.WorldGenerator gen; - net.minecraft.server.WorldGenFeatureConfiguration conf = new WorldGenFeatureEmptyConfiguration(); + net.minecraft.server.WorldGenFeatureConfiguration conf; switch (type) { - case BIG_TREE: + case BIG_TREE: gen = WorldGenerator.FANCY_TREE; + conf = BiomeDecoratorGroups.FANCY_TREE; break; case BIRCH: - gen = WorldGenerator.BIRCH_TREE; + gen = WorldGenerator.NORMAL_TREE; + conf = BiomeDecoratorGroups.BIRCH_TREE; break; case REDWOOD: - gen = WorldGenerator.SPRUCE_TREE; + gen = WorldGenerator.NORMAL_TREE; + conf = BiomeDecoratorGroups.SPRUCE_TREE; break; case TALL_REDWOOD: - gen = WorldGenerator.PINE_TREE; + gen = WorldGenerator.NORMAL_TREE; + conf = BiomeDecoratorGroups.PINE_TREE; break; case JUNGLE: gen = WorldGenerator.MEGA_JUNGLE_TREE; + conf = BiomeDecoratorGroups.MEGA_JUNGLE_TREE; break; case SMALL_JUNGLE: - gen = WorldGenerator.JUNGLE_TREE; + gen = WorldGenerator.NORMAL_TREE; + conf = BiomeDecoratorGroups.JUNGLE_TREE_NOVINE; break; case COCOA_TREE: - gen = WorldGenerator.MEGA_JUNGLE_TREE; + gen = WorldGenerator.NORMAL_TREE; + conf = BiomeDecoratorGroups.JUNGLE_TREE; break; case JUNGLE_BUSH: gen = WorldGenerator.JUNGLE_GROUND_BUSH; + conf = BiomeDecoratorGroups.JUNGLE_BUSH; break; case RED_MUSHROOM: gen = WorldGenerator.HUGE_RED_MUSHROOM; - conf = new WorldGenHugeMushroomConfiguration(true); + conf = BiomeDecoratorGroups.HUGE_RED_MUSHROOM; break; case BROWN_MUSHROOM: gen = WorldGenerator.HUGE_BROWN_MUSHROOM; - conf = new WorldGenHugeMushroomConfiguration(true); + conf = BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM; break; case SWAMP: - gen = WorldGenerator.SWAMP_TREE; + gen = WorldGenerator.NORMAL_TREE; + conf = BiomeDecoratorGroups.SWAMP_TREE; break; case ACACIA: - gen = WorldGenerator.SAVANNA_TREE; + gen = WorldGenerator.ACACIA_TREE; + conf = BiomeDecoratorGroups.ACACIA_TREE; break; case DARK_OAK: gen = WorldGenerator.DARK_OAK_TREE; + conf = BiomeDecoratorGroups.DARK_OAK_TREE; break; case MEGA_REDWOOD: - gen = WorldGenerator.MEGA_PINE_TREE; + gen = WorldGenerator.MEGA_SPRUCE_TREE; + conf = BiomeDecoratorGroups.MEGA_PINE_TREE; break; case TALL_BIRCH: - gen = WorldGenerator.SUPER_BIRCH_TREE; + gen = WorldGenerator.NORMAL_TREE; + conf = BiomeDecoratorGroups.TALL_BIRCH_TREE; break; case CHORUS_PLANT: ((BlockChorusFlower) Blocks.CHORUS_FLOWER).a(world, pos, rand, 8); @@ -712,6 +726,7 @@ public class CraftWorld implements World { case TREE: default: gen = WorldGenerator.NORMAL_TREE; + conf = BiomeDecoratorGroups.NORMAL_TREE; break; } @@ -889,8 +904,7 @@ public class CraftWorld implements World { net.minecraft.server.Chunk chunk = this.world.getChunkAtWorldCoords(new BlockPosition(x, 0, z)); if (chunk != null) { - BiomeBase[] biomevals = chunk.getBiomeIndex(); - biomevals[((z & 0xF) << 4) | (x & 0xF)] = bb; + chunk.getBiomeIndex().setBiome(x, 0, z, bb); chunk.markDirty(); // SPIGOT-2890 } @@ -1620,6 +1634,8 @@ public class CraftWorld implements World { entity = EntityTypes.PANDA.a(world); } else if (Fox.class.isAssignableFrom(clazz)) { entity = EntityTypes.FOX.a(world); + } else if (Bee.class.isAssignableFrom(clazz)) { + entity = EntityTypes.BEE.a(world); } if (entity != null) { @@ -2172,14 +2188,14 @@ public class CraftWorld implements World { Validate.notNull(location, "Location cannot be null"); Validate.isTrue(radius >= 0, "Radius cannot be negative"); - PersistentRaid persistentRaid = world.C(); // PAIL rename getPersistentRaid - net.minecraft.server.Raid raid = persistentRaid.a(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), radius * radius); // PAIL rename getNearbyRaid + PersistentRaid persistentRaid = world.getPersistentRaid(); + net.minecraft.server.Raid raid = persistentRaid.getNearbyRaid(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), radius * radius); return (raid == null) ? null : new CraftRaid(raid); } @Override public List getRaids() { - PersistentRaid persistentRaid = world.C(); // PAIL rename getPersistentRaid - return persistentRaid.a.values().stream().map(CraftRaid::new).collect(Collectors.toList()); + PersistentRaid persistentRaid = world.getPersistentRaid(); + return persistentRaid.raids.values().stream().map(CraftRaid::new).collect(Collectors.toList()); } } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java index 859e19113d..509d2865ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -181,7 +181,7 @@ public class Main { Date buildDate = new SimpleDateFormat("yyyyMMdd-HHmm").parse(Main.class.getPackage().getImplementationVendor()); Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -28); + deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java new file mode 100644 index 0000000000..2b815eb86a --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java @@ -0,0 +1,32 @@ +package org.bukkit.craftbukkit.block; + +import com.google.common.base.Preconditions; +import net.minecraft.server.BlockPosition; +import net.minecraft.server.TileEntityBeehive; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.Beehive; + +public class CraftBeehive extends CraftBlockEntityState implements Beehive { + + public CraftBeehive(final Block block) { + super(block, TileEntityBeehive.class); + } + + public CraftBeehive(final Material material, final TileEntityBeehive te) { + super(material, te); + } + + @Override + public Location getFlower() { + BlockPosition flower = getSnapshot().flowerPos; + return (flower == null) ? null : new Location(getWorld(), flower.getX(), flower.getY(), flower.getZ()); + } + + @Override + public void setFlower(Location location) { + Preconditions.checkArgument(location == null || this.getWorld().equals(location.getWorld()), "Flower must be in same world"); + getSnapshot().flowerPos = (location == null) ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index d3e5240932..3d632543b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -457,6 +457,8 @@ public class CraftBlock implements Block { return new CraftLectern(this); case SMOKER: return new CraftSmoker(this); + case BEEHIVE: + return new CraftBeehive(this); default: TileEntity tileEntity = world.getTileEntity(position); if (tileEntity != null) { @@ -613,7 +615,7 @@ public class CraftBlock implements Block { net.minecraft.server.ItemStack nms = CraftItemStack.asNMSCopy(item); // Modelled off EntityHuman#hasBlock - if (iblockdata.getMaterial().isAlwaysDestroyable() || nms.b(iblockdata)) { + if (iblockdata.getMaterial().isAlwaysDestroyable() || nms.canDestroySpecialBlock(iblockdata)) { return net.minecraft.server.Block.getDrops(iblockdata, (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), null, nms) .stream().map(CraftItemStack::asBukkitCopy).collect(Collectors.toList()); } else { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java index 99c361dc69..e371e7f6d9 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -392,6 +392,7 @@ public class CraftBlockData implements BlockData { register(net.minecraft.server.BlockBannerWall.class, org.bukkit.craftbukkit.block.impl.CraftBannerWall::new); register(net.minecraft.server.BlockBarrel.class, org.bukkit.craftbukkit.block.impl.CraftBarrel::new); register(net.minecraft.server.BlockBed.class, org.bukkit.craftbukkit.block.impl.CraftBed::new); + register(net.minecraft.server.BlockBeehive.class, org.bukkit.craftbukkit.block.impl.CraftBeehive::new); register(net.minecraft.server.BlockBeetroot.class, org.bukkit.craftbukkit.block.impl.CraftBeetroot::new); register(net.minecraft.server.BlockBell.class, org.bukkit.craftbukkit.block.impl.CraftBell::new); register(net.minecraft.server.BlockBlastFurnace.class, org.bukkit.craftbukkit.block.impl.CraftBlastFurnace::new); diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBeehive.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBeehive.java new file mode 100644 index 0000000000..084b8f94f4 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftBeehive.java @@ -0,0 +1,24 @@ +package org.bukkit.craftbukkit.block.data.type; + +import org.bukkit.block.data.type.Beehive; +import org.bukkit.craftbukkit.block.data.CraftBlockData; + +public abstract class CraftBeehive extends CraftBlockData implements Beehive { + + private static final net.minecraft.server.BlockStateInteger HONEY_LEVEL = getInteger("honey_level"); + + @Override + public int getHoneyLevel() { + return get(HONEY_LEVEL); + } + + @Override + public void setHoneyLevel(int honeyLevel) { + set(HONEY_LEVEL, honeyLevel); + } + + @Override + public int getMaximumHoneyLevel() { + return getMax(HONEY_LEVEL); + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBeehive.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBeehive.java new file mode 100644 index 0000000000..c2a2820b20 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftBeehive.java @@ -0,0 +1,53 @@ +/** + * Automatically generated file, changes will be lost. + */ +package org.bukkit.craftbukkit.block.impl; + +public final class CraftBeehive extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Beehive, org.bukkit.block.data.Directional { + + public CraftBeehive() { + super(); + } + + public CraftBeehive(net.minecraft.server.IBlockData state) { + super(state); + } + + // org.bukkit.craftbukkit.block.data.type.CraftBeehive + + private static final net.minecraft.server.BlockStateInteger HONEY_LEVEL = getInteger(net.minecraft.server.BlockBeehive.class, "honey_level"); + + @Override + public int getHoneyLevel() { + return get(HONEY_LEVEL); + } + + @Override + public void setHoneyLevel(int honeyLevel) { + set(HONEY_LEVEL, honeyLevel); + } + + @Override + public int getMaximumHoneyLevel() { + return getMax(HONEY_LEVEL); + } + + // org.bukkit.craftbukkit.block.data.CraftDirectional + + private static final net.minecraft.server.BlockStateEnum FACING = getEnum(net.minecraft.server.BlockBeehive.class, "facing"); + + @Override + public org.bukkit.block.BlockFace getFacing() { + return get(FACING, org.bukkit.block.BlockFace.class); + } + + @Override + public void setFacing(org.bukkit.block.BlockFace facing) { + set(FACING, facing); + } + + @Override + public java.util.Set getFaces() { + return getValues(FACING, org.bukkit.block.BlockFace.class); + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java new file mode 100644 index 0000000000..9d2936d926 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java @@ -0,0 +1,85 @@ +package org.bukkit.craftbukkit.entity; + +import com.google.common.base.Preconditions; +import net.minecraft.server.BlockPosition; +import net.minecraft.server.EntityBee; +import org.bukkit.Location; +import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.Bee; +import org.bukkit.entity.EntityType; + +public class CraftBee extends CraftAnimals implements Bee { + + public CraftBee(CraftServer server, EntityBee entity) { + super(server, entity); + } + + @Override + public EntityBee getHandle() { + return (EntityBee) entity; + } + + @Override + public String toString() { + return "CraftBee"; + } + + @Override + public EntityType getType() { + return EntityType.BEE; + } + + @Override + public Location getHive() { + BlockPosition hive = getHandle().getHivePos(); + return (hive == null) ? null : new Location(getWorld(), hive.getX(), hive.getY(), hive.getZ()); + } + + @Override + public void setHive(Location location) { + Preconditions.checkArgument(location == null || this.getWorld().equals(location.getWorld()), "Hive must be in same world"); + getHandle().hivePos = (location == null) ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + } + + @Override + public Location getFlower() { + BlockPosition flower = getHandle().getFlowerPos(); + return (flower == null) ? null : new Location(getWorld(), flower.getX(), flower.getY(), flower.getZ()); + } + + @Override + public void setFlower(Location location) { + Preconditions.checkArgument(location == null || this.getWorld().equals(location.getWorld()), "Flower must be in same world"); + getHandle().setFlowerPos(location == null ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())); + } + + @Override + public boolean hasNectar() { + return getHandle().hasNectar(); + } + + @Override + public void setHasNectar(boolean nectar) { + getHandle().setHasNectar(nectar); + } + + @Override + public boolean hasStung() { + return getHandle().hasStung(); + } + + @Override + public void setHasStung(boolean stung) { + getHandle().setHasStung(stung); + } + + @Override + public int getAnger() { + return getHandle().getAnger(); + } + + @Override + public void setAnger(int anger) { + getHandle().setAnger(anger); + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index be8b862d9a..ed700e3980 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -16,6 +16,7 @@ import net.minecraft.server.EntityAreaEffectCloud; import net.minecraft.server.EntityArmorStand; import net.minecraft.server.EntityArrow; import net.minecraft.server.EntityBat; +import net.minecraft.server.EntityBee; import net.minecraft.server.EntityBlaze; import net.minecraft.server.EntityBoat; import net.minecraft.server.EntityCat; @@ -232,6 +233,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { else if (entity instanceof EntityOcelot) { return new CraftOcelot(server, (EntityOcelot) entity); } else if (entity instanceof EntityPanda) { return new CraftPanda(server, (EntityPanda) entity); } else if (entity instanceof EntityFox) { return new CraftFox(server, (EntityFox) entity); } + else if (entity instanceof EntityBee) { return new CraftBee(server, (EntityBee) entity); } else { return new CraftAnimals(server, (EntityAnimal) entity); } } // Monsters @@ -372,16 +374,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @Override public Location getLocation() { - return new Location(getWorld(), entity.locX, entity.locY, entity.locZ, entity.getBukkitYaw(), entity.pitch); + return new Location(getWorld(), entity.locX(), entity.locY(), entity.locZ(), entity.getBukkitYaw(), entity.pitch); } @Override public Location getLocation(Location loc) { if (loc != null) { loc.setWorld(getWorld()); - loc.setX(entity.locX); - loc.setY(entity.locY); - loc.setZ(entity.locZ); + loc.setX(entity.locX()); + loc.setY(entity.locY()); + loc.setZ(entity.locZ()); loc.setYaw(entity.getBukkitYaw()); loc.setPitch(entity.pitch); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java index d3cbad9a5c..475b7b004b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java @@ -71,11 +71,11 @@ public class CraftFirework extends CraftEntity implements Firework { @Override public boolean isShotAtAngle() { - return getHandle().i(); + return getHandle().isShotAtAngle(); } @Override public void setShotAtAngle(boolean shotAtAngle) { - getHandle().getDataWatcher().set(EntityFireworks.d, shotAtAngle); + getHandle().getDataWatcher().set(EntityFireworks.SHOT_AT_ANGLE, shotAtAngle); } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java index 1ed9a4e32e..cd04a2b997 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java @@ -53,7 +53,7 @@ public class CraftFishHook extends AbstractProjectile implements FishHook { EntityFishingHook hook = getHandle(); if (this.biteChance == -1) { - if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX), MathHelper.floor(hook.locY) + 1, MathHelper.floor(hook.locZ)))) { + if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX()), MathHelper.floor(hook.locY()) + 1, MathHelper.floor(hook.locZ())))) { return 1/300.0; } return 1/500.0; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 027063239b..66cd2db1ea 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -164,9 +164,9 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @Override public void setBedSpawnLocation(Location location, boolean override) { if (location == null) { - getHandle().setRespawnPosition(null, override); + getHandle().setRespawnPosition(null, override, false); } else { - getHandle().setRespawnPosition(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override); + getHandle().setRespawnPosition(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override, false); getHandle().spawnWorld = location.getWorld().getName(); } } @@ -198,7 +198,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { public void wakeup(boolean setSpawnLocation) { Preconditions.checkState(isSleeping(), "Cannot wakeup if not sleeping"); - getHandle().wakeup(true, true, setSpawnLocation); + getHandle().wakeup(true, setSpawnLocation); } @Override @@ -335,7 +335,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { if (iinventory instanceof TileEntity) { TileEntity te = (TileEntity) iinventory; if (!te.hasWorld()) { - te.setWorld(getHandle().world); + te.setLocation(getHandle().world, getHandle().getChunkCoordinates()); } } } @@ -473,7 +473,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { openCustomInventory(inventory, player, Containers.LOOM); break; case CARTOGRAPHY: - openCustomInventory(inventory, player, Containers.CARTOGRAPHY); + openCustomInventory(inventory, player, Containers.CARTOGRAPHY_TABLE); break; case GRINDSTONE: openCustomInventory(inventory, player, Containers.GRINDSTONE); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java index d889fe8c38..9c659d764b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java @@ -30,6 +30,6 @@ public class CraftPillager extends CraftIllager implements Pillager { @Override public Inventory getInventory() { - return new CraftInventory(getHandle().getInventory()); + return new CraftInventory(getHandle().inventory); } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0f9fa92224..ac7a4791b1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -66,7 +66,6 @@ import net.minecraft.server.WhiteListEntry; import net.minecraft.server.WorldServer; import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang.Validate; -import org.bukkit.Achievement; import org.bukkit.BanList; import org.bukkit.Bukkit; import org.bukkit.DyeColor; @@ -713,21 +712,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return getHandle().fauxSleeping; } - @Override - public void awardAchievement(Achievement achievement) { - throw new UnsupportedOperationException("Not supported in this Minecraft version."); - } - - @Override - public void removeAchievement(Achievement achievement) { - throw new UnsupportedOperationException("Not supported in this Minecraft version."); - } - - @Override - public boolean hasAchievement(Achievement achievement) { - throw new UnsupportedOperationException("Not supported in this Minecraft version."); - } - @Override public void incrementStatistic(Statistic statistic) { incrementStatistic(statistic, 1); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java index f291a8d754..a73ebaa75f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -94,7 +94,7 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { return false; } - getHandle().e(position); // PAIL rename sleep + getHandle().entitySleep(position); return true; } @@ -102,7 +102,7 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { public void wakeup() { Preconditions.checkState(isSleeping(), "Cannot wakeup if not sleeping"); - getHandle().dy(); // PAIL rename wakeup + getHandle().entityWakeup(); } public static Profession nmsToBukkitProfession(VillagerProfession nms) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0e78fdfd42..698ab262a2 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1480,18 +1480,18 @@ public class CraftEventFactory { * Raid events */ public static boolean callRaidTriggerEvent(Raid raid, EntityPlayer player) { - RaidTriggerEvent event = new RaidTriggerEvent(new CraftRaid(raid), raid.i().getWorld(), player.getBukkitEntity()); + RaidTriggerEvent event = new RaidTriggerEvent(new CraftRaid(raid), raid.getWorld().getWorld(), player.getBukkitEntity()); Bukkit.getPluginManager().callEvent(event); return !event.isCancelled(); } public static void callRaidFinishEvent(Raid raid, List players) { - RaidFinishEvent event = new RaidFinishEvent(new CraftRaid(raid), raid.i().getWorld(), players); + RaidFinishEvent event = new RaidFinishEvent(new CraftRaid(raid), raid.getWorld().getWorld(), players); Bukkit.getPluginManager().callEvent(event); } public static void callRaidStopEvent(Raid raid, RaidStopEvent.Reason reason) { - RaidStopEvent event = new RaidStopEvent(new CraftRaid(raid), raid.i().getWorld(), reason); + RaidStopEvent event = new RaidStopEvent(new CraftRaid(raid), raid.getWorld().getWorld(), reason); Bukkit.getPluginManager().callEvent(event); } @@ -1501,7 +1501,7 @@ public class CraftEventFactory { for (EntityRaider entityRaider : raiders) { craftRaiders.add((Raider) entityRaider.getBukkitEntity()); } - RaidSpawnWaveEvent event = new RaidSpawnWaveEvent(new CraftRaid(raid), raid.i().getWorld(), craftLeader, craftRaiders); + RaidSpawnWaveEvent event = new RaidSpawnWaveEvent(new CraftRaid(raid), raid.getWorld().getWorld(), craftLeader, craftRaiders); Bukkit.getPluginManager().callEvent(event); } } diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java index f9411d9d5a..0986eca086 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java @@ -4,6 +4,8 @@ import com.google.common.base.Preconditions; import java.util.List; import java.util.Random; import net.minecraft.server.BiomeBase; +import net.minecraft.server.BiomeManager; +import net.minecraft.server.BiomeStorage; import net.minecraft.server.Block; import net.minecraft.server.BlockPosition; import net.minecraft.server.ChunkSection; @@ -16,6 +18,7 @@ import net.minecraft.server.ITileEntity; import net.minecraft.server.MobSpawnerCat; import net.minecraft.server.MobSpawnerPatrol; import net.minecraft.server.MobSpawnerPhantom; +import net.minecraft.server.ProtoChunk; import net.minecraft.server.RegionLimitedWorldAccess; import net.minecraft.server.StructureGenerator; import net.minecraft.server.TileEntity; @@ -43,16 +46,16 @@ public class CustomChunkGenerator extends InternalChunkGenerator= 1803 ? CraftChatMessage.toJSON(value) : CraftChatMessage.fromComponent(value, EnumChatFormat.DARK_PURPLE))); // SPIGOT-4935 + tagList.add(NBTTagString.a(version <= 0 || version >= 1803 ? CraftChatMessage.toJSON(value) : CraftChatMessage.fromComponent(value, EnumChatFormat.DARK_PURPLE))); // SPIGOT-4935 } return tagList; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java index 2d2d73cc07..8c86fe2084 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java @@ -66,7 +66,7 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo if (hasRecipes()) { NBTTagList list = new NBTTagList(); for (NamespacedKey recipe : this.recipes) { - list.add(new NBTTagString(recipe.toString())); + list.add(NBTTagString.a(recipe.toString())); } itemData.set(BOOK_RECIPES.NBT, list); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java index ecb12457a2..e7b45310a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java @@ -51,7 +51,7 @@ class CraftMetaLeatherArmor extends CraftMetaItem implements LeatherArmorMeta { super.applyToItem(itemTag); if (hasColor()) { - setDisplayTag(itemTag, COLOR.NBT, new NBTTagInt(color.asRGB())); + setDisplayTag(itemTag, COLOR.NBT, NBTTagInt.a(color.asRGB())); } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java index 7489e63a15..bb0c062b9e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java @@ -105,11 +105,11 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta { } if (hasLocationName()) { - setDisplayTag(tag, MAP_LOC_NAME.NBT, new NBTTagString(getLocationName())); + setDisplayTag(tag, MAP_LOC_NAME.NBT, NBTTagString.a(getLocationName())); } if (hasColor()) { - setDisplayTag(tag, MAP_COLOR.NBT, new NBTTagInt(color.asRGB())); + setDisplayTag(tag, MAP_COLOR.NBT, NBTTagInt.a(color.asRGB())); } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java index 082f851197..0634fb36dd 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java @@ -111,6 +111,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta { boolean applicableTo(Material type) { switch (type) { case BAT_SPAWN_EGG: + case BEE_SPAWN_EGG: case BLAZE_SPAWN_EGG: case CAT_SPAWN_EGG: case CAVE_SPIDER_SPAWN_EGG: diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java index f6fa0650fa..32b36c70ae 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.inventory.util; +import net.minecraft.server.BlockPosition; import net.minecraft.server.DimensionManager; import net.minecraft.server.IInventory; import net.minecraft.server.MinecraftServer; @@ -49,7 +50,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat @Override public IInventory getTileEntity() { TileEntityFurnace furnace = new TileEntityFurnaceFurnace(); - furnace.setWorld(MinecraftServer.getServer().getWorldServer(DimensionManager.OVERWORLD)); // TODO: customize this if required + furnace.setLocation(MinecraftServer.getServer().getWorldServer(DimensionManager.OVERWORLD), BlockPosition.ZERO); // TODO: customize this if required return furnace; } diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java index 0bf63e4593..c65fe0ac8f 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java +++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java @@ -110,29 +110,29 @@ public final class CraftPersistentDataTypeRegistry { Primitives */ if (Objects.equals(Byte.class, type)) { - return createAdapter(Byte.class, NBTTagByte.class, NBTTagByte::new, NBTTagByte::asByte); + return createAdapter(Byte.class, NBTTagByte.class, NBTTagByte::a, NBTTagByte::asByte); } if (Objects.equals(Short.class, type)) { - return createAdapter(Short.class, NBTTagShort.class, NBTTagShort::new, NBTTagShort::asShort); + return createAdapter(Short.class, NBTTagShort.class, NBTTagShort::a, NBTTagShort::asShort); } if (Objects.equals(Integer.class, type)) { - return createAdapter(Integer.class, NBTTagInt.class, NBTTagInt::new, NBTTagInt::asInt); + return createAdapter(Integer.class, NBTTagInt.class, NBTTagInt::a, NBTTagInt::asInt); } if (Objects.equals(Long.class, type)) { - return createAdapter(Long.class, NBTTagLong.class, NBTTagLong::new, NBTTagLong::asLong); + return createAdapter(Long.class, NBTTagLong.class, NBTTagLong::a, NBTTagLong::asLong); } if (Objects.equals(Float.class, type)) { - return createAdapter(Float.class, NBTTagFloat.class, NBTTagFloat::new, NBTTagFloat::asFloat); + return createAdapter(Float.class, NBTTagFloat.class, NBTTagFloat::a, NBTTagFloat::asFloat); } if (Objects.equals(Double.class, type)) { - return createAdapter(Double.class, NBTTagDouble.class, NBTTagDouble::new, NBTTagDouble::asDouble); + return createAdapter(Double.class, NBTTagDouble.class, NBTTagDouble::a, NBTTagDouble::asDouble); } /* String */ if (Objects.equals(String.class, type)) { - return createAdapter(String.class, NBTTagString.class, NBTTagString::new, NBTTagString::asString); + return createAdapter(String.class, NBTTagString.class, NBTTagString::a, NBTTagString::asString); } /* diff --git a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java index 88fbfc01b5..60330f753f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java +++ b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java @@ -33,7 +33,7 @@ public class BlockStateListPopulator extends DummyGeneratorAccess { @Override public Fluid getFluid(BlockPosition bp) { CraftBlockState state = list.get(bp); - return (state != null) ? state.getHandle().p() : world.getFluid(bp); + return (state != null) ? state.getHandle().getFluid() : world.getFluid(bp); } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java index dd602243d3..8e23c47502 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -188,12 +188,12 @@ public final class CraftMagicNumbers implements UnsafeValues { * @return string */ public String getMappingsVersion() { - return "11ae498d9cf909730659b6357e7c2afa"; + return "e50e3dd1d07234cc9c09cb516a951227"; } @Override public int getDataVersion() { - return SharedConstants.a().getWorldVersion(); + return SharedConstants.getGameVersion().getWorldVersion(); } @Override @@ -247,7 +247,7 @@ public final class CraftMagicNumbers implements UnsafeValues { return file.delete(); } - private static final List SUPPORTED_API = Arrays.asList("1.13", "1.14"); + private static final List SUPPORTED_API = Arrays.asList("1.13", "1.14", "1.15"); @Override public void checkSupported(PluginDescriptionFile pdf) throws InvalidPluginException { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java index fd0b99b786..b17faa25e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java @@ -77,16 +77,16 @@ public class CraftNBTTagConfigSerializer { throw new RuntimeException("Could not deserialize found list ", e); } } else if (INTEGER.matcher(string).matches()) { //Read integers on our own - return new NBTTagInt(Integer.parseInt(string.substring(0, string.length() - 1))); + return NBTTagInt.a(Integer.parseInt(string.substring(0, string.length() - 1))); } else if (DOUBLE.matcher(string).matches()) { - return new NBTTagDouble(Double.parseDouble(string.substring(0, string.length() - 1))); + return NBTTagDouble.a(Double.parseDouble(string.substring(0, string.length() - 1))); } else { NBTBase nbtBase = MOJANGSON_PARSER.parseLiteral(string); if (nbtBase instanceof NBTTagInt) { // If this returns an integer, it did not use our method from above - return new NBTTagString(nbtBase.asString()); // It then is a string that was falsely read as an int + return NBTTagString.a(nbtBase.asString()); // It then is a string that was falsely read as an int } else if (nbtBase instanceof NBTTagDouble) { - return new NBTTagString(String.valueOf(((NBTTagDouble) nbtBase).asDouble())); // Doubles add "d" at the end + return NBTTagString.a(String.valueOf(((NBTTagDouble) nbtBase).asDouble())); // Doubles add "d" at the end } else { return nbtBase; } diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java index f575b884b0..d8358a0f03 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java @@ -5,13 +5,13 @@ import java.util.Random; import java.util.function.Predicate; import net.minecraft.server.AxisAlignedBB; import net.minecraft.server.BiomeBase; +import net.minecraft.server.BiomeManager; import net.minecraft.server.Block; import net.minecraft.server.BlockPosition; import net.minecraft.server.ChunkStatus; import net.minecraft.server.DifficultyDamageScaler; import net.minecraft.server.Entity; import net.minecraft.server.EntityHuman; -import net.minecraft.server.EnumSkyBlock; import net.minecraft.server.Fluid; import net.minecraft.server.FluidType; import net.minecraft.server.GeneratorAccess; @@ -19,6 +19,7 @@ import net.minecraft.server.HeightMap; import net.minecraft.server.IBlockData; import net.minecraft.server.IChunkAccess; import net.minecraft.server.IChunkProvider; +import net.minecraft.server.LightEngine; import net.minecraft.server.ParticleParam; import net.minecraft.server.SoundCategory; import net.minecraft.server.SoundEffect; @@ -111,21 +112,11 @@ public class DummyGeneratorAccess implements GeneratorAccess { throw new UnsupportedOperationException("Not supported yet."); } - @Override - public int getLightLevel(BlockPosition bp, int i) { - throw new UnsupportedOperationException("Not supported yet."); - } - @Override public IChunkAccess getChunkAt(int i, int i1, ChunkStatus cs, boolean bln) { throw new UnsupportedOperationException("Not supported yet."); } - @Override - public BlockPosition getHighestBlockYAt(HeightMap.Type type, BlockPosition bp) { - throw new UnsupportedOperationException("Not supported yet."); - } - @Override public int a(HeightMap.Type type, int i, int i1) { throw new UnsupportedOperationException("Not supported yet."); @@ -137,12 +128,17 @@ public class DummyGeneratorAccess implements GeneratorAccess { } @Override - public WorldBorder getWorldBorder() { + public BiomeManager d() { throw new UnsupportedOperationException("Not supported yet."); } @Override - public boolean e() { + public BiomeBase a(int i, int i1, int i2) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean p_() { throw new UnsupportedOperationException("Not supported yet."); } @@ -157,27 +153,27 @@ public class DummyGeneratorAccess implements GeneratorAccess { } @Override - public BiomeBase getBiome(BlockPosition bp) { + public LightEngine e() { throw new UnsupportedOperationException("Not supported yet."); } @Override - public int getBrightness(EnumSkyBlock esb, BlockPosition bp) { + public TileEntity getTileEntity(BlockPosition blockposition) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public TileEntity getTileEntity(BlockPosition bp) { + public IBlockData getType(BlockPosition blockposition) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public IBlockData getType(BlockPosition bp) { + public Fluid getFluid(BlockPosition blockposition) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public Fluid getFluid(BlockPosition bp) { + public WorldBorder getWorldBorder() { throw new UnsupportedOperationException("Not supported yet."); } @@ -197,7 +193,7 @@ public class DummyGeneratorAccess implements GeneratorAccess { } @Override - public boolean b(BlockPosition blockposition, boolean flag) { + public boolean a(BlockPosition blockposition, boolean flag, Entity entity) { throw new UnsupportedOperationException("Not supported yet."); } } diff --git a/src/test/java/org/bukkit/LegacyTest.java b/src/test/java/org/bukkit/LegacyTest.java index 6099364c20..524495841c 100644 --- a/src/test/java/org/bukkit/LegacyTest.java +++ b/src/test/java/org/bukkit/LegacyTest.java @@ -46,6 +46,8 @@ public class LegacyTest extends AbstractTestingBase { Material.SMOOTH_QUARTZ_SLAB, Material.SMOOTH_QUARTZ_STAIRS, Material.SMOOTH_RED_SANDSTONE_SLAB, Material.SMOOTH_RED_SANDSTONE_STAIRS, Material.SMOOTH_SANDSTONE_SLAB, Material.SMOOTH_SANDSTONE_STAIRS, Material.SMOOTH_STONE_SLAB, Material.SPRUCE_SIGN, Material.SPRUCE_WALL_SIGN, Material.STONECUTTER, Material.STONE_BRICK_WALL, Material.STONE_STAIRS, Material.SUSPICIOUS_STEW, Material.SWEET_BERRIES, Material.SWEET_BERRY_BUSH, Material.WHITE_DYE, Material.WITHER_ROSE, Material.YELLOW_DYE, Material.COMPOSTER, Material.TRADER_LLAMA_SPAWN_EGG, Material.WANDERING_TRADER_SPAWN_EGG, Material.FOX_SPAWN_EGG, Material.LEATHER_HORSE_ARMOR, Material.GLOBE_BANNER_PATTERN, Material.CUT_RED_SANDSTONE_SLAB, Material.CUT_SANDSTONE_SLAB, + // 1.15 + Material.BEEHIVE, Material.BEE_NEST, Material.BEE_SPAWN_EGG, Material.HONEYCOMB, Material.HONEYCOMB_BLOCK, Material.HONEY_BLOCK, Material.HONEY_BOTTLE, // Material.LEGACY_AIR, Material.LEGACY_DEAD_BUSH, Material.LEGACY_BURNING_FURNACE, Material.LEGACY_WALL_SIGN, Material.LEGACY_REDSTONE_TORCH_OFF, Material.LEGACY_SKULL, Material.LEGACY_REDSTONE_COMPARATOR_ON, Material.LEGACY_WALL_BANNER, Material.LEGACY_MONSTER_EGG)); diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java index 4d44cf5b4b..07006a23f2 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java @@ -25,7 +25,7 @@ public class ItemFactoryTest extends AbstractTestingBase { continue; } - final Class clazz = Class.forName(entryName.substring(0, entryName.length() - ".class".length()).replace('/', '.')); + final Class clazz = Class.forName(entryName.substring(0, entryName.length() - ".class".length()).replace('/', '.'), false, ClassLoader.getSystemClassLoader()); assertThat(entryName, clazz, is(not(nullValue()))); for (final Field field : clazz.getDeclaredFields()) { if (IAttribute.class.isAssignableFrom(field.getType()) && Modifier.isStatic(field.getModifiers())) { diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java index 86a279e8ec..6302339601 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java @@ -144,44 +144,6 @@ public class ItemMetaTest extends AbstractTestingBase { assertThat(bukkit, is((ItemStack) craft)); } - @Test - public void testNoDamageEquality() { - CraftItemStack noTag = CraftItemStack.asCraftCopy(new ItemStack(Material.SHEARS)); - - CraftItemStack noDamage = CraftItemStack.asCraftCopy(new ItemStack(Material.SHEARS)); - noDamage.handle.setDamage(0); - - CraftItemStack enchanted = CraftItemStack.asCraftCopy(new ItemStack(Material.SHEARS)); - enchanted.addEnchantment(Enchantment.DIG_SPEED, 1); - - CraftItemStack enchantedNoDamage = CraftItemStack.asCraftCopy(new ItemStack(Material.SHEARS)); - enchantedNoDamage.addEnchantment(Enchantment.DIG_SPEED, 1); - enchantedNoDamage.handle.setDamage(0); - - // check tags: - assertThat("noTag should have no NBT tag", CraftItemStack.hasItemMeta(noTag.handle), is(false)); - assertThat("noTag should have no meta", noTag.hasItemMeta(), is(false)); - - assertThat("noDamage should have no NBT tag", CraftItemStack.hasItemMeta(noDamage.handle), is(false)); - assertThat("noDamage should have no meta", noDamage.hasItemMeta(), is(false)); - - assertThat("enchanted should have NBT tag", CraftItemStack.hasItemMeta(enchanted.handle), is(true)); - assertThat("enchanted should have meta", enchanted.hasItemMeta(), is(true)); - - assertThat("enchantedNoDamage should have NBT tag", CraftItemStack.hasItemMeta(enchantedNoDamage.handle), is(true)); - assertThat("enchantedNoDamage should have meta", enchantedNoDamage.hasItemMeta(), is(true)); - - // check comparisons: - assertThat("noTag and noDamage stacks should be similar", noTag.isSimilar(noDamage), is(true)); - assertThat("noTag and noDamage stacks should be equal", noTag.equals(noDamage), is(true)); - - assertThat("enchanted and enchantedNoDamage stacks should be similar", enchanted.isSimilar(enchantedNoDamage), is(true)); - assertThat("enchanted and enchantedNoDamage stacks should be equal", enchanted.equals(enchantedNoDamage), is(true)); - - assertThat("noTag and enchanted stacks should not be similar", noTag.isSimilar(enchanted), is(false)); - assertThat("noTag and enchanted stacks should not be equal", noTag.equals(enchanted), is(false)); - } - @Test public void testBlockStateMeta() { List queue = new ArrayList<>(); diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java index f135d88005..46539e87b3 100644 --- a/src/test/java/org/bukkit/support/AbstractTestingBase.java +++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.concurrent.CompletableFuture; import net.minecraft.server.DispenserRegistry; import net.minecraft.server.EnumResourcePackType; +import net.minecraft.server.LootPredicateManager; import net.minecraft.server.LootTableRegistry; import net.minecraft.server.ResourceManager; import net.minecraft.server.ResourcePackVanilla; @@ -37,7 +38,7 @@ public abstract class AbstractTestingBase { ResourceManager resourceManager = new ResourceManager(EnumResourcePackType.SERVER_DATA, Thread.currentThread()); // add tags and loot tables for unit tests resourceManager.a(TAG_REGISTRY = new TagRegistry()); - resourceManager.a(LOOT_TABLE_REGISTRY = new LootTableRegistry()); + resourceManager.a(LOOT_TABLE_REGISTRY = new LootTableRegistry(new LootPredicateManager())); // Register vanilla pack resourceManager.a(MoreExecutors.directExecutor(), MoreExecutors.directExecutor(), Collections.singletonList(new ResourcePackVanilla("minecraft")), CompletableFuture.completedFuture(Unit.INSTANCE)).join();