diff options
author | md_5 <git@md-5.net> | 2018-07-22 12:00:00 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-07-22 12:00:00 +1000 |
commit | 1a6b4f5392c8cda1e347c10976d394b47936dda6 (patch) | |
tree | 3b27585102b8348a432064ca1f1cad1e6488f1ad /nms-patches | |
parent | 961295e4327324766a0404857c1ca85051971995 (diff) | |
download | craftbukkit-1a6b4f5392c8cda1e347c10976d394b47936dda6.tar craftbukkit-1a6b4f5392c8cda1e347c10976d394b47936dda6.tar.gz craftbukkit-1a6b4f5392c8cda1e347c10976d394b47936dda6.tar.lz craftbukkit-1a6b4f5392c8cda1e347c10976d394b47936dda6.tar.xz craftbukkit-1a6b4f5392c8cda1e347c10976d394b47936dda6.zip |
Update to Minecraft 1.13
Diffstat (limited to 'nms-patches')
52 files changed, 286 insertions, 281 deletions
diff --git a/nms-patches/AdvancementDataPlayer.patch b/nms-patches/AdvancementDataPlayer.patch index 0cadb6c8..d92b9548 100644 --- a/nms-patches/AdvancementDataPlayer.patch +++ b/nms-patches/AdvancementDataPlayer.patch @@ -29,7 +29,7 @@ dynamic = dynamic.set("DataVersion", dynamic.createInt(1343)); @@ -148,7 +148,7 @@ - dynamic = this.d.aB().update(DataFixTypes.ADVANCEMENTS, dynamic, dynamic.getInt("DataVersion"), 1513); + dynamic = this.d.aB().update(DataFixTypes.ADVANCEMENTS, dynamic, dynamic.getInt("DataVersion"), 1519); dynamic = dynamic.remove("DataVersion"); - Map map = (Map) AdvancementDataPlayer.b.getAdapter(AdvancementDataPlayer.c).fromJsonTree((JsonElement) dynamic.getValue()); + Map<MinecraftKey, AdvancementProgress> map = (Map) AdvancementDataPlayer.b.getAdapter(AdvancementDataPlayer.c).fromJsonTree((JsonElement) dynamic.getValue()); // CraftBukkit - decompile error diff --git a/nms-patches/AttributeRanged.patch b/nms-patches/AttributeRanged.patch index 6c2e9bf2..f71634b5 100644 --- a/nms-patches/AttributeRanged.patch +++ b/nms-patches/AttributeRanged.patch @@ -6,6 +6,6 @@ public double a(double d0) { + if (d0 != d0) return getDefault(); // CraftBukkit + - d0 = MathHelper.a(d0, this.a, this.b); + d0 = MathHelper.a(d0, this.a, this.maximum); return d0; } diff --git a/nms-patches/Block.patch b/nms-patches/Block.patch index abff3dcd..1c99929a 100644 --- a/nms-patches/Block.patch +++ b/nms-patches/Block.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Block.java +++ b/net/minecraft/server/Block.java -@@ -213,7 +213,7 @@ +@@ -212,7 +212,7 @@ } public Block(Block.Info block_info) { @@ -9,7 +9,7 @@ this.a(blockstatelist_a); this.blockStateList = blockstatelist_a.a(BlockData::new); -@@ -428,7 +428,8 @@ +@@ -427,7 +427,8 @@ int j = this.getDropCount(iblockdata, i, world, blockposition, world.random); for (int k = 0; k < j; ++k) { @@ -19,7 +19,7 @@ Item item = this.getDropType(iblockdata, world, blockposition, i).getItem(); if (item != Items.AIR) { -@@ -449,7 +450,13 @@ +@@ -448,7 +449,13 @@ EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack); entityitem.n(); @@ -34,7 +34,7 @@ } } -@@ -668,7 +675,7 @@ +@@ -667,7 +674,7 @@ } public String toString() { @@ -43,7 +43,7 @@ } public static boolean c(Block block) { -@@ -1380,6 +1387,12 @@ +@@ -1406,6 +1413,12 @@ } diff --git a/nms-patches/BlockDiodeAbstract.patch b/nms-patches/BlockDiodeAbstract.patch index b870476b..30cf95ab 100644 --- a/nms-patches/BlockDiodeAbstract.patch +++ b/nms-patches/BlockDiodeAbstract.patch @@ -27,4 +27,4 @@ + // CraftBukkit end world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, Boolean.valueOf(true)), 2); if (!flag1) { - world.I().a(blockposition, this, this.j(iblockdata), TickListPriority.HIGH); + world.I().a(blockposition, this, this.k(iblockdata), TickListPriority.HIGH); diff --git a/nms-patches/BlockFire.patch b/nms-patches/BlockFire.patch index 9f26ccf3..26c20c6f 100644 --- a/nms-patches/BlockFire.patch +++ b/nms-patches/BlockFire.patch @@ -68,7 +68,7 @@ return; } - if (i == 15 && random.nextInt(4) == 0 && !this.j(world.getType(blockposition.down()))) { + if (i == 15 && random.nextInt(4) == 0 && !this.k(world.getType(blockposition.down()))) { - world.setAir(blockposition); + fireExtinguished(world, blockposition); // CraftBukkit return; diff --git a/nms-patches/BlockPumpkinCarved.patch b/nms-patches/BlockPumpkinCarved.patch index 8e2dfb39..336d8eb7 100644 --- a/nms-patches/BlockPumpkinCarved.patch +++ b/nms-patches/BlockPumpkinCarved.patch @@ -19,7 +19,7 @@ + BlockStateListPopulator blockList = new BlockStateListPopulator(world); // CraftBukkit - Use BlockStateListPopulator if (shapedetector_shapedetectorcollection != null) { - for (i = 0; i < this.d().b(); ++i) { + for (i = 0; i < this.e().b(); ++i) { ShapeDetectorBlock shapedetectorblock1 = shapedetector_shapedetectorcollection.a(0, i, 0); - world.setTypeAndData(shapedetectorblock1.getPosition(), Blocks.AIR.getBlockData(), 2); @@ -42,8 +42,8 @@ while (iterator.hasNext()) { @@ -70,7 +82,7 @@ if (shapedetector_shapedetectorcollection != null) { - for (i = 0; i < this.f().c(); ++i) { - for (int l = 0; l < this.f().b(); ++l) { + for (i = 0; i < this.g().c(); ++i) { + for (int l = 0; l < this.g().b(); ++l) { - world.setTypeAndData(shapedetector_shapedetectorcollection.a(i, l, 0).getPosition(), Blocks.AIR.getBlockData(), 2); + blockList.setTypeAndData(shapedetector_shapedetectorcollection.a(i, l, 0).getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit } diff --git a/nms-patches/BlockRedstoneWire.patch b/nms-patches/BlockRedstoneWire.patch index 206d6222..4f8952db 100644 --- a/nms-patches/BlockRedstoneWire.patch +++ b/nms-patches/BlockRedstoneWire.patch @@ -9,7 +9,7 @@ public class BlockRedstoneWire extends Block { public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.L; -@@ -216,6 +218,15 @@ +@@ -215,6 +217,15 @@ j = k; } diff --git a/nms-patches/BlockStem.patch b/nms-patches/BlockStem.patch index 1159ca0a..2a7b86d1 100644 --- a/nms-patches/BlockStem.patch +++ b/nms-patches/BlockStem.patch @@ -23,7 +23,7 @@ if (world.getType(blockposition1).isAir() && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) { - world.setTypeUpdate(blockposition1, this.blockFruit.getBlockData()); + CraftEventFactory.handleBlockGrowEvent(world, blockposition1, this.blockFruit.getBlockData()); // CraftBukkit - world.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.d().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection)); + world.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.e().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection)); } } @@ -94,7 +96,7 @@ diff --git a/nms-patches/BlockVine.patch b/nms-patches/BlockVine.patch index d7093f6f..7a84a4a6 100644 --- a/nms-patches/BlockVine.patch +++ b/nms-patches/BlockVine.patch @@ -16,28 +16,28 @@ + // CraftBukkit start - Call BlockSpreadEvent + BlockPosition source = blockposition; + - if (flag && this.b(world, blockposition3, enumdirection1)) { + if (flag && this.b((IBlockAccess) world, blockposition3, enumdirection1)) { - world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), Boolean.valueOf(true)), 2); + CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), Boolean.valueOf(true)), 2); - } else if (flag1 && this.b(world, blockposition4, enumdirection2)) { + } else if (flag1 && this.b((IBlockAccess) world, blockposition4, enumdirection2)) { - world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2); + CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2); } else { EnumDirection enumdirection3 = enumdirection.opposite(); - if (flag && world.isEmpty(blockposition3) && this.b(world, blockposition.shift(enumdirection1), enumdirection3)) { + if (flag && world.isEmpty(blockposition3) && this.b((IBlockAccess) world, blockposition.shift(enumdirection1), enumdirection3)) { - world.setTypeAndData(blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2); + CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2); - } else if (flag1 && world.isEmpty(blockposition4) && this.b(world, blockposition.shift(enumdirection2), enumdirection3)) { + } else if (flag1 && world.isEmpty(blockposition4) && this.b((IBlockAccess) world, blockposition.shift(enumdirection2), enumdirection3)) { - world.setTypeAndData(blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2); + CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2); - } else if ((double) world.random.nextFloat() < 0.05D && this.b(world, blockposition2.up(), EnumDirection.UP)) { + } else if ((double) world.random.nextFloat() < 0.05D && this.b((IBlockAccess) world, blockposition2.up(), EnumDirection.UP)) { - world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, Boolean.valueOf(true)), 2); + CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, Boolean.valueOf(true)), 2); } + // CraftBukkit end } - } else if (this.b(world, blockposition2, enumdirection)) { + } else if (this.b((IBlockAccess) world, blockposition2, enumdirection)) { world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), Boolean.valueOf(true)), 2); @@ -226,7 +232,7 @@ } diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch index 22b18836..f08c03d7 100644 --- a/nms-patches/ChunkRegionLoader.patch +++ b/nms-patches/ChunkRegionLoader.patch @@ -9,20 +9,25 @@ public ChunkRegionLoader(File file, DataFixer datafixer) { this.c = file; -@@ -48,15 +48,54 @@ - return nbttagcompound != null ? nbttagcompound : this.b(generatoraccess, i, j); - } +@@ -45,20 +45,56 @@ + private synchronized NBTTagCompound a(GeneratorAccess generatoraccess, int i, int j) throws IOException { + NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(new ChunkCoordIntPair(i, j)); +- return nbttagcompound != null ? nbttagcompound : this.a(generatoraccess.o().getDimensionManager(), generatoraccess.s_(), i, j); ++ return nbttagcompound != null ? nbttagcompound : this.a(generatoraccess.o().getDimensionManager(), generatoraccess.s_(), i, j, generatoraccess); // CraftBukkit ++ } ++ + // CraftBukkit start + private boolean check(ChunkProviderServer cps, int x, int z) throws IOException { -+ com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread"); -+ -+ if (cps.isLoaded(x, z)) { -+ return true; ++ if (cps != null) { ++ com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread"); ++ if (cps.isLoaded(x, z)) { ++ return true; ++ } + } + + if (RegionFileCache.chunkExists(this.c, x, z)) { -+ NBTTagCompound nbt = RegionFileCache.d(this.c, x, z); ++ NBTTagCompound nbt = RegionFileCache.read(this.c, x, z); + if (nbt != null) { + NBTTagCompound level = nbt.getCompound("Level"); + if (level.getBoolean("TerrainPopulated")) { @@ -37,27 +42,28 @@ + } + + return false; -+ } -+ // CraftBukkit end -+ + } + @Nullable - private NBTTagCompound b(GeneratorAccess generatoraccess, int i, int j) throws IOException { -- DataInputStream datainputstream = RegionFileCache.d(this.c, i, j); -+ // CraftBukkit start -+ NBTTagCompound nbttagcompound = RegionFileCache.d(this.c, i, j); +- private NBTTagCompound a(DimensionManager dimensionmanager, @Nullable PersistentCollection persistentcollection, int i, int j) throws IOException { +- DataInputStream datainputstream = RegionFileCache.read(this.c, i, j); ++ private NBTTagCompound a(DimensionManager dimensionmanager, @Nullable PersistentCollection persistentcollection, int i, int j, @Nullable GeneratorAccess generatoraccess) throws IOException { ++ NBTTagCompound nbttagcompound = RegionFileCache.read(this.c, i, j); - if (datainputstream == null) { + if (nbttagcompound == null) { return null; } else { - NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a(datainputstream); +- +- datainputstream.close(); + // CraftBukkit end int k = nbttagcompound.hasKeyOfType("DataVersion", 99) ? nbttagcompound.getInt("DataVersion") : -1; + // CraftBukkit start + if (k < 1466) { + NBTTagCompound level = nbttagcompound.getCompound("Level"); + if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) { -+ ChunkProviderServer cps = ((WorldServer) generatoraccess).getChunkProviderServer(); ++ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkProviderServer(); + if (check(cps, i - 1, j) && check(cps, i - 1, j - 1) && check(cps, i, j - 1)) { + level.setBoolean("LightPopulated", true); + } @@ -67,7 +73,7 @@ if (k < 1493) { nbttagcompound = GameProfileSerializer.a(this.d, DataFixTypes.CHUNK, nbttagcompound, k, 1493); -@@ -78,13 +117,29 @@ +@@ -81,13 +117,29 @@ } } @@ -97,7 +103,7 @@ Chunk chunk = this.a(generatoraccess, i, j, nbttagcompound); if (chunk != null) { -@@ -93,6 +148,9 @@ +@@ -96,6 +148,9 @@ } return chunk; @@ -107,7 +113,7 @@ } } -@@ -121,7 +179,7 @@ +@@ -124,7 +179,7 @@ } @Nullable @@ -116,7 +122,7 @@ if (nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8)) { ChunkStatus.Type chunkstatus_type = this.a(nbttagcompound); -@@ -140,10 +198,28 @@ +@@ -143,10 +198,28 @@ ChunkRegionLoader.a.error("Chunk file at {},{} is in the wrong location; relocating. (Expected {}, {}, got {}, {})", Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(chunk.locX), Integer.valueOf(chunk.locZ)); nbttagcompound1.setInt("xPos", i); nbttagcompound1.setInt("zPos", j); @@ -146,7 +152,7 @@ } } } else { -@@ -158,7 +234,7 @@ +@@ -161,7 +234,7 @@ ChunkStatus.Type chunkstatus_type = this.a(nbttagcompound); if (chunkstatus_type == ChunkStatus.Type.LEVELCHUNK) { @@ -155,7 +161,7 @@ } else { NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level"); -@@ -204,19 +280,30 @@ +@@ -209,19 +282,30 @@ } public synchronized boolean a() { @@ -190,7 +196,7 @@ if (nbttagcompound != null) { try { -@@ -228,7 +315,7 @@ +@@ -233,7 +317,7 @@ flag = true; } finally { @@ -199,13 +205,13 @@ } return flag; -@@ -248,10 +335,14 @@ +@@ -253,10 +337,14 @@ } private void b(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { -- DataOutputStream dataoutputstream = RegionFileCache.e(this.c, chunkcoordintpair.x, chunkcoordintpair.z); +- DataOutputStream dataoutputstream = RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z); + // CraftBukkit start -+ RegionFileCache.e(this.c, chunkcoordintpair.x, chunkcoordintpair.z, nbttagcompound); ++ RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z, nbttagcompound); + /* NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); @@ -215,7 +221,7 @@ if (this.e != null) { this.e.a(chunkcoordintpair.a()); } -@@ -264,15 +355,16 @@ +@@ -269,15 +357,16 @@ public void c() { try { @@ -235,7 +241,7 @@ } } -@@ -301,7 +393,7 @@ +@@ -306,7 +395,7 @@ if (abiomebase != null) { for (int k = 0; k < abiomebase.length; ++k) { @@ -244,7 +250,7 @@ } } -@@ -383,7 +475,7 @@ +@@ -388,7 +477,7 @@ int[] aint = new int[abiomebase.length]; for (int i = 0; i < abiomebase.length; ++i) { @@ -253,7 +259,7 @@ } nbttagcompound.setIntArray("Biomes", aint); -@@ -485,7 +577,7 @@ +@@ -490,7 +579,7 @@ } ChunkConverter chunkconverter = nbttagcompound.hasKeyOfType("UpgradeData", 10) ? new ChunkConverter(nbttagcompound.getCompound("UpgradeData")) : ChunkConverter.a; @@ -262,7 +268,7 @@ return block.getBlockData().isAir(); }; RegistryBlocks registryblocks = Block.REGISTRY; -@@ -497,7 +589,7 @@ +@@ -502,7 +591,7 @@ Block.REGISTRY.getClass(); ProtoChunkTickList protochunkticklist = new ProtoChunkTickList(predicate, function, registryblocks1::get, new ChunkCoordIntPair(i, j)); @@ -271,7 +277,7 @@ return fluidtype == FluidTypes.a; }; registryblocks = FluidType.c; -@@ -505,7 +597,7 @@ +@@ -510,7 +599,7 @@ function = registryblocks::b; registryblocks1 = FluidType.c; FluidType.c.getClass(); @@ -280,7 +286,7 @@ long i1 = nbttagcompound.getLong("InhabitedTime"); Chunk chunk = new Chunk(generatoraccess.getMinecraftWorld(), i, j, abiomebase, chunkconverter, protochunkticklist, protochunkticklist1, i1); -@@ -852,17 +944,29 @@ +@@ -853,17 +942,29 @@ } @Nullable @@ -312,7 +318,7 @@ }); } -@@ -876,8 +980,14 @@ +@@ -877,8 +978,14 @@ } } @@ -328,3 +334,12 @@ Iterator iterator = entity.bP().iterator(); while (iterator.hasNext()) { +@@ -894,7 +1001,7 @@ + boolean flag = false; + + try { +- this.a(dimensionmanager, persistentcollection, chunkcoordintpair.x, chunkcoordintpair.z); ++ this.a(dimensionmanager, persistentcollection, chunkcoordintpair.x, chunkcoordintpair.z, null); // CraftBukkit + + while (!this.b.isEmpty()) { + this.a(); diff --git a/nms-patches/ContainerAnvil.patch b/nms-patches/ContainerAnvil.patch index 0f9f7d3a..7b6e8d92 100644 --- a/nms-patches/ContainerAnvil.patch +++ b/nms-patches/ContainerAnvil.patch @@ -76,7 +76,7 @@ public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit - return !this.i.getType(this.j).a(TagsBlock.x) ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D; + return !this.i.getType(this.j).a(TagsBlock.y) ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D; } @@ -357,4 +368,33 @@ diff --git a/nms-patches/CustomFunctionData.patch b/nms-patches/CustomFunctionData.patch index 67c67470..8542f3a5 100644 --- a/nms-patches/CustomFunctionData.patch +++ b/nms-patches/CustomFunctionData.patch @@ -17,7 +17,7 @@ + return this.f.vanillaCommandDispatcher.a(); // CraftBukkit } - public void X_() { + public void Y_() { @@ -164,7 +164,7 @@ arraylist.add(CompletableFuture.supplyAsync(() -> { return a(iresourcemanager, minecraftkey); diff --git a/nms-patches/DedicatedServer.patch b/nms-patches/DedicatedServer.patch index e2d9e6ee..b4e76915 100644 --- a/nms-patches/DedicatedServer.patch +++ b/nms-patches/DedicatedServer.patch @@ -130,7 +130,7 @@ + this.convertable = new WorldLoaderServer(server.getWorldContainer().toPath(), server.getWorldContainer().toPath().resolve("../backups"), this.dataConverterManager); // CraftBukkit - moved from MinecraftServer constructor long j = SystemUtils.c(); - if (this.K() == null) { + if (this.getWorld() == null) { @@ -228,7 +282,18 @@ DedicatedServer.LOGGER.info("Starting remote control listener"); this.m = new RemoteControlListener(this); diff --git a/nms-patches/DispenserRegistry.patch b/nms-patches/DispenserRegistry.patch index 47b0478d..5c389cc5 100644 --- a/nms-patches/DispenserRegistry.patch +++ b/nms-patches/DispenserRegistry.patch @@ -241,7 +241,7 @@ itemstack.subtract(1); if (itemstack.isEmpty()) { return new ItemStack(item); -@@ -227,14 +387,42 @@ +@@ -227,11 +387,39 @@ protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.getWorld(); @@ -274,20 +274,15 @@ if (ItemFlintAndSteel.a((GeneratorAccess) world, blockposition)) { - world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); -- if (itemstack.isDamaged(1, world.random, (EntityPlayer) null)) { -- itemstack.setCount(0); + // CraftBukkit start - Ignition by dispensing flint and steel + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, isourceblock.getBlockPosition()).isCancelled()) { + world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); -+ if (itemstack.isDamaged(1, world.random, (EntityPlayer) null)) { -+ itemstack.setCount(0); -+ } - } ++ } + // CraftBukkit end } else { Block block = world.getType(blockposition).getBlock(); -@@ -254,12 +442,55 @@ +@@ -255,12 +443,55 @@ this.a = true; World world = isourceblock.getWorld(); BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); @@ -343,7 +338,7 @@ return itemstack; } -@@ -268,11 +499,40 @@ +@@ -269,11 +500,40 @@ protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.getWorld(); BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); @@ -386,7 +381,7 @@ return itemstack; } })); -@@ -294,6 +554,30 @@ +@@ -295,6 +555,30 @@ EnumDirection enumdirection = (EnumDirection) isourceblock.e().get(BlockDispenser.FACING); BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection); @@ -417,7 +412,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, Integer.valueOf(enumdirection.opposite().get2DRotationValue() * 4)), 3); -@@ -317,6 +601,30 @@ +@@ -318,6 +602,30 @@ BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN; @@ -448,7 +443,7 @@ this.a = true; if (world.isEmpty(blockposition) && blockpumpkincarved.a((IWorldReader) world, blockposition)) { if (!world.isClientSide) { -@@ -378,6 +686,51 @@ +@@ -379,6 +687,51 @@ } d(); @@ -500,7 +495,7 @@ } } } -@@ -386,7 +739,7 @@ +@@ -387,7 +740,7 @@ LocaleLanguage localelanguage = LocaleLanguage.a(); registrymaterials.iterator().forEachRemaining((object) -> { @@ -509,7 +504,7 @@ if (!localelanguage.b(s)) { DispenserRegistry.c.warn("Missing translation for {}: {} (key: \'{}\')", s1, registrymaterials.b(object), s); -@@ -480,6 +833,30 @@ +@@ -481,6 +834,30 @@ BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection); EnumDirection enumdirection1 = isourceblock.getWorld().isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP; @@ -540,7 +535,7 @@ this.a = ((ItemBlock) item).a((BlockActionContext) (new DispenserRegistry.b(isourceblock.getWorld(), blockposition, enumdirection, itemstack, enumdirection1))) == EnumInteractionResult.SUCCESS; if (this.a) { itemstack.subtract(1); -@@ -533,12 +910,40 @@ +@@ -534,12 +911,40 @@ d3 = 0.0D; } diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch index 567ef8b0..b8a4a887 100644 --- a/nms-patches/Entity.patch +++ b/nms-patches/Entity.patch @@ -500,9 +500,9 @@ @@ -1799,6 +2118,13 @@ } - public void g(boolean flag) { + public void setSwimming(boolean flag) { + // CraftBukkit start -+ if (this.bb() != flag && this instanceof EntityLiving) { ++ if (this.isSwimming() != flag && this instanceof EntityLiving) { + if (CraftEventFactory.callToggleSwimEvent((EntityLiving) this, flag).isCancelled()) { + return; + } diff --git a/nms-patches/EntityCreeper.patch b/nms-patches/EntityCreeper.patch index 4a0912c6..09152034 100644 --- a/nms-patches/EntityCreeper.patch +++ b/nms-patches/EntityCreeper.patch @@ -56,7 +56,7 @@ - this.aX = true; - this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, flag); - this.die(); -- this.dF(); +- this.dG(); + // CraftBukkit start + ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false); + this.world.getServer().getPluginManager().callEvent(event); @@ -64,7 +64,7 @@ + this.aX = true; + this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag); + this.die(); -+ this.dF(); ++ this.dG(); + } else { + fuseTicks = 0; + } diff --git a/nms-patches/EntityDolphin.patch b/nms-patches/EntityDolphin.patch index fbb63290..8b681bd9 100644 --- a/nms-patches/EntityDolphin.patch +++ b/nms-patches/EntityDolphin.patch @@ -12,7 +12,7 @@ @@ -429,7 +429,7 @@ } - if (this.c.bb() && this.c.world.random.nextInt(6) == 0) { + if (this.c.isSwimming() && this.c.world.random.nextInt(6) == 0) { - this.c.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100)); + this.c.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit } diff --git a/nms-patches/EntityFallingBlock.patch b/nms-patches/EntityFallingBlock.patch index c09b0e5f..0dbf54de 100644 --- a/nms-patches/EntityFallingBlock.patch +++ b/nms-patches/EntityFallingBlock.patch @@ -20,7 +20,7 @@ this.die(); @@ -112,7 +114,7 @@ - if (!flag1 && BlockFalling.j(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) { + if (!flag1 && BlockFalling.k(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) { this.onGround = false; - return; + // return; // CraftBukkit @@ -31,9 +31,9 @@ if (iblockdata.getBlock() != Blocks.MOVING_PISTON) { this.die(); if (!this.f) { -- if (iblockdata.getMaterial().isReplaceable() && (flag1 || !BlockFalling.j(this.world.getType(blockposition.down()))) && this.world.setTypeAndData(blockposition, this.block, 3)) { +- if (iblockdata.getMaterial().isReplaceable() && (flag1 || !BlockFalling.k(this.world.getType(blockposition.down()))) && this.world.setTypeAndData(blockposition, this.block, 3)) { + // CraftBukkit start -+ if (iblockdata.getMaterial().isReplaceable() && (flag1 || !BlockFalling.j(this.world.getType(blockposition.down())))) { ++ if (iblockdata.getMaterial().isReplaceable() && (flag1 || !BlockFalling.k(this.world.getType(blockposition.down())))) { + if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.block).isCancelled()) { + return; + } diff --git a/nms-patches/EntityFishingHook.patch b/nms-patches/EntityFishingHook.patch index 10a8f121..387b1763 100644 --- a/nms-patches/EntityFishingHook.patch +++ b/nms-patches/EntityFishingHook.patch @@ -86,7 +86,7 @@ + this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, playerFishEvent.getExpToDrop())); + } + // CraftBukkit end - if (itemstack1.getItem().a(TagsItem.G)) { + if (itemstack1.getItem().a(TagsItem.D)) { this.owner.a(StatisticList.FISH_CAUGHT, 1); } @@ -425,8 +463,25 @@ diff --git a/nms-patches/EntityGuardianElder.patch b/nms-patches/EntityGuardianElder.patch index 23fec4b9..b51a76a4 100644 --- a/nms-patches/EntityGuardianElder.patch +++ b/nms-patches/EntityGuardianElder.patch @@ -1,14 +1,5 @@ --- a/net/minecraft/server/EntityGuardianElder.java +++ b/net/minecraft/server/EntityGuardianElder.java -@@ -17,7 +17,7 @@ - - } - -- protected void initAttributes() { -+ public void initAttributes() { // CraftBukkit - decompile error - super.initAttributes(); - this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.30000001192092896D); - this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(8.0D); @@ -68,7 +68,7 @@ if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) { diff --git a/nms-patches/EntityHorseAbstract.patch b/nms-patches/EntityHorseAbstract.patch index f4b2eeda..c050ff85 100644 --- a/nms-patches/EntityHorseAbstract.patch +++ b/nms-patches/EntityHorseAbstract.patch @@ -20,8 +20,8 @@ public void loadChest() { InventoryHorseChest inventoryhorsechest = this.inventoryChest; -- this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dA()); -+ this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dA(), this); // CraftBukkit +- this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dB()); ++ this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dB(), this); // CraftBukkit this.inventoryChest.a(this.getCustomName()); if (inventoryhorsechest != null) { inventoryhorsechest.b(this); @@ -33,7 +33,7 @@ + return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100 } - protected float cC() { + protected float cD() { @@ -408,7 +410,7 @@ } @@ -68,7 +68,7 @@ + this.heal(1.0F, RegainReason.REGEN); // CraftBukkit } - if (this.dY()) { + if (this.dZ()) { @@ -716,6 +719,7 @@ if (this.getOwnerUUID() != null) { nbttagcompound.setString("OwnerUUID", this.getOwnerUUID().toString()); @@ -106,5 +106,5 @@ + } + // CraftBukkit end this.canSlide = true; - this.dH(); + this.dI(); } diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch index 5475400e..ca77592f 100644 --- a/nms-patches/EntityLiving.patch +++ b/nms-patches/EntityLiving.patch @@ -93,7 +93,7 @@ @@ -283,19 +335,19 @@ - protected void ca() { + protected void cb() { ++this.deathTicks; - if (this.deathTicks == 20) { + if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead) @@ -280,7 +280,7 @@ } else { return false; @@ -637,14 +779,40 @@ - public boolean co() { + public boolean cp() { return this.getMonsterType() == EnumMonsterType.UNDEAD; } - @@ -734,7 +734,7 @@ protected void q() { if (!this.activeItem.isEmpty() && this.isHandRaised()) { this.b(this.activeItem, 16); -- this.a(this.cT(), this.activeItem.a(this.world, this)); +- this.a(this.cU(), this.activeItem.a(this.world, this)); + // CraftBukkit start - fire PlayerItemConsumeEvent + ItemStack itemstack; + if (this instanceof EntityPlayer) { @@ -754,9 +754,9 @@ + itemstack = this.activeItem.a(this.world, this); + } + -+ this.a(this.cT(), itemstack); ++ this.a(this.cU(), itemstack); + // CraftBukkit end - this.cZ(); + this.da(); } @@ -2261,10 +2649,18 @@ diff --git a/nms-patches/EntityMinecartContainer.patch b/nms-patches/EntityMinecartContainer.patch index f2044686..11d6d77e 100644 --- a/nms-patches/EntityMinecartContainer.patch +++ b/nms-patches/EntityMinecartContainer.patch @@ -68,7 +68,7 @@ this.b = true; } -@@ -93,7 +136,7 @@ +@@ -102,7 +145,7 @@ } public int getMaxStackSize() { diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch index fbb4ce6d..33ab3f25 100644 --- a/nms-patches/EntityPlayer.patch +++ b/nms-patches/EntityPlayer.patch @@ -259,7 +259,7 @@ this.releaseShoulderEntities(); - if (!this.world.getGameRules().getBoolean("keepInventory") && !this.isSpectator()) { -- this.di(); +- this.dj(); - this.inventory.q(); + // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. + if (!event.getKeepInventory()) { @@ -274,7 +274,7 @@ + // CraftBukkit - Get our scores instead + this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getName(), ScoreboardScore::incrementScore); + - EntityLiving entityliving = this.cu(); + EntityLiving entityliving = this.cv(); if (entityliving != null) { @@ -383,10 +537,12 @@ @@ -568,7 +568,7 @@ this.locale = packetplayinsettings.b(); this.ct = packetplayinsettings.d(); this.cu = packetplayinsettings.e(); -@@ -1039,7 +1288,7 @@ +@@ -1033,7 +1282,7 @@ this.cw = (Entity) (entity == null ? this : entity); if (entity1 != this.cw) { this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cw)); @@ -577,7 +577,7 @@ } } -@@ -1066,7 +1315,7 @@ +@@ -1060,7 +1309,7 @@ @Nullable public IChatBaseComponent getPlayerListName() { @@ -586,7 +586,7 @@ } public void a(EnumHand enumhand) { -@@ -1083,12 +1332,17 @@ +@@ -1077,12 +1326,17 @@ } public void J() { @@ -604,7 +604,7 @@ } public AdvancementDataPlayer getAdvancementData() { -@@ -1100,9 +1354,16 @@ +@@ -1094,9 +1348,16 @@ return this.cD; } @@ -621,7 +621,7 @@ if (worldserver == this.world) { this.playerConnection.a(d0, d1, d2, f, f1); } else { -@@ -1127,6 +1388,149 @@ +@@ -1121,6 +1382,149 @@ this.server.getPlayerList().b(this, worldserver); this.server.getPlayerList().updateClient(this); } diff --git a/nms-patches/EntityPufferFish.patch b/nms-patches/EntityPufferFish.patch index d010db2c..05b2a7cc 100644 --- a/nms-patches/EntityPufferFish.patch +++ b/nms-patches/EntityPufferFish.patch @@ -1,14 +1,5 @@ --- a/net/minecraft/server/EntityPufferFish.java +++ b/net/minecraft/server/EntityPufferFish.java -@@ -47,7 +47,7 @@ - this.a(f); - } - -- protected final void setSize(float f, float f1) { -+ public final void setSize(float f, float f1) { // CraftBukkit - decompile error - boolean flag = this.bE > 0.0F; - - this.bE = f; @@ -140,7 +140,7 @@ int i = this.getPuffState(); diff --git a/nms-patches/EntitySilverfish.patch b/nms-patches/EntitySilverfish.patch index 6eeae7d5..ef17cbf6 100644 --- a/nms-patches/EntitySilverfish.patch +++ b/nms-patches/EntitySilverfish.patch @@ -3,7 +3,7 @@ @@ -153,6 +153,11 @@ IBlockData iblockdata = world.getType(blockposition); - if (BlockMonsterEggs.j(iblockdata)) { + if (BlockMonsterEggs.k(iblockdata)) { + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, BlockMonsterEggs.f(iblockdata.getBlock())).isCancelled()) { + return; diff --git a/nms-patches/EntityWither.patch b/nms-patches/EntityWither.patch index 26eb069d..e07a21fb 100644 --- a/nms-patches/EntityWither.patch +++ b/nms-patches/EntityWither.patch @@ -14,8 +14,8 @@ private static final DataWatcherObject<Integer> a = DataWatcher.a(EntityWither.class, DataWatcherRegistry.b); @@ -181,13 +187,38 @@ - if (this.dz() > 0) { - i = this.dz() - 1; + if (this.dA() > 0) { + i = this.dA() - 1; if (i <= 0) { - this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, this.world.getGameRules().getBoolean("mobGriefing")); - this.world.a(1023, new BlockPosition(this), 0); diff --git a/nms-patches/EntityWolf.patch b/nms-patches/EntityWolf.patch index 69378f11..68e13f3c 100644 --- a/nms-patches/EntityWolf.patch +++ b/nms-patches/EntityWolf.patch @@ -57,7 +57,7 @@ @@ -258,7 +280,7 @@ this.goalSit.setSitting(!this.isSitting()); this.bg = false; - this.navigation.r(); + this.navigation.q(); - this.setGoalTarget((EntityLiving) null); + this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason } @@ -71,7 +71,7 @@ + // CraftBukkit - added event call and isCancelled check. + if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { this.c(entityhuman); - this.navigation.r(); + this.navigation.q(); this.setGoalTarget((EntityLiving) null); this.goalSit.setSitting(true); - this.setHealth(20.0F); diff --git a/nms-patches/EntityZombieVillager.patch b/nms-patches/EntityZombieVillager.patch index b04cbf5f..6d38c4b7 100644 --- a/nms-patches/EntityZombieVillager.patch +++ b/nms-patches/EntityZombieVillager.patch @@ -11,7 +11,7 @@ @@ -56,6 +57,11 @@ public void tick() { if (!this.world.isClientSide && this.isConverting()) { - int i = this.dK(); + int i = this.dL(); + // CraftBukkit start - Use wall time instead of ticks for villager conversion + int elapsedTicks = MinecraftServer.currentTick - this.lastTick; + this.lastTick = MinecraftServer.currentTick; diff --git a/nms-patches/FluidTypeFlowing.patch b/nms-patches/FluidTypeFlowing.patch index d1f69c07..32ce4ece 100644 --- a/nms-patches/FluidTypeFlowing.patch +++ b/nms-patches/FluidTypeFlowing.patch @@ -12,7 +12,7 @@ public abstract class FluidTypeFlowing extends FluidType { -@@ -116,6 +121,15 @@ +@@ -128,6 +133,15 @@ Fluid fluid1 = this.a((IWorldReader) generatoraccess, blockposition1, iblockdata1); if (this.a(generatoraccess, blockposition, iblockdata, EnumDirection.DOWN, blockposition1, iblockdata1, generatoraccess.b(blockposition1), fluid1.c())) { @@ -28,7 +28,7 @@ this.a(generatoraccess, blockposition1, iblockdata1, EnumDirection.DOWN, fluid1); if (this.a((IWorldReader) generatoraccess, blockposition) >= 3) { this.a(generatoraccess, blockposition, fluid, iblockdata); -@@ -146,6 +160,15 @@ +@@ -158,6 +172,15 @@ IBlockData iblockdata1 = generatoraccess.getType(blockposition1); if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.b(blockposition1), fluid1.c())) { diff --git a/nms-patches/FoodMetaData.patch b/nms-patches/FoodMetaData.patch index 3383084e..9aff748f 100644 --- a/nms-patches/FoodMetaData.patch +++ b/nms-patches/FoodMetaData.patch @@ -64,7 +64,7 @@ this.a(f); this.foodTickTimer = 0; } - } else if (flag && this.foodLevel >= 18 && entityhuman.dw()) { + } else if (flag && this.foodLevel >= 18 && entityhuman.dx()) { ++this.foodTickTimer; if (this.foodTickTimer >= 80) { - entityhuman.heal(1.0F); diff --git a/nms-patches/HandshakeListener.patch b/nms-patches/HandshakeListener.patch index 0b5c975c..6d93d0b9 100644 --- a/nms-patches/HandshakeListener.patch +++ b/nms-patches/HandshakeListener.patch @@ -57,8 +57,8 @@ + } + // CraftBukkit end + - if (packethandshakinginsetprotocol.c() > 389) { - chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[] { "1.13-pre7"}); + if (packethandshakinginsetprotocol.c() > 393) { + chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[] { "1.13"}); this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); @@ -26,6 +71,7 @@ this.b.close(chatmessage); diff --git a/nms-patches/ItemBow.patch b/nms-patches/ItemBow.patch index 4f227519..c34128b3 100644 --- a/nms-patches/ItemBow.patch +++ b/nms-patches/ItemBow.patch @@ -12,10 +12,10 @@ + // CraftBukkit start - obfuscator went a little crazy + /* this.a(new MinecraftKey("pull"), (itemstack, world, entityliving) -> { - return entityliving == null ? 0.0F : (entityliving.cV().getItem() != Items.BOW ? 0.0F : (float) (itemstack.k() - entityliving.cW()) / 20.0F); + return entityliving == null ? 0.0F : (entityliving.cW().getItem() != Items.BOW ? 0.0F : (float) (itemstack.k() - entityliving.cX()) / 20.0F); }); this.a(new MinecraftKey("pulling"), (itemstack, world, entityliving) -> { - return entityliving != null && entityliving.isHandRaised() && entityliving.cV() == itemstack ? 1.0F : 0.0F; + return entityliving != null && entityliving.isHandRaised() && entityliving.cW() == itemstack ? 1.0F : 0.0F; }); + */ + // CraftBukkit end diff --git a/nms-patches/ItemBucket.patch b/nms-patches/ItemBucket.patch index 5e131a07..d5c9794a 100644 --- a/nms-patches/ItemBucket.patch +++ b/nms-patches/ItemBucket.patch @@ -19,14 +19,14 @@ iblockdata = world.getType(blockposition); if (iblockdata.getBlock() instanceof IFluidSource) { + // CraftBukkit start -+ FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).b(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); ++ FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).a(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); + PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, blockposition.getX(), blockposition.getY(), blockposition.getZ(), null, itemstack, dummyFluid.b()); + + if (event.isCancelled()) { + return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); + } + // CraftBukkit end - FluidType fluidtype = ((IFluidSource) iblockdata.getBlock()).b(world, blockposition, iblockdata); + FluidType fluidtype = ((IFluidSource) iblockdata.getBlock()).a(world, blockposition, iblockdata); if (fluidtype != FluidTypes.a) { entityhuman.b(StatisticList.ITEM_USED.b(this)); diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch index dbcc897c..c879c7f4 100644 --- a/nms-patches/MinecraftServer.patch +++ b/nms-patches/MinecraftServer.patch @@ -14,9 +14,9 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable { -@@ -124,7 +131,22 @@ - private boolean an; - private float ao; +@@ -125,7 +132,22 @@ + private boolean forceUpgrade; + private float ap; - public MinecraftServer(@Nullable File file, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { + // CraftBukkit start @@ -38,7 +38,7 @@ this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA); this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new); this.ag = new CraftingManager(); -@@ -135,22 +157,51 @@ +@@ -136,22 +158,51 @@ this.al = new AdvancementDataWorld(); this.am = new CustomFunctionData(this); this.d = proxy; @@ -93,16 +93,35 @@ + public abstract boolean init() throws IOException; - protected void a(String s) { -@@ -184,6 +235,7 @@ - this.a(s); + public void convertWorld(String s) { +@@ -176,11 +227,11 @@ + } + + if (this.forceUpgrade) { +- MinecraftServer.LOGGER.info("Forcing world upgrade!"); +- WorldData worlddata = this.getConvertable().c(this.getWorld()); ++ MinecraftServer.LOGGER.info("Forcing world upgrade! {}", s); // CraftBukkit ++ WorldData worlddata = this.getConvertable().c(s); // CraftBukkit + + if (worlddata != null) { +- WorldUpgrader worldupgrader = new WorldUpgrader(this.getWorld(), this.getConvertable(), worlddata); ++ WorldUpgrader worldupgrader = new WorldUpgrader(s, this.getConvertable(), worlddata); // CraftBukkit + IChatBaseComponent ichatbasecomponent = null; + + while (!worldupgrader.b()) { +@@ -219,9 +270,10 @@ + } + + public void a(String s, String s1, long i, WorldType worldtype, JsonElement jsonelement) { +- this.convertWorld(s); ++ // this.convertWorld(s); // CraftBukkit - moved down this.b((IChatBaseComponent) (new ChatMessage("menu.loadingLevel", new Object[0]))); this.worldServer = new WorldServer[3]; + /* CraftBukkit start - Remove ticktime arrays and worldsettings this.f = new long[this.worldServer.length][100]; IDataManager idatamanager = this.convertable.a(s, this); -@@ -209,40 +261,115 @@ +@@ -247,40 +299,116 @@ } this.a(idatamanager.getDirectory(), worlddata); @@ -136,6 +155,7 @@ + String worldType = org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase(); + String name = (dimension == 0) ? s : s + "_" + worldType; ++ this.convertWorld(name); // Run conversion now + + org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name); + WorldSettings worldsettings = new WorldSettings(i, this.getGamemode(), this.getGenerateStructures(), this.isHardcore(), worldtype); @@ -232,7 +252,7 @@ this.a(this.getDifficulty()); this.g_(); -@@ -251,6 +378,25 @@ +@@ -289,6 +417,25 @@ protected void a(File file, WorldData worlddata) { this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla())); this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks")); @@ -258,7 +278,7 @@ this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder); this.resourcePackRepository.a(); ArrayList arraylist = Lists.newArrayList(); -@@ -281,41 +427,52 @@ +@@ -319,41 +466,52 @@ this.b((IChatBaseComponent) (new ChatMessage("menu.generatingTerrain", new Object[0]))); boolean flag5 = false; @@ -286,11 +306,6 @@ + BlockPosition blockposition = worldserver.getSpawn(); + ArrayList arraylist = 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)); -+ } - while (!completablefuture.isDone()) { - try { @@ -301,6 +316,11 @@ - if (executionexception.getCause() instanceof RuntimeException) { - throw (RuntimeException) executionexception.getCause(); - } ++ 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)); ++ } ++ + CompletableFuture completablefuture = worldserver.getChunkProviderServer().a((Iterable) arraylist, (chunk) -> { + set.add(chunk.getPos()); + }); @@ -337,7 +357,7 @@ this.m(); MinecraftServer.LOGGER.info("Time elapsed: {} ms", Long.valueOf(stopwatch.elapsed(TimeUnit.MILLISECONDS))); } -@@ -354,14 +511,17 @@ +@@ -392,14 +550,17 @@ protected void m() { this.w = null; this.x = 0; @@ -357,7 +377,7 @@ if (worldserver != null) { if (!flag) { -@@ -378,8 +538,24 @@ +@@ -416,8 +577,24 @@ } @@ -383,7 +403,7 @@ if (this.getServerConnection() != null) { this.getServerConnection().b(); } -@@ -388,6 +564,7 @@ +@@ -426,6 +603,7 @@ MinecraftServer.LOGGER.info("Saving players"); this.s.savePlayers(); this.s.u(); @@ -391,7 +411,7 @@ } if (this.worldServer != null) { -@@ -398,8 +575,10 @@ +@@ -436,8 +614,10 @@ int j; WorldServer worldserver; @@ -404,7 +424,7 @@ if (worldserver != null) { worldserver.savingDisabled = false; } -@@ -409,8 +588,10 @@ +@@ -447,8 +627,10 @@ aworldserver = this.worldServer; i = aworldserver.length; @@ -417,7 +437,7 @@ if (worldserver != null) { worldserver.close(); } -@@ -453,11 +634,13 @@ +@@ -491,11 +673,13 @@ if (i > 2000L && this.aa - this.Q >= 15000L) { long j = i / 50L; @@ -431,7 +451,7 @@ this.v(); this.aa += 50L; -@@ -496,6 +679,12 @@ +@@ -534,6 +718,12 @@ } catch (Throwable throwable1) { MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); } finally { @@ -444,7 +464,7 @@ this.u(); } -@@ -564,7 +753,7 @@ +@@ -602,7 +792,7 @@ this.n.b().a(agameprofile); } @@ -453,7 +473,7 @@ this.methodProfiler.a("save"); this.s.savePlayers(); this.saveChunks(true); -@@ -590,6 +779,7 @@ +@@ -628,6 +818,7 @@ } public void w() { @@ -461,8 +481,8 @@ this.methodProfiler.a("jobs"); FutureTask futuretask; -@@ -602,22 +792,40 @@ - this.aD().X_(); +@@ -640,22 +831,40 @@ + this.getFunctionData().Y_(); this.methodProfiler.c("levels"); + // CraftBukkit start @@ -505,7 +525,7 @@ this.methodProfiler.a("tick"); -@@ -646,7 +854,7 @@ +@@ -684,7 +893,7 @@ this.methodProfiler.e(); } @@ -514,7 +534,7 @@ } this.methodProfiler.c("connection"); -@@ -670,10 +878,11 @@ +@@ -708,10 +917,11 @@ this.l.add(itickable); } @@ -527,7 +547,7 @@ boolean flag = true; String s = null; String s1 = "."; -@@ -718,13 +927,16 @@ +@@ -759,13 +969,16 @@ ++j; } } @@ -545,7 +565,7 @@ if (s != null) { dedicatedserver.h(s); } -@@ -758,6 +970,25 @@ +@@ -803,6 +1016,29 @@ thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER)); Runtime.getRuntime().addShutdownHook(thread); @@ -566,12 +586,16 @@ + dedicatedserver.setWorld((String) options.valueOf("world")); + } + ++ if (options.has("forceUpgrade")) { ++ dedicatedserver.setForceUpgrade(true); ++ } ++ + dedicatedserver.primaryThread.start(); + // CraftBukkit end } catch (Exception exception) { MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); } -@@ -765,11 +996,13 @@ +@@ -814,11 +1050,13 @@ } public void y() { @@ -585,7 +609,7 @@ } public File c(String s) { -@@ -785,11 +1018,18 @@ +@@ -834,11 +1072,18 @@ } public WorldServer getWorldServer(int i) { @@ -606,7 +630,7 @@ } public String getVersion() { -@@ -809,7 +1049,7 @@ +@@ -858,7 +1103,7 @@ } public boolean isDebugging() { @@ -615,7 +639,7 @@ } public void f(String s) { -@@ -824,7 +1064,7 @@ +@@ -873,7 +1118,7 @@ } public String getServerModName() { @@ -624,7 +648,7 @@ } public CrashReport b(CrashReport crashreport) { -@@ -860,7 +1100,7 @@ +@@ -909,7 +1154,7 @@ } public boolean F() { @@ -633,7 +657,7 @@ } public void sendMessage(IChatBaseComponent ichatbasecomponent) { -@@ -904,11 +1144,13 @@ +@@ -953,11 +1198,13 @@ } public void a(EnumDifficulty enumdifficulty) { @@ -650,7 +674,7 @@ if (worldserver != null) { if (worldserver.getWorldData().isHardcore()) { -@@ -975,13 +1217,11 @@ +@@ -1024,13 +1271,11 @@ int i = 0; if (this.worldServer != null) { @@ -668,7 +692,7 @@ WorldData worlddata = worldserver.getWorldData(); mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimensionManager().getDimensionID())); -@@ -1007,7 +1247,7 @@ +@@ -1056,7 +1301,7 @@ public abstract boolean S(); public boolean getOnlineMode() { @@ -677,7 +701,7 @@ } public void setOnlineMode(boolean flag) { -@@ -1089,13 +1329,9 @@ +@@ -1138,13 +1383,9 @@ public abstract boolean af(); public void setGamemode(EnumGamemode enumgamemode) { @@ -694,7 +718,7 @@ } } -@@ -1168,7 +1404,7 @@ +@@ -1217,7 +1458,7 @@ public <V> ListenableFuture<V> a(Callable<V> callable) { Validate.notNull(callable); @@ -703,7 +727,7 @@ ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable); this.g.add(listenablefuturetask); -@@ -1225,7 +1461,7 @@ +@@ -1274,7 +1515,7 @@ } else { this.getPlayerList().savePlayers(); this.resourcePackRepository.a(); @@ -712,7 +736,7 @@ this.getPlayerList().reload(); } } -@@ -1239,8 +1475,8 @@ +@@ -1288,8 +1529,8 @@ if (!worlddata.N().contains(resourcepackloader.e()) && !arraylist.contains(resourcepackloader)) { MinecraftServer.LOGGER.info("Found new data pack {}, loading it automatically", resourcepackloader.e()); @@ -723,7 +747,7 @@ }, false); } } -@@ -1249,7 +1485,7 @@ +@@ -1298,7 +1539,7 @@ ArrayList arraylist1 = Lists.newArrayList(); this.resourcePackRepository.d().forEach((resourcepackloader) -> { @@ -732,7 +756,7 @@ }); this.ac.a((List) arraylist1); worlddata.O().clear(); -@@ -1299,7 +1535,7 @@ +@@ -1348,7 +1589,7 @@ } public CommandListenerWrapper getServerCommandListener() { @@ -741,7 +765,7 @@ } public boolean a() { -@@ -1327,7 +1563,7 @@ +@@ -1376,7 +1617,7 @@ } public GameRules aQ() { @@ -750,9 +774,9 @@ } public BossBattleCustomData aR() { -@@ -1341,4 +1577,11 @@ - public void k(boolean flag) { - this.an = flag; +@@ -1400,4 +1641,11 @@ + return 0; + } } + + // CraftBukkit start diff --git a/nms-patches/MobEffectList.patch b/nms-patches/MobEffectList.patch index 22ff3c21..2d7984c9 100644 --- a/nms-patches/MobEffectList.patch +++ b/nms-patches/MobEffectList.patch @@ -53,8 +53,8 @@ + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel)); + // CraftBukkit end } - } else if ((this != MobEffects.HEAL || entityliving.co()) && (this != MobEffects.HARM || !entityliving.co())) { - if (this == MobEffects.HARM && !entityliving.co() || this == MobEffects.HEAL && entityliving.co()) { + } else if ((this != MobEffects.HEAL || entityliving.cp()) && (this != MobEffects.HARM || !entityliving.cp())) { + if (this == MobEffects.HARM && !entityliving.cp() || this == MobEffects.HEAL && entityliving.cp()) { entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i)); } } else { diff --git a/nms-patches/PathfinderGoalFollowOwner.patch b/nms-patches/PathfinderGoalFollowOwner.patch index df21289c..0abaf53d 100644 --- a/nms-patches/PathfinderGoalFollowOwner.patch +++ b/nms-patches/PathfinderGoalFollowOwner.patch @@ -29,6 +29,6 @@ + + this.b.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch()); + // CraftBukkit end - this.e.r(); + this.e.q(); return; } diff --git a/nms-patches/PathfinderGoalHorseTrap.patch b/nms-patches/PathfinderGoalHorseTrap.patch index 47730fe0..ae35ba73 100644 --- a/nms-patches/PathfinderGoalHorseTrap.patch +++ b/nms-patches/PathfinderGoalHorseTrap.patch @@ -18,7 +18,7 @@ } @@ -42,7 +43,7 @@ - entityhorseskeleton.di(); + entityhorseskeleton.dj(); entityhorseskeleton.setTamed(true); entityhorseskeleton.setAgeRaw(0); - entityhorseskeleton.world.addEntity(entityhorseskeleton); diff --git a/nms-patches/PathfinderGoalHurtByTarget.patch b/nms-patches/PathfinderGoalHurtByTarget.patch index 37d9cc80..1e4a1a13 100644 --- a/nms-patches/PathfinderGoalHurtByTarget.patch +++ b/nms-patches/PathfinderGoalHurtByTarget.patch @@ -7,7 +7,7 @@ - this.e.setGoalTarget(this.e.getLastDamager()); + this.e.setGoalTarget(this.e.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason this.g = this.e.getGoalTarget(); - this.b = this.e.cf(); + this.b = this.e.cg(); this.h = 300; @@ -66,6 +66,6 @@ } diff --git a/nms-patches/PathfinderGoalPanic.patch b/nms-patches/PathfinderGoalPanic.patch index f7030cd7..0d5ec285 100644 --- a/nms-patches/PathfinderGoalPanic.patch +++ b/nms-patches/PathfinderGoalPanic.patch @@ -10,6 +10,6 @@ + return false; + } + // CraftBukkit end - return !this.a.getNavigation().q(); + return !this.a.getNavigation().p(); } diff --git a/nms-patches/PathfinderGoalVillagerFarm.patch b/nms-patches/PathfinderGoalVillagerFarm.patch index 19116f1a..0a27e7e8 100644 --- a/nms-patches/PathfinderGoalVillagerFarm.patch +++ b/nms-patches/PathfinderGoalVillagerFarm.patch @@ -11,7 +11,7 @@ + } + // CraftBukkit end } else if (this.i == 1 && iblockdata.isAir()) { - InventorySubcontainer inventorysubcontainer = this.f.dD(); + InventorySubcontainer inventorysubcontainer = this.f.dE(); @@ -49,19 +53,28 @@ boolean flag = false; diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 4a550027..72d9f7d5 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -95,7 +95,7 @@ } + // CraftBukkit end - public void X_() { + public void Y_() { this.syncPosition(); @@ -103,7 +176,7 @@ this.minecraftServer.methodProfiler.a("keepAlive"); @@ -389,8 +389,8 @@ + speed = player.abilities.walkSpeed * 10f; + } + - if (!this.player.H() && (!this.player.getWorldServer().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.db())) { - float f2 = this.player.db() ? 300.0F : 100.0F; + if (!this.player.H() && (!this.player.getWorldServer().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.dc())) { + float f2 = this.player.dc() ? 300.0F : 100.0F; - if (d11 - d10 > (double) (f2 * (float) i) && (!this.minecraftServer.J() || !this.minecraftServer.I().equals(this.player.getProfile().getName()))) { + if (d11 - d10 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && (!this.minecraftServer.J() || !this.minecraftServer.I().equals(this.player.getProfile().getName()))) { @@ -467,7 +467,7 @@ + this.B = d12 >= -0.03125D; this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly; - this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.db() && !worldserver.a(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); + 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)); @@ -662,10 +959,76 @@ } diff --git a/nms-patches/PlayerInteractManager.patch b/nms-patches/PlayerInteractManager.patch index eccbf574..cfc3a711 100644 --- a/nms-patches/PlayerInteractManager.patch +++ b/nms-patches/PlayerInteractManager.patch @@ -159,7 +159,7 @@ + if (nmsBlock != null && !event.isCancelled() && !this.isCreative() && this.player.hasBlock(nmsBlock.getBlockData())) { + // Copied from block.a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, ItemStack itemstack) + // PAIL: checkme each update -+ if (!(nmsBlock.k() && EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) > 0)) { ++ if (!(nmsBlock.X_() && EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) > 0)) { + int bonusLevel = EnchantmentManager.getEnchantmentLevel(Enchantments.LOOT_BONUS_BLOCKS, itemstack); + + event.setExpToDrop(nmsBlock.getExpDrop(nmsData, this.world, blockposition, bonusLevel)); @@ -261,7 +261,7 @@ + public boolean firedInteract = false; public EnumInteractionResult a(EntityHuman entityhuman, World world, ItemStack itemstack, EnumHand enumhand, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { IBlockData iblockdata = world.getType(blockposition); -+ EnumInteractionResult enuminteractionresult = EnumInteractionResult.FAIL; ++ EnumInteractionResult enuminteractionresult = EnumInteractionResult.PASS; + if (iblockdata.isAir()) return enuminteractionresult; + boolean cancelledBlock = false; @@ -293,22 +293,18 @@ if (tileentity instanceof ITileInventory) { Block block = iblockdata.getBlock(); -@@ -304,26 +486,26 @@ - } else { - boolean flag = entityhuman.getItemInMainHand().isEmpty(); +@@ -305,24 +487,26 @@ + boolean flag = !entityhuman.getItemInMainHand().isEmpty() || !entityhuman.getItemInOffHand().isEmpty(); + boolean flag1 = entityhuman.isSneaking() && flag; -- if ((!entityhuman.isSneaking() || flag && entityhuman.getItemInOffHand().isEmpty()) && iblockdata.interact(world, blockposition, entityhuman, enumhand, enumdirection, f, f1, f2)) { +- if (!flag1 && iblockdata.interact(world, blockposition, entityhuman, enumhand, enumdirection, f, f1, f2)) { - return EnumInteractionResult.SUCCESS; -- } else if (flag) { -- return EnumInteractionResult.PASS; -- } else if (entityhuman.getCooldownTracker().a(itemstack.getItem())) { -- return EnumInteractionResult.PASS; -- } else { -+ if ((!entityhuman.isSneaking() || flag && entityhuman.getItemInOffHand().isEmpty())) { +- } else if (!itemstack.isEmpty() && !entityhuman.getCooldownTracker().a(itemstack.getItem())) { ++ if (!flag1) { + enuminteractionresult = iblockdata.interact(world, blockposition, entityhuman, enumhand, enumdirection, f, f1, f2) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.FAIL; + } + -+ if (!itemstack.isEmpty() && !flag && enuminteractionresult != EnumInteractionResult.SUCCESS && !interactResult) { // add !interactResult SPIGOT-764 // MC-133478 - add isEmpty ++ if (!itemstack.isEmpty() && enuminteractionresult != EnumInteractionResult.SUCCESS && !interactResult) { // add !interactResult SPIGOT-764 ItemActionContext itemactioncontext = new ItemActionContext(entityhuman, entityhuman.b(enumhand), blockposition, enumdirection, f, f1, f2); if (this.isCreative()) { @@ -322,6 +318,8 @@ - return itemstack.placeItem(itemactioncontext); + return itemstack.placeItem(itemactioncontext, enumhand); } +- } else { +- return EnumInteractionResult.PASS; } } + return enuminteractionresult; diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index 29ed2522..89e070cf 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -619,17 +619,8 @@ + public void f(EntityPlayer entityplayer) { GameProfile gameprofile = entityplayer.getProfile(); - int i = this.isOp(gameprofile) ? this.operators.a(gameprofile) : 0; -@@ -470,7 +771,7 @@ - boolean flag1 = flag && this.server.I().equalsIgnoreCase(entityplayer.getProfile().getName()); - int j = flag1 ? 4 : 2; - -- i = flag && this.server.worldServer[0].getWorldData().u() ? j : i; -+ i = flag && this.server.worlds.get(0).getWorldData().u() ? j : i; // CraftBukkit - i = this.u ? j : i; - this.b(entityplayer, i); - } -@@ -504,12 +805,111 @@ + int i = this.server.a(gameprofile); +@@ -499,12 +800,111 @@ } public void changeWorld(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) { @@ -741,7 +732,7 @@ if (entity.dimension == -1) { d0 = MathHelper.a(d0 / 8.0D, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D); d1 = MathHelper.a(d1 / 8.0D, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D); -@@ -528,6 +928,8 @@ +@@ -523,6 +923,8 @@ BlockPosition blockposition; if (i == 1) { @@ -750,7 +741,7 @@ blockposition = worldserver1.getSpawn(); } else { blockposition = worldserver1.getDimensionSpawn(); -@@ -541,16 +943,27 @@ +@@ -536,16 +938,27 @@ worldserver.entityJoinedWorld(entity, false); } } @@ -781,7 +772,7 @@ worldserver1.entityJoinedWorld(entity, false); } -@@ -558,11 +971,23 @@ +@@ -553,11 +966,23 @@ } entity.spawnIn(worldserver1); @@ -806,7 +797,7 @@ this.v = 0; } -@@ -575,6 +1000,25 @@ +@@ -570,6 +995,25 @@ } @@ -832,7 +823,7 @@ public void a(Packet<?> packet, int i) { for (int j = 0; j < this.players.size(); ++j) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(j); -@@ -677,6 +1121,7 @@ +@@ -670,6 +1114,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0)); } @@ -840,7 +831,7 @@ this.server.getCommandDispatcher().a(entityplayer); } -@@ -685,7 +1130,7 @@ +@@ -678,7 +1123,7 @@ } public boolean isOp(GameProfile gameprofile) { @@ -849,7 +840,7 @@ } @Nullable -@@ -709,6 +1154,12 @@ +@@ -702,6 +1147,12 @@ for (int j = 0; j < this.players.size(); ++j) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(j); @@ -862,7 +853,7 @@ if (entityplayer != entityhuman && entityplayer.dimension == i) { double d4 = d0 - entityplayer.locX; double d5 = d1 - entityplayer.locY; -@@ -748,7 +1199,7 @@ +@@ -741,7 +1192,7 @@ public void reloadWhitelist() {} public void b(EntityPlayer entityplayer, WorldServer worldserver) { @@ -871,7 +862,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE)); entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))); -@@ -756,16 +1207,21 @@ +@@ -749,16 +1200,21 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition)); if (worldserver.isRaining()) { @@ -897,7 +888,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); } -@@ -778,7 +1234,7 @@ +@@ -771,7 +1227,7 @@ } public String[] getSeenPlayers() { @@ -906,7 +897,7 @@ } public boolean getHasWhitelist() { -@@ -827,26 +1283,39 @@ +@@ -820,26 +1276,39 @@ } public void u() { @@ -951,7 +942,7 @@ if (serverstatisticmanager == null) { File file = new File(this.server.a(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "stats"); -@@ -861,7 +1330,7 @@ +@@ -854,7 +1323,7 @@ } serverstatisticmanager = new ServerStatisticManager(this.server, file1); @@ -960,7 +951,7 @@ } return serverstatisticmanager; -@@ -869,14 +1338,14 @@ +@@ -862,14 +1331,14 @@ public AdvancementDataPlayer h(EntityPlayer entityplayer) { UUID uuid = entityplayer.getUniqueID(); @@ -977,7 +968,7 @@ } advancementdataplayer.a(entityplayer); -@@ -889,8 +1358,10 @@ +@@ -882,8 +1351,10 @@ WorldServer[] aworldserver = this.server.worldServer; int j = aworldserver.length; @@ -990,7 +981,7 @@ if (worldserver != null) { worldserver.getPlayerChunkMap().a(i); -@@ -915,13 +1386,20 @@ +@@ -908,13 +1379,20 @@ } public void reload() { diff --git a/nms-patches/RegionFileCache.patch b/nms-patches/RegionFileCache.patch index c91a0f60..8628214f 100644 --- a/nms-patches/RegionFileCache.patch +++ b/nms-patches/RegionFileCache.patch @@ -4,9 +4,9 @@ } @Nullable -- public static DataInputStream d(File file, int i, int j) { +- public static DataInputStream read(File file, int i, int j) { + // CraftBukkit start - call sites hoisted for synchronization -+ public static synchronized NBTTagCompound d(File file, int i, int j) throws IOException { ++ public static synchronized NBTTagCompound read(File file, int i, int j) throws IOException { RegionFile regionfile = a(file, i, j); - return regionfile.a(i & 31, j & 31); @@ -20,12 +20,12 @@ } @Nullable -- public static DataOutputStream e(File file, int i, int j) { -+ public static synchronized void e(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException { +- public static DataOutputStream write(File file, int i, int j) { ++ public static synchronized void write(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException { RegionFile regionfile = a(file, i, j); -- return regionfile.b(i & 31, j & 31); -+ DataOutputStream dataoutputstream = regionfile.b(i & 31, j & 31); +- return regionfile.c(i & 31, j & 31); ++ DataOutputStream dataoutputstream = regionfile.c(i & 31, j & 31); + NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream); + dataoutputstream.close(); } diff --git a/nms-patches/TileEntityChest.patch b/nms-patches/TileEntityChest.patch index 80ec4086..44cba102 100644 --- a/nms-patches/TileEntityChest.patch +++ b/nms-patches/TileEntityChest.patch @@ -51,7 +51,7 @@ + return maxStack; // CraftBukkit } - public void X_() { + public void Y_() { @@ -170,8 +199,20 @@ if (this.f < 0) { this.f = 0; diff --git a/nms-patches/TileEntityFurnace.patch b/nms-patches/TileEntityFurnace.patch index e5861798..3597409b 100644 --- a/nms-patches/TileEntityFurnace.patch +++ b/nms-patches/TileEntityFurnace.patch @@ -16,7 +16,7 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeHolder, AutoRecipeOutput, ITickable { -@@ -98,6 +107,32 @@ +@@ -93,6 +102,32 @@ return linkedhashmap; } @@ -49,10 +49,10 @@ public TileEntityFurnace() { super(TileEntityTypes.b); this.items = NonNullList.a(3, ItemStack.a); -@@ -225,11 +260,30 @@ +@@ -220,11 +255,30 @@ } - public void X_() { + public void Y_() { - boolean flag = this.isBurning(); + boolean flag = this.getBlock().get(BlockFurnace.LIT); // CraftBukkit - SPIGOT-844 - Check if furnace block is lit using the block instead of burn time boolean flag1 = false; @@ -82,7 +82,7 @@ } if (!this.world.isClientSide) { -@@ -240,12 +294,21 @@ +@@ -235,12 +289,21 @@ this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.cookTimeTotal); } } else { @@ -109,7 +109,7 @@ flag1 = true; if (!itemstack.isEmpty()) { Item item = itemstack.getItem(); -@@ -260,6 +323,7 @@ +@@ -255,6 +318,7 @@ } } @@ -117,7 +117,7 @@ if (this.isBurning() && this.canBurn(irecipe)) { ++this.cookTime; if (this.cookTime == this.cookTimeTotal) { -@@ -271,11 +335,13 @@ +@@ -266,11 +330,13 @@ } else { this.cookTime = 0; } @@ -131,7 +131,7 @@ } } -@@ -300,7 +366,8 @@ +@@ -295,7 +361,8 @@ } else { ItemStack itemstack1 = (ItemStack) this.items.get(2); @@ -141,7 +141,7 @@ } } else { return false; -@@ -313,11 +380,38 @@ +@@ -308,11 +375,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 467d842d..6e4514bd 100644 --- a/nms-patches/TileEntityHopper.patch +++ b/nms-patches/TileEntityHopper.patch @@ -55,7 +55,7 @@ + return maxStack; // CraftBukkit } - public void X_() { + public void Y_() { @@ -165,10 +199,35 @@ for (int i = 0; i < this.getSize(); ++i) { if (!this.getItem(i).isEmpty()) { diff --git a/nms-patches/World.patch b/nms-patches/World.patch index 93eaaad1..0ec40741 100644 --- a/nms-patches/World.patch +++ b/nms-patches/World.patch @@ -441,15 +441,15 @@ entity.N = entity.locX; entity.O = entity.locY; -@@ -967,6 +1220,7 @@ - entity.aH(); - } else { +@@ -970,6 +1223,7 @@ + return ((MinecraftKey) EntityTypes.REGISTRY.b(entity.P())).toString(); + }); entity.tick(); + entity.postTick(); // CraftBukkit + this.methodProfiler.e(); } } - -@@ -1296,11 +1550,18 @@ +@@ -1300,11 +1554,18 @@ } } @@ -468,7 +468,7 @@ TileEntity tileentity = null; if (this.J) { -@@ -1335,6 +1596,14 @@ +@@ -1339,6 +1600,14 @@ public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) { if (!k(blockposition)) { if (tileentity != null && !tileentity.x()) { @@ -483,7 +483,7 @@ if (this.J) { tileentity.setPosition(blockposition); Iterator iterator = this.c.iterator(); -@@ -1494,6 +1763,14 @@ +@@ -1498,6 +1767,14 @@ } this.p = MathHelper.a(this.p, 0.0F, 1.0F); @@ -498,7 +498,7 @@ } } } -@@ -1579,7 +1856,10 @@ +@@ -1583,7 +1860,10 @@ } public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { @@ -510,7 +510,7 @@ return false; } else { int i = 0; -@@ -1750,7 +2030,7 @@ +@@ -1754,7 +2034,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -519,7 +519,7 @@ arraylist.add(entity); } } -@@ -1765,7 +2045,7 @@ +@@ -1769,7 +2049,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -528,7 +528,7 @@ arraylist.add(entity); } } -@@ -1814,7 +2094,7 @@ +@@ -1818,7 +2098,7 @@ } } @@ -537,7 +537,7 @@ } @Nullable -@@ -1835,8 +2115,17 @@ +@@ -1839,8 +2119,17 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -556,7 +556,7 @@ ++i; } } -@@ -1845,12 +2134,18 @@ +@@ -1849,12 +2138,18 @@ } public void a(Collection<Entity> collection) { @@ -576,7 +576,7 @@ this.b(entity); } -@@ -1954,6 +2249,11 @@ +@@ -1958,6 +2253,11 @@ for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); @@ -588,7 +588,7 @@ if (predicate.test(entityhuman1)) { double d5 = entityhuman1.d(d0, d1, d2); -@@ -2122,6 +2422,16 @@ +@@ -2126,6 +2426,16 @@ public void everyoneSleeping() {} @@ -605,7 +605,7 @@ public float g(float f) { return (this.q + (this.r - this.q) * f) * this.i(f); } -@@ -2296,7 +2606,7 @@ +@@ -2300,7 +2610,7 @@ int l = j * 16 + 8 - blockposition.getZ(); boolean flag = true; diff --git a/nms-patches/WorldData.patch b/nms-patches/WorldData.patch index 568e11a8..e8480760 100644 --- a/nms-patches/WorldData.patch +++ b/nms-patches/WorldData.patch @@ -12,23 +12,23 @@ public class WorldData { -@@ -62,6 +67,7 @@ - private final Map<DimensionManager, NBTTagCompound> S; - private NBTTagCompound T; - private final GameRules U; +@@ -64,6 +69,7 @@ + private final Map<DimensionManager, NBTTagCompound> T; + private NBTTagCompound U; + private final GameRules V; + public WorldServer world; // CraftBukkit protected WorldData() { this.f = WorldType.NORMAL; -@@ -296,6 +302,7 @@ - nbttagcompound2.setBoolean("Snapshot", true); +@@ -304,6 +310,7 @@ + nbttagcompound2.setBoolean("Snapshot", false); nbttagcompound.set("Version", nbttagcompound2); - nbttagcompound.setInt("DataVersion", 1513); -+ if (org.bukkit.craftbukkit.util.CraftMagicNumbers.DATA_VERSION != 1513) throw new AssertionError(); // CraftBukkit - sentinel + nbttagcompound.setInt("DataVersion", 1519); ++ if (org.bukkit.craftbukkit.util.CraftMagicNumbers.DATA_VERSION != 1519) throw new AssertionError(); // CraftBukkit - sentinel nbttagcompound.setLong("RandomSeed", this.e); - nbttagcompound.setString("generatorName", this.f.name()); + nbttagcompound.setString("generatorName", this.f.b()); nbttagcompound.setInt("generatorVersion", this.f.getVersion()); -@@ -466,6 +473,16 @@ +@@ -478,6 +485,16 @@ } public void setThundering(boolean flag) { @@ -42,10 +42,10 @@ + } + } + // CraftBukkit end - this.y = flag; + this.z = flag; } -@@ -482,6 +499,16 @@ +@@ -494,6 +511,16 @@ } public void setStorm(boolean flag) { @@ -59,13 +59,13 @@ + } + } + // CraftBukkit end - this.w = flag; + this.x = flag; } -@@ -631,6 +658,12 @@ +@@ -643,6 +670,12 @@ public void setDifficulty(EnumDifficulty enumdifficulty) { - this.F = enumdifficulty; + this.G = enumdifficulty; + // CraftBukkit start + PacketPlayOutServerDifficulty packet = new PacketPlayOutServerDifficulty(this.getDifficulty(), this.isDifficultyLocked()); + for (EntityPlayer player : (java.util.List<EntityPlayer>) (java.util.List) world.players) { @@ -75,9 +75,9 @@ } public boolean isDifficultyLocked() { -@@ -712,4 +745,12 @@ +@@ -724,4 +757,12 @@ public void c(@Nullable NBTTagCompound nbttagcompound) { - this.T = nbttagcompound; + this.U = nbttagcompound; } + + // CraftBukkit start - Check if the name stored in NBT is the correct one diff --git a/nms-patches/WorldGenVillagePieces.patch b/nms-patches/WorldGenVillagePieces.patch index e55f15ce..8609a458 100644 --- a/nms-patches/WorldGenVillagePieces.patch +++ b/nms-patches/WorldGenVillagePieces.patch @@ -3,7 +3,7 @@ @@ -1662,14 +1662,14 @@ entityzombievillager.prepare(generatoraccess.getDamageScaler(new BlockPosition(entityzombievillager)), (GroupDataEntity) null, (NBTTagCompound) null); entityzombievillager.setProfession(this.c(i1, 0)); - entityzombievillager.di(); + entityzombievillager.dj(); - generatoraccess.addEntity(entityzombievillager); + generatoraccess.addEntity(entityzombievillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason } else { diff --git a/nms-patches/WorldGenWitchHut.patch b/nms-patches/WorldGenWitchHut.patch index 70c91680..8d43bbea 100644 --- a/nms-patches/WorldGenWitchHut.patch +++ b/nms-patches/WorldGenWitchHut.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/WorldGenWitchHut.java +++ b/net/minecraft/server/WorldGenWitchHut.java @@ -86,7 +86,7 @@ - entitywitch.di(); + entitywitch.dj(); entitywitch.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, 0.0F, 0.0F); entitywitch.prepare(generatoraccess.getDamageScaler(new BlockPosition(i, j, k)), (GroupDataEntity) null, (NBTTagCompound) null); - generatoraccess.addEntity(entitywitch); |