diff --git a/nms-patches/Advancement.patch b/nms-patches/Advancement.patch index 1c31b84021..29a78647f2 100644 --- a/nms-patches/Advancement.patch +++ b/nms-patches/Advancement.patch @@ -8,29 +8,11 @@ public Advancement(MinecraftKey minecraftkey, @Nullable Advancement advancement, @Nullable AdvancementDisplay advancementdisplay, AdvancementRewards advancementrewards, Map map, String[][] astring) { this.d = minecraftkey; -@@ -46,7 +47,7 @@ - EnumChatFormat enumchatformat = advancementdisplay.e().c(); - IChatBaseComponent ichatbasecomponent1 = ichatbasecomponent.h().a(enumchatformat).a("\n").addSibling(advancementdisplay.b()); - IChatBaseComponent ichatbasecomponent2 = ichatbasecomponent.h().a((chatmodifier) -> { -- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent)); -+ chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent1)); // CraftBukkit - decompile error - }); - - this.h = (new ChatComponentText("[")).addSibling(ichatbasecomponent2).a("]").a(enumchatformat); -@@ -55,7 +56,7 @@ - } - - public Advancement.SerializedAdvancement a() { -- return new Advancement.SerializedAdvancement(this.a == null ? null : this.a.getName(), this.b, this.c, this.e, this.f, null); -+ return new Advancement.SerializedAdvancement(this.a == null ? null : this.a.getName(), this.b, this.c, this.e, this.f); // CraftBukkit - decompile error - } - - @Nullable @@ -206,7 +207,7 @@ } public Advancement b(MinecraftKey minecraftkey) { -- if (!this.a((minecraftkey) -> { +- if (!this.a((minecraftkey1) -> { + if (!this.a((Function) (minecraftkey1) -> { // CraftBukkit - decompile error return null; })) { diff --git a/nms-patches/AdvancementDataPlayer.patch b/nms-patches/AdvancementDataPlayer.patch index 3030c6065b..e2c4774c1e 100644 --- a/nms-patches/AdvancementDataPlayer.patch +++ b/nms-patches/AdvancementDataPlayer.patch @@ -1,42 +1,6 @@ --- a/net/minecraft/server/AdvancementDataPlayer.java +++ b/net/minecraft/server/AdvancementDataPlayer.java -@@ -38,7 +38,7 @@ - - private static final Logger a = LogManager.getLogger(); - private static final Gson b = (new GsonBuilder()).registerTypeAdapter(AdvancementProgress.class, new AdvancementProgress.a()).registerTypeAdapter(MinecraftKey.class, new MinecraftKey.a()).setPrettyPrinting().create(); -- private static final TypeToken> c = new TypeToken() { -+ private static final TypeToken> c = new TypeToken>() { // CraftBukkit - decompile error - }; - private final MinecraftServer d; - private final File e; -@@ -100,7 +100,7 @@ - Iterator iterator = this.data.entrySet().iterator(); - - while (iterator.hasNext()) { -- Entry entry = (Entry) iterator.next(); -+ Entry entry = (Entry) iterator.next(); // CraftBukkit - decompile error - - if (((AdvancementProgress) entry.getValue()).isDone()) { - arraylist.add(entry.getKey()); -@@ -140,7 +140,7 @@ - - try { - jsonreader.setLenient(false); -- Dynamic dynamic = new Dynamic(JsonOps.INSTANCE, Streams.parse(jsonreader)); -+ Dynamic dynamic = new Dynamic(JsonOps.INSTANCE, Streams.parse(jsonreader)); // CraftBukkit - decompile error - - if (!dynamic.get("DataVersion").flatMap(Dynamic::getNumberValue).isPresent()) { - dynamic = dynamic.set("DataVersion", dynamic.createInt(1343)); -@@ -148,7 +148,7 @@ - - dynamic = this.d.az().update(DataFixTypes.ADVANCEMENTS, dynamic, dynamic.getInt("DataVersion"), 1631); - dynamic = dynamic.remove("DataVersion"); -- Map map = (Map) AdvancementDataPlayer.b.getAdapter(AdvancementDataPlayer.c).fromJsonTree((JsonElement) dynamic.getValue()); -+ Map map = (Map) AdvancementDataPlayer.b.getAdapter(AdvancementDataPlayer.c).fromJsonTree((JsonElement) dynamic.getValue()); // CraftBukkit - decompile error - - if (map == null) { - throw new JsonParseException("Found null for advancements"); -@@ -162,7 +162,11 @@ +@@ -158,7 +158,11 @@ Advancement advancement = this.d.getAdvancementData().a((MinecraftKey) entry.getKey()); if (advancement == null) { @@ -49,7 +13,7 @@ } else { this.a(advancement, (AdvancementProgress) entry.getValue()); } -@@ -231,6 +235,7 @@ +@@ -227,6 +231,7 @@ this.i.add(advancement); flag = true; if (!flag1 && advancementprogress.isDone()) { diff --git a/nms-patches/ArgumentBlock.patch b/nms-patches/ArgumentBlock.patch index 1c33861f66..320f3f4214 100644 --- a/nms-patches/ArgumentBlock.patch +++ b/nms-patches/ArgumentBlock.patch @@ -9,26 +9,24 @@ private final Map l = Maps.newHashMap(); private MinecraftKey m = new MinecraftKey(""); private BlockStateList n; -@@ -222,7 +222,7 @@ - if (comparable instanceof Integer) { - suggestionsbuilder.suggest((Integer) comparable); - } else { -- suggestionsbuilder.suggest(iblockstate.a(comparable)); -+ suggestionsbuilder.suggest(iblockstate.a((T) comparable)); // CraftBukkit - decompile error - } - } +@@ -217,7 +217,7 @@ + Iterator iterator = iblockstate.d().iterator(); -@@ -488,8 +488,8 @@ - Optional optional = iblockstate.b(s); + while (iterator.hasNext()) { +- T t0 = (Comparable) iterator.next(); ++ T t0 = (T) iterator.next(); // CraftBukkit - decompile error + + if (t0 instanceof Integer) { + suggestionsbuilder.suggest((Integer) t0); +@@ -488,7 +488,7 @@ + Optional optional = iblockstate.b(s); if (optional.isPresent()) { - this.o = (IBlockData) this.o.set(iblockstate, (Comparable) optional.get()); -- this.k.put(iblockstate, optional.get()); + this.o = (IBlockData) this.o.set(iblockstate, (T) optional.get()); // CraftBukkit - decompile error -+ this.k.put(iblockstate, (Comparable) optional.get()); // CraftBukkit - decompile error + this.k.put(iblockstate, optional.get()); } else { this.i.setCursor(i); - throw ArgumentBlock.e.createWithContext(this.i, this.m.toString(), iblockstate.a(), s); @@ -526,7 +526,7 @@ private static > void a(StringBuilder stringbuilder, IBlockState iblockstate, Comparable comparable) { stringbuilder.append(iblockstate.a()); diff --git a/nms-patches/Block.patch b/nms-patches/Block.patch index cbf7866531..e59d629c1b 100644 --- a/nms-patches/Block.patch +++ b/nms-patches/Block.patch @@ -1,24 +1,6 @@ --- a/net/minecraft/server/Block.java +++ b/net/minecraft/server/Block.java -@@ -32,7 +32,7 @@ - @Nullable - private String name; - private static final ThreadLocal> q = ThreadLocal.withInitial(() -> { -- Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) { -+ Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) { // CraftBukkit - decompile error - protected void rehash(int i) {} - }; - -@@ -194,7 +194,7 @@ - } - - public Block(Block.Info block_info) { -- BlockStateList.a blockstatelist_a = new BlockStateList.a(this); -+ BlockStateList.a blockstatelist_a = new BlockStateList.a(this); // CraftBukkit - decompile error - - this.a(blockstatelist_a); - this.blockStateList = blockstatelist_a.a(BlockData::new); -@@ -406,7 +406,8 @@ +@@ -405,7 +405,8 @@ int j = this.getDropCount(iblockdata, i, world, blockposition, world.random); for (int k = 0; k < j; ++k) { @@ -28,7 +10,7 @@ Item item = this.getDropType(iblockdata, world, blockposition, i).getItem(); if (item != Items.AIR) { -@@ -427,7 +428,13 @@ +@@ -426,7 +427,13 @@ EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack); entityitem.n(); @@ -43,7 +25,7 @@ } } -@@ -1395,8 +1402,14 @@ +@@ -1394,8 +1401,14 @@ } diff --git a/nms-patches/BlockDispenser.patch b/nms-patches/BlockDispenser.patch index 3292d90aea..7add46ebe3 100644 --- a/nms-patches/BlockDispenser.patch +++ b/nms-patches/BlockDispenser.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/BlockDispenser.java +++ b/net/minecraft/server/BlockDispenser.java -@@ -9,9 +9,10 @@ +@@ -8,9 +8,10 @@ public static final BlockStateDirection FACING = BlockDirectional.FACING; public static final BlockStateBoolean TRIGGERED = BlockProperties.w; @@ -12,7 +12,7 @@ public static void a(IMaterial imaterial, IDispenseBehavior idispensebehavior) { BlockDispenser.REGISTRY.put(imaterial.getItem(), idispensebehavior); -@@ -57,6 +58,7 @@ +@@ -56,6 +57,7 @@ IDispenseBehavior idispensebehavior = this.a(itemstack); if (idispensebehavior != IDispenseBehavior.NONE) { diff --git a/nms-patches/BlockEnderPortal.patch b/nms-patches/BlockEnderPortal.patch index 1de1d724cc..0ffb11e0c8 100644 --- a/nms-patches/BlockEnderPortal.patch +++ b/nms-patches/BlockEnderPortal.patch @@ -12,7 +12,7 @@ @@ -28,6 +30,10 @@ public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { - if (!world.isClientSide && !entity.isPassenger() && !entity.isVehicle() && entity.bm() && VoxelShapes.c(VoxelShapes.a(entity.getBoundingBox().d((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.g(world, blockposition), OperatorBoolean.AND)) { + if (!world.isClientSide && !entity.isPassenger() && !entity.isVehicle() && entity.bm() && VoxelShapes.c(VoxelShapes.a(entity.getBoundingBox().d((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) { + // CraftBukkit start - Entity in portal + EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ())); + world.getServer().getPluginManager().callEvent(event); diff --git a/nms-patches/BlockFire.patch b/nms-patches/BlockFire.patch index 6279bab56c..399b8d34fd 100644 --- a/nms-patches/BlockFire.patch +++ b/nms-patches/BlockFire.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/BlockFire.java +++ b/net/minecraft/server/BlockFire.java -@@ -8,6 +8,16 @@ - import java.util.function.Predicate; +@@ -7,6 +7,16 @@ + import java.util.Map.Entry; import javax.annotation.Nullable; +// CraftBukkit start @@ -17,7 +17,7 @@ public class BlockFire extends Block { public static final BlockStateInteger AGE = BlockProperties.X; -@@ -32,7 +42,20 @@ +@@ -31,7 +41,20 @@ } public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { @@ -39,7 +39,7 @@ } @Nullable -@@ -82,7 +105,7 @@ +@@ -81,7 +104,7 @@ public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { if (world.getGameRules().getBoolean("doFireTick")) { if (!iblockdata.canPlace(world, blockposition)) { @@ -48,7 +48,7 @@ } Block block = world.getType(blockposition.down()).getBlock(); -@@ -90,7 +113,7 @@ +@@ -89,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) { @@ -57,7 +57,7 @@ } else { int j = Math.min(15, i + random.nextInt(3) / 2); -@@ -103,14 +126,14 @@ +@@ -102,14 +125,14 @@ world.getBlockTickList().a(blockposition, this, this.a((IWorldReader) world) + random.nextInt(10)); if (!this.d(world, blockposition)) { if (!world.getType(blockposition.down()).q() || i > 3) { @@ -74,7 +74,7 @@ return; } } -@@ -118,12 +141,14 @@ +@@ -117,12 +140,14 @@ boolean flag1 = world.x(blockposition); int k = flag1 ? -50 : 0; @@ -95,7 +95,7 @@ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); for (int l = -1; l <= 1; ++l) { -@@ -149,7 +174,15 @@ +@@ -148,7 +173,15 @@ if (i2 > 0 && random.nextInt(k1) <= i2 && (!world.isRaining() || !this.a(world, (BlockPosition) blockposition_mutableblockposition))) { int j2 = Math.min(15, i + random.nextInt(5) / 4); @@ -112,7 +112,7 @@ } } } -@@ -173,12 +206,24 @@ +@@ -172,12 +205,24 @@ return this.flameChances.getInt(block); } @@ -138,7 +138,7 @@ if (random.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) { int l = Math.min(j + random.nextInt(5) / 4, 15); -@@ -241,7 +286,7 @@ +@@ -240,7 +285,7 @@ if (iblockdata1.getBlock() != iblockdata.getBlock()) { if (world.worldProvider.getDimensionManager() != DimensionManager.OVERWORLD && world.worldProvider.getDimensionManager() != DimensionManager.NETHER || !((BlockPortal) Blocks.NETHER_PORTAL).a((GeneratorAccess) world, blockposition)) { if (!iblockdata.canPlace(world, blockposition)) { @@ -147,7 +147,7 @@ } else { world.getBlockTickList().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10)); } -@@ -387,4 +432,12 @@ +@@ -386,4 +431,12 @@ blockfire.a(Blocks.BLACK_CARPET, 60, 20); blockfire.a(Blocks.DRIED_KELP_BLOCK, 30, 60); } diff --git a/nms-patches/BlockFluids.patch b/nms-patches/BlockFluids.patch index d34dd16f6e..b46d9e2cd7 100644 --- a/nms-patches/BlockFluids.patch +++ b/nms-patches/BlockFluids.patch @@ -1,20 +1,6 @@ --- a/net/minecraft/server/BlockFluids.java +++ b/net/minecraft/server/BlockFluids.java -@@ -57,10 +57,10 @@ - public VoxelShape a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { - Fluid fluid = iblockaccess.getFluid(blockposition.up()); - -- return fluid.c().a((FluidType) this.b) ? VoxelShapes.b() : (VoxelShape) this.o.computeIfAbsent(iblockdata, (iblockdata) -> { -- Fluid fluid = iblockdata.s(); -+ return fluid.c().a((FluidType) this.b) ? VoxelShapes.b() : (VoxelShape) this.o.computeIfAbsent(iblockdata, (iblockdata1) -> { // CraftBukkit - decompile errors -+ Fluid fluid1 = iblockdata1.s(); - -- return VoxelShapes.create(0.0D, 0.0D, 0.0D, 1.0D, (double) fluid.getHeight(), 1.0D); -+ return VoxelShapes.create(0.0D, 0.0D, 0.0D, 1.0D, (double) fluid1.getHeight(), 1.0D); - }); - } - -@@ -117,14 +117,20 @@ +@@ -116,14 +116,20 @@ Fluid fluid = world.getFluid(blockposition); if (fluid.d()) { diff --git a/nms-patches/BlockMushroom.patch b/nms-patches/BlockMushroom.patch index a9c3ba3ce8..9db3c94c77 100644 --- a/nms-patches/BlockMushroom.patch +++ b/nms-patches/BlockMushroom.patch @@ -21,7 +21,7 @@ } @@ -66,8 +70,10 @@ - WorldGenerator worldgenerator = null; + WorldGenerator worldgenerator = null; if (this == Blocks.BROWN_MUSHROOM) { + BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit diff --git a/nms-patches/BlockPiston.patch b/nms-patches/BlockPiston.patch index bc3b1489d9..30a00535d1 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 -@@ -7,6 +7,18 @@ - import java.util.Iterator; +@@ -6,6 +6,18 @@ import java.util.List; + import java.util.Set; +// CraftBukkit start +import java.util.AbstractList; @@ -19,7 +19,7 @@ public class BlockPiston extends BlockDirectional { public static final BlockStateBoolean EXTENDED = BlockProperties.f; -@@ -106,6 +118,18 @@ +@@ -105,6 +117,18 @@ } } @@ -38,10 +38,10 @@ world.playBlockAction(blockposition, this, b0, enumdirection.a()); } -@@ -278,6 +302,48 @@ +@@ -277,6 +301,48 @@ IBlockData[] aiblockdata = new IBlockData[j]; EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite(); - HashSet hashset = Sets.newHashSet(list); + 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/BlockRedstoneComparator.patch b/nms-patches/BlockRedstoneComparator.patch index 6e839dfc42..9eac7be6e1 100644 --- a/nms-patches/BlockRedstoneComparator.patch +++ b/nms-patches/BlockRedstoneComparator.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/BlockRedstoneComparator.java +++ b/net/minecraft/server/BlockRedstoneComparator.java -@@ -5,6 +5,8 @@ - import java.util.function.Predicate; +@@ -4,6 +4,8 @@ + import java.util.Random; import javax.annotation.Nullable; +import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit @@ -9,17 +9,17 @@ public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity { public static final BlockStateEnum MODE = BlockProperties.aq; -@@ -65,7 +67,8 @@ +@@ -64,7 +66,8 @@ @Nullable private EntityItemFrame a(World world, EnumDirection enumdirection, BlockPosition blockposition) { -- List list = world.a(EntityItemFrame.class, new AxisAlignedBB((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 1), (double) (blockposition.getZ() + 1)), (entityitemframe) -> { +- List list = world.a(EntityItemFrame.class, new AxisAlignedBB((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 1), (double) (blockposition.getZ() + 1)), (entityitemframe) -> { + // CraftBukkit - decompile error -+ List list = world.a(EntityItemFrame.class, new AxisAlignedBB((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 1), (double) (blockposition.getZ() + 1)), (Predicate) (entityitemframe) -> { ++ List list = world.a(EntityItemFrame.class, new AxisAlignedBB((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 1), (double) (blockposition.getZ() + 1)), (java.util.function.Predicate) (entityitemframe) -> { return entityitemframe != null && entityitemframe.getDirection() == enumdirection; }); -@@ -118,8 +121,18 @@ +@@ -117,8 +120,18 @@ boolean flag1 = (Boolean) iblockdata.get(BlockRedstoneComparator.c); if (flag1 && !flag) { diff --git a/nms-patches/BlockRedstoneTorch.patch b/nms-patches/BlockRedstoneTorch.patch index dc2c7e5d3f..b1d4f34088 100644 --- a/nms-patches/BlockRedstoneTorch.patch +++ b/nms-patches/BlockRedstoneTorch.patch @@ -50,12 +50,3 @@ world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, true), 3); } -@@ -112,7 +139,7 @@ - } - - private static boolean a(World world, BlockPosition blockposition, boolean flag) { -- Object object = (List) BlockRedstoneTorch.b.get(world); -+ List object = (List) BlockRedstoneTorch.b.get(world); // CraftBukkit - decompile error - - if (object == null) { - object = Lists.newArrayList(); diff --git a/nms-patches/BlockSponge.patch b/nms-patches/BlockSponge.patch index 5164942f8c..b9efc64f46 100644 --- a/nms-patches/BlockSponge.patch +++ b/nms-patches/BlockSponge.patch @@ -3,7 +3,7 @@ @@ -2,6 +2,12 @@ import com.google.common.collect.Lists; - import java.util.LinkedList; + import java.util.Queue; +// CraftBukkit start +import java.util.List; +import org.bukkit.craftbukkit.block.CraftBlockState; @@ -15,28 +15,28 @@ @@ -33,6 +39,7 @@ - linkedlist.add(new Tuple(blockposition, 0)); + queue.add(new Tuple<>(blockposition, 0)); int i = 0; + BlockStateListPopulator blockList = new BlockStateListPopulator(world); // CraftBukkit - Use BlockStateListPopulator - while (!linkedlist.isEmpty()) { - Tuple tuple = (Tuple) linkedlist.poll(); + while (!queue.isEmpty()) { + Tuple tuple = (Tuple) queue.poll(); @@ -49,20 +56,20 @@ Material material = iblockdata.getMaterial(); if (fluid.a(TagsFluid.WATER)) { -- if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).a(world, blockposition2, iblockdata) != FluidTypes.a) { -+ if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).a(blockList, blockposition2, iblockdata) != FluidTypes.a) { // CraftBukkit +- if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).removeFluid(world, blockposition2, iblockdata) != FluidTypes.EMPTY) { ++ if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).removeFluid(blockList, blockposition2, iblockdata) != FluidTypes.EMPTY) { // CraftBukkit ++i; if (j < 6) { - linkedlist.add(new Tuple(blockposition2, j + 1)); + queue.add(new Tuple<>(blockposition2, j + 1)); } } else if (iblockdata.getBlock() instanceof BlockFluids) { - world.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3); + blockList.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3); // CraftBukkit ++i; if (j < 6) { - linkedlist.add(new Tuple(blockposition2, j + 1)); + queue.add(new Tuple<>(blockposition2, j + 1)); } } else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) { - iblockdata.a(world, blockposition2, 0); @@ -45,7 +45,7 @@ + blockList.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3); // CraftBukkit ++i; if (j < 6) { - linkedlist.add(new Tuple(blockposition2, j + 1)); + queue.add(new Tuple<>(blockposition2, j + 1)); @@ -75,6 +82,37 @@ break; } @@ -69,7 +69,7 @@ + Material material = iblockdata.getMaterial(); + + if (fluid.a(TagsFluid.WATER)) { -+ if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).a(blockList, blockposition2, iblockdata) != FluidTypes.a) { ++ if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).removeFluid(blockList, blockposition2, iblockdata) != FluidTypes.EMPTY) { + // NOP + } else if (iblockdata.getBlock() instanceof BlockFluids) { + // NOP diff --git a/nms-patches/BlockVine.patch b/nms-patches/BlockVine.patch index c563ec8fc6..41c930d1ee 100644 --- a/nms-patches/BlockVine.patch +++ b/nms-patches/BlockVine.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/BlockVine.java +++ b/net/minecraft/server/BlockVine.java -@@ -7,6 +7,8 @@ - import java.util.function.Predicate; +@@ -6,6 +6,8 @@ + import java.util.Map.Entry; import javax.annotation.Nullable; +import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit @@ -9,7 +9,7 @@ public class BlockVine extends Block { public static final BlockStateBoolean UP = BlockSprawling.p; -@@ -183,20 +185,24 @@ +@@ -182,20 +184,24 @@ BlockPosition blockposition3 = blockposition2.shift(enumdirection1); BlockPosition blockposition4 = blockposition2.shift(enumdirection2); @@ -39,7 +39,7 @@ } } else if (this.b((IBlockAccess) world, blockposition2, enumdirection)) { world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2); -@@ -226,7 +232,7 @@ +@@ -225,7 +231,7 @@ } if (this.x(iblockdata3)) { @@ -48,7 +48,7 @@ } return; -@@ -241,7 +247,7 @@ +@@ -240,7 +246,7 @@ IBlockData iblockdata5 = this.a(iblockdata, iblockdata4, random); if (iblockdata4 != iblockdata5 && this.x(iblockdata5)) { diff --git a/nms-patches/BossBattleCustom.patch b/nms-patches/BossBattleCustom.patch index cf8d10e9c7..ce2c0d3720 100644 --- a/nms-patches/BossBattleCustom.patch +++ b/nms-patches/BossBattleCustom.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/server/BossBattleCustom.java +++ b/net/minecraft/server/BossBattleCustom.java -@@ -8,12 +8,27 @@ +@@ -6,12 +6,27 @@ + import java.util.Set; import java.util.UUID; - import java.util.function.Consumer; +// CraftBukkit start +import org.bukkit.boss.KeyedBossBar; diff --git a/nms-patches/Chunk.patch b/nms-patches/Chunk.patch index f7b4aa9eb3..c6d4e6707e 100644 --- a/nms-patches/Chunk.patch +++ b/nms-patches/Chunk.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Chunk.java +++ b/net/minecraft/server/Chunk.java -@@ -22,6 +22,13 @@ +@@ -21,6 +21,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -14,7 +14,7 @@ public class Chunk implements IChunkAccess { private static final Logger d = LogManager.getLogger(); -@@ -57,6 +64,35 @@ +@@ -56,6 +63,35 @@ private final AtomicInteger E; private final ChunkCoordIntPair F; @@ -50,7 +50,7 @@ public Chunk(World world, int i, int j, BiomeBase[] abiomebase, ChunkConverter chunkconverter, TickList ticklist, TickList ticklist1, long k) { this.sections = new ChunkSection[16]; this.g = new boolean[256]; -@@ -95,8 +131,16 @@ +@@ -94,8 +130,16 @@ this.s = ticklist; this.t = ticklist1; this.z = k; @@ -67,17 +67,7 @@ public Chunk(World world, ProtoChunk protochunk, int i, int j) { this(world, i, j, protochunk.getBiomeIndex(), protochunk.v(), protochunk.k(), protochunk.l(), protochunk.m()); -@@ -136,14 +180,15 @@ - HeightMap.Type heightmap_type = (HeightMap.Type) iterator.next(); - - if (heightmap_type.c() == HeightMap.Use.LIVE_WORLD) { -- ((HeightMap) this.heightMap.computeIfAbsent(heightmap_type, (heightmap_type) -> { -- return new HeightMap(this, heightmap_type); -+ ((HeightMap) this.heightMap.computeIfAbsent(heightmap_type, (heightmap_type1) -> { // CraftBukkit - decompile error -+ return new HeightMap(this, heightmap_type1); // CraftBukkit - decompile error - })).a(protochunk.b(heightmap_type).b()); - } - } +@@ -143,6 +187,7 @@ this.x = true; this.a(ChunkStatus.FULLCHUNK); @@ -85,7 +75,7 @@ } public Set t() { -@@ -413,8 +458,15 @@ +@@ -412,8 +457,15 @@ } } @@ -101,7 +91,7 @@ int i = blockposition.getX() & 15; int j = blockposition.getY(); int k = blockposition.getZ() & 15; -@@ -474,7 +526,8 @@ +@@ -473,7 +525,8 @@ } } @@ -111,7 +101,7 @@ iblockdata.onPlace(this.world, blockposition, iblockdata1); } -@@ -654,7 +707,12 @@ +@@ -653,7 +706,12 @@ @Nullable public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { @@ -125,7 +115,7 @@ if (tileentity == null) { NBTTagCompound nbttagcompound = (NBTTagCompound) this.h.remove(blockposition); -@@ -701,6 +759,13 @@ +@@ -700,6 +758,13 @@ tileentity.z(); this.tileEntities.put(blockposition.h(), tileentity); @@ -139,14 +129,11 @@ } } -@@ -726,13 +791,55 @@ - int i = aentityslice.length; - +@@ -727,11 +792,53 @@ for (int j = 0; j < i; ++j) { -- EntitySlice entityslice = aentityslice[j]; -+ // CraftBukkit start -+ EntitySlice entityslice = aentityslice[j]; + EntitySlice entityslice = aentityslice[j]; ++ // CraftBukkit start + List toRemove = new LinkedList<>(); this.world.a(entityslice.stream().filter((entity) -> { + if (this.needsDecoration && !CraftEventFactory.doEntityAddEventCalling(this.world, entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { // Only call for new chunks @@ -196,11 +183,11 @@ } public void removeEntities() { -@@ -749,9 +856,21 @@ +@@ -748,9 +855,21 @@ int i = aentityslice.length; for (int j = 0; j < i; ++j) { -- EntitySlice entityslice = aentityslice[j]; +- EntitySlice entityslice = aentityslice[j]; + // CraftBukkit start + List newList = Lists.newArrayList(aentityslice[j]); + java.util.Iterator iter = newList.iterator(); @@ -220,49 +207,28 @@ } } -@@ -813,8 +932,8 @@ +@@ -810,7 +929,7 @@ + Iterator iterator = this.entitySlices[k].c(oclass).iterator(); + while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); +- T t0 = (Entity) iterator.next(); ++ T t0 = (T) iterator.next(); // CraftBukkit - decompile error -- if (entity.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(entity))) { -- list.add(entity); -+ if (entity.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test((T) entity))) { // CraftBukkit - fix decompile error -+ list.add((T) entity); // Fix decompile error - } - } - } -@@ -1020,13 +1139,13 @@ - - @Nullable - public LongSet b(String s) { -- return (LongSet) this.q.computeIfAbsent(s, (s) -> { -+ return (LongSet) this.q.computeIfAbsent(s, (s1) -> { // CraftBukkit - decompile error - return new LongOpenHashSet(); - }); - } - - public void a(String s, long i) { -- ((LongSet) this.q.computeIfAbsent(s, (s) -> { -+ ((LongSet) this.q.computeIfAbsent(s, (s1) -> { // CraftBukkit - decompile error - return new LongOpenHashSet(); - })).add(i); - } -@@ -1074,14 +1193,14 @@ + if (t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { + list.add(t0); +@@ -1073,13 +1192,13 @@ } if (this.s instanceof ProtoChunkTickList) { -- ((ProtoChunkTickList) this.s).a(this.world.getBlockTickList(), (blockposition) -> { -- return this.world.getType(blockposition).getBlock(); +- ((ProtoChunkTickList) this.s).a(this.world.getBlockTickList(), (blockposition1) -> { + ((ProtoChunkTickList) this.s).a(this.world.getBlockTickList(), (blockposition1) -> { // CraftBukkit - decompile error -+ return this.world.getType(blockposition1).getBlock(); + return this.world.getType(blockposition1).getBlock(); }); } if (this.t instanceof ProtoChunkTickList) { -- ((ProtoChunkTickList) this.t).a(this.world.getFluidTickList(), (blockposition) -> { -- return this.world.getFluid(blockposition).c(); +- ((ProtoChunkTickList) this.t).a(this.world.getFluidTickList(), (blockposition1) -> { + ((ProtoChunkTickList) this.t).a(this.world.getFluidTickList(), (blockposition1) -> { // CraftBukkit - decompile error -+ return this.world.getFluid(blockposition1).c(); + return this.world.getFluid(blockposition1).c(); }); } - diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch index 1a02616ca8..e418ff0ed7 100644 --- a/nms-patches/ChunkProviderServer.patch +++ b/nms-patches/ChunkProviderServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ChunkProviderServer.java +++ b/net/minecraft/server/ChunkProviderServer.java -@@ -18,6 +18,11 @@ +@@ -16,6 +16,11 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -12,39 +12,16 @@ public class ChunkProviderServer implements IChunkProvider { private static final Logger a = LogManager.getLogger(); -@@ -36,7 +41,7 @@ +@@ -34,7 +39,7 @@ this.chunkLoader = ichunkloader; this.chunkGenerator = chunkgenerator; this.asyncTaskHandler = iasynctaskhandler; - this.chunkScheduler = new ChunkTaskScheduler(2, worldserver, chunkgenerator, ichunkloader, iasynctaskhandler); + this.chunkScheduler = new ChunkTaskScheduler(0, worldserver, chunkgenerator, ichunkloader, iasynctaskhandler); // CraftBukkit - very buggy, broken in lots of __subtle__ ways. Same goes for async chunk loading. Also Bukkit API / plugins can't handle async events at all anyway. - this.batchScheduler = new SchedulerBatch(this.chunkScheduler); + this.batchScheduler = new SchedulerBatch<>(this.chunkScheduler); } -@@ -86,9 +91,10 @@ - - if (flag) { - try { -- chunk = this.chunkLoader.a(this.world, i, j, (chunk) -> { -- chunk.setLastSaved(this.world.getTime()); -- this.chunks.put(ChunkCoordIntPair.a(i, j), chunk); -+ // CraftBukkit - decompile error -+ chunk = this.chunkLoader.a(this.world, i, j, (chunk1) -> { -+ chunk1.setLastSaved(this.world.getTime()); -+ this.chunks.put(ChunkCoordIntPair.a(i, j), chunk1); - }); - } catch (Exception exception) { - ChunkProviderServer.a.error("Couldn't load chunk", exception); -@@ -103,7 +109,7 @@ - try { - this.batchScheduler.b(); - this.batchScheduler.a(new ChunkCoordIntPair(i, j)); -- CompletableFuture completablefuture = this.batchScheduler.c(); -+ CompletableFuture completablefuture = this.batchScheduler.c(); // CraftBukkit - decompile error - - return (Chunk) completablefuture.thenApply(this::a).join(); - } catch (RuntimeException runtimeexception) { -@@ -114,6 +120,22 @@ +@@ -112,6 +117,22 @@ } } @@ -67,7 +44,7 @@ public IChunkAccess a(int i, int j, boolean flag) { Chunk chunk = this.getChunkAt(i, j, true, false); -@@ -251,10 +273,12 @@ +@@ -249,10 +270,12 @@ Chunk chunk = (Chunk) this.chunks.get(olong); if (chunk != null) { @@ -84,7 +61,7 @@ ++i; } } -@@ -267,6 +291,42 @@ +@@ -265,6 +288,42 @@ return false; } diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch index 16101c6fef..b42cabed5c 100644 --- a/nms-patches/ChunkRegionLoader.patch +++ b/nms-patches/ChunkRegionLoader.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ChunkRegionLoader.java +++ b/net/minecraft/server/ChunkRegionLoader.java -@@ -31,7 +31,7 @@ +@@ -29,7 +29,7 @@ private final File c; private final DataFixer d; private PersistentStructureLegacy e; @@ -9,7 +9,7 @@ public ChunkRegionLoader(File file, DataFixer datafixer) { this.c = file; -@@ -40,25 +40,64 @@ +@@ -38,25 +38,64 @@ @Nullable private NBTTagCompound a(GeneratorAccess generatoraccess, int i, int j) throws IOException { @@ -81,7 +81,7 @@ if (k < 1493) { nbttagcompound1 = GameProfileSerializer.a(this.d, DataFixTypes.CHUNK, nbttagcompound1, k, 1493); -@@ -86,13 +125,29 @@ +@@ -84,13 +123,29 @@ } @@ -111,7 +111,7 @@ Chunk chunk = this.a(generatoraccess, i, j, nbttagcompound); if (chunk != null) { -@@ -101,6 +156,9 @@ +@@ -99,6 +154,9 @@ } return chunk; @@ -121,7 +121,7 @@ } } -@@ -132,7 +190,7 @@ +@@ -130,7 +188,7 @@ } @Nullable @@ -130,7 +130,7 @@ if (nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8)) { ChunkStatus.Type chunkstatus_type = this.a(nbttagcompound); -@@ -151,10 +209,28 @@ +@@ -149,10 +207,28 @@ ChunkRegionLoader.a.error("Chunk file at {},{} is in the wrong location; relocating. (Expected {}, {}, got {}, {})", i, j, i, j, chunk.locX, chunk.locZ); nbttagcompound1.setInt("xPos", i); nbttagcompound1.setInt("zPos", j); @@ -160,7 +160,7 @@ } } } else { -@@ -169,7 +245,7 @@ +@@ -167,7 +243,7 @@ ChunkStatus.Type chunkstatus_type = this.a(nbttagcompound); if (chunkstatus_type == ChunkStatus.Type.LEVELCHUNK) { @@ -169,24 +169,24 @@ } else { NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level"); -@@ -217,10 +293,14 @@ +@@ -215,10 +291,15 @@ } public boolean a() { -- Iterator iterator = this.b.entrySet().iterator(); + // CraftBukkit start + return this.processSaveQueueEntry(false); + } - ++ + private boolean processSaveQueueEntry(boolean logCompletion) { -+ Iterator iterator = this.b.entrySet().iterator(); + Iterator> iterator = this.b.entrySet().iterator(); + if (!iterator.hasNext()) { - if (this.f) { + if (logCompletion) { // CraftBukkit ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.c.getName()); } -@@ -236,10 +316,14 @@ +@@ -234,10 +315,14 @@ return true; } else { try { @@ -202,7 +202,7 @@ if (this.e != null) { this.e.a(chunkcoordintpair.a()); } -@@ -266,15 +350,16 @@ +@@ -264,15 +349,16 @@ public void b() { try { @@ -222,7 +222,7 @@ } } -@@ -303,7 +388,7 @@ +@@ -301,7 +387,7 @@ if (abiomebase != null) { for (int k = 0; k < abiomebase.length; ++k) { @@ -231,7 +231,7 @@ } } -@@ -385,7 +470,7 @@ +@@ -383,7 +469,7 @@ int[] aint = new int[abiomebase.length]; for (int i = 0; i < abiomebase.length; ++i) { @@ -240,41 +240,7 @@ } nbttagcompound.setIntArray("Biomes", aint); -@@ -487,27 +572,27 @@ - } - - ChunkConverter chunkconverter = nbttagcompound.hasKeyOfType("UpgradeData", 10) ? new ChunkConverter(nbttagcompound.getCompound("UpgradeData")) : ChunkConverter.a; -- Predicate predicate = (block) -> { -+ Predicate predicate = (block) -> { // CraftBukkit - decompile error - return block.getBlockData().isAir(); - }; - IRegistry iregistry = IRegistry.BLOCK; - - IRegistry.BLOCK.getClass(); - Function function = iregistry::getKey; -- IRegistry iregistry1 = IRegistry.BLOCK; -+ IRegistry iregistry1 = IRegistry.BLOCK; // CraftBukkit - decompile error - - IRegistry.BLOCK.getClass(); -- ProtoChunkTickList protochunkticklist = new ProtoChunkTickList(predicate, function, iregistry1::getOrDefault, new ChunkCoordIntPair(i, j)); -+ ProtoChunkTickList protochunkticklist = new ProtoChunkTickList<>(predicate, function, iregistry1::getOrDefault, new ChunkCoordIntPair(i, j)); // CraftBukkit - decompile error - -- predicate = (fluidtype) -> { -+ Predicate predicate1 = (fluidtype) -> { // CraftBukkit - decompile error - return fluidtype == FluidTypes.a; - }; - iregistry = IRegistry.FLUID; - IRegistry.FLUID.getClass(); - function = iregistry::getKey; -- iregistry1 = IRegistry.FLUID; -+ IRegistry iregistry2 = IRegistry.FLUID; // CraftBukkit - decompile error - IRegistry.FLUID.getClass(); -- ProtoChunkTickList protochunkticklist1 = new ProtoChunkTickList(predicate, function, iregistry1::getOrDefault, new ChunkCoordIntPair(i, j)); -+ ProtoChunkTickList protochunkticklist1 = new ProtoChunkTickList<>(predicate1, function, iregistry2::getOrDefault, new ChunkCoordIntPair(i, j)); // CraftBukkit - decompile error - long i1 = nbttagcompound.getLong("InhabitedTime"); - Chunk chunk = new Chunk(generatoraccess.getMinecraftWorld(), i, j, abiomebase, chunkconverter, protochunkticklist, protochunkticklist1, i1); - -@@ -850,17 +935,29 @@ +@@ -833,17 +919,29 @@ } @Nullable @@ -306,7 +272,7 @@ }); } -@@ -874,8 +971,14 @@ +@@ -857,8 +955,14 @@ } } @@ -322,7 +288,7 @@ Iterator iterator = entity.bP().iterator(); while (iterator.hasNext()) { -@@ -891,7 +994,7 @@ +@@ -874,7 +978,7 @@ boolean flag = false; try { diff --git a/nms-patches/ChunkTaskScheduler.patch b/nms-patches/ChunkTaskScheduler.patch index a143764586..f94778aaf8 100644 --- a/nms-patches/ChunkTaskScheduler.patch +++ b/nms-patches/ChunkTaskScheduler.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/server/ChunkTaskScheduler.java +++ b/net/minecraft/server/ChunkTaskScheduler.java -@@ -20,7 +20,7 @@ - private final ChunkGenerator d; - private final IChunkLoader e; - private final IAsyncTaskHandler f; -- private final Long2ObjectMap progressCache = new ExpiringMap(8192, 5000) { -+ private final Long2ObjectMap progressCache = new ExpiringMap(8192, 5000) { // CraftBukkit - decompile error - protected boolean a(Scheduler.a scheduler_a) { - ProtoChunk protochunk = (ProtoChunk) scheduler_a.a(); - -@@ -40,6 +40,12 @@ +@@ -37,6 +37,12 @@ this.f = iasynctaskhandler; } @@ -20,5 +11,5 @@ + // CraftBukkit end + @Nullable - protected Scheduler.a a(ChunkCoordIntPair chunkcoordintpair, boolean flag) { + protected Scheduler.a a(ChunkCoordIntPair chunkcoordintpair, boolean flag) { IChunkLoader ichunkloader = this.e; diff --git a/nms-patches/CommandBlockListenerAbstract.patch b/nms-patches/CommandBlockListenerAbstract.patch index 21208d9088..6bf30152d8 100644 --- a/nms-patches/CommandBlockListenerAbstract.patch +++ b/nms-patches/CommandBlockListenerAbstract.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CommandBlockListenerAbstract.java +++ b/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -5,6 +5,7 @@ +@@ -4,6 +4,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import javax.annotation.Nullable; @@ -8,7 +8,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { -@@ -16,6 +17,10 @@ +@@ -15,6 +16,10 @@ private IChatBaseComponent f; private String g = ""; private IChatBaseComponent h = new ChatComponentText("@"); @@ -19,7 +19,7 @@ public CommandBlockListenerAbstract() {} -@@ -103,14 +108,7 @@ +@@ -102,14 +107,7 @@ if (minecraftserver != null && minecraftserver.D() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.g)) { try { this.f = null; @@ -35,7 +35,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Executing command block"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed"); -@@ -141,6 +139,11 @@ +@@ -140,6 +138,11 @@ } public void setName(IChatBaseComponent ichatbasecomponent) { diff --git a/nms-patches/CommandDebug.patch b/nms-patches/CommandDebug.patch index d982a4834a..797a6c8c2f 100644 --- a/nms-patches/CommandDebug.patch +++ b/nms-patches/CommandDebug.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CommandDebug.java +++ b/net/minecraft/server/CommandDebug.java -@@ -35,6 +35,14 @@ +@@ -33,6 +33,14 @@ } private static int a(CommandListenerWrapper commandlistenerwrapper) throws CommandSyntaxException { @@ -15,7 +15,7 @@ MinecraftServer minecraftserver = commandlistenerwrapper.getServer(); MethodProfiler methodprofiler = minecraftserver.methodProfiler; -@@ -48,6 +56,14 @@ +@@ -46,6 +54,14 @@ } private static int b(CommandListenerWrapper commandlistenerwrapper) throws CommandSyntaxException { diff --git a/nms-patches/CommandDispatcher.patch b/nms-patches/CommandDispatcher.patch index c762ac7ead..95782935b4 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 -@@ -27,12 +27,21 @@ +@@ -22,12 +22,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); -@@ -100,8 +109,13 @@ +@@ -95,8 +104,13 @@ } this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> { @@ -35,10 +35,10 @@ + + public CommandDispatcher() { + // CraftBukkit end - this.b.setConsumer((commandcontext, flag, i) -> { - ((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag, i); + this.b.setConsumer((commandcontext, flag1, i) -> { + ((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag1, i); }); -@@ -116,7 +130,47 @@ +@@ -111,7 +125,47 @@ } @@ -85,8 +85,8 @@ + // CraftBukkit end StringReader stringreader = new StringReader(s); - if(stringreader.canRead() && stringreader.peek() == 47) { -@@ -128,7 +182,6 @@ + if (stringreader.canRead() && stringreader.peek() == '/') { +@@ -123,7 +177,6 @@ byte b0; try { @@ -94,7 +94,7 @@ ChatComponentText chatcomponenttext; try { -@@ -137,52 +190,56 @@ +@@ -132,52 +185,56 @@ return i; } catch (CommandException commandexception) { commandlistenerwrapper.sendFailureMessage(commandexception.a()); @@ -104,21 +104,21 @@ + return b0; } catch (CommandSyntaxException commandsyntaxexception) { commandlistenerwrapper.sendFailureMessage(ChatComponentUtils.a(commandsyntaxexception.getRawMessage())); - if(commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) { + if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) { int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor()); - IChatBaseComponent ichatbasecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).a((chatmodifier) -> { - chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, s)); - }); + chatcomponenttext = new ChatComponentText(""); - if(j > 10) { + if (j > 10) { - ichatbasecomponent.a("..."); + chatcomponenttext.a("..."); } - ichatbasecomponent.a(commandsyntaxexception.getInput().substring(Math.max(0, j - 10), j)); + chatcomponenttext.a(commandsyntaxexception.getInput().substring(Math.max(0, j - 10), j)); - if(j < commandsyntaxexception.getInput().length()) { + if (j < commandsyntaxexception.getInput().length()) { - IChatBaseComponent ichatbasecomponent1 = (new ChatComponentText(commandsyntaxexception.getInput().substring(j))).a(new EnumChatFormat[]{EnumChatFormat.RED, EnumChatFormat.UNDERLINE}); + ChatComponentText chatcomponenttext1 = new ChatComponentText(commandsyntaxexception.getInput().substring(j)); @@ -147,11 +147,11 @@ - chatcomponenttext = new ChatComponentText; - } - -- chatcomponenttext.(exception.getMessage() == null?exception.getClass().getName():exception.getMessage()); +- chatcomponenttext.(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage()); - ChatComponentText chatcomponenttext1 = chatcomponenttext; + ChatMessage chatmessage1 = new ChatMessage("command.failed", new Object[0]); -- if(CommandDispatcher.a.isDebugEnabled()) { +- if (CommandDispatcher.a.isDebugEnabled()) { - StackTraceElement[] astacktraceelement = exception.getStackTrace(); + chatcomponenttext = new ChatComponentText(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage()); + if (CommandDispatcher.a.isDebugEnabled()) { @@ -166,7 +166,7 @@ - } - commandlistenerwrapper.sendFailureMessage((new ChatMessage("command.failed", new Object[0])).a((chatmodifier) -> { -- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent)); +- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatcomponenttext1)); - })); - b0 = 0; + chatmessage1.getChatModifier().setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatcomponenttext)); @@ -178,26 +178,25 @@ } finally { commandlistenerwrapper.getServer().methodProfiler.exit(); } -@@ -191,11 +248,36 @@ +@@ -186,11 +243,36 @@ } public void a(EntityPlayer entityplayer) { -- HashMap hashmap = Maps.newHashMap(); -- RootCommandNode rootcommandnode = new RootCommandNode(); +- Map, CommandNode> map = Maps.newHashMap(); + // CraftBukkit start + // Register Vanilla commands into builtRoot as before -+ Map hashmap = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues ++ Map, CommandNode> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues + RootCommandNode vanillaRoot = new RootCommandNode(); + + RootCommandNode vanilla = entityplayer.server.vanillaCommandDispatcher.a().getRoot(); -+ hashmap.put(vanilla, vanillaRoot); -+ this.a(vanilla, vanillaRoot, entityplayer.getCommandListener(), (Map) hashmap); ++ map.put(vanilla, vanillaRoot); ++ this.a(vanilla, vanillaRoot, entityplayer.getCommandListener(), (Map) map); + + // Now build the global commands in a second pass -+ RootCommandNode rootcommandnode = new RootCommandNode(); + RootCommandNode rootcommandnode = new RootCommandNode(); - hashmap.put(this.b.getRoot(), rootcommandnode); - this.a(this.b.getRoot(), rootcommandnode, entityplayer.getCommandListener(), (Map) hashmap); + map.put(this.b.getRoot(), rootcommandnode); + this.a(this.b.getRoot(), rootcommandnode, entityplayer.getCommandListener(), (Map) map); + + Collection bukkit = new LinkedHashSet<>(); + for (CommandNode node : rootcommandnode.getChildren()) { @@ -217,3 +216,21 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode)); } +@@ -201,7 +283,7 @@ + CommandNode commandnode2 = (CommandNode) iterator.next(); + + if (commandnode2.canUse(commandlistenerwrapper)) { +- ArgumentBuilder argumentbuilder = commandnode2.createBuilder(); ++ ArgumentBuilder argumentbuilder = commandnode2.createBuilder(); // CraftBukkit - decompile error + + argumentbuilder.requires((icompletionprovider) -> { + return true; +@@ -224,7 +306,7 @@ + argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect())); + } + +- CommandNode commandnode3 = argumentbuilder.build(); ++ CommandNode commandnode3 = argumentbuilder.build(); // CraftBukkit - decompile error + + map.put(commandnode2, commandnode3); + commandnode1.addChild(commandnode3); diff --git a/nms-patches/CommandEffect.patch b/nms-patches/CommandEffect.patch index 42f5524389..81ee359fc1 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 -@@ -62,7 +62,7 @@ +@@ -60,7 +60,7 @@ if (entity instanceof EntityLiving) { MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag); @@ -9,7 +9,7 @@ ++j; } } -@@ -88,7 +88,7 @@ +@@ -86,7 +86,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -18,7 +18,7 @@ ++i; } } -@@ -113,7 +113,7 @@ +@@ -111,7 +111,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); diff --git a/nms-patches/CommandForceload.patch b/nms-patches/CommandForceload.patch index 42e58521db..1d03a10a75 100644 --- a/nms-patches/CommandForceload.patch +++ b/nms-patches/CommandForceload.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CommandForceload.java +++ b/net/minecraft/server/CommandForceload.java -@@ -47,7 +47,7 @@ +@@ -43,7 +43,7 @@ private static int a(CommandListenerWrapper commandlistenerwrapper, ArgumentVec2I.a argumentvec2i_a) throws CommandSyntaxException { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(argumentvec2i_a.a >> 4, argumentvec2i_a.b >> 4); @@ -9,7 +9,7 @@ boolean flag = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager).isForceLoaded(chunkcoordintpair.x, chunkcoordintpair.z); if (flag) { -@@ -59,7 +59,7 @@ +@@ -55,7 +55,7 @@ } private static int a(CommandListenerWrapper commandlistenerwrapper) { @@ -18,7 +18,7 @@ LongSet longset = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager).ag(); int i = longset.size(); -@@ -79,12 +79,12 @@ +@@ -75,11 +75,11 @@ } private static int b(CommandListenerWrapper commandlistenerwrapper) { @@ -28,13 +28,11 @@ LongSet longset = worldserver.ag(); - longset.forEach((i) -> { -- worldserver.setForceLoaded(ChunkCoordIntPair.a(i), ChunkCoordIntPair.b(i), false); -+ longset.forEach((LongConsumer) (ix) -> { // CraftBukkit - decompile error -+ worldserver.setForceLoaded(ChunkCoordIntPair.a(ix), ChunkCoordIntPair.b(ix), false); // CraftBukkit - decompile error ++ longset.forEach((java.util.function.LongConsumer) (i) -> { // CraftBukkit - decompile error + worldserver.setForceLoaded(ChunkCoordIntPair.a(i), ChunkCoordIntPair.b(i), false); }); commandlistenerwrapper.sendMessage(new ChatMessage("commands.forceload.removed.all", new Object[] { dimensionmanager}), true); - return 0; -@@ -106,7 +106,7 @@ +@@ -102,7 +102,7 @@ if (i2 > 256L) { throw CommandForceload.a.create(256, i2); } else { diff --git a/nms-patches/CommandGamemode.patch b/nms-patches/CommandGamemode.patch index 939a80d371..b29b482848 100644 --- a/nms-patches/CommandGamemode.patch +++ b/nms-patches/CommandGamemode.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CommandGamemode.java +++ b/net/minecraft/server/CommandGamemode.java -@@ -57,6 +57,12 @@ +@@ -55,6 +55,12 @@ if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) { entityplayer.a(enumgamemode); diff --git a/nms-patches/CommandGamerule.patch b/nms-patches/CommandGamerule.patch index 055ff9554b..614b56a6ed 100644 --- a/nms-patches/CommandGamerule.patch +++ b/nms-patches/CommandGamerule.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CommandGamerule.java +++ b/net/minecraft/server/CommandGamerule.java -@@ -29,7 +29,7 @@ +@@ -27,7 +27,7 @@ } private static int a(CommandListenerWrapper commandlistenerwrapper, String s, CommandContext commandcontext) { @@ -9,7 +9,7 @@ gamerules_gamerulevalue.getType().a(commandcontext, "value", gamerules_gamerulevalue); commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[] { s, gamerules_gamerulevalue.a()}), true); -@@ -37,7 +37,7 @@ +@@ -35,7 +35,7 @@ } private static int a(CommandListenerWrapper commandlistenerwrapper, String s) { diff --git a/nms-patches/CommandListenerWrapper.patch b/nms-patches/CommandListenerWrapper.patch index 8235d596ce..7db763ace2 100644 --- a/nms-patches/CommandListenerWrapper.patch +++ b/nms-patches/CommandListenerWrapper.patch @@ -8,18 +8,14 @@ import java.util.Collection; import java.util.Collections; import java.util.Iterator; -@@ -31,9 +32,10 @@ +@@ -31,6 +32,7 @@ private final ResultConsumer l; private final ArgumentAnchor.Anchor m; private final Vec2F n; + public CommandNode currentCommand; // CraftBukkit public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) { -- this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, i) -> { -+ this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, ix) -> { // CraftBukkit - decompile error - }, ArgumentAnchor.Anchor.FEET); - } - + this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, j) -> { @@ -119,6 +121,13 @@ } diff --git a/nms-patches/CommandSpreadPlayers.patch b/nms-patches/CommandSpreadPlayers.patch index c1af65a477..c3042535dc 100644 --- a/nms-patches/CommandSpreadPlayers.patch +++ b/nms-patches/CommandSpreadPlayers.patch @@ -1,6 +1,15 @@ --- a/net/minecraft/server/CommandSpreadPlayers.java +++ b/net/minecraft/server/CommandSpreadPlayers.java -@@ -269,7 +269,7 @@ +@@ -58,7 +58,7 @@ + if (entity instanceof EntityHuman) { + set.add(entity.getScoreboardTeam()); + } else { +- set.add((Object) null); ++ set.add((ScoreboardTeamBase) null); // CraftBukkit - decompile error + } + } + +@@ -266,7 +266,7 @@ } blockposition = blockposition.down(); @@ -9,7 +18,7 @@ return blockposition.getY() + 1; } -@@ -285,7 +285,7 @@ +@@ -282,7 +282,7 @@ } blockposition = blockposition.down(); @@ -18,7 +27,7 @@ } while (iblockdata.isAir()); Material material = iblockdata.getMaterial(); -@@ -297,5 +297,12 @@ +@@ -294,5 +294,12 @@ this.a = MathHelper.a(random, d0, d2); this.b = MathHelper.a(random, d1, d3); } diff --git a/nms-patches/CommandSummon.patch b/nms-patches/CommandSummon.patch index 780b945a98..4c2499ba91 100644 --- a/nms-patches/CommandSummon.patch +++ b/nms-patches/CommandSummon.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CommandSummon.java +++ b/net/minecraft/server/CommandSummon.java -@@ -32,7 +32,7 @@ +@@ -30,7 +30,7 @@ if (EntityTypes.getName(EntityTypes.LIGHTNING_BOLT).equals(minecraftkey)) { EntityLightning entitylightning = new EntityLightning(commandlistenerwrapper.getWorld(), vec3d.x, vec3d.y, vec3d.z, false); diff --git a/nms-patches/CommandTeleport.patch b/nms-patches/CommandTeleport.patch index 68307ea101..3406408951 100644 --- a/nms-patches/CommandTeleport.patch +++ b/nms-patches/CommandTeleport.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/server/CommandTeleport.java +++ b/net/minecraft/server/CommandTeleport.java -@@ -14,6 +14,11 @@ +@@ -12,6 +12,11 @@ + import java.util.Iterator; import java.util.Set; - import java.util.function.Predicate; import javax.annotation.Nullable; +// CraftBukkit start +import org.bukkit.Location; @@ -12,7 +12,7 @@ public class CommandTeleport { -@@ -49,7 +54,7 @@ +@@ -47,7 +52,7 @@ while (iterator.hasNext()) { Entity entity1 = (Entity) iterator.next(); @@ -21,7 +21,7 @@ } if (collection.size() == 1) { -@@ -120,9 +125,9 @@ +@@ -118,9 +123,9 @@ } if (worldserver == entity.world) { @@ -33,7 +33,7 @@ } entity.setHeadRotation(f); -@@ -131,6 +136,21 @@ +@@ -129,6 +134,21 @@ float f3 = MathHelper.g(f1); f3 = MathHelper.a(f3, -90.0F, 90.0F); diff --git a/nms-patches/ContainerEnchantTable.patch b/nms-patches/ContainerEnchantTable.patch index 3795eebaf9..93d4b63c57 100644 --- a/nms-patches/ContainerEnchantTable.patch +++ b/nms-patches/ContainerEnchantTable.patch @@ -117,7 +117,7 @@ } else { @@ -176,25 +240,53 @@ if (!this.world.isClientSide) { - List list = this.a(itemstack, i, this.costs[i]); + List list = this.a(itemstack, i, this.costs[i]); - if (!list.isEmpty()) { - entityhuman.enchantDone(itemstack, j); diff --git a/nms-patches/ContainerHorse.patch b/nms-patches/ContainerHorse.patch index f3c7a80b7a..9237f2bfb3 100644 --- a/nms-patches/ContainerHorse.patch +++ b/nms-patches/ContainerHorse.patch @@ -26,7 +26,7 @@ + return bukkitEntity = new CraftInventoryView(player.player.getBukkitEntity(), a.getOwner().getInventory(), this); + } + - public ContainerHorse(IInventory iinventory, final IInventory iinventory1, final EntityHorseAbstract entityhorseabstract, EntityHuman entityhuman) { + public ContainerHorse(IInventory iinventory, IInventory iinventory1, final EntityHorseAbstract entityhorseabstract, EntityHuman entityhuman) { + player = (PlayerInventory) iinventory; + // CraftBukkit end this.a = iinventory1; diff --git a/nms-patches/ContainerPlayer.patch b/nms-patches/ContainerPlayer.patch index 40595e4911..1b9002dd16 100644 --- a/nms-patches/ContainerPlayer.patch +++ b/nms-patches/ContainerPlayer.patch @@ -20,7 +20,7 @@ + private PlayerInventory player; + // CraftBukkit end - public ContainerPlayer(final PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) { + public ContainerPlayer(PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) { this.g = flag; this.owner = entityhuman; + // CraftBukkit start diff --git a/nms-patches/CraftingManager.patch b/nms-patches/CraftingManager.patch index c788f89154..d0100d23b5 100644 --- a/nms-patches/CraftingManager.patch +++ b/nms-patches/CraftingManager.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CraftingManager.java +++ b/net/minecraft/server/CraftingManager.java -@@ -96,12 +96,14 @@ +@@ -95,12 +95,14 @@ do { if (!iterator.hasNext()) { @@ -15,7 +15,7 @@ return irecipe.craftItem(iinventory); } -@@ -113,12 +115,14 @@ +@@ -112,12 +114,14 @@ do { if (!iterator.hasNext()) { diff --git a/nms-patches/CrashReport.patch b/nms-patches/CrashReport.patch index 65a7265d33..fb516d9170 100644 --- a/nms-patches/CrashReport.patch +++ b/nms-patches/CrashReport.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/server/CrashReport.java @@ -63,6 +63,7 @@ - return String.format("%d total; %s", new Object[] { list.size(), list.stream().collect(Collectors.joining(" "))}); + return String.format("%d total; %s", list.size(), list.stream().collect(Collectors.joining(" "))); }); + this.d.a("CraftBukkit Information", (CrashReportCallable) new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit } diff --git a/nms-patches/CustomFunction.patch b/nms-patches/CustomFunction.patch index e4720577ad..43851fe09b 100644 --- a/nms-patches/CustomFunction.patch +++ b/nms-patches/CustomFunction.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/CustomFunction.java +++ b/net/minecraft/server/CustomFunction.java -@@ -48,7 +48,7 @@ +@@ -47,7 +47,7 @@ } try { -- ParseResults parseresults = customfunctiondata.a().getCommandDispatcher().a().parse(stringreader, customfunctiondata.f()); -+ ParseResults parseresults = customfunctiondata.d().parse(stringreader, customfunctiondata.f()); // CraftBukkit +- ParseResults parseresults = customfunctiondata.a().getCommandDispatcher().a().parse(stringreader, customfunctiondata.f()); ++ ParseResults parseresults = customfunctiondata.d().parse(stringreader, customfunctiondata.f()); // CraftBukkit if (parseresults.getReader().canRead()) { if (parseresults.getExceptions().size() == 1) { diff --git a/nms-patches/CustomFunctionData.patch b/nms-patches/CustomFunctionData.patch index 03f28821e8..64cfdcc3d9 100644 --- a/nms-patches/CustomFunctionData.patch +++ b/nms-patches/CustomFunctionData.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/server/CustomFunctionData.java +++ b/net/minecraft/server/CustomFunctionData.java -@@ -32,7 +32,7 @@ - private final Map g = Maps.newHashMap(); - private final ArrayDeque h = new ArrayDeque(); - private boolean i; -- private final Tags j = new Tags((minecraftkey) -> { -+ private final Tags j = new Tags<>((minecraftkey) -> { // CraftBukkit - decompile error - return this.a(minecraftkey) != null; - }, this::a, "tags/functions", true, "function"); - private final List k = Lists.newArrayList(); -@@ -60,7 +60,7 @@ +@@ -55,7 +55,7 @@ } public com.mojang.brigadier.CommandDispatcher d() { @@ -18,12 +9,3 @@ } public void tick() { -@@ -164,7 +164,7 @@ - arraylist.add(CompletableFuture.supplyAsync(() -> { - return a(iresourcemanager, minecraftkey); - }, Resource.a).thenApplyAsync((list) -> { -- return CustomFunction.a(minecraftkey, this, list); -+ return CustomFunction.a(minecraftkey1, this, list); // CraftBukkit - decompile error - }).handle((customfunction, throwable) -> { - return this.a(customfunction, throwable, minecraftkey); - })); diff --git a/nms-patches/DataConverterFlatten.patch b/nms-patches/DataConverterFlatten.patch index 4c4a198f84..d6351b4f3e 100644 --- a/nms-patches/DataConverterFlatten.patch +++ b/nms-patches/DataConverterFlatten.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/server/DataConverterFlatten.java +++ b/net/minecraft/server/DataConverterFlatten.java -@@ -378,7 +378,7 @@ - Typed typed2 = typed.getOrCreateTyped(opticfinder1); - Dynamic dynamic1 = (Dynamic) typed2.get(DSL.remainderFinder()); +@@ -376,7 +376,7 @@ + Typed typed2 = typed.getOrCreateTyped(opticfinder1); + Dynamic dynamic1 = (Dynamic) typed2.get(DSL.remainderFinder()); - dynamic1 = dynamic1.set("Damage", dynamic1.createInt(i)); + if (i != 0) dynamic1 = dynamic1.set("Damage", dynamic1.createInt(i)); // CraftBukkit diff --git a/nms-patches/DataConverterMap.patch b/nms-patches/DataConverterMap.patch index 190d6490c2..6ee2eecac6 100644 --- a/nms-patches/DataConverterMap.patch +++ b/nms-patches/DataConverterMap.patch @@ -1,17 +1,8 @@ --- a/net/minecraft/server/DataConverterMap.java +++ b/net/minecraft/server/DataConverterMap.java -@@ -22,7 +22,7 @@ - public TypeRewriteRule makeRule() { - Type type = this.getInputSchema().getType(DataConverterTypes.ITEM_STACK); - OpticFinder opticfinder = DSL.fieldFinder("id", DSL.named(DataConverterTypes.q.typeName(), DSL.namespacedString())); -- OpticFinder opticfinder1 = type.findField("tag"); -+ OpticFinder opticfinder1 = type.findField("tag"); // CraftBukkit - decompile error - - return this.fixTypeEverywhereTyped("ItemInstanceMapIdFix", type, (typed) -> { - Optional optional = typed.getOptional(opticfinder); -@@ -32,7 +32,7 @@ - Typed typed1 = typed.getOrCreateTyped(opticfinder1); - Dynamic dynamic1 = (Dynamic) typed1.get(DSL.remainderFinder()); +@@ -31,7 +31,7 @@ + Typed typed1 = typed.getOrCreateTyped(opticfinder1); + Dynamic dynamic1 = (Dynamic) typed1.get(DSL.remainderFinder()); - dynamic1 = dynamic1.set("map", dynamic1.createInt(dynamic.getInt("Damage"))); + if (!dynamic1.get("map").isPresent()) dynamic1 = dynamic1.set("map", dynamic1.createInt(dynamic.getInt("Damage"))); // CraftBukkit diff --git a/nms-patches/DataConverterRegistry.patch b/nms-patches/DataConverterRegistry.patch index b20d22e5c2..0caa4e865a 100644 --- a/nms-patches/DataConverterRegistry.patch +++ b/nms-patches/DataConverterRegistry.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/DataConverterRegistry.java +++ b/net/minecraft/server/DataConverterRegistry.java -@@ -21,7 +21,12 @@ +@@ -20,7 +20,12 @@ DataFixerBuilder datafixerbuilder = new DataFixerBuilder(1631); a(datafixerbuilder); @@ -14,7 +14,7 @@ } public static DataFixer a() { -@@ -185,6 +190,18 @@ +@@ -184,6 +189,18 @@ datafixerbuilder.addFixer(new DataConverterItemFrame(schema46, false)); Schema schema47 = datafixerbuilder.addSchema(1458, DataConverterRegistry.b); diff --git a/nms-patches/DataWatcher.patch b/nms-patches/DataWatcher.patch index 676bc64c1a..ace8a7726a 100644 --- a/nms-patches/DataWatcher.patch +++ b/nms-patches/DataWatcher.patch @@ -1,23 +1,5 @@ --- a/net/minecraft/server/DataWatcher.java +++ b/net/minecraft/server/DataWatcher.java -@@ -70,7 +70,7 @@ - } - } - -- public void register(DataWatcherObject datawatcherobject, T t0) { -+ public void register(DataWatcherObject datawatcherobject, Object t0) { // CraftBukkit T -> Object - int i = datawatcherobject.a(); - - if (i > 254) { -@@ -84,7 +84,7 @@ - } - } - -- private void registerObject(DataWatcherObject datawatcherobject, T t0) { -+ private void registerObject(DataWatcherObject datawatcherobject, Object t0) { // CraftBukkit Object - DataWatcher.Item datawatcher_item = new DataWatcher.Item(datawatcherobject, t0); - - this.e.writeLock().lock(); @@ -128,6 +128,13 @@ } diff --git a/nms-patches/DispenserRegistry.patch b/nms-patches/DispenserRegistry.patch index edb177e358..8e9eb2397b 100644 --- a/nms-patches/DispenserRegistry.patch +++ b/nms-patches/DispenserRegistry.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/DispenserRegistry.java +++ b/net/minecraft/server/DispenserRegistry.java -@@ -8,6 +8,16 @@ +@@ -7,6 +7,16 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -17,27 +17,9 @@ public class DispenserRegistry { public static final PrintStream a = System.out; -@@ -70,7 +80,7 @@ - BlockDispenser.a((IMaterial) Items.SPLASH_POTION, new IDispenseBehavior() { - public ItemStack dispense(ISourceBlock isourceblock, final ItemStack itemstack) { - return (new DispenseBehaviorProjectile() { -- protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) { -+ protected IProjectile a(World world, IPosition iposition, ItemStack itemstack1) { // CraftBukkit - decompile issue - return new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ(), itemstack1.cloneItemStack()); - } - -@@ -87,7 +97,7 @@ - BlockDispenser.a((IMaterial) Items.LINGERING_POTION, new IDispenseBehavior() { - public ItemStack dispense(ISourceBlock isourceblock, final ItemStack itemstack) { - return (new DispenseBehaviorProjectile() { -- protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) { -+ protected IProjectile a(World world, IPosition iposition, ItemStack itemstack1) { // CraftBukkit - decompile issue - return new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ(), itemstack1.cloneItemStack()); - } - -@@ -106,11 +116,39 @@ +@@ -105,11 +115,39 @@ EnumDirection enumdirection = (EnumDirection) isourceblock.e().get(BlockDispenser.FACING); - EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).b(itemstack.getTag()); + EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).b(itemstack.getTag()); + // CraftBukkit start + World world = isourceblock.getWorld(); @@ -76,7 +58,7 @@ return itemstack; } }; -@@ -128,10 +166,39 @@ +@@ -127,10 +165,39 @@ double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX(); double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F); double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ(); @@ -118,7 +100,7 @@ return itemstack; } -@@ -152,8 +219,38 @@ +@@ -151,8 +218,38 @@ double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY(); double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ(); @@ -159,7 +141,7 @@ return itemstack; } -@@ -175,9 +272,52 @@ +@@ -174,9 +271,52 @@ BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); World world = isourceblock.getWorld(); @@ -213,12 +195,12 @@ } else { return this.a.dispense(isourceblock, itemstack); } -@@ -200,13 +340,39 @@ +@@ -199,13 +339,39 @@ Block block = iblockdata.getBlock(); if (block instanceof IFluidSource) { -- FluidType fluidtype = ((IFluidSource) block).a(world, blockposition, iblockdata); -+ FluidType fluidtype = ((IFluidSource) block).a(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); // CraftBukkit +- FluidType fluidtype = ((IFluidSource) block).removeFluid(world, blockposition, iblockdata); ++ FluidType fluidtype = ((IFluidSource) block).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); // CraftBukkit if (!(fluidtype instanceof FluidTypeFlowing)) { return super.a(isourceblock, itemstack); @@ -248,13 +230,13 @@ + } + } + -+ fluidtype = ((IFluidSource) block).a(world, blockposition, iblockdata); // From above ++ fluidtype = ((IFluidSource) block).removeFluid(world, blockposition, iblockdata); // From above + // CraftBukkit end + itemstack.subtract(1); if (itemstack.isEmpty()) { return new ItemStack(item); -@@ -227,11 +393,39 @@ +@@ -226,11 +392,39 @@ protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.getWorld(); @@ -295,7 +277,7 @@ } else { Block block = world.getType(blockposition).getBlock(); -@@ -255,12 +449,57 @@ +@@ -254,12 +448,57 @@ this.a = true; World world = isourceblock.getWorld(); BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); @@ -353,7 +335,7 @@ return itemstack; } -@@ -269,11 +508,40 @@ +@@ -268,11 +507,40 @@ protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.getWorld(); BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); @@ -396,7 +378,7 @@ return itemstack; } })); -@@ -295,6 +563,30 @@ +@@ -294,6 +562,30 @@ EnumDirection enumdirection = (EnumDirection) isourceblock.e().get(BlockDispenser.FACING); BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection); @@ -427,7 +409,7 @@ this.a = 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); -@@ -318,6 +610,30 @@ +@@ -317,6 +609,30 @@ BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN; @@ -458,24 +440,7 @@ this.a = true; if (world.isEmpty(blockposition) && blockpumpkincarved.a((IWorldReader) world, blockposition)) { if (!world.isClientSide) { -@@ -336,14 +652,14 @@ - return itemstack; - } - })); -- BlockDispenser.a((IMaterial) Blocks.SHULKER_BOX.getItem(), (IDispenseBehavior) (new DispenserRegistry.d(null))); -+ BlockDispenser.a((IMaterial) Blocks.SHULKER_BOX.getItem(), (IDispenseBehavior) (new DispenserRegistry.d())); // CraftBukkit - decompile error - EnumColor[] aenumcolor = EnumColor.values(); - int i = aenumcolor.length; - - for (int j = 0; j < i; ++j) { - EnumColor enumcolor = aenumcolor[j]; - -- BlockDispenser.a((IMaterial) BlockShulkerBox.a(enumcolor).getItem(), (IDispenseBehavior) (new DispenserRegistry.d(null))); -+ BlockDispenser.a((IMaterial) BlockShulkerBox.a(enumcolor).getItem(), (IDispenseBehavior) (new DispenserRegistry.d())); // CraftBukkit - decompile error - } - - } -@@ -385,6 +701,51 @@ +@@ -384,6 +700,51 @@ } d(); @@ -527,16 +492,7 @@ } } } -@@ -393,7 +754,7 @@ - LocaleLanguage localelanguage = LocaleLanguage.a(); - - iregistry.iterator().forEachRemaining((object) -> { -- String s = (String) function.apply(object); -+ String s1 = (String) function.apply(object); // CraftBukkit - decompile error - - if (!localelanguage.b(s)) { - DispenserRegistry.c.warn("Missing translation for {}: {} (key: '{}')", s1, iregistry.getKey(object), s); -@@ -482,6 +843,30 @@ +@@ -481,6 +842,30 @@ BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection); EnumDirection enumdirection1 = isourceblock.getWorld().isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP; @@ -567,7 +523,7 @@ this.a = ((ItemBlock) item).a((BlockActionContext) (new DispenserRegistry.b(isourceblock.getWorld(), blockposition, enumdirection, itemstack, enumdirection1))) == EnumInteractionResult.SUCCESS; if (this.a) { itemstack.subtract(1); -@@ -531,12 +916,40 @@ +@@ -530,12 +915,40 @@ d3 = 0.0D; } diff --git a/nms-patches/Enchantment.patch b/nms-patches/Enchantment.patch index 8cece08345..77c69ed6a2 100644 --- a/nms-patches/Enchantment.patch +++ b/nms-patches/Enchantment.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Enchantment.java +++ b/net/minecraft/server/Enchantment.java -@@ -154,10 +154,15 @@ +@@ -153,10 +153,15 @@ a("channeling", new EnchantmentTridentChanneling(Enchantment.Rarity.VERY_RARE, new EnumItemSlot[] { EnumItemSlot.MAINHAND})); a("mending", new EnchantmentMending(Enchantment.Rarity.RARE, EnumItemSlot.values())); a("vanishing_curse", new EnchantmentVanishing(Enchantment.Rarity.VERY_RARE, EnumItemSlot.values())); diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch index 80926a084b..4dff5af0b7 100644 --- a/nms-patches/Entity.patch +++ b/nms-patches/Entity.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Entity.java +++ b/net/minecraft/server/Entity.java -@@ -19,8 +19,55 @@ +@@ -17,8 +17,55 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -56,7 +56,7 @@ protected static final Logger i = LogManager.getLogger(); private static final List a = Collections.emptyList(); private static final AxisAlignedBB b = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); -@@ -107,6 +154,16 @@ +@@ -105,6 +152,16 @@ private boolean aK; private final double[] aL; private long aM; @@ -73,7 +73,7 @@ public Entity(EntityTypes entitytypes, World world) { this.id = Entity.entityCount++; -@@ -212,6 +269,33 @@ +@@ -210,6 +267,33 @@ } protected void setYawPitch(float f, float f1) { @@ -107,7 +107,7 @@ this.yaw = f % 360.0F; this.pitch = f1 % 360.0F; } -@@ -224,6 +308,7 @@ +@@ -222,6 +306,7 @@ float f1 = this.length; this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); @@ -115,7 +115,7 @@ } public void tick() { -@@ -234,6 +319,51 @@ +@@ -232,6 +317,51 @@ this.W(); } @@ -167,7 +167,7 @@ public void W() { this.world.methodProfiler.enter("entityBaseTick"); if (this.isPassenger() && this.getVehicle().dead) { -@@ -250,6 +380,8 @@ +@@ -248,6 +378,8 @@ this.lastZ = this.locZ; this.lastPitch = this.pitch; this.lastYaw = this.yaw; @@ -176,7 +176,7 @@ if (!this.world.isClientSide && this.world instanceof WorldServer) { this.world.methodProfiler.enter("portal"); if (this.an) { -@@ -289,6 +421,7 @@ +@@ -287,6 +419,7 @@ this.E(); this.world.methodProfiler.exit(); } @@ -184,7 +184,7 @@ this.av(); this.r(); -@@ -339,7 +472,23 @@ +@@ -337,7 +470,23 @@ protected void burnFromLava() { if (!this.fireProof) { @@ -209,7 +209,7 @@ this.damageEntity(DamageSource.LAVA, 4.0F); } } -@@ -505,7 +654,7 @@ +@@ -503,7 +652,7 @@ } } @@ -218,7 +218,7 @@ double d11; if (this.Q > 0.0F && flag && (d7 != d0 || d9 != d2)) { -@@ -592,7 +741,7 @@ +@@ -590,7 +739,7 @@ this.world.methodProfiler.enter("rest"); this.recalcPosition(); this.positionChanged = d7 != d0 || d9 != d2; @@ -227,7 +227,7 @@ this.onGround = this.C && d8 < 0.0D; this.D = this.positionChanged || this.C; int k = MathHelper.floor(this.locX); -@@ -627,6 +776,28 @@ +@@ -625,6 +774,28 @@ block1.a((IBlockAccess) this.world, this); } @@ -256,7 +256,7 @@ if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) { double d22 = this.locX - d4; double d23 = this.locY - d5; -@@ -678,7 +849,14 @@ +@@ -676,7 +847,14 @@ if (!flag1) { ++this.fireTicks; if (this.fireTicks == 0) { @@ -272,7 +272,7 @@ } } -@@ -706,6 +884,7 @@ +@@ -704,6 +882,7 @@ this.locX = (axisalignedbb.minX + axisalignedbb.maxX) / 2.0D; this.locY = axisalignedbb.minY; this.locZ = (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D; @@ -280,7 +280,7 @@ } protected SoundEffect ad() { -@@ -876,7 +1055,7 @@ +@@ -874,7 +1053,7 @@ return null; } @@ -289,7 +289,7 @@ if (!this.fireProof) { this.damageEntity(DamageSource.FIRE, (float) i); } -@@ -1095,6 +1274,13 @@ +@@ -1093,6 +1272,13 @@ } public void spawnIn(World world) { @@ -303,7 +303,7 @@ this.world = world; } -@@ -1120,6 +1306,7 @@ +@@ -1118,6 +1304,7 @@ this.lastYaw -= 360.0F; } @@ -311,7 +311,7 @@ this.setPosition(this.locX, this.locY, this.locZ); this.setYawPitch(f, f1); } -@@ -1302,7 +1489,7 @@ +@@ -1300,7 +1487,7 @@ public boolean c(NBTTagCompound nbttagcompound) { String s = this.getSaveID(); @@ -320,7 +320,7 @@ nbttagcompound.setString("id", s); this.save(nbttagcompound); return true; -@@ -1319,6 +1506,18 @@ +@@ -1317,6 +1504,18 @@ try { nbttagcompound.set("Pos", this.a(this.locX, this.locY, this.locZ)); nbttagcompound.set("Motion", this.a(this.motX, this.motY, this.motZ)); @@ -339,7 +339,7 @@ nbttagcompound.set("Rotation", this.a(this.yaw, this.pitch)); nbttagcompound.setFloat("FallDistance", this.fallDistance); nbttagcompound.setShort("Fire", (short) this.fireTicks); -@@ -1328,6 +1527,12 @@ +@@ -1326,6 +1525,12 @@ nbttagcompound.setBoolean("Invulnerable", this.invulnerable); nbttagcompound.setInt("PortalCooldown", this.portalCooldown); nbttagcompound.a("UUID", this.getUniqueID()); @@ -352,7 +352,7 @@ IChatBaseComponent ichatbasecomponent = this.getCustomName(); if (ichatbasecomponent != null) { -@@ -1404,6 +1609,8 @@ +@@ -1402,6 +1607,8 @@ this.motX = nbttaglist1.k(0); this.motY = nbttaglist1.k(1); this.motZ = nbttaglist1.k(2); @@ -361,7 +361,7 @@ if (Math.abs(this.motX) > 10.0D) { this.motX = 0.0D; } -@@ -1415,6 +1622,7 @@ +@@ -1413,6 +1620,7 @@ if (Math.abs(this.motZ) > 10.0D) { this.motZ = 0.0D; } @@ -369,7 +369,7 @@ this.locX = nbttaglist.k(0); this.locY = nbttaglist.k(1); -@@ -1471,6 +1679,56 @@ +@@ -1469,6 +1677,56 @@ this.setPosition(this.locX, this.locY, this.locZ); } @@ -426,7 +426,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -1544,9 +1802,22 @@ +@@ -1542,9 +1800,22 @@ if (itemstack.isEmpty()) { return null; } else { @@ -449,7 +449,7 @@ this.world.addEntity(entityitem); return entityitem; } -@@ -1658,7 +1929,7 @@ +@@ -1656,7 +1927,7 @@ } this.vehicle = entity; @@ -458,7 +458,7 @@ return true; } } -@@ -1679,15 +1950,33 @@ +@@ -1677,15 +1948,33 @@ Entity entity = this.vehicle; this.vehicle = null; @@ -494,7 +494,7 @@ if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bO() instanceof EntityHuman)) { this.passengers.add(0, entity); } else { -@@ -1695,15 +1984,33 @@ +@@ -1693,15 +1982,33 @@ } } @@ -529,7 +529,7 @@ } protected boolean q(Entity entity) { -@@ -1800,6 +2107,13 @@ +@@ -1798,6 +2105,13 @@ } public void setSwimming(boolean flag) { @@ -543,7 +543,7 @@ this.setFlag(4, flag); } -@@ -1860,16 +2174,53 @@ +@@ -1858,16 +2172,53 @@ } public void setAirTicks(int i) { @@ -600,7 +600,7 @@ } public void j(boolean flag) { -@@ -2036,19 +2387,72 @@ +@@ -2034,19 +2385,72 @@ if (!this.world.isClientSide && !this.dead) { this.world.methodProfiler.enter("changeDimension"); MinecraftServer minecraftserver = this.bK(); @@ -676,7 +676,7 @@ BlockPosition blockposition; if (dimensionmanager == DimensionManager.THE_END) { -@@ -2077,12 +2481,18 @@ +@@ -2075,12 +2479,18 @@ blockposition = new BlockPosition(this); } @@ -696,7 +696,7 @@ if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) { BlockPosition blockposition1 = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn()); -@@ -2090,6 +2500,7 @@ +@@ -2088,6 +2498,7 @@ } else { entity.setPositionRotation(blockposition, entity.yaw, entity.pitch); } @@ -704,7 +704,7 @@ boolean flag = entity.attachedToPlayer; -@@ -2097,13 +2508,21 @@ +@@ -2095,13 +2506,21 @@ worldserver1.addEntity(entity); entity.attachedToPlayer = flag; worldserver1.entityJoinedWorld(entity, false); @@ -727,7 +727,7 @@ return entity; } else { return null; -@@ -2243,7 +2662,26 @@ +@@ -2241,7 +2660,26 @@ } public void a(AxisAlignedBB axisalignedbb) { diff --git a/nms-patches/EntityAreaEffectCloud.patch b/nms-patches/EntityAreaEffectCloud.patch index d4ecf157c4..8e003c16f7 100644 --- a/nms-patches/EntityAreaEffectCloud.patch +++ b/nms-patches/EntityAreaEffectCloud.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/server/EntityAreaEffectCloud.java +++ b/net/minecraft/server/EntityAreaEffectCloud.java -@@ -10,6 +10,10 @@ - import java.util.List; - import java.util.Map; - import java.util.UUID; -+ -+import org.bukkit.craftbukkit.entity.CraftLivingEntity; // CraftBukkit -+import org.bukkit.entity.LivingEntity; // CraftBukkit -+ - import java.util.Map.Entry; +@@ -13,6 +13,10 @@ import javax.annotation.Nullable; import org.apache.logging.log4j.LogManager; -@@ -102,6 +106,22 @@ + import org.apache.logging.log4j.Logger; ++// CraftBukkit start ++import org.bukkit.craftbukkit.entity.CraftLivingEntity; ++import org.bukkit.entity.LivingEntity; ++// CraftBukkit end + + public class EntityAreaEffectCloud extends Entity { + +@@ -101,6 +105,22 @@ } @@ -34,15 +34,15 @@ public int getColor() { return (Integer) this.getDataWatcher().get(EntityAreaEffectCloud.c); } -@@ -245,6 +265,7 @@ - if (!list.isEmpty()) { - Iterator iterator2 = list.iterator(); +@@ -244,6 +264,7 @@ + if (!list1.isEmpty()) { + Iterator iterator2 = list1.iterator(); -+ List entities = new ArrayList(); // CraftBukkit ++ List entities = new java.util.ArrayList(); // CraftBukkit while (iterator2.hasNext()) { EntityLiving entityliving = (EntityLiving) iterator2.next(); -@@ -254,6 +275,17 @@ +@@ -253,6 +274,17 @@ double d2 = d0 * d0 + d1 * d1; if (d2 <= (double) (f * f)) { @@ -58,9 +58,9 @@ + EntityLiving entityliving = ((CraftLivingEntity) entity).getHandle(); + // CraftBukkit end this.h.put(entityliving, this.ticksLived + this.reapplicationDelay); - Iterator iterator3 = arraylist.iterator(); + Iterator iterator3 = list.iterator(); -@@ -263,7 +295,7 @@ +@@ -262,7 +294,7 @@ if (mobeffect1.getMobEffect().isInstant()) { mobeffect1.getMobEffect().applyInstantEffect(this, this.getSource(), entityliving, mobeffect1.getAmplifier(), 0.5D); } else { diff --git a/nms-patches/EntityDolphin.patch b/nms-patches/EntityDolphin.patch index 06ac5150d7..8b681bd9bb 100644 --- a/nms-patches/EntityDolphin.patch +++ b/nms-patches/EntityDolphin.patch @@ -1,14 +1,5 @@ --- a/net/minecraft/server/EntityDolphin.java +++ b/net/minecraft/server/EntityDolphin.java -@@ -95,7 +95,7 @@ - this.goalSelector.a(5, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F)); - this.goalSelector.a(5, new PathfinderGoalWaterJump(this, 10)); - this.goalSelector.a(6, new PathfinderGoalMeleeAttack(this, 1.2000000476837158D, true)); -- this.goalSelector.a(8, new EntityDolphin.d(null)); -+ this.goalSelector.a(8, new EntityDolphin.d()); // CraftBukkit - decompile error - this.goalSelector.a(8, new PathfinderGoalFollowBoat(this)); - this.goalSelector.a(9, new PathfinderGoalAvoidTarget(this, EntityGuardian.class, 8.0F, 1.0D, 1.0D)); - this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityGuardian.class})); @@ -412,7 +412,7 @@ } diff --git a/nms-patches/EntityEnderman.patch b/nms-patches/EntityEnderman.patch index fbe30e3f37..49dc4e2a08 100644 --- a/nms-patches/EntityEnderman.patch +++ b/nms-patches/EntityEnderman.patch @@ -1,22 +1,6 @@ --- a/net/minecraft/server/EntityEnderman.java +++ b/net/minecraft/server/EntityEnderman.java -@@ -33,7 +33,14 @@ - this.goalSelector.a(11, new EntityEnderman.PathfinderGoalEndermanPickupBlock(this)); - this.targetSelector.a(1, new EntityEnderman.PathfinderGoalPlayerWhoLookedAtTarget(this)); - this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false, new Class[0])); -- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityEndermite.class, 10, true, false, EntityEndermite::isPlayerSpawned)); -+ // CraftBukkit - decompile error -+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityEndermite.class, 10, true, false, new Predicate() { -+ @Override -+ public boolean test(EntityEndermite entityendermite) { -+ return entityendermite.isPlayerSpawned(); -+ } -+ })); -+ // CraftBukkit end - } - - protected void initAttributes() { -@@ -45,7 +52,17 @@ +@@ -44,7 +44,17 @@ } public void setGoalTarget(@Nullable EntityLiving entityliving) { @@ -35,7 +19,7 @@ AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); if (entityliving == null) { -@@ -59,6 +76,7 @@ +@@ -58,6 +68,7 @@ attributeinstance.b(EntityEnderman.b); } } @@ -43,7 +27,7 @@ } -@@ -277,8 +295,12 @@ +@@ -276,8 +287,12 @@ boolean flag = movingobjectposition != null && movingobjectposition.getBlockPosition().equals(blockposition); if (block.a(TagsBlock.ENDERMAN_HOLDABLE) && flag) { @@ -58,7 +42,7 @@ } } -@@ -308,8 +330,12 @@ +@@ -307,8 +322,12 @@ IBlockData iblockdata2 = this.a.getCarried(); if (iblockdata2 != null && this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1)) { diff --git a/nms-patches/EntityFallingBlock.patch b/nms-patches/EntityFallingBlock.patch index 37b5e8280d..76feba7500 100644 --- a/nms-patches/EntityFallingBlock.patch +++ b/nms-patches/EntityFallingBlock.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/server/EntityFallingBlock.java +++ b/net/minecraft/server/EntityFallingBlock.java @@ -4,6 +4,8 @@ - import java.util.ArrayList; import java.util.Iterator; + import java.util.List; +import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit + diff --git a/nms-patches/EntityGuardianElder.patch b/nms-patches/EntityGuardianElder.patch index b51a76a433..e7977fe70a 100644 --- a/nms-patches/EntityGuardianElder.patch +++ b/nms-patches/EntityGuardianElder.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityGuardianElder.java +++ b/net/minecraft/server/EntityGuardianElder.java -@@ -68,7 +68,7 @@ +@@ -67,7 +67,7 @@ if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) { entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(10, 0.0F)); diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch index 8d81262afa..63e7278b1f 100644 --- a/nms-patches/EntityHuman.patch +++ b/nms-patches/EntityHuman.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/EntityHuman.java +++ b/net/minecraft/server/EntityHuman.java -@@ -15,6 +15,18 @@ - import java.util.function.ToIntFunction; +@@ -12,6 +12,18 @@ + import java.util.function.Predicate; import javax.annotation.Nullable; +// CraftBukkit start @@ -19,7 +19,7 @@ public abstract class EntityHuman extends EntityLiving { private static final DataWatcherObject a = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c); -@@ -24,10 +36,10 @@ +@@ -21,10 +33,10 @@ protected static final DataWatcherObject bz = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); protected static final DataWatcherObject bA = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); public PlayerInventory inventory = new PlayerInventory(this); @@ -32,7 +32,7 @@ protected int bG; public float bH; public float bI; -@@ -60,6 +72,17 @@ +@@ -57,6 +69,17 @@ @Nullable public EntityFishingHook hookedFish; @@ -50,7 +50,7 @@ public EntityHuman(World world, GameProfile gameprofile) { super(EntityTypes.PLAYER, world); this.cd = ItemStack.a; -@@ -184,7 +207,7 @@ +@@ -181,7 +204,7 @@ ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD); if (itemstack.getItem() == Items.TURTLE_HELMET && !this.a(TagsFluid.WATER)) { @@ -59,7 +59,7 @@ } } -@@ -369,7 +392,8 @@ +@@ -366,7 +389,8 @@ if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.world.getGameRules().getBoolean("naturalRegeneration")) { if (this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 == 0) { @@ -69,7 +69,7 @@ } if (this.foodData.c() && this.ticksLived % 10 == 0) { -@@ -393,7 +417,7 @@ +@@ -390,7 +414,7 @@ this.o((float) attributeinstance.getValue()); float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); @@ -78,7 +78,7 @@ if (f > 0.1F) { f = 0.1F; -@@ -516,6 +540,7 @@ +@@ -513,6 +537,7 @@ @Nullable public EntityItem a(boolean flag) { @@ -86,7 +86,7 @@ return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && !this.inventory.getItemInHand().isEmpty() ? this.inventory.getItemInHand().getCount() : 1), false, true); } -@@ -558,6 +583,30 @@ +@@ -555,6 +580,30 @@ entityitem.motZ += Math.sin((double) f1) * (double) f; } @@ -117,7 +117,7 @@ ItemStack itemstack1 = this.a(entityitem); if (flag1) { -@@ -652,6 +701,13 @@ +@@ -649,6 +698,13 @@ this.a(true, true, false); } @@ -131,7 +131,7 @@ if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) { this.e = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); this.f = nbttagcompound.getBoolean("SpawnForced"); -@@ -702,6 +758,7 @@ +@@ -699,6 +755,7 @@ if (!this.getShoulderEntityRight().isEmpty()) { nbttagcompound.set("ShoulderEntityRight", this.getShoulderEntityRight()); } @@ -139,7 +139,7 @@ } -@@ -719,10 +776,10 @@ +@@ -716,10 +773,10 @@ this.a(true, true, false); } @@ -152,7 +152,7 @@ } if (this.world.getDifficulty() == EnumDifficulty.EASY) { -@@ -734,7 +791,13 @@ +@@ -731,7 +788,13 @@ } } @@ -167,7 +167,7 @@ } } } -@@ -748,10 +811,29 @@ +@@ -745,10 +808,29 @@ } public boolean a(EntityHuman entityhuman) { @@ -200,7 +200,7 @@ } protected void damageArmor(float f) { -@@ -794,7 +876,12 @@ +@@ -791,7 +873,12 @@ return (float) i / (float) this.inventory.armor.size(); } @@ -214,7 +214,7 @@ if (!this.isInvulnerable(damagesource)) { f = this.applyArmorModifier(damagesource, f); f = this.applyMagicModifier(damagesource, f); -@@ -820,6 +907,7 @@ +@@ -817,6 +904,7 @@ } } @@ -222,7 +222,7 @@ } public void openSign(TileEntitySign tileentitysign) {} -@@ -941,8 +1029,15 @@ +@@ -938,8 +1026,15 @@ if (entity instanceof EntityLiving) { f3 = ((EntityLiving) entity).getHealth(); if (j > 0 && !entity.isBurning()) { @@ -240,7 +240,7 @@ } } -@@ -973,8 +1068,11 @@ +@@ -970,8 +1065,11 @@ EntityLiving entityliving = (EntityLiving) iterator.next(); if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h(entityliving) < 9.0D) { @@ -253,7 +253,7 @@ } } -@@ -983,11 +1081,28 @@ +@@ -980,11 +1078,28 @@ } if (entity instanceof EntityPlayer && entity.velocityChanged) { @@ -282,7 +282,7 @@ } if (flag2) { -@@ -1036,7 +1151,14 @@ +@@ -1033,7 +1148,14 @@ this.a(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F)); if (j > 0) { @@ -298,7 +298,7 @@ } if (this.world instanceof WorldServer && f5 > 2.0F) { -@@ -1052,6 +1174,11 @@ +@@ -1049,6 +1171,11 @@ if (flag4) { entity.extinguish(); } @@ -310,7 +310,7 @@ } } -@@ -1113,15 +1240,15 @@ +@@ -1110,15 +1237,15 @@ return this.h; } @@ -330,15 +330,7 @@ return EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE; } -@@ -1136,13 +1263,33 @@ - if (!this.u()) { - double d0 = 8.0D; - double d1 = 5.0D; -- List list = this.world.a(EntityMonster.class, new AxisAlignedBB((double) blockposition.getX() - 8.0D, (double) blockposition.getY() - 5.0D, (double) blockposition.getZ() - 8.0D, (double) blockposition.getX() + 8.0D, (double) blockposition.getY() + 5.0D, (double) blockposition.getZ() + 8.0D), (Predicate) (new EntityHuman.c(this, null))); -+ List list = this.world.a(EntityMonster.class, new AxisAlignedBB((double) blockposition.getX() - 8.0D, (double) blockposition.getY() - 5.0D, (double) blockposition.getZ() - 8.0D, (double) blockposition.getX() + 8.0D, (double) blockposition.getY() + 5.0D, (double) blockposition.getZ() + 8.0D), (Predicate) (new EntityHuman.c(this))); // CraftBukkit - decompile error - - if (!list.isEmpty()) { - return EntityHuman.EnumBedResult.NOT_SAFE; +@@ -1140,6 +1267,26 @@ } } } @@ -365,7 +357,7 @@ if (this.isPassenger()) { this.stopRiding(); -@@ -1209,6 +1356,24 @@ +@@ -1206,6 +1353,24 @@ this.world.everyoneSleeping(); } @@ -390,7 +382,7 @@ this.sleepTicks = flag ? 0 : 100; if (flag2) { this.setRespawnPosition(this.bedPosition, false); -@@ -1260,9 +1425,11 @@ +@@ -1257,9 +1422,11 @@ if (blockposition != null) { this.e = blockposition; this.f = flag; @@ -402,7 +394,7 @@ } } -@@ -1328,7 +1495,11 @@ +@@ -1325,7 +1492,11 @@ this.motY = d3 * 0.6D; this.aU = f3; this.fallDistance = 0.0F; @@ -415,7 +407,7 @@ } else { super.a(f, f1, f2); } -@@ -1628,13 +1799,17 @@ +@@ -1625,13 +1796,17 @@ } protected void releaseShoulderEntities() { @@ -438,7 +430,7 @@ if (!this.world.isClientSide && !nbttagcompound.isEmpty()) { Entity entity = EntityTypes.a(nbttagcompound, this.world); -@@ -1643,9 +1818,10 @@ +@@ -1640,9 +1815,10 @@ } entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ); diff --git a/nms-patches/EntityIllagerIllusioner.patch b/nms-patches/EntityIllagerIllusioner.patch index 25b148f7eb..ba18ec7ced 100644 --- a/nms-patches/EntityIllagerIllusioner.patch +++ b/nms-patches/EntityIllagerIllusioner.patch @@ -1,16 +1,5 @@ --- a/net/minecraft/server/EntityIllagerIllusioner.java +++ b/net/minecraft/server/EntityIllagerIllusioner.java -@@ -24,8 +24,8 @@ - super.n(); - this.goalSelector.a(0, new PathfinderGoalFloat(this)); - this.goalSelector.a(1, new EntityIllagerWizard.b()); -- this.goalSelector.a(4, new EntityIllagerIllusioner.b(null)); -- this.goalSelector.a(5, new EntityIllagerIllusioner.a(null)); -+ this.goalSelector.a(4, new EntityIllagerIllusioner.b()); // CraftBukkit - decompile error -+ this.goalSelector.a(5, new EntityIllagerIllusioner.a()); // CraftBukkit - decompile error - this.goalSelector.a(6, new PathfinderGoalBowShoot(this, 0.5D, 20, 15.0F)); - this.goalSelector.a(8, new PathfinderGoalRandomStroll(this, 0.6D)); - this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 3.0F, 1.0F)); @@ -164,7 +164,7 @@ } diff --git a/nms-patches/EntityInsentient.patch b/nms-patches/EntityInsentient.patch index ab2f0d2f8b..aec93ef3b3 100644 --- a/nms-patches/EntityInsentient.patch +++ b/nms-patches/EntityInsentient.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityInsentient.java +++ b/net/minecraft/server/EntityInsentient.java -@@ -9,6 +9,18 @@ +@@ -10,6 +10,18 @@ import java.util.UUID; import javax.annotation.Nullable; @@ -19,7 +19,7 @@ public abstract class EntityInsentient extends EntityLiving { private static final DataWatcherObject a = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a); -@@ -27,7 +39,7 @@ +@@ -28,7 +40,7 @@ public float[] dropChanceHand; private final NonNullList bE; public float[] dropChanceArmor; @@ -28,7 +28,7 @@ public boolean persistent; private final Map bH; public MinecraftKey lootTableKey; -@@ -57,6 +69,9 @@ +@@ -58,6 +70,9 @@ this.n(); } @@ -38,7 +38,7 @@ } protected void n() {} -@@ -110,7 +125,38 @@ +@@ -111,7 +126,38 @@ } public void setGoalTarget(@Nullable EntityLiving entityliving) { @@ -77,7 +77,7 @@ } public boolean b(Class oclass) { -@@ -336,11 +382,20 @@ +@@ -337,11 +383,20 @@ public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); @@ -100,7 +100,7 @@ NBTTagList nbttaglist; int i; -@@ -394,6 +449,11 @@ +@@ -395,6 +450,11 @@ protected MinecraftKey getDefaultLootTable() { return null; } @@ -112,7 +112,7 @@ protected void a(boolean flag, int i, DamageSource damagesource) { MinecraftKey minecraftkey = this.lootTableKey; -@@ -470,11 +530,21 @@ +@@ -471,11 +531,21 @@ ItemStack itemstack1 = this.getEquipment(enumitemslot); boolean flag = this.a(itemstack, itemstack1, enumitemslot); @@ -135,7 +135,7 @@ } this.setSlot(enumitemslot, itemstack); -@@ -553,11 +623,11 @@ +@@ -554,11 +624,11 @@ double d2 = entityhuman.locZ - this.locZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -149,7 +149,7 @@ this.die(); } else if (d3 < 1024.0D) { this.ticksFarFromPlayer = 0; -@@ -931,12 +1001,24 @@ +@@ -932,12 +1002,24 @@ public final boolean b(EntityHuman entityhuman, EnumHand enumhand) { if (this.isLeashed() && this.getLeashHolder() == entityhuman) { @@ -174,7 +174,7 @@ this.setLeashHolder(entityhuman, true); itemstack.subtract(1); return true; -@@ -957,10 +1039,12 @@ +@@ -958,10 +1040,12 @@ if (this.bK) { if (!this.isAlive()) { @@ -187,7 +187,7 @@ this.unleash(true, true); } } -@@ -971,7 +1055,9 @@ +@@ -972,7 +1056,9 @@ this.bK = false; this.leashHolder = null; if (!this.world.isClientSide && flag1) { @@ -197,7 +197,7 @@ } if (!this.world.isClientSide && flag && this.world instanceof WorldServer) { -@@ -1041,6 +1127,7 @@ +@@ -1042,6 +1128,7 @@ this.setLeashHolder(entityleash, true); } else { @@ -205,7 +205,7 @@ this.unleash(false, true); } } -@@ -1136,7 +1223,14 @@ +@@ -1137,7 +1224,14 @@ int j = EnchantmentManager.getFireAspectEnchantmentLevel(this); if (j > 0) { diff --git a/nms-patches/EntityIronGolem.patch b/nms-patches/EntityIronGolem.patch index 5b53545a63..650792d9a4 100644 --- a/nms-patches/EntityIronGolem.patch +++ b/nms-patches/EntityIronGolem.patch @@ -1,21 +1,6 @@ --- a/net/minecraft/server/EntityIronGolem.java +++ b/net/minecraft/server/EntityIronGolem.java -@@ -28,8 +28,12 @@ - this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); - this.targetSelector.a(1, new PathfinderGoalDefendVillage(this)); - this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false, new Class[0])); -- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityInsentient.class, 10, false, true, (entityinsentient) -> { -- return entityinsentient != null && IMonster.e.test(entityinsentient) && !(entityinsentient instanceof EntityCreeper); -+ // CraftBukkit start - decompile error -+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityInsentient.class, 10, false, true, new Predicate() { -+ public boolean test(@Nullable EntityInsentient entityinsentient) { -+ return entityinsentient != null && IMonster.e.test(entityinsentient) && !(entityinsentient instanceof EntityCreeper); -+ } -+ // CraftBukkit end - })); - } - -@@ -67,7 +71,7 @@ +@@ -66,7 +66,7 @@ protected void C(Entity entity) { if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.getRandom().nextInt(20) == 0) { diff --git a/nms-patches/EntityMinecartAbstract.patch b/nms-patches/EntityMinecartAbstract.patch index 6737e40688..d5ec05b2c9 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 -@@ -8,6 +8,15 @@ - import java.util.function.ToIntFunction; +@@ -6,6 +6,15 @@ + import java.util.List; import javax.annotation.Nullable; +// CraftBukkit start @@ -16,7 +16,7 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableTileEntity { private static final DataWatcherObject a = DataWatcher.a(EntityMinecartAbstract.class, DataWatcherRegistry.b); -@@ -25,6 +34,17 @@ +@@ -23,6 +32,17 @@ private double aA; private double aB; @@ -34,7 +34,7 @@ protected EntityMinecartAbstract(EntityTypes entitytypes, World world) { super(entitytypes, world); this.j = true; -@@ -92,6 +112,19 @@ +@@ -90,6 +110,19 @@ if (this.isInvulnerable(damagesource)) { return false; } else { @@ -54,7 +54,7 @@ this.k(-this.u()); this.d(10); this.aA(); -@@ -99,6 +132,15 @@ +@@ -97,6 +130,15 @@ boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild; if (flag || this.getDamage() > 40.0F) { @@ -70,7 +70,7 @@ this.ejectPassengers(); if (flag && !this.hasCustomName()) { this.die(); -@@ -137,6 +179,14 @@ +@@ -135,6 +177,14 @@ } public void tick() { @@ -85,7 +85,7 @@ if (this.getType() > 0) { this.d(this.getType() - 1); } -@@ -151,6 +201,8 @@ +@@ -149,6 +199,8 @@ int i; @@ -94,7 +94,7 @@ if (!this.world.isClientSide && this.world instanceof WorldServer) { this.world.methodProfiler.enter("portal"); MinecraftServer minecraftserver = this.world.getMinecraftServer(); -@@ -190,6 +242,7 @@ +@@ -188,6 +240,7 @@ this.world.methodProfiler.exit(); } @@ -102,7 +102,7 @@ if (this.world.isClientSide) { if (this.aw > 0) { -@@ -257,6 +310,18 @@ +@@ -255,6 +308,18 @@ } this.setYawPitch(this.yaw, this.pitch); @@ -119,9 +119,9 @@ + } + // CraftBukkit end if (this.v() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.motX * this.motX + this.motZ * this.motZ > 0.01D) { - List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.a(this)); + List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.a(this)); -@@ -265,8 +330,24 @@ +@@ -263,8 +328,24 @@ Entity entity = (Entity) list.get(l); if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) { @@ -146,7 +146,7 @@ entity.collide(this); } } -@@ -278,6 +359,14 @@ +@@ -276,6 +357,14 @@ Entity entity1 = (Entity) iterator.next(); if (!this.w(entity1) && entity1.isCollidable() && entity1 instanceof EntityMinecartAbstract) { @@ -161,7 +161,7 @@ entity1.collide(this); } } -@@ -288,7 +377,7 @@ +@@ -286,7 +375,7 @@ } protected double p() { @@ -170,7 +170,7 @@ } public void a(int i, int j, int k, boolean flag) {} -@@ -299,16 +388,20 @@ +@@ -297,16 +386,20 @@ this.motX = MathHelper.a(this.motX, -d0, d0); this.motZ = MathHelper.a(this.motZ, -d0, d0); if (this.onGround) { @@ -197,7 +197,7 @@ } } -@@ -493,7 +586,7 @@ +@@ -491,7 +584,7 @@ } protected void r() { @@ -206,7 +206,7 @@ this.motX *= 0.996999979019165D; this.motY *= 0.0D; this.motZ *= 0.996999979019165D; -@@ -590,6 +683,14 @@ +@@ -588,6 +681,14 @@ if (!this.world.isClientSide) { if (!entity.noclip && !this.noclip) { if (!this.w(entity)) { @@ -221,7 +221,7 @@ double d0 = entity.locX - this.locX; double d1 = entity.locZ - this.locZ; double d2 = d0 * d0 + d1 * d1; -@@ -736,4 +837,26 @@ +@@ -734,4 +835,26 @@ return this.i; } } diff --git a/nms-patches/EntityPainting.patch b/nms-patches/EntityPainting.patch index cc62b6709b..7b034ea7e2 100644 --- a/nms-patches/EntityPainting.patch +++ b/nms-patches/EntityPainting.patch @@ -5,8 +5,8 @@ public EntityPainting(World world) { super(EntityTypes.PAINTING, world); + // CraftBukkit start - generate a non-null painting -+ ArrayList arraylist = Lists.newArrayList(Paintings.a); -+ this.art = (Paintings) arraylist.get(this.random.nextInt(arraylist.size())); ++ List list = Lists.newArrayList(Paintings.a); ++ this.art = (Paintings) list.get(this.random.nextInt(list.size())); + // CraftBukkit end } diff --git a/nms-patches/EntityParrot.patch b/nms-patches/EntityParrot.patch index 2ea16e1648..c16d42cd68 100644 --- a/nms-patches/EntityParrot.patch +++ b/nms-patches/EntityParrot.patch @@ -1,14 +1,6 @@ --- a/net/minecraft/server/EntityParrot.java +++ b/net/minecraft/server/EntityParrot.java -@@ -16,14 +16,14 @@ - public class EntityParrot extends EntityPerchable implements EntityBird { - - private static final DataWatcherObject bL = DataWatcher.a(EntityParrot.class, DataWatcherRegistry.b); -- private static final Predicate bM = new Predicate() { -+ private static final Predicate bM = new Predicate() { // CraftBukkit - decompile error - public boolean test(@Nullable EntityInsentient entityinsentient) { - return entityinsentient != null && EntityParrot.bP.containsKey(entityinsentient.P()); - } +@@ -21,7 +21,7 @@ }; private static final Item bN = Items.COOKIE; private static final Set bO = Sets.newHashSet(new Item[] { Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS}); @@ -17,7 +9,7 @@ hashmap.put(EntityTypes.BLAZE, SoundEffects.ENTITY_PARROT_IMITATE_BLAZE); hashmap.put(EntityTypes.CAVE_SPIDER, SoundEffects.ENTITY_PARROT_IMITATE_SPIDER); hashmap.put(EntityTypes.CREEPER, SoundEffects.ENTITY_PARROT_IMITATE_CREEPER); -@@ -170,7 +170,7 @@ +@@ -168,7 +168,7 @@ } if (!this.world.isClientSide) { @@ -26,7 +18,7 @@ this.c(entityhuman); this.s(true); this.world.broadcastEntityEffect(this, (byte) 7); -@@ -186,7 +186,7 @@ +@@ -184,7 +184,7 @@ itemstack.subtract(1); } @@ -35,7 +27,7 @@ if (entityhuman.u() || !this.bl()) { this.damageEntity(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE); } -@@ -306,7 +306,8 @@ +@@ -304,7 +304,8 @@ return false; } else { if (this.goalSit != null) { diff --git a/nms-patches/EntityPhantom.patch b/nms-patches/EntityPhantom.patch index eca94bc683..9ec8a7bb74 100644 --- a/nms-patches/EntityPhantom.patch +++ b/nms-patches/EntityPhantom.patch @@ -1,31 +1,6 @@ --- a/net/minecraft/server/EntityPhantom.java +++ b/net/minecraft/server/EntityPhantom.java -@@ -28,10 +28,11 @@ - } - - protected void n() { -- this.goalSelector.a(1, new EntityPhantom.c(null)); -- this.goalSelector.a(2, new EntityPhantom.i(null)); -- this.goalSelector.a(3, new EntityPhantom.e(null)); -- this.targetSelector.a(1, new EntityPhantom.b(null)); -+ // CraftBukkit - decompile errors -+ this.goalSelector.a(1, new EntityPhantom.c()); -+ this.goalSelector.a(2, new EntityPhantom.i()); -+ this.goalSelector.a(3, new EntityPhantom.e()); -+ this.targetSelector.a(1, new EntityPhantom.b()); - } - - protected void initAttributes() { -@@ -186,7 +187,7 @@ - } else { - this.b = 60; - AxisAlignedBB axisalignedbb = EntityPhantom.this.getBoundingBox().grow(16.0D, 64.0D, 16.0D); -- List list = EntityPhantom.this.world.a(EntityHuman.class, axisalignedbb); -+ List list = EntityPhantom.this.world.a(EntityHuman.class, axisalignedbb); // CraftBukkit - decompile error - - if (!list.isEmpty()) { - list.sort((entityhuman, entityhuman1) -> { -@@ -198,7 +199,7 @@ +@@ -197,7 +197,7 @@ EntityHuman entityhuman = (EntityHuman) iterator.next(); if (PathfinderGoalTarget.a(EntityPhantom.this, entityhuman, false, false)) { diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch index 564f704915..3419160ec8 100644 --- a/nms-patches/EntityPlayer.patch +++ b/nms-patches/EntityPlayer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityPlayer.java +++ b/net/minecraft/server/EntityPlayer.java -@@ -15,10 +15,28 @@ +@@ -12,10 +12,28 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -30,7 +30,7 @@ public PlayerConnection playerConnection; public final MinecraftServer server; public final PlayerInteractManager playerInteractManager; -@@ -54,6 +72,20 @@ +@@ -51,6 +69,20 @@ public int ping; public boolean viewingCredits; @@ -51,7 +51,7 @@ public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { super((World) worldserver, gameprofile); playerinteractmanager.player = this; -@@ -64,8 +96,50 @@ +@@ -61,8 +93,50 @@ this.cf = minecraftserver.getPlayerList().h(this); this.Q = 1.0F; this.a(worldserver); @@ -102,7 +102,7 @@ private void a(WorldServer worldserver) { BlockPosition blockposition = worldserver.getSpawn(); -@@ -132,6 +206,7 @@ +@@ -129,6 +203,7 @@ if (nbttagcompound.hasKeyOfType("recipeBook", 10)) { this.recipeBook.a(nbttagcompound.getCompound("recipeBook")); } @@ -110,7 +110,7 @@ } -@@ -151,7 +226,20 @@ +@@ -148,7 +223,20 @@ Entity entity = this.getRootVehicle(); Entity entity1 = this.getVehicle(); @@ -132,7 +132,7 @@ NBTTagCompound nbttagcompound2 = new NBTTagCompound(); NBTTagCompound nbttagcompound3 = new NBTTagCompound(); -@@ -162,8 +250,34 @@ +@@ -159,8 +247,34 @@ } nbttagcompound.set("recipeBook", this.recipeBook.e()); @@ -167,7 +167,7 @@ public void a(int i) { float f = (float) this.getExpToLevel(); float f1 = (f - 1.0F) / f; -@@ -210,6 +324,11 @@ +@@ -207,6 +321,11 @@ } public void tick() { @@ -179,7 +179,7 @@ this.playerInteractManager.a(); --this.invulnerableTicks; if (this.noDamageTicks > 0) { -@@ -275,7 +394,7 @@ +@@ -272,7 +391,7 @@ } if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cp) { @@ -188,7 +188,7 @@ this.lastHealthSent = this.getHealth(); this.lastFoodSent = this.foodData.getFoodLevel(); this.cp = this.foodData.getSaturationLevel() == 0.0F; -@@ -306,6 +425,12 @@ +@@ -303,6 +422,12 @@ this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.cm)); } @@ -201,7 +201,7 @@ if (this.expLevel != this.cl) { this.cl = this.expLevel; this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.cl)); -@@ -320,6 +445,16 @@ +@@ -317,6 +442,16 @@ CriterionTriggers.p.a(this); } @@ -218,7 +218,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Ticking player"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked"); -@@ -330,24 +465,50 @@ +@@ -327,16 +462,43 @@ } private void a(IScoreboardCriteria iscoreboardcriteria, int i) { @@ -265,16 +265,7 @@ this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> { if (!future.isSuccess()) { -- boolean flag = true; - String s = ichatbasecomponent.a(256); - ChatMessage chatmessage = new ChatMessage("death.attack.message_too_long", new Object[] { (new ChatComponentText(s)).a(EnumChatFormat.YELLOW)}); - IChatBaseComponent ichatbasecomponent1 = (new ChatMessage("death.attack.even_more_magic", new Object[] { this.getScoreboardDisplayName()})).a((chatmodifier) -> { -- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent)); -+ chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatmessage)); - }); - - this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent1)); -@@ -370,12 +531,17 @@ +@@ -367,12 +529,17 @@ } this.releaseShoulderEntities(); @@ -296,7 +287,7 @@ EntityLiving entityliving = this.cv(); if (entityliving != null) { -@@ -398,10 +564,12 @@ +@@ -395,10 +562,12 @@ String s = this.getName(); String s1 = entity.getName(); @@ -311,7 +302,7 @@ } else { this.a(StatisticList.MOB_KILLS); } -@@ -419,7 +587,8 @@ +@@ -416,7 +585,8 @@ int i = scoreboardteam.getColor().b(); if (i >= 0 && i < aiscoreboardcriteria.length) { @@ -321,7 +312,7 @@ } } -@@ -461,12 +630,14 @@ +@@ -458,12 +628,14 @@ } private boolean canPvP() { @@ -338,7 +329,7 @@ if (this.dimension == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) { this.cC = new Vec3D(this.locX, this.locY, this.locZ); } else if (this.dimension != DimensionManager.NETHER && dimensionmanager != DimensionManager.OVERWORLD) { -@@ -474,6 +645,7 @@ +@@ -471,6 +643,7 @@ } if (this.dimension == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) { @@ -346,7 +337,7 @@ this.world.kill(this); if (!this.viewingCredits) { this.viewingCredits = true; -@@ -487,7 +659,10 @@ +@@ -484,7 +657,10 @@ dimensionmanager = DimensionManager.THE_END; } @@ -358,7 +349,7 @@ this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false)); this.lastSentExp = -1; this.lastHealthSent = -1.0F; -@@ -533,6 +708,7 @@ +@@ -530,6 +706,7 @@ } public void a(boolean flag, boolean flag1, boolean flag2) { @@ -366,7 +357,7 @@ if (this.isSleeping()) { this.getWorldServer().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2)); } -@@ -611,23 +787,55 @@ +@@ -608,23 +785,55 @@ this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition())); } @@ -425,7 +416,7 @@ if (iinventory instanceof ILootable && ((ILootable) iinventory).getLootTable() != null && this.isSpectator()) { this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true); } else { -@@ -641,18 +849,21 @@ +@@ -638,18 +847,21 @@ if (itileinventory.isLocked() && !this.a(itileinventory.getLock()) && !this.isSpectator()) { this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), ChatMessageType.GAME_INFO)); this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.BLOCK_CHEST_LOCKED, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F)); @@ -449,7 +440,7 @@ this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); -@@ -660,8 +871,14 @@ +@@ -657,8 +869,14 @@ } public void openTrade(IMerchant imerchant) { @@ -465,7 +456,7 @@ this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).d(); -@@ -681,13 +898,20 @@ +@@ -678,13 +896,20 @@ } public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) { @@ -487,7 +478,7 @@ this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); } -@@ -728,6 +952,11 @@ +@@ -725,6 +950,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())); @@ -499,7 +490,7 @@ } public void setContainerData(Container container, int i, int j) { -@@ -742,6 +971,7 @@ +@@ -739,6 +969,7 @@ } public void closeInventory() { @@ -507,7 +498,7 @@ this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId)); this.m(); } -@@ -775,14 +1005,14 @@ +@@ -772,14 +1003,14 @@ public void a(Statistic statistic, int i) { this.cg.b(this, statistic, i); @@ -524,7 +515,7 @@ } public int discoverRecipes(Collection collection) { -@@ -830,8 +1060,17 @@ +@@ -827,8 +1058,17 @@ public void triggerHealthUpdate() { this.lastHealthSent = -1.0E8F; @@ -542,7 +533,7 @@ public void a(IChatBaseComponent ichatbasecomponent, boolean flag) { this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT)); } -@@ -882,7 +1121,7 @@ +@@ -879,7 +1119,7 @@ this.lastSentExp = -1; this.lastHealthSent = -1.0F; this.lastFoodSent = -1; @@ -551,7 +542,7 @@ this.removeQueue.addAll(entityplayer.removeQueue); this.cx = entityplayer.cx; this.cC = entityplayer.cC; -@@ -941,6 +1180,18 @@ +@@ -938,6 +1178,18 @@ } public void a(EnumGamemode enumgamemode) { @@ -570,7 +561,7 @@ this.playerInteractManager.setGameMode(enumgamemode); this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId())); if (enumgamemode == EnumGamemode.SPECTATOR) { -@@ -988,6 +1239,17 @@ +@@ -985,6 +1237,17 @@ } public void a(PacketPlayInSettings packetplayinsettings) { @@ -588,7 +579,7 @@ this.locale = packetplayinsettings.b(); this.cs = packetplayinsettings.d(); this.ct = packetplayinsettings.e(); -@@ -1023,13 +1285,13 @@ +@@ -1020,13 +1283,13 @@ if (entity instanceof EntityHuman) { this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[] { entity.getId()})); } else { @@ -604,7 +595,7 @@ } protected void C() { -@@ -1053,7 +1315,7 @@ +@@ -1050,7 +1313,7 @@ this.spectatedEntity = (Entity) (entity == null ? this : entity); if (entity1 != this.spectatedEntity) { this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity)); @@ -613,7 +604,7 @@ } } -@@ -1080,7 +1342,7 @@ +@@ -1077,7 +1340,7 @@ @Nullable public IChatBaseComponent getPlayerListName() { @@ -622,7 +613,7 @@ } public void a(EnumHand enumhand) { -@@ -1097,12 +1359,17 @@ +@@ -1094,12 +1357,17 @@ } public void J() { @@ -640,7 +631,7 @@ } public AdvancementDataPlayer getAdvancementData() { -@@ -1114,9 +1381,16 @@ +@@ -1111,9 +1379,16 @@ return this.cC; } @@ -657,7 +648,7 @@ if (worldserver == this.world) { this.playerConnection.a(d0, d1, d2, f, f1); } else { -@@ -1141,6 +1415,149 @@ +@@ -1138,6 +1413,149 @@ this.server.getPlayerList().b(this, worldserver); this.server.getPlayerList().updateClient(this); } diff --git a/nms-patches/EntityPotion.patch b/nms-patches/EntityPotion.patch index 5b710a81f8..df5fea07cb 100644 --- a/nms-patches/EntityPotion.patch +++ b/nms-patches/EntityPotion.patch @@ -25,7 +25,7 @@ @@ -114,6 +120,7 @@ private void a(MovingObjectPosition movingobjectposition, List list) { AxisAlignedBB axisalignedbb = this.getBoundingBox().grow(4.0D, 2.0D, 4.0D); - List list1 = this.world.a(EntityLiving.class, axisalignedbb); + List list1 = this.world.a(EntityLiving.class, axisalignedbb); + Map affected = new HashMap(); // CraftBukkit if (!list1.isEmpty()) { diff --git a/nms-patches/EntitySheep.patch b/nms-patches/EntitySheep.patch index 0bdde89de9..1e2eb064dd 100644 --- a/nms-patches/EntitySheep.patch +++ b/nms-patches/EntitySheep.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntitySheep.java +++ b/net/minecraft/server/EntitySheep.java -@@ -10,6 +10,12 @@ +@@ -8,6 +8,12 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; @@ -13,7 +13,7 @@ public class EntitySheep extends EntityAnimal { private static final DataWatcherObject bC = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.a); -@@ -17,8 +23,15 @@ +@@ -15,8 +21,15 @@ public boolean canUse(EntityHuman entityhuman) { return false; } @@ -30,7 +30,7 @@ enummap.put(EnumColor.WHITE, Blocks.WHITE_WOOL); enummap.put(EnumColor.ORANGE, Blocks.ORANGE_WOOL); enummap.put(EnumColor.MAGENTA, Blocks.MAGENTA_WOOL); -@@ -143,11 +156,22 @@ +@@ -141,11 +154,22 @@ if (itemstack.getItem() == Items.SHEARS && !this.isSheared() && !this.isBaby()) { if (!this.world.isClientSide) { @@ -53,7 +53,7 @@ if (entityitem != null) { entityitem.motY += (double) (this.random.nextFloat() * 0.05F); -@@ -232,6 +256,12 @@ +@@ -230,6 +254,12 @@ } public void x() { @@ -66,7 +66,7 @@ this.setSheared(false); if (this.isBaby()) { this.setAge(60); -@@ -252,6 +282,7 @@ +@@ -250,6 +280,7 @@ this.container.setItem(0, new ItemStack(ItemDye.a(enumcolor))); this.container.setItem(1, new ItemStack(ItemDye.a(enumcolor1))); diff --git a/nms-patches/EntityShulker.patch b/nms-patches/EntityShulker.patch index 450f5b4611..934eda32e2 100644 --- a/nms-patches/EntityShulker.patch +++ b/nms-patches/EntityShulker.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/server/EntityShulker.java +++ b/net/minecraft/server/EntityShulker.java -@@ -6,6 +6,10 @@ +@@ -5,6 +5,10 @@ + import java.util.Optional; import java.util.UUID; - import java.util.function.Predicate; import javax.annotation.Nullable; +// CraftBukkit start +import org.bukkit.Location; @@ -11,16 +11,7 @@ public class EntityShulker extends EntityGolem implements IMonster { -@@ -44,7 +48,7 @@ - protected void n() { - this.goalSelector.a(1, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); - this.goalSelector.a(4, new EntityShulker.a()); -- this.goalSelector.a(7, new EntityShulker.e(null)); -+ this.goalSelector.a(7, new EntityShulker.e()); // CraftBukkit - decompile error - this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); - this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[0])); - this.targetSelector.a(2, new EntityShulker.d(this)); -@@ -321,8 +325,17 @@ +@@ -320,8 +324,17 @@ EnumDirection enumdirection = aenumdirection[k]; if (this.world.q(blockposition1.shift(enumdirection))) { @@ -40,7 +31,7 @@ break; } } -@@ -367,6 +380,7 @@ +@@ -366,6 +379,7 @@ this.locX = (double) blockposition.getX() + 0.5D; this.locY = (double) blockposition.getY(); this.locZ = (double) blockposition.getZ() + 0.5D; diff --git a/nms-patches/EntityShulkerBullet.patch b/nms-patches/EntityShulkerBullet.patch index 38a1c68988..732a33793e 100644 --- a/nms-patches/EntityShulkerBullet.patch +++ b/nms-patches/EntityShulkerBullet.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityShulkerBullet.java +++ b/net/minecraft/server/EntityShulkerBullet.java -@@ -42,8 +42,29 @@ +@@ -41,8 +41,29 @@ this.target = entity; this.c = EnumDirection.UP; this.a(enumdirection_enumaxis); @@ -30,7 +30,7 @@ public SoundCategory bV() { return SoundCategory.HOSTILE; } -@@ -287,6 +308,7 @@ +@@ -286,6 +307,7 @@ } protected void a(MovingObjectPosition movingobjectposition) { @@ -38,7 +38,7 @@ if (movingobjectposition.entity == null) { ((WorldServer) this.world).a(Particles.u, this.locX, this.locY, this.locZ, 2, 0.2D, 0.2D, 0.2D, 0.0D); this.a(SoundEffects.ENTITY_SHULKER_BULLET_HIT, 1.0F, 1.0F); -@@ -296,7 +318,7 @@ +@@ -295,7 +317,7 @@ if (flag) { this.a(this.shooter, movingobjectposition.entity); if (movingobjectposition.entity instanceof EntityLiving) { diff --git a/nms-patches/EntitySkeletonAbstract.patch b/nms-patches/EntitySkeletonAbstract.patch index 9b16ed8208..dc564d4763 100644 --- a/nms-patches/EntitySkeletonAbstract.patch +++ b/nms-patches/EntitySkeletonAbstract.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntitySkeletonAbstract.java +++ b/net/minecraft/server/EntitySkeletonAbstract.java -@@ -3,12 +3,13 @@ +@@ -3,6 +3,7 @@ import java.time.LocalDate; import java.time.temporal.ChronoField; import javax.annotation.Nullable; @@ -8,13 +8,6 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IRangedEntity { - private static final DataWatcherObject a = DataWatcher.a(EntitySkeletonAbstract.class, DataWatcherRegistry.i); - private final PathfinderGoalBowShoot b = new PathfinderGoalBowShoot(this, 1.0D, 20, 15.0F); -- private final PathfinderGoalMeleeAttack c = new PathfinderGoalMeleeAttack(this, 1.2D, flag) { -+ private final PathfinderGoalMeleeAttack c = new PathfinderGoalMeleeAttack(this, 1.2D, false) { // CraftBukkit - decompile error - public void d() { - super.d(); - EntitySkeletonAbstract.this.s(false); @@ -78,7 +79,14 @@ } diff --git a/nms-patches/EntitySlice.patch b/nms-patches/EntitySlice.patch index 2efa923fe6..c2e001f321 100644 --- a/nms-patches/EntitySlice.patch +++ b/nms-patches/EntitySlice.patch @@ -9,17 +9,17 @@ private final Map, List> b = Maps.newHashMap(); private final Set> c = Sets.newIdentityHashSet(); private final Class d; -@@ -41,7 +41,7 @@ - Object object = iterator.next(); +@@ -35,7 +35,7 @@ - if (oclass.isAssignableFrom(object.getClass())) { -- this.a(object, oclass); -+ this.a((T) object, oclass); - } - } + protected void a(Class oclass) { + EntitySlice.a.add(oclass); +- Iterator iterator = this.e.iterator(); ++ Iterator iterator = this.e.iterator(); // CraftBukkit - decompile error + while (iterator.hasNext()) { + T t0 = iterator.next(); @@ -78,7 +78,7 @@ - List list = (List) this.b.get(oclass); + List list = (List) this.b.get(oclass); if (list == null) { - this.b.put(oclass, Lists.newArrayList(new Object[] { t0})); @@ -27,3 +27,12 @@ } else { list.add(t0); } +@@ -86,7 +86,7 @@ + } + + public boolean remove(Object object) { +- T t0 = object; ++ T t0 = (T) object; // CraftBukkit - decompile error + boolean flag = false; + Iterator iterator = this.c.iterator(); + diff --git a/nms-patches/EntitySnowman.patch b/nms-patches/EntitySnowman.patch index d78d57264a..abee1fd42d 100644 --- a/nms-patches/EntitySnowman.patch +++ b/nms-patches/EntitySnowman.patch @@ -14,7 +14,7 @@ @@ -55,7 +59,7 @@ } - if (this.world.getBiome(new BlockPosition(i, 0, k)).c(new BlockPosition(i, j, k)) > 1.0F) { + if (this.world.getBiome(new BlockPosition(i, 0, k)).getAdjustedTemperature(new BlockPosition(i, j, k)) > 1.0F) { - this.damageEntity(DamageSource.BURN, 1.0F); + this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING } @@ -23,7 +23,7 @@ @@ -71,7 +75,7 @@ BlockPosition blockposition = new BlockPosition(i, j, k); - if (this.world.getType(blockposition).isAir() && this.world.getBiome(blockposition).c(blockposition) < 0.8F && iblockdata.canPlace(this.world, blockposition)) { + if (this.world.getType(blockposition).isAir() && this.world.getBiome(blockposition).getAdjustedTemperature(blockposition) < 0.8F && iblockdata.canPlace(this.world, blockposition)) { - this.world.setTypeUpdate(blockposition, iblockdata); + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.world, blockposition, iblockdata, this); // CraftBukkit } diff --git a/nms-patches/EntityTippedArrow.patch b/nms-patches/EntityTippedArrow.patch index b834c09431..7b60939903 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 -@@ -116,6 +116,25 @@ +@@ -115,6 +115,25 @@ } } @@ -26,7 +26,7 @@ public int getColor() { return (Integer) this.datawatcher.get(EntityTippedArrow.g); } -@@ -180,7 +199,7 @@ +@@ -179,7 +198,7 @@ while (iterator.hasNext()) { mobeffect = (MobEffect) iterator.next(); @@ -35,7 +35,7 @@ } if (!this.effects.isEmpty()) { -@@ -188,7 +207,7 @@ +@@ -187,7 +206,7 @@ while (iterator.hasNext()) { mobeffect = (MobEffect) iterator.next(); diff --git a/nms-patches/EntityTrackerEntry.patch b/nms-patches/EntityTrackerEntry.patch index cb8903ad68..b81ebfac27 100644 --- a/nms-patches/EntityTrackerEntry.patch +++ b/nms-patches/EntityTrackerEntry.patch @@ -64,7 +64,7 @@ + } + // CraftBukkit end this.c(); - object = new PacketPlayOutEntityTeleport(this.tracker); + packet1 = new PacketPlayOutEntityTeleport(this.tracker); } @@ -181,6 +205,7 @@ } @@ -112,7 +112,7 @@ } @@ -224,6 +270,11 @@ - Set set = attributemapserver.getAttributes(); + Set set = attributemapserver.getAttributes(); if (!set.isEmpty()) { + // CraftBukkit start - Send scaled max health @@ -138,11 +138,11 @@ + entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId())); + // CraftBukkit end this.trackedPlayers.add(entityplayer); - Packet packet = this.e(); + Packet packet = this.e(); @@ -290,6 +351,12 @@ AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) this.tracker).getAttributeMap(); - Collection collection = attributemapserver.c(); + Collection collection = attributemapserver.c(); + // CraftBukkit start - If sending own attributes send scaled health instead of current maximum health + if (this.tracker.getId() == entityplayer.getId()) { diff --git a/nms-patches/EntityTurtle.patch b/nms-patches/EntityTurtle.patch index 4c06eaa975..3adf710dba 100644 --- a/nms-patches/EntityTurtle.patch +++ b/nms-patches/EntityTurtle.patch @@ -1,19 +1,5 @@ --- a/net/minecraft/server/EntityTurtle.java +++ b/net/minecraft/server/EntityTurtle.java -@@ -130,11 +130,11 @@ - this.goalSelector.a(1, new EntityTurtle.a(this, 1.0D)); - this.goalSelector.a(1, new EntityTurtle.d(this, 1.0D)); - this.goalSelector.a(2, new EntityTurtle.i(this, 1.1D, Blocks.SEAGRASS.getItem())); -- this.goalSelector.a(3, new EntityTurtle.c(this, 1.0D, null)); -+ this.goalSelector.a(3, new EntityTurtle.c(this, 1.0D)); // CraftBukkit - decompile error - this.goalSelector.a(4, new EntityTurtle.b(this, 1.0D)); - this.goalSelector.a(7, new EntityTurtle.j(this, 1.0D)); - this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); -- this.goalSelector.a(9, new EntityTurtle.h(this, 1.0D, 100, null)); -+ this.goalSelector.a(9, new EntityTurtle.h(this, 1.0D, 100)); // CraftBukkit - decompile error - } - - protected void initAttributes() { @@ -232,7 +232,9 @@ protected void l() { super.l(); @@ -34,7 +20,7 @@ } public void die(DamageSource damagesource) { -@@ -423,15 +427,19 @@ +@@ -423,8 +427,12 @@ } else if (this.f.bK > 200) { World world = this.f.world; @@ -47,11 +33,3 @@ this.f.s(false); this.f.t(false); this.f.d(600); - } - - if (this.f.dz()) { -- EntityTurtle.g(this.f); -+ this.f.bK++; // CraftBukkit - decompile error - } - } - diff --git a/nms-patches/EntityTypes.patch b/nms-patches/EntityTypes.patch index 25a77d3406..bc3e3d1b93 100644 --- a/nms-patches/EntityTypes.patch +++ b/nms-patches/EntityTypes.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/server/EntityTypes.java @@ -121,7 +121,7 @@ public static EntityTypes a(String s, EntityTypes.a entitytypes_a) { - EntityTypes entitytypes = entitytypes_a.a(s); + EntityTypes entitytypes = entitytypes_a.a(s); - IRegistry.ENTITY_TYPE.a(new MinecraftKey(s), (Object) entitytypes); + IRegistry.ENTITY_TYPE.a(new MinecraftKey(s), entitytypes); // CraftBukkit - decompile error @@ -19,24 +19,15 @@ + + @Nullable + public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { - Entity entity = this.b(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, flag, flag1); + T t0 = this.b(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, flag, flag1); -- world.addEntity(entity); -- return entity; -+ return world.addEntity(entity, spawnReason) ? (T) entity : null; // Don't return an entity when CreatureSpawnEvent is canceled +- world.addEntity(t0); +- return t0; ++ return world.addEntity(t0, spawnReason) ? t0 : null; // Don't return an entity when CreatureSpawnEvent is canceled + // CraftBukkit end } @Nullable -@@ -187,7 +193,7 @@ - } - - a(world, entityhuman, entity, nbttagcompound); -- return entity; -+ return (T) entity; // CraftBukkit - decompile error - } - } - @@ -250,7 +256,7 @@ @Nullable diff --git a/nms-patches/EntityVillager.patch b/nms-patches/EntityVillager.patch index 9c952cb690..ef6f4d5dc3 100644 --- a/nms-patches/EntityVillager.patch +++ b/nms-patches/EntityVillager.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityVillager.java +++ b/net/minecraft/server/EntityVillager.java -@@ -7,6 +7,16 @@ +@@ -6,6 +6,16 @@ import javax.annotation.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -17,7 +17,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant { -@@ -38,7 +48,7 @@ +@@ -37,7 +47,7 @@ public EntityVillager(World world, int i) { super(EntityTypes.VILLAGER, world); @@ -26,7 +26,7 @@ this.setProfession(i); this.setSize(0.6F, 1.95F); ((Navigation) this.getNavigation()).a(true); -@@ -120,7 +130,14 @@ +@@ -119,7 +129,14 @@ MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next(); if (merchantrecipe.h()) { @@ -42,7 +42,7 @@ } } -@@ -132,7 +149,7 @@ +@@ -131,7 +148,7 @@ } } @@ -51,7 +51,7 @@ } } -@@ -434,7 +451,20 @@ +@@ -433,7 +450,20 @@ for (int l = 0; l < k; ++l) { EntityVillager.IMerchantRecipeOption entityvillager_imerchantrecipeoption = aentityvillager_imerchantrecipeoption3[l]; @@ -73,7 +73,7 @@ } } -@@ -569,7 +599,12 @@ +@@ -568,7 +598,12 @@ entitywitch.setCustomNameVisible(this.getCustomNameVisible()); } diff --git a/nms-patches/EntityWolf.patch b/nms-patches/EntityWolf.patch index 68e13f3cd6..4fff0cce42 100644 --- a/nms-patches/EntityWolf.patch +++ b/nms-patches/EntityWolf.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/EntityWolf.java +++ b/net/minecraft/server/EntityWolf.java -@@ -4,6 +4,11 @@ - import java.util.function.Predicate; +@@ -3,6 +3,11 @@ + import java.util.UUID; import javax.annotation.Nullable; +// CraftBukkit start @@ -12,7 +12,7 @@ public class EntityWolf extends EntityTameableAnimal { private static final DataWatcherObject DATA_HEALTH = DataWatcher.a(EntityWolf.class, DataWatcherRegistry.c); -@@ -57,6 +62,22 @@ +@@ -56,6 +61,22 @@ this.getAttributeMap().b(GenericAttributes.ATTACK_DAMAGE).setValue(2.0D); } @@ -35,7 +35,7 @@ public void setGoalTarget(@Nullable EntityLiving entityliving) { super.setGoalTarget(entityliving); if (entityliving == null) { -@@ -191,7 +212,8 @@ +@@ -190,7 +211,8 @@ Entity entity = damagesource.getEntity(); if (this.goalSit != null) { @@ -45,7 +45,7 @@ } if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) { -@@ -237,7 +259,7 @@ +@@ -236,7 +258,7 @@ itemstack.subtract(1); } @@ -54,7 +54,7 @@ return true; } } else if (item instanceof ItemDye) { -@@ -258,7 +280,7 @@ +@@ -257,7 +279,7 @@ this.goalSit.setSitting(!this.isSitting()); this.bg = false; this.navigation.q(); @@ -63,7 +63,7 @@ } } else if (item == Items.BONE && !this.isAngry()) { if (!entityhuman.abilities.canInstantlyBuild) { -@@ -266,12 +288,13 @@ +@@ -265,12 +287,13 @@ } if (!this.world.isClientSide) { diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch index 6912ad16c2..f960084733 100644 --- a/nms-patches/EntityZombie.patch +++ b/nms-patches/EntityZombie.patch @@ -16,17 +16,8 @@ public class EntityZombie extends EntityMonster { protected static final IAttribute c = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); -@@ -14,13 +23,14 @@ - private static final DataWatcherObject bC = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); - private static final DataWatcherObject bD = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); - private static final DataWatcherObject bE = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); -- private static final DataWatcherObject bF = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); -+ public static final DataWatcherObject bF = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); // PAIL - private final PathfinderGoalBreakDoor bG; - private boolean bH; - private int bI; -- private int drownedConversionTime; -+ public int drownedConversionTime; // PAIL +@@ -21,6 +30,7 @@ + public int drownedConversionTime; private float bK; private float bL; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field @@ -48,7 +39,7 @@ if (this.drownedConversionTime < 0) { this.dE(); } -@@ -182,14 +196,21 @@ +@@ -182,7 +196,14 @@ } if (flag) { @@ -64,14 +55,6 @@ } } - super.movementTick(); - } - -- private void a(int i) { -+ public void a(int i) { // PAIL - this.drownedConversionTime = i; - this.getDataWatcher().set(EntityZombie.bF, true); - } @@ -221,7 +242,12 @@ entityzombie.setCustomNameVisible(this.getCustomNameVisible()); } @@ -113,17 +96,15 @@ } } -@@ -362,8 +395,8 @@ +@@ -362,7 +395,7 @@ EntityZombieVillager entityzombievillager = new EntityZombieVillager(this.world); entityzombievillager.u(entityvillager); - this.world.kill(entityvillager); -- entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false, null), (NBTTagCompound) null); + // this.world.kill(entityvillager); // CraftBukkit - moved down -+ entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false), (NBTTagCompound) null); // CraftBukkit - decompile error + entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false), (NBTTagCompound) null); entityzombievillager.setProfession(entityvillager.getProfession()); entityzombievillager.setBaby(entityvillager.isBaby()); - entityzombievillager.setNoAI(entityvillager.isNoAI()); @@ -372,7 +405,13 @@ entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible()); } @@ -139,15 +120,6 @@ this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0); } -@@ -399,7 +438,7 @@ - - this.p(this.random.nextFloat() < 0.55F * f); - if (object == null) { -- object = new EntityZombie.GroupDataZombie(this.world.random.nextFloat() < 0.05F, null); -+ object = new EntityZombie.GroupDataZombie(this.world.random.nextFloat() < 0.05F); // CraftBukkit - decompile error - } - - if (object instanceof EntityZombie.GroupDataZombie) { @@ -422,7 +461,7 @@ entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null); diff --git a/nms-patches/EntityZombieVillager.patch b/nms-patches/EntityZombieVillager.patch index f497e0a53a..48acd99c9e 100644 --- a/nms-patches/EntityZombieVillager.patch +++ b/nms-patches/EntityZombieVillager.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityZombieVillager.java +++ b/net/minecraft/server/EntityZombieVillager.java -@@ -2,13 +2,18 @@ +@@ -2,6 +2,10 @@ import java.util.UUID; import javax.annotation.Nullable; @@ -11,11 +11,9 @@ public class EntityZombieVillager extends EntityZombie { -- private static final DataWatcherObject a = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.i); -+ public static final DataWatcherObject a = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.i); // PAIL +@@ -9,6 +13,7 @@ private static final DataWatcherObject b = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.b); -- private int conversionTime; -+ public int conversionTime; // PAIL + public int conversionTime; private UUID bD; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field @@ -36,15 +34,10 @@ this.conversionTime -= i; if (this.conversionTime <= 0) { -@@ -96,12 +106,14 @@ - return (Boolean) this.getDataWatcher().get(EntityZombieVillager.a); - } - -- protected void a(@Nullable UUID uuid, int i) { -+ public void a(@Nullable UUID uuid, int i) { // PAIL +@@ -100,8 +110,10 @@ this.bD = uuid; this.conversionTime = i; - this.getDataWatcher().set(EntityZombieVillager.a, true); + this.getDataWatcher().set(EntityZombieVillager.CONVERTING, true); - this.removeEffect(MobEffects.WEAKNESS); - this.addEffect(new MobEffect(MobEffects.INCREASE_DAMAGE, i, Math.min(this.world.getDifficulty().a() - 1, 0))); + // CraftBukkit start diff --git a/nms-patches/ExpiringMap.patch b/nms-patches/ExpiringMap.patch index 16adacb21a..0852538759 100644 --- a/nms-patches/ExpiringMap.patch +++ b/nms-patches/ExpiringMap.patch @@ -11,35 +11,25 @@ public class ExpiringMap extends Long2ObjectOpenHashMap { -@@ -21,11 +23,17 @@ +@@ -21,10 +23,17 @@ long j = SystemUtils.getMonotonicMillis(); this.b.put(i, j); -- ObjectIterator objectiterator = this.b.long2LongEntrySet().iterator(); -+ cleanup(); + // CraftBukkit start ++ cleanup(); + } + + public void cleanup() { + long j = SystemUtils.getMonotonicMillis(); -+ ObjectIterator objectiterator = this.b.long2LongEntrySet().iterator(); // CraftBukkit - decompile error ++ // CraftBukkit end + ObjectIterator objectiterator = this.b.long2LongEntrySet().iterator(); while (objectiterator.hasNext()) { - Entry entry = (Entry) objectiterator.next(); -- Object object = super.get(entry.getLongKey()); + Long2LongMap.Entry entry = (Long2LongMap.Entry) objectiterator.next(); // CraftBukkit - decompile error -+ T object = super.get(entry.getLongKey()); // CraftBukkit - decompile error + T t0 = super.get(entry.getLongKey()); if (j - entry.getLongValue() <= (long) this.a) { - break; -@@ -36,6 +44,7 @@ - objectiterator.remove(); - } - } -+ // CraftBukkit end - - } - @@ -69,4 +78,18 @@ public T remove(Object object) { throw new RuntimeException("Not implemented"); @@ -57,5 +47,5 @@ + cleanup(); + return super.values(); + } -+ // CraftBukkit end ++ // CraftBukkit end } diff --git a/nms-patches/Explosion.patch b/nms-patches/Explosion.patch index c9ededaaca..5605823456 100644 --- a/nms-patches/Explosion.patch +++ b/nms-patches/Explosion.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/Explosion.java +++ b/net/minecraft/server/Explosion.java @@ -10,6 +10,13 @@ - import java.util.Random; + import java.util.Set; import javax.annotation.Nullable; +// CraftBukkit start @@ -37,7 +37,7 @@ + return; + } + // CraftBukkit end - HashSet hashset = Sets.newHashSet(); + Set set = Sets.newHashSet(); boolean flag = true; @@ -76,7 +89,7 @@ @@ -46,7 +46,7 @@ - if (f > 0.0F && (this.source == null || this.source.a(this, this.world, blockposition, iblockdata, f))) { + if (f > 0.0F && (this.source == null || this.source.a(this, this.world, blockposition, iblockdata, f)) && blockposition.getY() < 256 && blockposition.getY() >= 0) { // CraftBukkit - don't wrap explosions - hashset.add(blockposition); + set.add(blockposition); } @@ -120,7 +133,16 @@ diff --git a/nms-patches/FluidTypeFlowing.patch b/nms-patches/FluidTypeFlowing.patch index f4e9cb652e..35c94a4058 100644 --- a/nms-patches/FluidTypeFlowing.patch +++ b/nms-patches/FluidTypeFlowing.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/server/FluidTypeFlowing.java +++ b/net/minecraft/server/FluidTypeFlowing.java -@@ -14,13 +14,18 @@ - import java.util.function.IntFunction; - import java.util.function.IntPredicate; - import java.util.function.Supplier; +@@ -10,6 +10,11 @@ + import java.util.Iterator; + import java.util.Map; + import java.util.Map.Entry; +// CraftBukkit start +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.block.CraftBlock; @@ -12,15 +12,7 @@ public abstract class FluidTypeFlowing extends FluidType { - public static final BlockStateBoolean FALLING = BlockProperties.h; - public static final BlockStateInteger LEVEL = BlockProperties.ag; - private static final ThreadLocal> e = ThreadLocal.withInitial(() -> { -- Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) { -+ Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) { // CraftBukkit - decompile error - protected void rehash(int i) {} - }; - -@@ -145,6 +150,15 @@ +@@ -141,6 +146,15 @@ Fluid fluid1 = this.a((IWorldReader) generatoraccess, blockposition1, iblockdata1); if (this.a(generatoraccess, blockposition, iblockdata, EnumDirection.DOWN, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.c())) { @@ -36,7 +28,7 @@ this.a(generatoraccess, blockposition1, iblockdata1, EnumDirection.DOWN, fluid1); if (this.a((IWorldReader) generatoraccess, blockposition) >= 3) { this.a(generatoraccess, blockposition, fluid, iblockdata); -@@ -175,6 +189,15 @@ +@@ -171,6 +185,15 @@ IBlockData iblockdata1 = generatoraccess.getType(blockposition1); if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.c())) { @@ -52,69 +44,3 @@ this.a(generatoraccess, blockposition1, iblockdata1, enumdirection, fluid1); } } -@@ -307,21 +330,25 @@ - if (enumdirection1 != enumdirection) { - BlockPosition blockposition2 = blockposition.shift(enumdirection1); - short short0 = a(blockposition1, blockposition2); -- Pair pair = (Pair) short2objectmap.computeIfAbsent(short0, (i) -> { -- IBlockData iblockdata = iworldreader.getType(blockposition); -+ // CraftBukkit start - decompile errors -+ Pair pair = (Pair) short2objectmap.computeIfAbsent(short0, (ix) -> { -+ IBlockData iblockdatax = iworldreader.getType(blockposition2); - -- return Pair.of(iblockdata, iblockdata.s()); -+ return Pair.of(iblockdatax, iblockdatax.s()); - }); -+ // CraftBukkit end - IBlockData iblockdata1 = (IBlockData) pair.getFirst(); - Fluid fluid = (Fluid) pair.getSecond(); - - if (this.a(iworldreader, this.e(), blockposition, iblockdata, enumdirection1, blockposition2, iblockdata1, fluid)) { -- boolean flag = short2booleanmap.computeIfAbsent(short0, (i) -> { -- BlockPosition blockposition = blockposition1.down(); -- IBlockData iblockdata = iworldreader.getType(blockposition); -+ // CraftBukkit start - decompile errors -+ boolean flag = short2booleanmap.computeIfAbsent(short0, (ix) -> { -+ BlockPosition blockpositionx = blockposition2.down(); -+ IBlockData iblockdatax = iworldreader.getType(blockpositionx); - -- return this.a((IBlockAccess) iworldreader, this.e(), blockposition1, iblockdata1, blockposition, iblockdata); -+ return this.a((IBlockAccess) iworldreader, this.e(), blockposition2, iblockdata1, blockpositionx, iblockdatax); - }); -+ // CraftBukkit end - - if (flag) { - return i; -@@ -383,22 +410,26 @@ - EnumDirection enumdirection = (EnumDirection) iterator.next(); - BlockPosition blockposition1 = blockposition.shift(enumdirection); - short short0 = a(blockposition, blockposition1); -- Pair pair = (Pair) short2objectopenhashmap.computeIfAbsent(short0, (i) -> { -- IBlockData iblockdata = iworldreader.getType(blockposition); -+ // CraftBukkit start - decompile errors -+ Pair pair = (Pair) short2objectopenhashmap.computeIfAbsent(short0, (ix) -> { -+ IBlockData iblockdatax = iworldreader.getType(blockposition1); - -- return Pair.of(iblockdata, iblockdata.s()); -+ return Pair.of(iblockdatax, iblockdatax.s()); - }); -+ // CraftBukkit end - IBlockData iblockdata1 = (IBlockData) pair.getFirst(); - Fluid fluid = (Fluid) pair.getSecond(); - Fluid fluid1 = this.a(iworldreader, blockposition1, iblockdata1); - - if (this.a(iworldreader, fluid1.c(), blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, fluid)) { - BlockPosition blockposition2 = blockposition1.down(); -- boolean flag = short2booleanopenhashmap.computeIfAbsent(short0, (i) -> { -- IBlockData iblockdata = iworldreader.getType(blockposition); -+ // CraftBukkit start - decompile errors -+ boolean flag = short2booleanopenhashmap.computeIfAbsent(short0, (ix) -> { -+ IBlockData iblockdatax = iworldreader.getType(blockposition2); - -- return this.a((IBlockAccess) iworldreader, this.e(), blockposition1, iblockdata1, blockposition, iblockdata); -+ return this.a((IBlockAccess) iworldreader, this.e(), blockposition1, iblockdata1, blockposition2, iblockdatax); - }); -+ // CraftBukkit end - int j; - - if (flag) { diff --git a/nms-patches/ItemBoat.patch b/nms-patches/ItemBoat.patch index 4d4748e76c..e9510c67fe 100644 --- a/nms-patches/ItemBoat.patch +++ b/nms-patches/ItemBoat.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/server/ItemBoat.java @@ -52,6 +52,13 @@ if (flag) { - return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); + return new InteractionResultWrapper<>(EnumInteractionResult.PASS, itemstack); } else if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK) { + // CraftBukkit start - Boat placement + org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectposition.getBlockPosition(), movingobjectposition.direction, itemstack, enumhand); @@ -15,7 +15,7 @@ Block block = world.getType(blockposition).getBlock(); EntityBoat entityboat = new EntityBoat(world, movingobjectposition.pos.x, movingobjectposition.pos.y, movingobjectposition.pos.z); @@ -62,7 +69,7 @@ - return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); + return new InteractionResultWrapper<>(EnumInteractionResult.FAIL, itemstack); } else { if (!world.isClientSide) { - world.addEntity(entityboat); diff --git a/nms-patches/ItemBucket.patch b/nms-patches/ItemBucket.patch index cce590e621..a234fb6bf4 100644 --- a/nms-patches/ItemBucket.patch +++ b/nms-patches/ItemBucket.patch @@ -15,11 +15,11 @@ public class ItemBucket extends Item { @@ -26,12 +33,21 @@ - if (this.fluidType == FluidTypes.a) { + if (this.fluidType == FluidTypes.EMPTY) { iblockdata = world.getType(blockposition); if (iblockdata.getBlock() instanceof IFluidSource) { + // CraftBukkit start -+ FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).a(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); ++ FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); + PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, blockposition.getX(), blockposition.getY(), blockposition.getZ(), null, itemstack, dummyFluid.b()); + + if (event.isCancelled()) { @@ -27,9 +27,9 @@ + return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); + } + // CraftBukkit end - FluidType fluidtype = ((IFluidSource) iblockdata.getBlock()).a(world, blockposition, iblockdata); + FluidType fluidtype = ((IFluidSource) iblockdata.getBlock()).removeFluid(world, blockposition, iblockdata); - if (fluidtype != FluidTypes.a) { + 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()); diff --git a/nms-patches/ItemEnderPearl.patch b/nms-patches/ItemEnderPearl.patch index ab9eacf1c1..8dafd4fa1f 100644 --- a/nms-patches/ItemEnderPearl.patch +++ b/nms-patches/ItemEnderPearl.patch @@ -32,4 +32,4 @@ + // CraftBukkit end entityhuman.b(StatisticList.ITEM_USED.b(this)); - return new InteractionResultWrapper(EnumInteractionResult.SUCCESS, itemstack); + return new InteractionResultWrapper<>(EnumInteractionResult.SUCCESS, itemstack); diff --git a/nms-patches/ItemSnowball.patch b/nms-patches/ItemSnowball.patch index 6bb2a21017..7f5eae73ba 100644 --- a/nms-patches/ItemSnowball.patch +++ b/nms-patches/ItemSnowball.patch @@ -30,4 +30,4 @@ + // CraftBukkit end entityhuman.b(StatisticList.ITEM_USED.b(this)); - return new InteractionResultWrapper(EnumInteractionResult.SUCCESS, itemstack); + return new InteractionResultWrapper<>(EnumInteractionResult.SUCCESS, itemstack); diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch index 2a6f40f7a2..eb950f97ca 100644 --- a/nms-patches/ItemStack.patch +++ b/nms-patches/ItemStack.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ItemStack.java +++ b/net/minecraft/server/ItemStack.java -@@ -16,6 +16,22 @@ +@@ -15,6 +15,22 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -23,7 +23,7 @@ public final class ItemStack { private static final Logger c = LogManager.getLogger(); -@@ -50,25 +66,49 @@ +@@ -49,25 +65,49 @@ this.E(); } @@ -76,7 +76,7 @@ this.E(); } -@@ -98,7 +138,7 @@ +@@ -97,7 +137,7 @@ return this.h ? Items.AIR : this.item; } @@ -85,7 +85,7 @@ EntityHuman entityhuman = itemactioncontext.getEntity(); BlockPosition blockposition = itemactioncontext.getClickPosition(); ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false); -@@ -106,12 +146,144 @@ +@@ -105,12 +145,144 @@ if (entityhuman != null && !entityhuman.abilities.mayBuild && !this.b(itemactioncontext.getWorld().F(), shapedetectorblock)) { return EnumInteractionResult.PASS; } else { @@ -231,7 +231,7 @@ return enuminteractionresult; } -@@ -135,7 +307,7 @@ +@@ -134,7 +306,7 @@ nbttagcompound.setString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString()); nbttagcompound.setByte("Count", (byte) this.count); if (this.tag != null) { @@ -240,7 +240,7 @@ } return nbttagcompound; -@@ -213,6 +385,11 @@ +@@ -212,6 +384,11 @@ if (this.isDamaged(i, entityliving.getRandom(), entityliving instanceof EntityPlayer ? (EntityPlayer) entityliving : null)) { entityliving.c(this); Item item = this.getItem(); @@ -252,7 +252,7 @@ this.subtract(1); if (entityliving instanceof EntityHuman) { -@@ -336,6 +513,17 @@ +@@ -335,6 +512,17 @@ return this.tag; } @@ -270,7 +270,7 @@ public NBTTagCompound getOrCreateTag() { if (this.tag == null) { this.setTag(new NBTTagCompound()); -@@ -480,6 +668,14 @@ +@@ -479,6 +667,14 @@ } public void setRepairCost(int i) { @@ -285,7 +285,7 @@ this.getOrCreateTag().setInt("RepairCost", i); } -@@ -522,6 +718,13 @@ +@@ -521,6 +717,13 @@ nbttaglist.add((NBTBase) nbttagcompound); } diff --git a/nms-patches/ItemWaterLily.patch b/nms-patches/ItemWaterLily.patch index 6dcc7f1d3b..0429408fcb 100644 --- a/nms-patches/ItemWaterLily.patch +++ b/nms-patches/ItemWaterLily.patch @@ -3,7 +3,7 @@ @@ -30,7 +30,15 @@ Fluid fluid = world.getFluid(blockposition); - if ((fluid.c() == FluidTypes.c || material == Material.ICE) && world.isEmpty(blockposition1)) { + if ((fluid.c() == FluidTypes.WATER || material == Material.ICE) && world.isEmpty(blockposition1)) { + // CraftBukkit start - special case for handling block placement with water lilies + org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, blockposition1); world.setTypeAndData(blockposition1, Blocks.LILY_PAD.getBlockData(), 11); diff --git a/nms-patches/ItemWorldMap.patch b/nms-patches/ItemWorldMap.patch index efd895649a..6584e852a0 100644 --- a/nms-patches/ItemWorldMap.patch +++ b/nms-patches/ItemWorldMap.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/ItemWorldMap.java +++ b/net/minecraft/server/ItemWorldMap.java @@ -6,6 +6,11 @@ - import java.util.function.Function; + import com.google.common.collect.Multisets; import javax.annotation.Nullable; +// CraftBukkit start diff --git a/nms-patches/JsonList.patch b/nms-patches/JsonList.patch index f443fe222a..984eaa04f8 100644 --- a/nms-patches/JsonList.patch +++ b/nms-patches/JsonList.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/server/JsonList.java +++ b/net/minecraft/server/JsonList.java -@@ -56,7 +56,7 @@ - this.c = file; - GsonBuilder gsonbuilder = (new GsonBuilder()).setPrettyPrinting(); - -- gsonbuilder.registerTypeHierarchyAdapter(JsonListEntry.class, new JsonList.JsonListEntrySerializer(null)); -+ gsonbuilder.registerTypeHierarchyAdapter(JsonListEntry.class, new JsonList.JsonListEntrySerializer()); // CraftBukkit - decompile error - this.b = gsonbuilder.create(); - } - -@@ -86,7 +86,7 @@ +@@ -85,7 +85,7 @@ @Nullable public V get(K k0) { this.h(); @@ -18,7 +9,7 @@ } public void remove(K k0) { -@@ -108,6 +108,12 @@ +@@ -107,6 +107,12 @@ return (String[]) this.d.keySet().toArray(new String[this.d.size()]); } @@ -31,17 +22,35 @@ public boolean isEmpty() { return this.d.size() < 1; } -@@ -137,7 +143,7 @@ +@@ -124,7 +130,7 @@ + Iterator iterator = this.d.values().iterator(); + while (iterator.hasNext()) { - Object object = iterator.next(); +- V v0 = (JsonListEntry) iterator.next(); ++ V v0 = (V) iterator.next(); // CraftBukkit - decompile error -- this.d.remove(this.a(object)); -+ this.d.remove(this.a((K) object)); // CraftBukkit - decompile error + if (v0.hasExpired()) { + list.add(v0.getKey()); +@@ -134,7 +140,7 @@ + iterator = list.iterator(); + + while (iterator.hasNext()) { +- K k0 = iterator.next(); ++ K k0 = (K) iterator.next(); // CraftBukkit - decompile error + + this.d.remove(this.a(k0)); } - +@@ -142,7 +148,7 @@ } -@@ -180,7 +186,7 @@ - JsonListEntry jsonlistentry = (JsonListEntry) iterator.next(); + + protected JsonListEntry a(JsonObject jsonobject) { +- return new JsonListEntry<>((Object) null, jsonobject); ++ return new JsonListEntry<>((K) null, jsonobject); // CraftBukkit - decompile error + } + + public Collection e() { +@@ -179,7 +185,7 @@ + JsonListEntry jsonlistentry = (JsonListEntry) iterator.next(); if (jsonlistentry.getKey() != null) { - this.d.put(this.a(jsonlistentry.getKey()), jsonlistentry); diff --git a/nms-patches/LegacyPingHandler.patch b/nms-patches/LegacyPingHandler.patch index b5efd46075..bd451453db 100644 --- a/nms-patches/LegacyPingHandler.patch +++ b/nms-patches/LegacyPingHandler.patch @@ -9,8 +9,8 @@ switch (i) { case 0: LegacyPingHandler.a.debug("Ping: (<1.3.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); -- s = String.format("%s\u00a7%d\u00a7%d", new Object[] { minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()}); -+ s = String.format("%s\u00a7%d\u00a7%d", new Object[] { event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit +- s = String.format("%s\u00a7%d\u00a7%d", minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); ++ s = String.format("%s\u00a7%d\u00a7%d", event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()); // CraftBukkit this.a(channelhandlercontext, this.a(s)); break; case 1: @@ -18,8 +18,8 @@ } LegacyPingHandler.a.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); -- s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()}); -+ s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit +- s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); ++ s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()); // CraftBukkit this.a(channelhandlercontext, this.a(s)); break; default: @@ -27,8 +27,8 @@ } LegacyPingHandler.a.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); -- String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()}); -+ String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit +- String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); ++ String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()); // CraftBukkit ByteBuf bytebuf1 = this.a(s1); try { diff --git a/nms-patches/LoginListener.patch b/nms-patches/LoginListener.patch index 774aad17e5..a9a4def4ac 100644 --- a/nms-patches/LoginListener.patch +++ b/nms-patches/LoginListener.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/LoginListener.java +++ b/net/minecraft/server/LoginListener.java -@@ -19,6 +19,12 @@ +@@ -18,6 +18,12 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -13,7 +13,7 @@ public class LoginListener implements PacketLoginInListener, ITickable { private static final AtomicInteger b = new AtomicInteger(0); -@@ -33,6 +39,7 @@ +@@ -32,6 +38,7 @@ private final String j; private SecretKey loginKey; private EntityPlayer l; @@ -21,7 +21,7 @@ public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { this.g = LoginListener.EnumProtocolState.HELLO; -@@ -61,6 +68,20 @@ +@@ -60,6 +67,20 @@ } @@ -42,7 +42,7 @@ public void disconnect(IChatBaseComponent ichatbasecomponent) { try { LoginListener.c.info("Disconnecting {}: {}", this.c(), ichatbasecomponent.getString()); -@@ -77,10 +98,12 @@ +@@ -76,10 +97,12 @@ this.i = this.a(this.i); } @@ -58,7 +58,7 @@ } else { this.g = LoginListener.EnumProtocolState.ACCEPTED; if (this.server.aw() >= 0 && !this.networkManager.isLocal()) { -@@ -94,9 +117,9 @@ +@@ -93,9 +116,9 @@ if (entityplayer != null) { this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT; @@ -70,7 +70,7 @@ } } -@@ -141,6 +164,43 @@ +@@ -140,6 +163,43 @@ LoginListener.this.i = LoginListener.this.server.ap().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a()); if (LoginListener.this.i != null) { @@ -114,7 +114,7 @@ LoginListener.c.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId()); LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; } else if (LoginListener.this.server.H()) { -@@ -160,6 +220,11 @@ +@@ -159,6 +219,11 @@ LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0])); LoginListener.c.error("Couldn't verify username because servers are unavailable"); } diff --git a/nms-patches/MethodProfiler.patch b/nms-patches/MethodProfiler.patch index c4d954a25e..203522a2cb 100644 --- a/nms-patches/MethodProfiler.patch +++ b/nms-patches/MethodProfiler.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MethodProfiler.java +++ b/net/minecraft/server/MethodProfiler.java -@@ -13,6 +13,7 @@ +@@ -12,6 +12,7 @@ public class MethodProfiler { @@ -8,7 +8,7 @@ private static final Logger a = LogManager.getLogger(); private final List b = Lists.newArrayList(); private final List c = Lists.newArrayList(); -@@ -41,6 +42,7 @@ +@@ -40,6 +41,7 @@ } public void a(int i) { @@ -16,7 +16,7 @@ if (!this.d) { this.d = true; this.f.clear(); -@@ -52,6 +54,7 @@ +@@ -51,6 +53,7 @@ } public void enter(String s) { @@ -24,7 +24,7 @@ if (this.d) { if (!this.e.isEmpty()) { this.e = this.e + "."; -@@ -64,12 +67,14 @@ +@@ -63,12 +66,14 @@ } public void a(Supplier supplier) { @@ -39,15 +39,15 @@ if (this.d && !this.c.isEmpty()) { long i = SystemUtils.getMonotonicNanos(); long j = (Long) this.c.remove(this.c.size() - 1); -@@ -92,6 +97,7 @@ +@@ -91,6 +96,7 @@ } public List b(String s) { + if (!ENABLED) return Collections.emptyList(); // CraftBukkit long i = this.f.containsKey("root") ? (Long) this.f.get("root") : 0L; long j = this.f.containsKey(s) ? (Long) this.f.get(s) : -1L; - ArrayList arraylist = Lists.newArrayList(); -@@ -154,11 +160,13 @@ + List list = Lists.newArrayList(); +@@ -153,11 +159,13 @@ } public void exitEnter(String s) { diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch index e5c12e9879..d5b84c02cd 100644 --- a/nms-patches/MinecraftServer.patch +++ b/nms-patches/MinecraftServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -59,6 +59,14 @@ +@@ -54,6 +54,14 @@ import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -15,7 +15,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable { -@@ -129,7 +137,21 @@ +@@ -124,7 +132,21 @@ private boolean forceUpgrade; private float ap; @@ -36,9 +36,9 @@ + + public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA); - this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new); + this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new); this.ag = new CraftingManager(); -@@ -140,22 +162,51 @@ +@@ -135,22 +157,51 @@ this.al = new AdvancementDataWorld(); this.am = new CustomFunctionData(this); this.c = proxy; @@ -94,7 +94,7 @@ public abstract boolean init() throws IOException; public void convertWorld(String s) { -@@ -180,11 +231,11 @@ +@@ -175,11 +226,11 @@ } if (this.forceUpgrade) { @@ -109,7 +109,7 @@ IChatBaseComponent ichatbasecomponent = null; while (!worldupgrader.b()) { -@@ -223,8 +274,9 @@ +@@ -218,8 +269,9 @@ } public void a(String s, String s1, long i, WorldType worldtype, JsonElement jsonelement) { @@ -120,7 +120,7 @@ IDataManager idatamanager = this.getConvertable().a(s, this); this.a(this.getWorld(), idatamanager); -@@ -249,54 +301,144 @@ +@@ -244,54 +296,144 @@ } this.a(idatamanager.getDirectory(), worlddata); @@ -158,8 +158,7 @@ + continue; + } + } - -- WorldServer worldserver = this.getWorldServer(DimensionManager.OVERWORLD); ++ + String worldType = org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase(); + String name = (dimension == 0) ? s : s + "_" + worldType; + this.convertWorld(name); // Run conversion now @@ -178,32 +177,32 @@ + this.a(idatamanager.getDirectory(), worlddata); + PersistentCollection persistentcollection = new PersistentCollection(idatamanager); -- worldserver.a(worldsettings); -- worldserver.addIWorldAccess(new WorldManager(this, worldserver)); -- if (!this.H()) { -- worldserver.getWorldData().setGameType(this.getGamemode()); -- } +- WorldServer worldserver = this.getWorldServer(DimensionManager.OVERWORLD); + if (this.L()) { + world = (WorldServer) (new DemoWorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler)).i_(); + } else { + world = (WorldServer) (new WorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), gen)).i_(); + } -- SecondaryWorldServer secondaryworldserver = (new SecondaryWorldServer(this, idatamanager, DimensionManager.NETHER, worldserver, this.methodProfiler)).i_(); +- worldserver.a(worldsettings); +- worldserver.addIWorldAccess(new WorldManager(this, worldserver)); +- if (!this.H()) { +- worldserver.getWorldData().setGameType(this.getGamemode()); +- } + world.a(worldsettings); + this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard()); + } else { + String dim = "DIM" + dimension; +- SecondaryWorldServer secondaryworldserver = (new SecondaryWorldServer(this, idatamanager, DimensionManager.NETHER, worldserver, this.methodProfiler)).i_(); ++ File newWorld = new File(new File(name), dim); ++ File oldWorld = new File(new File(s), dim); + - this.worldServer.put(DimensionManager.NETHER, secondaryworldserver); - secondaryworldserver.addIWorldAccess(new WorldManager(this, secondaryworldserver)); - if (!this.H()) { - secondaryworldserver.getWorldData().setGameType(this.getGamemode()); - } -+ File newWorld = new File(new File(name), dim); -+ File oldWorld = new File(new File(s), dim); - -- SecondaryWorldServer secondaryworldserver1 = (new SecondaryWorldServer(this, idatamanager, DimensionManager.THE_END, worldserver, this.methodProfiler)).i_(); + if ((!newWorld.isDirectory()) && (oldWorld.isDirectory())) { + MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder required ----"); + MinecraftServer.LOGGER.info("Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly."); @@ -234,11 +233,7 @@ + } + } -- this.worldServer.put(DimensionManager.THE_END, secondaryworldserver1); -- secondaryworldserver1.addIWorldAccess(new WorldManager(this, secondaryworldserver1)); -- if (!this.H()) { -- secondaryworldserver1.getWorldData().setGameType(this.getGamemode()); -- } +- SecondaryWorldServer secondaryworldserver1 = (new SecondaryWorldServer(this, idatamanager, DimensionManager.THE_END, worldserver, this.methodProfiler)).i_(); + IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), name, this, this.dataConverterManager); + // world =, b0 to dimension, s1 to name, added Environment and gen + worlddata = idatamanager.getWorldData(); @@ -248,20 +243,25 @@ + worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end) + world = (WorldServer) new SecondaryWorldServer(this, idatamanager, DimensionManager.a(dimension), this.getWorldServer(DimensionManager.OVERWORLD), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen).i_(); + } -+ + +- this.worldServer.put(DimensionManager.THE_END, secondaryworldserver1); +- secondaryworldserver1.addIWorldAccess(new WorldManager(this, secondaryworldserver1)); +- if (!this.H()) { +- secondaryworldserver1.getWorldData().setGameType(this.getGamemode()); +- } + this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld())); + + world.addIWorldAccess(new WorldManager(this, world)); + if (!this.H()) { + world.getWorldData().setGameType(this.getGamemode()); + } -+ -+ this.worldServer.put(world.dimension, world); -+ this.getPlayerList().setPlayerFileData(world); - this.getPlayerList().setPlayerFileData(worldserver); - if (worlddata.P() != null) { - this.getBossBattleCustomData().a(worlddata.P()); ++ this.worldServer.put(world.dimension, world); ++ this.getPlayerList().setPlayerFileData(world); ++ + if (worlddata.P() != null) { + this.getBossBattleCustomData().a(worlddata.P()); + } @@ -296,8 +296,8 @@ + // CraftBukkit end this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder); this.resourcePackRepository.a(); - ArrayList arraylist = Lists.newArrayList(); -@@ -325,42 +467,52 @@ + List list = Lists.newArrayList(); +@@ -320,42 +462,52 @@ boolean flag4 = true; this.b((IChatBaseComponent) (new ChatMessage("menu.generatingTerrain", new Object[0]))); @@ -305,30 +305,30 @@ - MinecraftServer.LOGGER.info("Preparing start region for dimension " + DimensionManager.a(worldserver.worldProvider.getDimensionManager())); - BlockPosition blockposition = worldserver.getSpawn(); -- ArrayList arraylist = Lists.newArrayList(); -- Set set = Sets.newConcurrentHashSet(); +- List list = Lists.newArrayList(); +- Set set = Sets.newConcurrentHashSet(); + // CraftBukkit start - fire WorldLoadEvent and handle whether or not to keep the spawn in memory Stopwatch stopwatch = Stopwatch.createStarted(); - - for (int i = -192; i <= 192 && this.isRunning(); i += 16) { - for (int j = -192; j <= 192 && this.isRunning(); j += 16) { -- arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4)); +- list.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4)); + for (WorldServer worldserver : this.getWorlds()) { + MinecraftServer.LOGGER.info("Preparing start region for level " + worldserver.dimension + " (Seed: " + worldserver.getSeed() + ")"); + if (!worldserver.getWorld().getKeepSpawnInMemory()) { + continue; } -- CompletableFuture completablefuture = worldserver.getChunkProvider().a((Iterable) arraylist, (chunk) -> { +- CompletableFuture completablefuture = worldserver.getChunkProvider().a((Iterable) list, (chunk) -> { - set.add(chunk.getPos()); - }); + BlockPosition blockposition = worldserver.getSpawn(); -+ ArrayList arraylist = Lists.newArrayList(); -+ Set set = Sets.newConcurrentHashSet(); ++ List list = Lists.newArrayList(); ++ Set set = Sets.newConcurrentHashSet(); + + for (int i = -192; i <= 192 && this.isRunning(); i += 16) { + for (int j = -192; j <= 192 && this.isRunning(); j += 16) { -+ arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4)); ++ list.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4)); + } - while (!completablefuture.isDone()) { @@ -340,7 +340,7 @@ - if (executionexception.getCause() instanceof RuntimeException) { - throw (RuntimeException) executionexception.getCause(); - } -+ CompletableFuture completablefuture = worldserver.getChunkProvider().a((Iterable) arraylist, (chunk) -> { ++ CompletableFuture completablefuture = worldserver.getChunkProvider().a((Iterable) list, (chunk) -> { + set.add(chunk.getPos()); + }); + @@ -376,7 +376,7 @@ MinecraftServer.LOGGER.info("Time elapsed: {} ms", stopwatch.elapsed(TimeUnit.MILLISECONDS)); Iterator iterator = DimensionManager.b().iterator(); -@@ -419,6 +571,10 @@ +@@ -414,6 +566,10 @@ protected void l() { this.w = null; this.x = 0; @@ -387,7 +387,7 @@ } protected void saveChunks(boolean flag) { -@@ -442,8 +598,24 @@ +@@ -437,8 +593,24 @@ } @@ -413,7 +413,7 @@ if (this.getServerConnection() != null) { this.getServerConnection().b(); } -@@ -452,6 +624,7 @@ +@@ -447,6 +619,7 @@ MinecraftServer.LOGGER.info("Saving players"); this.playerList.savePlayers(); this.playerList.u(); @@ -421,7 +421,7 @@ } MinecraftServer.LOGGER.info("Saving worlds"); -@@ -516,11 +689,13 @@ +@@ -511,11 +684,13 @@ if (i > 2000L && this.nextTick - this.lastOverloadTime >= 15000L) { long j = i / 50L; @@ -435,7 +435,7 @@ this.a(this::canSleepForTick); this.nextTick += 50L; -@@ -559,6 +734,12 @@ +@@ -554,6 +729,12 @@ } catch (Throwable throwable1) { MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); } finally { @@ -448,7 +448,7 @@ this.t(); } -@@ -627,7 +808,7 @@ +@@ -622,7 +803,7 @@ this.m.b().a(agameprofile); } @@ -457,7 +457,7 @@ this.methodProfiler.enter("save"); this.playerList.savePlayers(); this.saveChunks(true); -@@ -653,6 +834,7 @@ +@@ -648,6 +829,7 @@ } public void b(BooleanSupplier booleansupplier) { @@ -465,7 +465,7 @@ this.methodProfiler.enter("jobs"); FutureTask futuretask; -@@ -665,23 +847,40 @@ +@@ -660,23 +842,40 @@ this.getFunctionData().tick(); this.methodProfiler.exitEnter("levels"); @@ -512,7 +512,7 @@ this.methodProfiler.enter("tick"); -@@ -732,10 +931,11 @@ +@@ -727,10 +926,11 @@ this.k.add(itickable); } @@ -525,7 +525,7 @@ boolean flag = true; String s = null; String s1 = "."; -@@ -783,13 +983,16 @@ +@@ -778,13 +978,16 @@ ++j; } } @@ -543,7 +543,7 @@ if (s != null) { dedicatedserver.h(s); } -@@ -827,6 +1030,29 @@ +@@ -822,6 +1025,29 @@ thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER)); Runtime.getRuntime().addShutdownHook(thread); @@ -573,7 +573,7 @@ } catch (Exception exception) { MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); } -@@ -838,11 +1064,13 @@ +@@ -833,11 +1059,13 @@ } public void v() { @@ -587,7 +587,7 @@ } public File c(String s) { -@@ -882,7 +1110,7 @@ +@@ -877,7 +1105,7 @@ } public boolean isDebugging() { @@ -596,7 +596,7 @@ } public void f(String s) { -@@ -897,7 +1125,7 @@ +@@ -892,7 +1120,7 @@ } public String getServerModName() { @@ -605,7 +605,7 @@ } public CrashReport b(CrashReport crashreport) { -@@ -933,7 +1161,7 @@ +@@ -928,7 +1156,7 @@ } public boolean D() { @@ -614,7 +614,7 @@ } public void sendMessage(IChatBaseComponent ichatbasecomponent) { -@@ -1073,7 +1301,7 @@ +@@ -1068,7 +1296,7 @@ public abstract boolean Q(); public boolean getOnlineMode() { @@ -623,36 +623,16 @@ } public void setOnlineMode(boolean flag) { -@@ -1233,7 +1461,7 @@ +@@ -1228,7 +1456,7 @@ public ListenableFuture a(Callable callable) { Validate.notNull(callable); - if (!this.isMainThread() && !this.isStopped()) { + if (!this.isMainThread()) { // CraftBukkit && !this.isStopped()) { - ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable); + ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable); this.f.add(listenablefuturetask); -@@ -1304,8 +1532,8 @@ - - if (!worlddata.N().contains(resourcepackloader.e()) && !arraylist.contains(resourcepackloader)) { - MinecraftServer.LOGGER.info("Found new data pack {}, loading it automatically", resourcepackloader.e()); -- resourcepackloader.h().a(arraylist, resourcepackloader, (resourcepackloader) -> { -- return resourcepackloader; -+ resourcepackloader.h().a(arraylist, resourcepackloader, (resourcepackloader1) -> { // CraftBukkit - decompile error -+ return resourcepackloader1; // CraftBukkit - decompile error - }, false); - } - } -@@ -1314,7 +1542,7 @@ - ArrayList arraylist1 = Lists.newArrayList(); - - this.resourcePackRepository.d().forEach((resourcepackloader) -> { -- list.add(resourcepackloader.d()); -+ arraylist1.add(resourcepackloader.d()); // CraftBukkit - decompile error - }); - this.ac.a((List) arraylist1); - worlddata.O().clear(); -@@ -1416,4 +1644,11 @@ +@@ -1411,4 +1639,11 @@ return 0; } } diff --git a/nms-patches/MobEffectList.patch b/nms-patches/MobEffectList.patch index ce7747c859..ff95cf402e 100644 --- a/nms-patches/MobEffectList.patch +++ b/nms-patches/MobEffectList.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/MobEffectList.java +++ b/net/minecraft/server/MobEffectList.java -@@ -8,6 +8,11 @@ - import java.util.function.Supplier; +@@ -7,6 +7,11 @@ + import java.util.Map.Entry; import javax.annotation.Nullable; +// CraftBukkit start @@ -12,7 +12,7 @@ public class MobEffectList { private final Map a = Maps.newHashMap(); -@@ -25,7 +30,7 @@ +@@ -24,7 +29,7 @@ } public static int getId(MobEffectList mobeffectlist) { @@ -21,7 +21,7 @@ } protected MobEffectList(boolean flag, int i) { -@@ -47,11 +52,11 @@ +@@ -46,11 +51,11 @@ public void tick(EntityLiving entityliving, int i) { if (this == MobEffects.REGENERATION) { if (entityliving.getHealth() < entityliving.getMaxHealth()) { @@ -35,7 +35,7 @@ } } else if (this == MobEffects.WITHER) { entityliving.damageEntity(DamageSource.WITHER, 1.0F); -@@ -59,14 +64,25 @@ +@@ -58,14 +63,25 @@ ((EntityHuman) entityliving).applyExhaustion(0.005F * (float) (i + 1)); } else if (this == MobEffects.SATURATION && entityliving instanceof EntityHuman) { if (!entityliving.world.isClientSide) { @@ -63,7 +63,7 @@ } } -@@ -87,7 +103,7 @@ +@@ -86,7 +102,7 @@ } } else { j = (int) (d0 * (double) (4 << i) + 0.5D); @@ -72,7 +72,7 @@ } } -@@ -216,6 +232,11 @@ +@@ -215,6 +231,11 @@ a(28, "slow_falling", (new MobEffectList(false, 16773073)).b(8, 0).l()); a(29, "conduit_power", (new MobEffectList(false, 1950417)).b(9, 0).l()); a(30, "dolphins_grace", (new MobEffectList(false, 8954814)).b(10, 0).l()); diff --git a/nms-patches/NameReferencingFileConverter.patch b/nms-patches/NameReferencingFileConverter.patch index 9877efe90d..a7b62dab86 100644 --- a/nms-patches/NameReferencingFileConverter.patch +++ b/nms-patches/NameReferencingFileConverter.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/NameReferencingFileConverter.java +++ b/net/minecraft/server/NameReferencingFileConverter.java -@@ -83,8 +83,9 @@ +@@ -81,8 +81,9 @@ if (gameprofilebanlist.c().exists()) { try { gameprofilebanlist.load(); @@ -12,16 +12,7 @@ } } -@@ -113,7 +114,7 @@ - public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) { - NameReferencingFileConverter.e.warn("Could not lookup user banlist entry for {}", gameprofile.getName(), exception); - if (!(exception instanceof ProfileNotFoundException)) { -- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null); -+ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error - } - } - }; -@@ -141,8 +142,9 @@ +@@ -139,8 +140,9 @@ if (ipbanlist.c().exists()) { try { ipbanlist.load(); @@ -33,7 +24,7 @@ } } -@@ -182,8 +184,9 @@ +@@ -180,8 +182,9 @@ if (oplist.c().exists()) { try { oplist.load(); @@ -45,16 +36,7 @@ } } -@@ -198,7 +201,7 @@ - public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) { - NameReferencingFileConverter.e.warn("Could not lookup oplist entry for {}", gameprofile.getName(), exception); - if (!(exception instanceof ProfileNotFoundException)) { -- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null); -+ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error - } - } - }; -@@ -226,8 +229,9 @@ +@@ -224,8 +227,9 @@ if (whitelist.c().exists()) { try { whitelist.load(); @@ -66,33 +48,15 @@ } } -@@ -242,7 +246,7 @@ - public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) { - NameReferencingFileConverter.e.warn("Could not lookup user whitelist entry for {}", gameprofile.getName(), exception); - if (!(exception instanceof ProfileNotFoundException)) { -- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null); -+ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error - } - } - }; -@@ -337,7 +341,7 @@ - - this.a(file, s, s); - } else { -- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null); -+ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error - } - } - -@@ -345,6 +349,30 @@ - File file1 = new File(file2, s + ".dat"); - File file3 = new File(file, s1 + ".dat"); +@@ -343,6 +347,30 @@ + File file5 = new File(file, s2 + ".dat"); + File file6 = new File(file4, s3 + ".dat"); + // CraftBukkit start - Use old file name to seed lastKnownName + NBTTagCompound root = null; + + try { -+ root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1)); ++ root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file5)); + } catch (Exception exception) { + exception.printStackTrace(); + } @@ -102,7 +66,7 @@ + root.set("bukkit", new NBTTagCompound()); + } + NBTTagCompound data = root.getCompound("bukkit"); -+ data.setString("lastKnownName", s); ++ data.setString("lastKnownName", s2); + + try { + NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2)); @@ -112,19 +76,10 @@ + } + // CraftBukkit end + - NameReferencingFileConverter.b(file); - if (!file1.renameTo(file3)) { - throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s, null); -@@ -353,7 +381,7 @@ - - private String a(GameProfile gameprofile) { - String s = null; -- String[] astring = astring1; -+ // String[] astring = astring1; // CraftBukkit - decompile error - int i = astring.length; - - for (int j = 0; j < i; ++j) { -@@ -466,7 +494,7 @@ + NameReferencingFileConverter.b(file4); + if (!file5.renameTo(file6)) { + throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s2); +@@ -464,7 +492,7 @@ private static File d(PropertyManager propertymanager) { String s = propertymanager.getString("level-name", "world"); diff --git a/nms-patches/NetworkManager.patch b/nms-patches/NetworkManager.patch index e9b6393d16..96d80e408a 100644 --- a/nms-patches/NetworkManager.patch +++ b/nms-patches/NetworkManager.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/server/NetworkManager.java +++ b/net/minecraft/server/NetworkManager.java -@@ -103,7 +103,7 @@ - if (flag) { - NetworkManager.g.debug("Failed to sent packet", throwable); - this.sendPacket(new PacketPlayOutKickDisconnect(chatmessage), (future) -> { -- this.close(ichatbasecomponent); -+ this.close(chatmessage); // CraftBukkit - decompile error - }); - this.stopReading(); - } else { -@@ -130,7 +130,7 @@ +@@ -129,7 +129,7 @@ } private static void a(Packet packet, PacketListener packetlistener) { @@ -18,7 +9,7 @@ } public void setPacketListener(PacketListener packetlistener) { -@@ -241,7 +241,7 @@ +@@ -240,7 +240,7 @@ public void close(IChatBaseComponent ichatbasecomponent) { if (this.channel.isOpen()) { diff --git a/nms-patches/PathfinderGoalNearestAttackableTarget.patch b/nms-patches/PathfinderGoalNearestAttackableTarget.patch index e306d1b256..19fe64ae47 100644 --- a/nms-patches/PathfinderGoalNearestAttackableTarget.patch +++ b/nms-patches/PathfinderGoalNearestAttackableTarget.patch @@ -9,7 +9,7 @@ return true; } } else { -- this.d = this.e.world.a(this.e.locX, this.e.locY + (double) this.e.getHeadHeight(), this.e.locZ, this.i(), this.i(), new Function() { +- this.d = this.e.world.a(this.e.locX, this.e.locY + (double) this.e.getHeadHeight(), this.e.locZ, this.i(), this.i(), new Function() { + this.d = (T) this.e.world.a(this.e.locX, this.e.locY + (double) this.e.getHeadHeight(), this.e.locZ, this.i(), this.i(), new Function() { // CraftBukkit - fix decompile error @Nullable public Double apply(@Nullable EntityHuman entityhuman) { diff --git a/nms-patches/PlayerChunkMap.patch b/nms-patches/PlayerChunkMap.patch index 0639fafd41..526eae71e8 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 -@@ -15,6 +15,10 @@ +@@ -13,6 +13,10 @@ import java.util.function.Predicate; import javax.annotation.Nullable; @@ -11,7 +11,7 @@ public class PlayerChunkMap { private static final Predicate a = (entityplayer) -> { -@@ -34,6 +38,7 @@ +@@ -32,6 +36,7 @@ private long k; private boolean l = true; private boolean m = true; @@ -19,30 +19,7 @@ public PlayerChunkMap(WorldServer worldserver) { this.world = worldserver; -@@ -103,16 +108,18 @@ - - if (this.l && i % 4L == 0L) { - this.l = false; -- Collections.sort(this.h, (playerchunk, playerchunk1) -> { -- return ComparisonChain.start().compare(playerchunk.g(), playerchunk1.g()).result(); -+ // CraftBukkit start -+ Collections.sort(this.h, (playerchunkx, playerchunk1x) -> { -+ return ComparisonChain.start().compare(playerchunkx.g(), playerchunk1x.g()).result(); - }); - } - - if (this.m && i % 4L == 2L) { - this.m = false; -- Collections.sort(this.g, (playerchunk, playerchunk1) -> { -- return ComparisonChain.start().compare(playerchunk.g(), playerchunk1.g()).result(); -+ Collections.sort(this.g, (playerchunkx, playerchunk1x) -> { -+ return ComparisonChain.start().compare(playerchunkx.g(), playerchunk1x.g()).result(); - }); -+ // CraftBukkit end - } - - if (!this.h.isEmpty()) { -@@ -137,7 +144,11 @@ +@@ -135,7 +140,11 @@ break; } } @@ -54,7 +31,7 @@ } } -@@ -199,6 +210,16 @@ +@@ -197,6 +206,16 @@ return playerchunk; } @@ -71,7 +48,7 @@ public void flagDirty(BlockPosition blockposition) { int i = blockposition.getX() >> 4; int j = blockposition.getZ() >> 4; -@@ -217,12 +238,22 @@ +@@ -215,12 +234,22 @@ entityplayer.d = entityplayer.locX; entityplayer.e = entityplayer.locZ; @@ -95,7 +72,7 @@ this.managedPlayers.add(entityplayer); this.e(); } -@@ -266,11 +297,14 @@ +@@ -264,11 +293,14 @@ int j1 = i - k; int k1 = j - l; @@ -111,7 +88,7 @@ } if (!this.a(l1 - j1, i2 - k1, i, j, i1)) { -@@ -286,6 +320,13 @@ +@@ -284,6 +316,13 @@ entityplayer.d = entityplayer.locX; entityplayer.e = entityplayer.locZ; this.e(); @@ -125,7 +102,7 @@ } } } -@@ -370,4 +411,47 @@ +@@ -368,4 +407,47 @@ } } diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 5d4a3de2c8..d2e8a7a617 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/PlayerConnection.java +++ b/net/minecraft/server/PlayerConnection.java -@@ -17,6 +17,50 @@ +@@ -16,6 +16,50 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -51,7 +51,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { private static final Logger LOGGER = LogManager.getLogger(); -@@ -27,7 +71,10 @@ +@@ -26,7 +70,10 @@ private long lastKeepAlive; private boolean awaitingKeepAlive; private long h; @@ -61,9 +61,9 @@ + private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); + // CraftBukkit end private int j; - private final IntHashMap k = new IntHashMap(); + private final IntHashMap k = new IntHashMap<>(); private double l; -@@ -59,7 +106,33 @@ +@@ -58,7 +105,33 @@ networkmanager.setPacketListener(this); this.player = entityplayer; entityplayer.playerConnection = this; @@ -97,7 +97,7 @@ public void tick() { this.syncPosition(); -@@ -105,7 +178,7 @@ +@@ -104,7 +177,7 @@ this.minecraftServer.methodProfiler.enter("keepAlive"); long i = SystemUtils.getMonotonicMillis(); @@ -106,7 +106,7 @@ if (this.awaitingKeepAlive) { this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); } else { -@@ -117,15 +190,21 @@ +@@ -116,15 +189,21 @@ } this.minecraftServer.methodProfiler.exit(); @@ -128,7 +128,7 @@ this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0])); } -@@ -144,16 +223,46 @@ +@@ -143,16 +222,46 @@ return this.networkManager; } @@ -176,7 +176,7 @@ } public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) { -@@ -192,7 +301,34 @@ +@@ -191,7 +300,34 @@ double d9 = entity.motX * entity.motX + entity.motY * entity.motY + entity.motZ * entity.motZ; double d10 = d6 * d6 + d7 * d7 + d8 * d8; @@ -212,7 +212,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; -@@ -222,14 +358,72 @@ +@@ -221,14 +357,72 @@ } entity.setLocation(d3, d4, d5, f, f1); @@ -285,7 +285,7 @@ this.minecraftServer.getPlayerList().updateChunks(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)); -@@ -243,7 +437,7 @@ +@@ -242,7 +436,7 @@ public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) { PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer()); @@ -294,7 +294,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; -@@ -253,6 +447,7 @@ +@@ -252,6 +446,7 @@ } this.teleportPos = null; @@ -302,7 +302,7 @@ } } -@@ -289,6 +484,12 @@ +@@ -288,6 +483,12 @@ public void a(PacketPlayInTabComplete packetplayintabcomplete) { PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); @@ -314,9 +314,9 @@ + // CraftBukkit end StringReader stringreader = new StringReader(packetplayintabcomplete.c()); - if (stringreader.canRead() && stringreader.peek() == 47) { -@@ -298,7 +499,8 @@ - ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); + if (stringreader.canRead() && stringreader.peek() == '/') { +@@ -297,7 +498,8 @@ + ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { - this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions)); @@ -325,7 +325,7 @@ }); } -@@ -490,6 +692,15 @@ +@@ -489,6 +691,15 @@ } public void a(PacketPlayInBEdit packetplayinbedit) { @@ -341,7 +341,7 @@ ItemStack itemstack = packetplayinbedit.b(); if (!itemstack.isEmpty()) { -@@ -514,11 +725,13 @@ +@@ -513,11 +724,13 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -357,7 +357,7 @@ } } -@@ -558,7 +771,7 @@ +@@ -557,7 +770,7 @@ } else { WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); @@ -366,7 +366,7 @@ if (this.e == 0) { this.syncPosition(); } -@@ -568,13 +781,21 @@ +@@ -567,13 +780,21 @@ this.A = this.e; this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); } @@ -389,7 +389,7 @@ double d0 = this.player.locX; double d1 = this.player.locY; double d2 = this.player.locZ; -@@ -599,15 +820,33 @@ +@@ -598,15 +819,33 @@ ++this.receivedMovePackets; int i = this.receivedMovePackets - this.processedMovePackets; @@ -425,7 +425,7 @@ 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); return; -@@ -653,6 +892,69 @@ +@@ -652,6 +891,69 @@ } } @@ -495,7 +495,7 @@ this.B = d12 >= -0.03125D; this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly; this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.dc() && !worldserver.a(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -670,10 +972,76 @@ +@@ -669,10 +971,76 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -573,7 +573,7 @@ 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; -@@ -685,6 +1053,14 @@ +@@ -684,6 +1052,14 @@ this.teleportAwait = 0; } @@ -588,7 +588,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)); -@@ -692,6 +1068,7 @@ +@@ -691,6 +1067,7 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer()); @@ -596,7 +596,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinblockdig.b(); -@@ -701,13 +1078,45 @@ +@@ -700,13 +1077,45 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); @@ -644,7 +644,7 @@ this.player.a(false); } -@@ -738,7 +1147,15 @@ +@@ -737,7 +1146,15 @@ if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.c()); } else { @@ -660,7 +660,7 @@ } } else { if (packetplayinblockdig.d() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -757,10 +1174,12 @@ +@@ -756,10 +1173,12 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -673,7 +673,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinuseitem.d(); ItemStack itemstack = this.player.b(enumhand); -@@ -773,6 +1192,13 @@ +@@ -772,6 +1191,13 @@ this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, ChatMessageType.GAME_INFO)); } else if (this.teleportPos == null && this.player.d((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { @@ -687,7 +687,7 @@ this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.e(), packetplayinuseitem.f(), packetplayinuseitem.g()); } -@@ -782,13 +1208,52 @@ +@@ -781,13 +1207,52 @@ public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer()); @@ -741,7 +741,7 @@ } } -@@ -808,13 +1273,18 @@ +@@ -807,13 +1272,18 @@ } if (entity != null) { @@ -762,7 +762,7 @@ public void a(PacketPlayInBoatMove packetplayinboatmove) { PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.getWorldServer()); -@@ -827,11 +1297,26 @@ +@@ -826,11 +1296,26 @@ } public void a(IChatBaseComponent ichatbasecomponent) { @@ -790,7 +790,7 @@ if (this.minecraftServer.H() && this.player.getDisplayName().getString().equals(this.minecraftServer.G())) { PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); this.minecraftServer.safeShutdown(); -@@ -857,6 +1342,15 @@ +@@ -856,6 +1341,15 @@ } } @@ -806,7 +806,7 @@ try { this.networkManager.sendPacket(packet, genericfuturelistener); } catch (Throwable throwable) { -@@ -872,17 +1366,37 @@ +@@ -871,17 +1365,37 @@ public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer()); @@ -846,7 +846,7 @@ this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend", new Object[0])).a(EnumChatFormat.RED))); } else { this.player.resetIdleTimer(); -@@ -892,39 +1406,249 @@ +@@ -891,39 +1405,249 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -1103,7 +1103,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -987,6 +1711,7 @@ +@@ -986,6 +1710,7 @@ public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer()); @@ -1111,7 +1111,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -1002,20 +1727,73 @@ +@@ -1001,20 +1726,73 @@ if (this.player.h(entity) < d0) { EnumHand enumhand; @@ -1186,7 +1186,7 @@ } } } -@@ -1031,7 +1809,8 @@ +@@ -1030,7 +1808,8 @@ case PERFORM_RESPAWN: if (this.player.viewingCredits) { this.player.viewingCredits = false; @@ -1196,7 +1196,7 @@ CriterionTriggers.v.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD); } else { if (this.player.getHealth() > 0.0F) { -@@ -1053,14 +1832,20 @@ +@@ -1052,14 +1831,20 @@ public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer()); @@ -1216,10 +1216,10 @@ + if (this.player.activeContainer.windowId == packetplayinwindowclick.b() && this.player.activeContainer.c(this.player) && this.player.activeContainer.canUse(this.player)) { // CraftBukkit + boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if + if (false/*this.player.isSpectator()*/) { // CraftBukkit - NonNullList nonnulllist = NonNullList.a(); + NonNullList nonnulllist = NonNullList.a(); for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) { -@@ -1069,8 +1854,274 @@ +@@ -1068,8 +1853,274 @@ this.player.a(this.player.activeContainer, nonnulllist); } else { @@ -1495,7 +1495,7 @@ if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true)); this.player.f = true; -@@ -1113,6 +2164,7 @@ +@@ -1112,6 +2163,7 @@ public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer()); @@ -1503,7 +1503,7 @@ this.player.resetIdleTimer(); if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { this.player.activeContainer.a(this.player, packetplayinenchantitem.c()); -@@ -1144,6 +2196,43 @@ +@@ -1143,6 +2195,43 @@ boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45; boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty(); @@ -1547,7 +1547,7 @@ if (flag1 && flag2) { if (itemstack.isEmpty()) { -@@ -1167,6 +2256,7 @@ +@@ -1166,6 +2255,7 @@ public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer()); @@ -1555,7 +1555,7 @@ Short oshort = (Short) this.k.get(this.player.activeContainer.windowId); if (oshort != null && packetplayintransaction.c() == oshort && this.player.activeContainer.windowId == packetplayintransaction.b() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { -@@ -1177,6 +2267,7 @@ +@@ -1176,6 +2266,7 @@ public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer()); @@ -1563,7 +1563,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.b(); -@@ -1193,14 +2284,30 @@ +@@ -1192,14 +2283,30 @@ if (!tileentitysign.d() || tileentitysign.e() != this.player) { this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign"); @@ -1595,7 +1595,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -1209,6 +2316,7 @@ +@@ -1208,6 +2315,7 @@ } public void a(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -1603,7 +1603,7 @@ if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) { int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive); -@@ -1222,7 +2330,17 @@ +@@ -1221,7 +2329,17 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer()); @@ -1622,7 +1622,7 @@ } public void a(PacketPlayInSettings packetplayinsettings) { -@@ -1230,5 +2348,47 @@ +@@ -1229,5 +2347,47 @@ this.player.a(packetplayinsettings); } diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index 6de4d27f46..cae3119221 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/PlayerList.java +++ b/net/minecraft/server/PlayerList.java -@@ -19,6 +19,29 @@ +@@ -18,6 +18,29 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -30,7 +30,7 @@ public abstract class PlayerList { public static final File a = new File("banned-players.json"); -@@ -28,14 +51,16 @@ +@@ -27,14 +50,16 @@ private static final Logger f = LogManager.getLogger(); private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); private final MinecraftServer server; @@ -50,7 +50,7 @@ public IPlayerFileData playerFileData; private boolean hasWhitelist; protected int maxPlayers; -@@ -44,13 +69,23 @@ +@@ -43,13 +68,23 @@ private boolean u; private int v; @@ -76,7 +76,7 @@ this.server = minecraftserver; this.getProfileBans().a(true); this.getIPBans().a(true); -@@ -65,6 +100,12 @@ +@@ -64,6 +99,12 @@ usercache.a(gameprofile); NBTTagCompound nbttagcompound = this.a(entityplayer); @@ -89,7 +89,7 @@ entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension)); entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); -@@ -74,7 +115,8 @@ +@@ -73,7 +114,8 @@ s1 = networkmanager.getSocketAddress().toString(); } @@ -99,7 +99,7 @@ WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); WorldData worlddata = worldserver.getWorldData(); -@@ -82,6 +124,7 @@ +@@ -81,6 +123,7 @@ PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, entityplayer); playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager(), worldserver.getDifficulty(), this.getMaxPlayers(), worlddata.getType(), worldserver.getGameRules().getBoolean("reducedDebugInfo"))); @@ -107,7 +107,7 @@ playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.b, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName()))); playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities)); -@@ -101,8 +144,10 @@ +@@ -100,8 +143,10 @@ chatmessage = new ChatMessage("multiplayer.player.joined.renamed", new Object[] { entityplayer.getScoreboardDisplayName(), s}); } @@ -120,7 +120,7 @@ playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); this.b(entityplayer, worldserver); if (!this.server.getResourcePack().isEmpty()) { -@@ -154,6 +199,8 @@ +@@ -153,6 +198,8 @@ } entityplayer.syncInventory(); @@ -129,7 +129,7 @@ } public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { -@@ -186,26 +233,27 @@ +@@ -185,26 +232,27 @@ } public void setPlayerFileData(WorldServer worldserver) { @@ -162,7 +162,7 @@ } public void b(WorldBorder worldborder, double d0) {} -@@ -253,14 +301,15 @@ +@@ -252,14 +300,15 @@ } protected void savePlayerFile(EntityPlayer entityplayer) { @@ -180,7 +180,7 @@ if (advancementdataplayer != null) { advancementdataplayer.c(); -@@ -268,29 +317,80 @@ +@@ -267,29 +316,80 @@ } @@ -268,7 +268,7 @@ this.savePlayerFile(entityplayer); if (entityplayer.isPassenger()) { Entity entity = entityplayer.getRootVehicle(); -@@ -321,18 +421,68 @@ +@@ -320,18 +420,68 @@ if (entityplayer1 == entityplayer) { this.j.remove(uuid); @@ -311,18 +311,18 @@ - if (this.k.isBanned(gameprofile)) { + // Moved from processLogin + UUID uuid = EntityHuman.a(gameprofile); -+ ArrayList arraylist = Lists.newArrayList(); ++ List list = Lists.newArrayList(); + + EntityPlayer entityplayer; + + for (int i = 0; i < this.players.size(); ++i) { + entityplayer = (EntityPlayer) this.players.get(i); + if (entityplayer.getUniqueID().equals(uuid)) { -+ arraylist.add(entityplayer); ++ list.add(entityplayer); + } + } + -+ Iterator iterator = arraylist.iterator(); ++ Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + entityplayer = (EntityPlayer) iterator.next(); @@ -343,7 +343,7 @@ GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile); chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[] { gameprofilebanentry.getReason()}); -@@ -340,10 +490,12 @@ +@@ -339,10 +489,12 @@ chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[] { PlayerList.g.format(gameprofilebanentry.getExpires())})); } @@ -359,7 +359,7 @@ IpBanEntry ipbanentry = this.l.get(socketaddress); chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[] { ipbanentry.getReason()}); -@@ -351,13 +503,25 @@ +@@ -350,13 +502,25 @@ chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[] { PlayerList.g.format(ipbanentry.getExpires())})); } @@ -386,9 +386,9 @@ + public EntityPlayer processLogin(GameProfile gameprofile, EntityPlayer player) { // CraftBukkit - added EntityPlayer + /* CraftBukkit startMoved up UUID uuid = EntityHuman.a(gameprofile); - ArrayList arraylist = Lists.newArrayList(); + List list = Lists.newArrayList(); -@@ -392,17 +556,27 @@ +@@ -391,17 +555,27 @@ } return new EntityPlayer(this.server, this.server.getWorldServer(DimensionManager.OVERWORLD), gameprofile, (PlayerInteractManager) object); @@ -417,7 +417,7 @@ entityplayer.dimension = dimensionmanager; Object object; -@@ -413,6 +587,11 @@ +@@ -412,6 +586,11 @@ } EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object); @@ -429,7 +429,7 @@ entityplayer1.playerConnection = entityplayer.playerConnection; entityplayer1.copyFrom(entityplayer, flag); -@@ -426,43 +605,160 @@ +@@ -425,43 +604,160 @@ entityplayer1.addScoreboardTag(s); } @@ -607,7 +607,7 @@ public void f(EntityPlayer entityplayer) { GameProfile gameprofile = entityplayer.getProfile(); int i = this.server.a(gameprofile); -@@ -499,42 +795,69 @@ +@@ -498,42 +794,69 @@ } public void changeWorld(Entity entity, DimensionManager dimensionmanager, WorldServer worldserver, WorldServer worldserver1) { @@ -680,7 +680,7 @@ } worldserver.methodProfiler.exit(); -@@ -542,22 +865,119 @@ +@@ -541,22 +864,119 @@ worldserver.methodProfiler.enter("placing"); d0 = (double) MathHelper.clamp((int) d0, -29999872, 29999872); d1 = (double) MathHelper.clamp((int) d1, -29999872, 29999872); @@ -801,7 +801,7 @@ this.v = 0; } -@@ -570,6 +990,25 @@ +@@ -569,6 +989,25 @@ } @@ -827,7 +827,7 @@ public void a(Packet packet, DimensionManager dimensionmanager) { for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); -@@ -670,6 +1109,7 @@ +@@ -669,6 +1108,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0)); } @@ -835,7 +835,7 @@ this.server.getCommandDispatcher().a(entityplayer); } -@@ -702,6 +1142,12 @@ +@@ -701,6 +1141,12 @@ for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); @@ -848,7 +848,7 @@ if (entityplayer != entityhuman && entityplayer.dimension == dimensionmanager) { double d4 = d0 - entityplayer.locX; double d5 = d1 - entityplayer.locY; -@@ -741,7 +1187,7 @@ +@@ -740,7 +1186,7 @@ public void reloadWhitelist() {} public void b(EntityPlayer entityplayer, WorldServer worldserver) { @@ -857,7 +857,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE)); entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))); -@@ -749,16 +1195,21 @@ +@@ -748,16 +1194,21 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition)); if (worldserver.isRaining()) { @@ -883,7 +883,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); } -@@ -820,26 +1271,39 @@ +@@ -819,26 +1270,39 @@ } public void u() { @@ -928,7 +928,7 @@ if (serverstatisticmanager == null) { File file = new File(this.server.getWorldServer(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "stats"); -@@ -854,7 +1318,7 @@ +@@ -853,7 +1317,7 @@ } serverstatisticmanager = new ServerStatisticManager(this.server, file1); @@ -937,7 +937,7 @@ } return serverstatisticmanager; -@@ -862,14 +1326,14 @@ +@@ -861,14 +1325,14 @@ public AdvancementDataPlayer h(EntityPlayer entityplayer) { UUID uuid = entityplayer.getUniqueID(); @@ -954,7 +954,7 @@ } advancementdataplayer.a(entityplayer); -@@ -905,13 +1369,20 @@ +@@ -904,13 +1368,20 @@ } public void reload() { diff --git a/nms-patches/RecipeArmorDye.patch b/nms-patches/RecipeArmorDye.patch index 6a4959d538..a91746b12c 100644 --- a/nms-patches/RecipeArmorDye.patch +++ b/nms-patches/RecipeArmorDye.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/server/RecipeArmorDye.java @@ -3,11 +3,13 @@ import com.google.common.collect.Lists; - import java.util.ArrayList; + import java.util.List; -public class RecipeArmorDye extends IRecipeComplex { +public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends diff --git a/nms-patches/RecipeBookServer.patch b/nms-patches/RecipeBookServer.patch index 821331746d..5175a692d8 100644 --- a/nms-patches/RecipeBookServer.patch +++ b/nms-patches/RecipeBookServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/RecipeBookServer.java +++ b/net/minecraft/server/RecipeBookServer.java -@@ -8,6 +8,7 @@ +@@ -7,6 +7,7 @@ import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -8,7 +8,7 @@ public class RecipeBookServer extends RecipeBook { -@@ -27,7 +28,7 @@ +@@ -26,7 +27,7 @@ IRecipe irecipe = (IRecipe) iterator.next(); MinecraftKey minecraftkey = irecipe.getKey(); @@ -16,8 +16,8 @@ + if (!this.a.contains(minecraftkey) && !irecipe.c() && CraftEventFactory.handlePlayerRecipeListUpdateEvent(entityplayer, minecraftkey)) { // CraftBukkit this.a(minecraftkey); this.c(minecraftkey); - arraylist.add(minecraftkey); -@@ -61,6 +62,7 @@ + list.add(minecraftkey); +@@ -60,6 +61,7 @@ } private void a(PacketPlayOutRecipes.Action packetplayoutrecipes_action, EntityPlayer entityplayer, List list) { diff --git a/nms-patches/RecipeFireworksFade.patch b/nms-patches/RecipeFireworksFade.patch index d974fe8f00..eb4be83667 100644 --- a/nms-patches/RecipeFireworksFade.patch +++ b/nms-patches/RecipeFireworksFade.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/RecipeFireworksFade.java +++ b/net/minecraft/server/RecipeFireworksFade.java -@@ -4,13 +4,15 @@ - import java.util.ArrayList; +@@ -3,13 +3,15 @@ + import com.google.common.collect.Lists; import java.util.List; -public class RecipeFireworksFade extends IRecipeComplex { diff --git a/nms-patches/RecipeFireworksStar.patch b/nms-patches/RecipeFireworksStar.patch index 80e004ffbb..5cd299d718 100644 --- a/nms-patches/RecipeFireworksStar.patch +++ b/nms-patches/RecipeFireworksStar.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/server/RecipeFireworksStar.java +++ b/net/minecraft/server/RecipeFireworksStar.java -@@ -8,12 +8,12 @@ +@@ -6,12 +6,12 @@ + import java.util.List; import java.util.Map; - import java.util.function.Consumer; -public class RecipeFireworksStar extends IRecipeComplex { +public class RecipeFireworksStar extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends @@ -15,7 +15,7 @@ hashmap.put(Items.FIRE_CHARGE, ItemFireworks.EffectType.LARGE_BALL); hashmap.put(Items.FEATHER, ItemFireworks.EffectType.BURST); hashmap.put(Items.GOLD_NUGGET, ItemFireworks.EffectType.STAR); -@@ -26,9 +26,11 @@ +@@ -24,9 +24,11 @@ }); private static final RecipeItemStack e = RecipeItemStack.a(Items.GUNPOWDER); diff --git a/nms-patches/RecipeRepair.patch b/nms-patches/RecipeRepair.patch index 388dbc10ab..e179af7f25 100644 --- a/nms-patches/RecipeRepair.patch +++ b/nms-patches/RecipeRepair.patch @@ -3,7 +3,7 @@ @@ -2,12 +2,15 @@ import com.google.common.collect.Lists; - import java.util.ArrayList; + import java.util.List; +import java.util.stream.Stream; -public class RecipeRepair extends IRecipeComplex { diff --git a/nms-patches/RegionLimitedWorldAccess.patch b/nms-patches/RegionLimitedWorldAccess.patch index d820df05e9..94225582ff 100644 --- a/nms-patches/RegionLimitedWorldAccess.patch +++ b/nms-patches/RegionLimitedWorldAccess.patch @@ -1,19 +1,6 @@ --- a/net/minecraft/server/RegionLimitedWorldAccess.java +++ b/net/minecraft/server/RegionLimitedWorldAccess.java -@@ -22,10 +22,10 @@ - private final Random k; - private final WorldProvider l; - private final GeneratorSettings m; -- private final TickList n = new TickListWorldGen((blockposition) -> { -+ private final TickList n = new TickListWorldGen<>((blockposition) -> { // CraftBukkit - decompile error - return this.y(blockposition).k(); - }); -- private final TickList o = new TickListWorldGen((blockposition) -> { -+ private final TickList o = new TickListWorldGen<>((blockposition) -> { // CraftBukkit - decompile error - return this.y(blockposition).l(); - }); - -@@ -201,7 +201,14 @@ +@@ -200,7 +200,14 @@ this.y(blockposition).e(blockposition); } diff --git a/nms-patches/ScoreboardServer.patch b/nms-patches/ScoreboardServer.patch index d441899002..f4313c34bc 100644 --- a/nms-patches/ScoreboardServer.patch +++ b/nms-patches/ScoreboardServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ScoreboardServer.java +++ b/net/minecraft/server/ScoreboardServer.java -@@ -22,7 +22,7 @@ +@@ -21,7 +21,7 @@ public void handleScoreChanged(ScoreboardScore scoreboardscore) { super.handleScoreChanged(scoreboardscore); if (this.b.contains(scoreboardscore.getObjective())) { @@ -9,7 +9,7 @@ } this.b(); -@@ -30,14 +30,14 @@ +@@ -29,14 +29,14 @@ public void handlePlayerRemoved(String s) { super.handlePlayerRemoved(s); @@ -26,7 +26,7 @@ } this.b(); -@@ -49,7 +49,7 @@ +@@ -48,7 +48,7 @@ super.setDisplaySlot(i, scoreboardobjective); if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) { if (this.h(scoreboardobjective1) > 0) { @@ -35,7 +35,7 @@ } else { this.g(scoreboardobjective1); } -@@ -57,7 +57,7 @@ +@@ -56,7 +56,7 @@ if (scoreboardobjective != null) { if (this.b.contains(scoreboardobjective)) { @@ -44,25 +44,25 @@ } else { this.e(scoreboardobjective); } -@@ -68,7 +68,7 @@ +@@ -67,7 +67,7 @@ public boolean addPlayerToTeam(String s, ScoreboardTeam scoreboardteam) { if (super.addPlayerToTeam(s, scoreboardteam)) { -- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 3)); -+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 3)); +- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 3)); ++ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 3)); this.b(); return true; } else { -@@ -78,7 +78,7 @@ +@@ -77,7 +77,7 @@ public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) { super.removePlayerFromTeam(s, scoreboardteam); -- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 4)); -+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 4)); +- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 4)); ++ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 4)); this.b(); } -@@ -90,7 +90,7 @@ +@@ -89,7 +89,7 @@ public void handleObjectiveChanged(ScoreboardObjective scoreboardobjective) { super.handleObjectiveChanged(scoreboardobjective); if (this.b.contains(scoreboardobjective)) { @@ -71,7 +71,7 @@ } this.b(); -@@ -107,19 +107,19 @@ +@@ -106,19 +106,19 @@ public void handleTeamAdded(ScoreboardTeam scoreboardteam) { super.handleTeamAdded(scoreboardteam); @@ -94,7 +94,7 @@ this.b(); } -@@ -168,6 +168,7 @@ +@@ -167,6 +167,7 @@ while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); @@ -102,7 +102,7 @@ Iterator iterator1 = list.iterator(); while (iterator1.hasNext()) { -@@ -200,6 +201,7 @@ +@@ -199,6 +200,7 @@ while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); @@ -110,7 +110,7 @@ Iterator iterator1 = list.iterator(); while (iterator1.hasNext()) { -@@ -224,6 +226,16 @@ +@@ -223,6 +225,16 @@ return i; } diff --git a/nms-patches/SecondaryWorldServer.patch b/nms-patches/SecondaryWorldServer.patch index f0a83f94b4..22624e4dc5 100644 --- a/nms-patches/SecondaryWorldServer.patch +++ b/nms-patches/SecondaryWorldServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/SecondaryWorldServer.java +++ b/net/minecraft/server/SecondaryWorldServer.java -@@ -4,8 +4,11 @@ +@@ -2,8 +2,11 @@ public class SecondaryWorldServer extends WorldServer { @@ -14,7 +14,7 @@ worldserver.getWorldBorder().a(new IWorldBorderListener() { public void a(WorldBorder worldborder, double d0) { SecondaryWorldServer.this.getWorldBorder().setSize(d0); -@@ -35,9 +38,10 @@ +@@ -33,9 +36,10 @@ SecondaryWorldServer.this.getWorldBorder().setDamageBuffer(d0); } }); @@ -26,7 +26,7 @@ public SecondaryWorldServer i_() { String s = PersistentVillage.a(this.worldProvider); -@@ -51,7 +55,7 @@ +@@ -49,7 +53,7 @@ this.villages.a((World) this); } diff --git a/nms-patches/ShapedRecipes.patch b/nms-patches/ShapedRecipes.patch index 827b8c9062..b2b1e08087 100644 --- a/nms-patches/ShapedRecipes.patch +++ b/nms-patches/ShapedRecipes.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/server/ShapedRecipes.java +++ b/net/minecraft/server/ShapedRecipes.java -@@ -13,6 +13,13 @@ - import java.util.Iterator; +@@ -12,6 +12,13 @@ import java.util.Map; + import java.util.Set; import java.util.Map.Entry; +// CraftBukkit start +import java.util.ArrayList; @@ -14,7 +14,7 @@ public class ShapedRecipes implements IRecipe { -@@ -32,6 +39,70 @@ +@@ -31,6 +38,70 @@ this.result = itemstack; } diff --git a/nms-patches/StructureGenerator.patch b/nms-patches/StructureGenerator.patch index b2cc226f4f..b65057baa9 100644 --- a/nms-patches/StructureGenerator.patch +++ b/nms-patches/StructureGenerator.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/server/StructureGenerator.java +++ b/net/minecraft/server/StructureGenerator.java -@@ -43,7 +43,7 @@ - StructureStart structurestart = this.a(generatoraccess, chunkgenerator, (SeededRandom) random, i2); - - if (structurestart != StructureGenerator.a && structurestart.c().a(l, i1, l + 15, i1 + 15)) { -- ((LongSet) chunkgenerator.getStructureCache(this).computeIfAbsent(j1, (i) -> { -+ ((LongSet) chunkgenerator.getStructureCache(this).computeIfAbsent(j1, (x) -> { // CraftBukkit - fix decompile error - return new LongOpenHashSet(); - })).add(i2); - generatoraccess.getChunkProvider().a(j, k, true).a(this.a(), i2); -@@ -204,7 +204,7 @@ +@@ -202,7 +202,7 @@ return structurestart; } else { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i); diff --git a/nms-patches/TagsServer.patch b/nms-patches/TagsServer.patch index 2d0c0861d5..ec49e57c9c 100644 --- a/nms-patches/TagsServer.patch +++ b/nms-patches/TagsServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/TagsServer.java +++ b/net/minecraft/server/TagsServer.java -@@ -11,6 +11,7 @@ +@@ -9,6 +9,7 @@ public class TagsServer extends Tags { private final IRegistry a; @@ -8,21 +8,21 @@ public TagsServer(IRegistry iregistry, String s, String s1) { super(iregistry::c, iregistry::get, s, false, s1); -@@ -31,7 +32,7 @@ +@@ -27,7 +28,7 @@ + Iterator iterator1 = ((Tag) entry.getValue()).a().iterator(); + while (iterator1.hasNext()) { - Object object = iterator1.next(); +- T t0 = iterator1.next(); ++ T t0 = (T) iterator1.next(); // CraftBukkit - decompile error -- packetdataserializer.d(this.a.a(object)); -+ packetdataserializer.d(this.a.a((T) object)); // CraftBukkit - decompile error + packetdataserializer.d(this.a.a(t0)); } - } - -@@ -49,7 +50,7 @@ - arraylist.add(this.a.fromId(packetdataserializer.g())); +@@ -47,7 +48,7 @@ + list.add(this.a.fromId(packetdataserializer.g())); } -- this.c().put(minecraftkey, Tag.a.a().a((Collection) arraylist).b(minecraftkey)); -+ this.c().put(minecraftkey, (Tag) Tag.a.a().a((Collection) arraylist).b(minecraftkey)); // CraftBukkit - decompile error +- this.c().put(minecraftkey, Tag.a.a().a((Collection) list).b(minecraftkey)); ++ this.c().put(minecraftkey, (Tag) Tag.a.a().a((Collection) list).b(minecraftkey)); // CraftBukkit - decompile error } } diff --git a/nms-patches/TickListServer.patch b/nms-patches/TickListServer.patch index 4cc3e3cac6..0e3b6e3cbc 100644 --- a/nms-patches/TickListServer.patch +++ b/nms-patches/TickListServer.patch @@ -62,45 +62,18 @@ } iterator.remove(); -@@ -141,7 +148,7 @@ - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) { -- NextTickListEntry nextticklistentry = (NextTickListEntry) iterator.next(); -+ NextTickListEntry nextticklistentry = (NextTickListEntry) iterator.next(); // CraftBukkit - decompile error - - if (structureboundingbox.b((BaseBlockPosition) nextticklistentry.a)) { - BlockPosition blockposition1 = nextticklistentry.a.a((BaseBlockPosition) blockposition); -@@ -159,7 +166,7 @@ - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) { -- NextTickListEntry nextticklistentry = (NextTickListEntry) iterator.next(); -+ NextTickListEntry nextticklistentry = (NextTickListEntry) iterator.next(); // CraftBukkit - decompile error - NBTTagCompound nbttagcompound = new NBTTagCompound(); - - nbttagcompound.setString("i", ((MinecraftKey) this.b.apply(nextticklistentry.a())).toString()); -@@ -177,7 +184,7 @@ - public void a(NBTTagList nbttaglist) { - for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound = nbttaglist.getCompound(i); -- Object object = this.c.apply(new MinecraftKey(nbttagcompound.getString("i"))); -+ T object = this.c.apply(new MinecraftKey(nbttagcompound.getString("i"))); // CraftBukkit - decompile error - - if (object != null) { - this.b(new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")), object, nbttagcompound.getInt("t"), TickListPriority.a(nbttagcompound.getInt("p"))); @@ -187,7 +194,7 @@ } public boolean a(BlockPosition blockposition, T t0) { -- return this.nextTickListHash.contains(new NextTickListEntry(blockposition, t0)); -+ return this.nextTickList.contains(new NextTickListEntry(blockposition, t0)); // CraftBukkit +- return this.nextTickListHash.contains(new NextTickListEntry<>(blockposition, t0)); ++ return this.nextTickList.contains(new NextTickListEntry<>(blockposition, t0)); // CraftBukkit } public void a(BlockPosition blockposition, T t0, int i, TickListPriority ticklistpriority) { @@ -209,8 +216,8 @@ private void c(BlockPosition blockposition, T t0, int i, TickListPriority ticklistpriority) { - NextTickListEntry nextticklistentry = new NextTickListEntry(blockposition, t0, (long) i + this.f.getTime(), ticklistpriority); + NextTickListEntry nextticklistentry = new NextTickListEntry<>(blockposition, t0, (long) i + this.f.getTime(), ticklistpriority); - if (!this.nextTickListHash.contains(nextticklistentry)) { - this.nextTickListHash.add(nextticklistentry); diff --git a/nms-patches/TileEntityBeacon.patch b/nms-patches/TileEntityBeacon.patch index 2b2bf7ed4a..f1827af33c 100644 --- a/nms-patches/TileEntityBeacon.patch +++ b/nms-patches/TileEntityBeacon.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/TileEntityBeacon.java +++ b/net/minecraft/server/TileEntityBeacon.java -@@ -9,6 +9,13 @@ +@@ -8,6 +8,13 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; @@ -14,7 +14,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IWorldInventory, ITickable { public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffects.FASTER_MOVEMENT, MobEffects.FASTER_DIG}, { MobEffects.RESISTANCE, MobEffects.JUMP}, { MobEffects.INCREASE_DAMAGE}, { MobEffects.REGENERATION}}; -@@ -23,6 +30,38 @@ +@@ -22,6 +29,38 @@ public MobEffectList secondaryEffect; private ItemStack inventorySlot; private IChatBaseComponent o; @@ -53,7 +53,7 @@ public TileEntityBeacon() { super(TileEntityTypes.BEACON); -@@ -56,41 +95,79 @@ +@@ -55,41 +94,79 @@ this.world.a((EntityHuman) null, this.position, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F); } @@ -88,7 +88,7 @@ int k = this.position.getY(); int l = this.position.getZ(); AxisAlignedBB axisalignedbb = (new AxisAlignedBB((double) j, (double) k, (double) l, (double) (j + 1), (double) (k + 1), (double) (l + 1))).g(d0).b(0.0D, (double) this.world.getHeight(), 0.0D); - List list = this.world.a(EntityHuman.class, axisalignedbb); + List list = this.world.a(EntityHuman.class, axisalignedbb); + + return list; + } @@ -142,7 +142,7 @@ private void E() { int i = this.position.getX(); -@@ -210,8 +287,10 @@ +@@ -209,8 +286,10 @@ public void load(NBTTagCompound nbttagcompound) { super.load(nbttagcompound); diff --git a/nms-patches/TileEntityConduit.patch b/nms-patches/TileEntityConduit.patch index c73526c8cf..71ab439510 100644 --- a/nms-patches/TileEntityConduit.patch +++ b/nms-patches/TileEntityConduit.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/server/TileEntityConduit.java +++ b/net/minecraft/server/TileEntityConduit.java -@@ -7,6 +7,10 @@ +@@ -6,6 +6,10 @@ + import java.util.Random; import java.util.UUID; - import java.util.function.Predicate; import javax.annotation.Nullable; +// CraftBukkit start +import org.bukkit.craftbukkit.block.CraftBlock; @@ -11,7 +11,7 @@ public class TileEntityConduit extends TileEntity implements ITickable { -@@ -152,7 +156,7 @@ +@@ -151,7 +155,7 @@ EntityHuman entityhuman = (EntityHuman) iterator.next(); if (this.position.m(new BlockPosition(entityhuman)) <= (double) j && entityhuman.ao()) { @@ -20,18 +20,16 @@ } } -@@ -169,8 +173,8 @@ +@@ -168,7 +172,7 @@ this.target = this.l(); this.k = null; } else if (this.target == null) { -- List list = this.world.a(EntityLiving.class, this.k(), (entityliving) -> { -- return entityliving instanceof IMonster && entityliving.ao(); -+ List list = this.world.a(EntityLiving.class, this.k(), (Predicate) (entitylivingx) -> { // CraftBukkit - decompile error -+ return entitylivingx instanceof IMonster && entitylivingx.ao(); // CraftBukkit - decompile error +- List list = this.world.a(EntityLiving.class, this.k(), (entityliving1) -> { ++ List list = this.world.a(EntityLiving.class, this.k(), (java.util.function.Predicate) (entityliving1) -> { // CraftBukkit - decompile error + return entityliving1 instanceof IMonster && entityliving1.ao(); }); - if (!list.isEmpty()) { -@@ -181,8 +185,13 @@ +@@ -180,8 +184,13 @@ } if (this.target != null) { @@ -47,12 +45,12 @@ } if (entityliving != this.target) { -@@ -215,7 +224,7 @@ +@@ -214,7 +223,7 @@ @Nullable private EntityLiving l() { -- List list = this.world.a(EntityLiving.class, this.k(), (entityliving) -> { -+ List list = this.world.a(EntityLiving.class, this.k(), (Predicate) (entityliving) -> { // CraftBukkit - decompile error +- List list = this.world.a(EntityLiving.class, this.k(), (entityliving) -> { ++ List list = this.world.a(EntityLiving.class, this.k(), (java.util.function.Predicate) (entityliving) -> { // CraftBukkit - decompile error return entityliving.getUniqueID().equals(this.k); }); diff --git a/nms-patches/TileEntityFurnace.patch b/nms-patches/TileEntityFurnace.patch index 5382eac164..3485bd63ad 100644 --- a/nms-patches/TileEntityFurnace.patch +++ b/nms-patches/TileEntityFurnace.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/TileEntityFurnace.java +++ b/net/minecraft/server/TileEntityFurnace.java -@@ -8,6 +8,15 @@ +@@ -7,6 +7,15 @@ import java.util.Map; import java.util.Map.Entry; import javax.annotation.Nullable; @@ -16,8 +16,8 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeHolder, AutoRecipeOutput, ITickable { -@@ -92,6 +101,31 @@ - return linkedhashmap; +@@ -91,6 +100,31 @@ + return map; } + // CraftBukkit start - add fields and methods @@ -48,7 +48,7 @@ public TileEntityFurnace() { super(TileEntityTypes.FURNACE); this.items = NonNullList.a(3, ItemStack.a); -@@ -237,9 +271,20 @@ +@@ -236,9 +270,20 @@ IRecipe irecipe = this.world.getCraftingManager().b(this, this.world); if (!this.isBurning() && this.canBurn(irecipe)) { @@ -71,7 +71,7 @@ flag1 = true; if (!itemstack.isEmpty()) { Item item = itemstack.getItem(); -@@ -280,7 +325,7 @@ +@@ -279,7 +324,7 @@ } private int s() { @@ -80,7 +80,7 @@ return furnacerecipe != null ? furnacerecipe.h() : 200; } -@@ -307,11 +352,38 @@ +@@ -306,11 +351,38 @@ ItemStack itemstack1 = irecipe.d(); ItemStack itemstack2 = (ItemStack) this.items.get(2); diff --git a/nms-patches/TileEntityHopper.patch b/nms-patches/TileEntityHopper.patch index 4115190f66..4fbcc8d049 100644 --- a/nms-patches/TileEntityHopper.patch +++ b/nms-patches/TileEntityHopper.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/TileEntityHopper.java +++ b/net/minecraft/server/TileEntityHopper.java -@@ -7,12 +7,46 @@ +@@ -6,12 +6,46 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; @@ -47,7 +47,7 @@ public TileEntityHopper() { super(TileEntityTypes.HOPPER); this.items = NonNullList.a(5, ItemStack.a); -@@ -72,7 +106,7 @@ +@@ -71,7 +105,7 @@ } public int getMaxStackSize() { @@ -56,7 +56,7 @@ } public void tick() { -@@ -165,7 +199,28 @@ +@@ -164,7 +198,28 @@ for (int i = 0; i < this.getSize(); ++i) { if (!this.getItem(i).isEmpty()) { ItemStack itemstack = this.getItem(i).cloneItemStack(); @@ -86,7 +86,7 @@ if (itemstack1.isEmpty()) { iinventory.update(); -@@ -290,7 +345,34 @@ +@@ -289,7 +344,34 @@ if (!itemstack.isEmpty() && b(iinventory, itemstack, i, enumdirection)) { ItemStack itemstack1 = itemstack.cloneItemStack(); @@ -122,7 +122,7 @@ if (itemstack2.isEmpty()) { iinventory.update(); -@@ -305,6 +387,13 @@ +@@ -304,6 +386,13 @@ public static boolean a(IInventory iinventory, EntityItem entityitem) { boolean flag = false; diff --git a/nms-patches/UserCache.patch b/nms-patches/UserCache.patch index 8883cde8db..561343e9e6 100644 --- a/nms-patches/UserCache.patch +++ b/nms-patches/UserCache.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/UserCache.java +++ b/net/minecraft/server/UserCache.java -@@ -46,7 +46,7 @@ +@@ -45,7 +45,7 @@ private static boolean c; private final Map d = Maps.newHashMap(); private final Map e = Maps.newHashMap(); @@ -9,30 +9,3 @@ private final GameProfileRepository g; protected final Gson b; private final File h; -@@ -69,7 +69,7 @@ - this.h = file; - GsonBuilder gsonbuilder = new GsonBuilder(); - -- gsonbuilder.registerTypeHierarchyAdapter(UserCache.UserCacheEntry.class, new UserCache.BanEntrySerializer(null)); -+ gsonbuilder.registerTypeHierarchyAdapter(UserCache.UserCacheEntry.class, new UserCache.BanEntrySerializer()); // CraftBukkit - decompile error - this.b = gsonbuilder.create(); - this.b(); - } -@@ -120,7 +120,7 @@ - date = calendar.getTime(); - } - -- UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date, null); -+ UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date); // CraftBukkit - decompile error - - if (this.e.containsKey(uuid)) { - UserCache.UserCacheEntry usercache_usercacheentry1 = (UserCache.UserCacheEntry) this.e.get(uuid); -@@ -314,7 +314,7 @@ - return null; - } - -- return UserCache.this.new UserCacheEntry(new GameProfile(uuid, s1), date, null); -+ return UserCache.this.new UserCacheEntry(new GameProfile(uuid, s1), date); // CraftBukkit - decompile error - } else { - return null; - } diff --git a/nms-patches/World.patch b/nms-patches/World.patch index 1ef6e82074..80eb15b9f0 100644 --- a/nms-patches/World.patch +++ b/nms-patches/World.patch @@ -1,11 +1,12 @@ --- a/net/minecraft/server/World.java +++ b/net/minecraft/server/World.java -@@ -21,6 +21,23 @@ +@@ -18,6 +18,22 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +// CraftBukkit start +import com.google.common.collect.Maps; ++import java.util.ArrayList; +import java.util.Map; +import org.bukkit.Bukkit; +import org.bukkit.block.BlockState; @@ -14,8 +15,6 @@ +import org.bukkit.craftbukkit.block.CraftBlockState; +import org.bukkit.craftbukkit.block.data.CraftBlockData; +import org.bukkit.craftbukkit.event.CraftEventFactory; -+import org.bukkit.craftbukkit.util.CraftMagicNumbers; -+import org.bukkit.event.block.BlockCanBuildEvent; +import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +import org.bukkit.generator.ChunkGenerator; @@ -24,7 +23,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAccess, AutoCloseable { protected static final Logger e = LogManager.getLogger(); -@@ -62,7 +79,52 @@ +@@ -59,7 +75,52 @@ private final WorldBorder K; int[] E; @@ -78,7 +77,7 @@ this.v = Lists.newArrayList(new IWorldAccess[] { this.u}); this.allowMonsters = true; this.allowAnimals = true; -@@ -74,6 +136,36 @@ +@@ -71,6 +132,36 @@ this.worldProvider = worldprovider; this.isClientSide = flag; this.K = worldprovider.getWorldBorder(); @@ -115,7 +114,7 @@ } public BiomeBase getBiome(BlockPosition blockposition) { -@@ -148,6 +240,26 @@ +@@ -145,6 +236,26 @@ } public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { @@ -142,7 +141,7 @@ if (k(blockposition)) { return false; } else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { -@@ -155,9 +267,23 @@ +@@ -152,9 +263,23 @@ } else { Chunk chunk = this.getChunkAtWorldCoords(blockposition); Block block = iblockdata.getBlock(); @@ -167,7 +166,7 @@ return false; } else { IBlockData iblockdata2 = this.getType(blockposition); -@@ -168,6 +294,7 @@ +@@ -165,6 +290,7 @@ this.methodProfiler.exit(); } @@ -175,7 +174,7 @@ if (iblockdata2 == iblockdata) { if (iblockdata1 != iblockdata2) { this.a(blockposition, blockposition); -@@ -192,12 +319,63 @@ +@@ -189,12 +315,63 @@ iblockdata.b(this, blockposition, j); } } @@ -239,7 +238,7 @@ public boolean setAir(BlockPosition blockposition) { Fluid fluid = this.getFluid(blockposition); -@@ -234,6 +412,11 @@ +@@ -231,6 +408,11 @@ public void update(BlockPosition blockposition, Block block) { if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) { @@ -251,7 +250,7 @@ this.applyPhysics(blockposition, block); } -@@ -309,6 +492,17 @@ +@@ -306,6 +488,17 @@ IBlockData iblockdata = this.getType(blockposition); try { @@ -269,16 +268,7 @@ iblockdata.doPhysics(this, blockposition, block, blockposition1); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); -@@ -317,7 +511,7 @@ - crashreportsystemdetails.a("Source block type", () -> { - try { - return String.format("ID #%s (%s // %s)", new Object[] { IRegistry.BLOCK.getKey(block), block.m(), block.getClass().getCanonicalName()}); -- } catch (Throwable throwable) { -+ } catch (Throwable throwablex) { // CraftBukkit - decompile error - return "ID #" + IRegistry.BLOCK.getKey(block); - } - }); -@@ -403,6 +597,17 @@ +@@ -400,6 +593,17 @@ } public IBlockData getType(BlockPosition blockposition) { @@ -296,7 +286,7 @@ if (k(blockposition)) { return Blocks.VOID_AIR.getBlockData(); } else { -@@ -649,6 +854,16 @@ +@@ -646,6 +850,16 @@ } public boolean addEntity(Entity entity) { @@ -313,7 +303,7 @@ int i = MathHelper.floor(entity.locX / 16.0D); int j = MathHelper.floor(entity.locZ / 16.0D); boolean flag = entity.attachedToPlayer; -@@ -679,6 +894,7 @@ +@@ -676,6 +890,7 @@ ((IWorldAccess) this.v.get(i)).a(entity); } @@ -321,7 +311,7 @@ } protected void c(Entity entity) { -@@ -686,6 +902,7 @@ +@@ -683,6 +898,7 @@ ((IWorldAccess) this.v.get(i)).b(entity); } @@ -329,7 +319,7 @@ } public void kill(Entity entity) { -@@ -721,7 +938,15 @@ +@@ -718,7 +934,15 @@ this.getChunkAt(i, j).b(entity); } @@ -346,7 +336,7 @@ this.c(entity); } -@@ -756,6 +981,11 @@ +@@ -753,6 +977,11 @@ for (i = 0; i < this.k.size(); ++i) { entity = (Entity) this.k.get(i); @@ -358,7 +348,7 @@ try { ++entity.ticksLived; -@@ -804,8 +1034,10 @@ +@@ -801,8 +1030,10 @@ CrashReport crashreport1; CrashReportSystemDetails crashreportsystemdetails1; @@ -371,7 +361,7 @@ Entity entity1 = entity.getVehicle(); if (entity1 != null) { -@@ -838,7 +1070,7 @@ +@@ -835,7 +1066,7 @@ this.getChunkAt(j, l).b(entity); } @@ -380,7 +370,7 @@ this.c(entity); } -@@ -893,9 +1125,11 @@ +@@ -890,9 +1121,11 @@ TileEntity tileentity1 = (TileEntity) this.c.get(i1); if (!tileentity1.x()) { @@ -392,7 +382,7 @@ if (this.isLoaded(tileentity1.getPosition())) { Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition()); -@@ -903,6 +1137,12 @@ +@@ -900,6 +1133,12 @@ chunk.a(tileentity1.getPosition(), tileentity1); this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3); @@ -405,7 +395,7 @@ } } } -@@ -956,15 +1196,13 @@ +@@ -953,15 +1192,13 @@ int i; int j; @@ -427,7 +417,7 @@ entity.N = entity.locX; entity.O = entity.locY; -@@ -980,6 +1218,7 @@ +@@ -977,6 +1214,7 @@ return IRegistry.ENTITY_TYPE.getKey(entity.P()).toString(); }); entity.tick(); @@ -435,7 +425,7 @@ this.methodProfiler.exit(); } } -@@ -1310,11 +1549,18 @@ +@@ -1307,11 +1545,18 @@ } } @@ -454,7 +444,7 @@ TileEntity tileentity = null; if (this.J) { -@@ -1349,6 +1595,14 @@ +@@ -1346,6 +1591,14 @@ public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) { if (!k(blockposition)) { if (tileentity != null && !tileentity.x()) { @@ -469,7 +459,7 @@ if (this.J) { tileentity.setPosition(blockposition); Iterator iterator = this.c.iterator(); -@@ -1509,6 +1763,14 @@ +@@ -1506,6 +1759,14 @@ } this.p = MathHelper.a(this.p, 0.0F, 1.0F); @@ -484,7 +474,7 @@ } } } -@@ -1594,7 +1856,10 @@ +@@ -1591,7 +1852,10 @@ } public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { @@ -496,43 +486,47 @@ return false; } else { int i = 0; -@@ -1737,7 +2002,7 @@ +@@ -1734,7 +1998,7 @@ } public Stream a(@Nullable Entity entity, VoxelShape voxelshape, VoxelShape voxelshape1, Set set) { -- Stream stream = super.a(entity, voxelshape, voxelshape1, set); -+ Stream stream = IIBlockAccess.super.a(entity, voxelshape, voxelshape1, set); // CraftBukkit - decompile error +- Stream stream = GeneratorAccess.super.a(entity, voxelshape, voxelshape1, set); ++ Stream stream = IIBlockAccess.super.a(entity, voxelshape, voxelshape1, set); // CraftBukkit - decompile error return entity == null ? stream : Stream.concat(stream, this.a(entity, voxelshape, set)); } -@@ -1767,7 +2032,7 @@ +@@ -1764,8 +2028,8 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); - if (oclass.isAssignableFrom(entity.getClass()) && predicate.test(entity)) { -+ if (oclass.isAssignableFrom(entity.getClass()) && predicate.test((T) entity)) { - arraylist.add(entity); +- list.add(entity); ++ if (oclass.isAssignableFrom(entity.getClass()) && predicate.test((T) entity)) { // CraftBukkit - decompile error ++ list.add((T) entity); // CraftBukkit - decompile error } } -@@ -1782,7 +2047,7 @@ + +@@ -1779,8 +2043,8 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); - if (oclass.isAssignableFrom(entity.getClass()) && predicate.test(entity)) { -+ if (oclass.isAssignableFrom(entity.getClass()) && predicate.test((T) entity)) { // CraftBukkit - fix decompile error - arraylist.add(entity); - } - } -@@ -1831,7 +2096,7 @@ +- list.add(entity); ++ if (oclass.isAssignableFrom(entity.getClass()) && predicate.test((T) entity)) { // CraftBukkit - decompile error ++ list.add((T) entity); // CraftBukkit - decompile error } } -- return entity; -+ return (T) entity; // CraftBukkit fix decompile error - } +@@ -1816,7 +2080,7 @@ + double d0 = Double.MAX_VALUE; - @Nullable -@@ -1852,8 +2117,16 @@ + for (int i = 0; i < list.size(); ++i) { +- T t2 = (Entity) list.get(i); ++ T t2 = (T) list.get(i); // CraftBukkit - decompile error + + if (t2 != t0 && IEntitySelector.f.test(t2)) { + double d1 = t0.h(t2); +@@ -1849,8 +2113,16 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -550,7 +544,7 @@ if (oclass.isAssignableFrom(entity.getClass())) { ++j; } -@@ -1972,6 +2245,11 @@ +@@ -1969,6 +2241,11 @@ for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); @@ -562,7 +556,7 @@ if (predicate.test(entityhuman1)) { double d5 = entityhuman1.d(d0, d1, d2); -@@ -2185,6 +2463,16 @@ +@@ -2182,6 +2459,16 @@ public void everyoneSleeping() {} @@ -579,7 +573,7 @@ public float g(float f) { return (this.q + (this.r - this.q) * f) * this.i(f); } -@@ -2346,7 +2634,7 @@ +@@ -2343,7 +2630,7 @@ int l = j * 16 + 8 - blockposition.getZ(); boolean flag = true; diff --git a/nms-patches/WorldBorder.patch b/nms-patches/WorldBorder.patch index b1420a7000..f28a690f40 100644 --- a/nms-patches/WorldBorder.patch +++ b/nms-patches/WorldBorder.patch @@ -8,15 +8,6 @@ public WorldBorder() {} -@@ -108,7 +109,7 @@ - } - - public void transitionSizeBetween(double d0, double d1, long i) { -- this.i = (WorldBorder.a) (d0 != d1 ? new WorldBorder.b(d0, d1, i, null) : new WorldBorder.c(d1)); -+ this.i = (WorldBorder.a) (d0 != d1 ? new WorldBorder.b(d0, d1, i) : new WorldBorder.c(d1)); // CraftBukkit - decompile error - Iterator iterator = this.k().iterator(); - - while (iterator.hasNext()) { @@ -124,6 +125,7 @@ } diff --git a/nms-patches/WorldGenVillagePieces.patch b/nms-patches/WorldGenVillagePieces.patch index 6a8899536f..fb1f1e8d76 100644 --- a/nms-patches/WorldGenVillagePieces.patch +++ b/nms-patches/WorldGenVillagePieces.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/WorldGenVillagePieces.java +++ b/net/minecraft/server/WorldGenVillagePieces.java -@@ -1647,14 +1647,14 @@ +@@ -1646,14 +1646,14 @@ entityzombievillager.prepare(generatoraccess.getDamageScaler(new BlockPosition(entityzombievillager)), (GroupDataEntity) null, (NBTTagCompound) null); entityzombievillager.setProfession(this.c(i1, 0)); entityzombievillager.di(); diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index bd17e44678..150e48d272 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 -@@ -21,6 +21,18 @@ +@@ -17,6 +17,18 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -19,13 +19,12 @@ public class WorldServer extends World implements IAsyncTaskHandler { private static final Logger a = LogManager.getLogger(); -@@ -39,28 +51,36 @@ +@@ -35,8 +47,16 @@ ObjectLinkedOpenHashSet d; private boolean P; - public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, PersistentCollection persistentcollection, WorldData worlddata, DimensionManager dimensionmanager, MethodProfiler methodprofiler) { - super(idatamanager, persistentcollection, worlddata, dimensionmanager.e(), methodprofiler, false); -- Predicate predicate = (block) -> { + // CraftBukkit start + public final DimensionManager dimension; + @@ -36,35 +35,10 @@ + this.pvpMode = minecraftserver.getPVP(); + worlddata.world = this; + // CraftBukkit end -+ Predicate predicate = (block) -> { // CraftBukkit - decompile error + this.nextTickListBlock = new TickListServer<>(this, (block) -> { return block == null || block.getBlockData().isAir(); - }; - IRegistry iregistry = IRegistry.BLOCK; - - IRegistry.BLOCK.getClass(); - Function function = iregistry::getKey; -- IRegistry iregistry1 = IRegistry.BLOCK; -+ IRegistry iregistry1 = IRegistry.BLOCK; // CraftBukkit - decompile error - - IRegistry.BLOCK.getClass(); -- this.nextTickListBlock = new TickListServer(this, predicate, function, iregistry1::getOrDefault, this::b); -- predicate = (fluidtype) -> { -+ this.nextTickListBlock = new TickListServer<>(this, predicate, function, iregistry1::getOrDefault, this::b); // CraftBukkit - decompile error -+ Predicate predicate2 = (fluidtype) -> { // CraftBukkit - decompile error - return fluidtype == null || fluidtype == FluidTypes.a; - }; - iregistry = IRegistry.FLUID; - IRegistry.FLUID.getClass(); - function = iregistry::getKey; -- iregistry1 = IRegistry.FLUID; -+ IRegistry iregistry2 = IRegistry.FLUID; // CraftBukkit - decompile error - IRegistry.FLUID.getClass(); -- this.nextTickListFluid = new TickListServer(this, predicate, function, iregistry1::getOrDefault, this::a); -+ this.nextTickListFluid = new TickListServer<>(this, predicate2, function, iregistry2::getOrDefault, this::a); // CraftBukkit - decompile error - this.siegeManager = new VillageSiege(this); - this.d = new ObjectLinkedOpenHashSet(); - this.server = minecraftserver; -@@ -68,7 +88,7 @@ + }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::getOrDefault, this::b); +@@ -50,7 +70,7 @@ this.manager = new PlayerChunkMap(this); this.worldProvider.a((World) this); this.chunkProvider = this.r(); @@ -73,7 +47,7 @@ this.P(); this.Q(); this.getWorldBorder().a(minecraftserver.au()); -@@ -86,6 +106,7 @@ +@@ -68,6 +88,7 @@ this.villages.a((World) this); } @@ -81,7 +55,7 @@ PersistentScoreboard persistentscoreboard = (PersistentScoreboard) this.a(DimensionManager.OVERWORLD, PersistentScoreboard::new, "scoreboard"); if (persistentscoreboard == null) { -@@ -95,6 +116,7 @@ +@@ -77,6 +98,7 @@ persistentscoreboard.a((Scoreboard) this.server.getScoreboard()); this.server.getScoreboard().a((Runnable) (new RunnableSaveScoreboard(persistentscoreboard))); @@ -89,7 +63,7 @@ this.getWorldBorder().setCenter(this.worldData.B(), this.worldData.C()); this.getWorldBorder().setDamageAmount(this.worldData.H()); this.getWorldBorder().setDamageBuffer(this.worldData.G()); -@@ -106,9 +128,130 @@ +@@ -88,9 +110,130 @@ this.getWorldBorder().setSize(this.worldData.D()); } @@ -220,7 +194,7 @@ public void doTick(BooleanSupplier booleansupplier) { this.P = true; super.doTick(booleansupplier); -@@ -128,9 +271,12 @@ +@@ -110,9 +253,12 @@ } this.methodProfiler.enter("spawner"); @@ -236,7 +210,7 @@ } this.methodProfiler.exitEnter("chunkSource"); -@@ -160,6 +306,8 @@ +@@ -142,6 +288,8 @@ this.methodProfiler.exit(); this.an(); this.P = false; @@ -245,7 +219,7 @@ } public boolean j_() { -@@ -191,7 +339,7 @@ +@@ -173,7 +321,7 @@ if (entityhuman.isSpectator()) { ++i; @@ -254,7 +228,7 @@ ++j; } } -@@ -223,25 +371,46 @@ +@@ -205,25 +353,46 @@ } private void b() { @@ -305,7 +279,7 @@ return false; } else { -@@ -316,10 +485,10 @@ +@@ -298,10 +467,10 @@ entityhorseskeleton.s(true); entityhorseskeleton.setAgeRaw(0); entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); @@ -318,7 +292,7 @@ } } -@@ -332,11 +501,11 @@ +@@ -314,11 +483,11 @@ BiomeBase biomebase = this.getBiome(blockposition); if (biomebase.a((IWorldReader) this, blockposition1)) { @@ -332,16 +306,16 @@ } if (flag && this.getBiome(blockposition1).c() == BiomeBase.Precipitation.RAIN) { -@@ -385,7 +554,7 @@ +@@ -367,7 +536,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.getHeight(), blockposition1.getZ()))).g(3.0D); -- List list = this.a(EntityLiving.class, axisalignedbb, (entityliving) -> { -+ List list = this.a(EntityLiving.class, axisalignedbb, (Predicate) (entityliving) -> { // CraftBukkit - decompile error +- List list = this.a(EntityLiving.class, axisalignedbb, (entityliving) -> { ++ List list = this.a(EntityLiving.class, axisalignedbb, (java.util.function.Predicate) (entityliving) -> { // CraftBukkit - decompile error return entityliving != null && entityliving.isAlive() && this.e(entityliving.getChunkCoordinates()); }); -@@ -401,7 +570,7 @@ +@@ -383,7 +552,7 @@ } public void tickEntities() { @@ -350,7 +324,7 @@ if (this.emptyTime++ >= 300) { return; } -@@ -490,6 +659,7 @@ +@@ -472,6 +641,7 @@ } @@ -358,7 +332,7 @@ public void entityJoinedWorld(Entity entity, boolean flag) { if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) { entity.die(); -@@ -501,6 +671,7 @@ +@@ -483,6 +653,7 @@ super.entityJoinedWorld(entity, flag); } @@ -366,7 +340,7 @@ private boolean getSpawnNPCs() { return this.server.getSpawnNPCs(); -@@ -513,7 +684,21 @@ +@@ -495,7 +666,21 @@ protected IChunkProvider r() { IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider); @@ -389,7 +363,7 @@ } public boolean a(EntityHuman entityhuman, BlockPosition blockposition) { -@@ -572,6 +757,22 @@ +@@ -554,6 +739,22 @@ BlockPosition blockposition = worldchunkmanager.a(0, 0, 256, list, random); ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); @@ -412,7 +386,7 @@ if (blockposition == null) { WorldServer.a.warn("Unable to find spawn biome"); } -@@ -647,6 +848,7 @@ +@@ -629,6 +830,7 @@ ChunkProviderServer chunkproviderserver = this.getChunkProvider(); if (chunkproviderserver.d()) { @@ -420,17 +394,17 @@ if (iprogressupdate != null) { iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0])); } -@@ -657,7 +859,8 @@ +@@ -639,7 +841,8 @@ } chunkproviderserver.a(flag); -- ArrayList arraylist = Lists.newArrayList(chunkproviderserver.a()); +- List list = Lists.newArrayList(chunkproviderserver.a()); + // CraftBukkit - ArrayList -> Collection -+ java.util.Collection arraylist = chunkproviderserver.a(); - Iterator iterator = arraylist.iterator(); ++ java.util.Collection list = chunkproviderserver.a(); + Iterator iterator = list.iterator(); while (iterator.hasNext()) { -@@ -691,6 +894,12 @@ +@@ -673,6 +876,12 @@ } } @@ -443,7 +417,7 @@ this.worldData.a(this.getWorldBorder().getSize()); this.worldData.d(this.getWorldBorder().getCenterX()); this.worldData.c(this.getWorldBorder().getCenterZ()); -@@ -705,9 +914,13 @@ +@@ -687,9 +896,13 @@ this.h().a(); } @@ -459,7 +433,7 @@ public void a(Stream stream) { stream.forEach((entity) -> { -@@ -721,7 +934,7 @@ +@@ -703,7 +916,7 @@ private boolean j(Entity entity) { if (entity.dead) { @@ -468,7 +442,7 @@ return false; } else { UUID uuid = entity.getUniqueID(); -@@ -733,7 +946,7 @@ +@@ -715,7 +928,7 @@ this.g.remove(entity1); } else { if (!(entity instanceof EntityHuman)) { @@ -477,7 +451,7 @@ return false; } -@@ -785,9 +998,21 @@ +@@ -767,9 +980,21 @@ } @@ -500,7 +474,7 @@ return true; } else { return false; -@@ -803,6 +1028,14 @@ +@@ -785,6 +1010,14 @@ } public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, boolean flag1) { @@ -515,7 +489,7 @@ Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, flag1); if (damagesource != null) { -@@ -811,6 +1044,8 @@ +@@ -793,6 +1026,8 @@ explosion.a(); explosion.a(false); @@ -524,7 +498,7 @@ if (!flag1) { explosion.clearBlocks(); } -@@ -837,7 +1072,8 @@ +@@ -819,7 +1054,8 @@ BlockActionData blockactiondata = (BlockActionData) this.d.removeFirst(); if (this.a(blockactiondata)) { @@ -534,7 +508,7 @@ } } -@@ -858,6 +1094,7 @@ +@@ -840,6 +1076,7 @@ boolean flag = this.isRaining(); super.w(); @@ -542,7 +516,7 @@ if (this.o != this.p) { this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.p)), this.worldProvider.getDimensionManager()); } -@@ -876,6 +1113,21 @@ +@@ -858,6 +1095,21 @@ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.p)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.r)); } @@ -564,7 +538,7 @@ } -@@ -909,13 +1161,20 @@ +@@ -891,13 +1143,20 @@ } public int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index d40127075b..4d993f6fc0 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -436,7 +436,7 @@ public class CraftBlock implements Block { } public double getTemperature() { - return world.getBiome(position).c(position); // PAIL: getAdjustedTemperature + return world.getBiome(position).getAdjustedTemperature(position); } public double getHumidity() { @@ -652,13 +652,13 @@ public class CraftBlock implements Block { @Override public BoundingBox getBoundingBox() { - VoxelShape shape = getData0().g(world, position); // PAIL: getShape + VoxelShape shape = getData0().getShape(world, position); if (shape.isEmpty()) { return new BoundingBox(); // Return an empty bounding box if the block has no dimension } - AxisAlignedBB aabb = shape.a(); // PAIL: getBoundingBox + AxisAlignedBB aabb = shape.getBoundingBox(); return new BoundingBox(getX() + aabb.minX, getY() + aabb.minY, getZ() + aabb.minZ, getX() + aabb.maxX, getY() + aabb.maxY, getZ() + aabb.maxZ); } } 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 57f4833677..8c110c67dd 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -240,7 +240,7 @@ public class CraftBlockData implements BlockData { @Override public String getAsString() { - return toString(((BlockDataAbstract) state).b()); + return toString(((BlockDataAbstract) state).getStateMap()); } @Override @@ -268,23 +268,13 @@ public class CraftBlockData implements BlockData { if (!states.isEmpty()) { stateString.append('['); - stateString.append(states.entrySet().stream().map(STATE_TO_VALUE).collect(Collectors.joining(","))); + stateString.append(states.entrySet().stream().map(BlockDataAbstract.STATE_TO_VALUE).collect(Collectors.joining(","))); stateString.append(']'); } return stateString.toString(); } - // BlockDataAbstract#b. Should PAIL public in future release but is mimicked for now to avoid a decompile error patch - private static final Function, Comparable>, String> STATE_TO_VALUE = (entry) -> { - if (entry == null) { - return ""; - } - - IBlockState state = entry.getKey(); - return state.a() + "=" + state.a(entry.getValue()); - }; - @Override public boolean equals(Object obj) { return obj instanceof CraftBlockData && state.equals(((CraftBlockData) obj).state); @@ -517,8 +507,8 @@ public class CraftBlockData implements BlockData { ArgumentBlock arg = new ArgumentBlock(reader, false).a(false); Preconditions.checkArgument(!reader.canRead(), "Spurious trailing data"); - blockData = arg.b(); // PAIL rename getBlockData - parsed = arg.a(); // PAIL rename getStateMap + blockData = arg.getBlockData(); + parsed = arg.getStateMap(); } catch (CommandSyntaxException ex) { throw new IllegalArgumentException("Could not parse data: " + data, ex); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java index 876129fd1b..64e4fd402c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java @@ -55,9 +55,9 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager { public void setConversionTime(int time) { if (time < 0) { getHandle().conversionTime = -1; - getHandle().getDataWatcher().set(EntityZombieVillager.a, false); + getHandle().getDataWatcher().set(EntityZombieVillager.CONVERTING, false); } else { - getHandle().a((UUID) null, time); + getHandle().startConversion((UUID) null, time); } } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java index 7af4ea9f85..e93ecb076b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -72,9 +72,9 @@ public class CraftZombie extends CraftMonster implements Zombie { public void setConversionTime(int time) { if (time < 0) { getHandle().drownedConversionTime = -1; - getHandle().getDataWatcher().set(EntityZombie.bF, false); + getHandle().getDataWatcher().set(EntityZombie.DROWN_CONVERTING, false); } else { - getHandle().a(time); + getHandle().startDrownedConversion(time); } } }