diff --git a/.gitignore b/.gitignore index 9712169ad..3ef869c1a 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ work/Spigot-Server work/Spigot-API work/*.jar work/test-server +work/ForgeFlower # Mac filesystem dust .DS_Store/ diff --git a/Spigot-Server-Patches/0003-MC-Dev-fixes.patch b/Spigot-Server-Patches/0003-MC-Dev-fixes.patch index 89f475df5..b7469c2a3 100644 --- a/Spigot-Server-Patches/0003-MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/0003-MC-Dev-fixes.patch @@ -1,351 +1,321 @@ -From 35b1f286830c7abfb00224e808b8b2cab705bf56 Mon Sep 17 00:00:00 2001 +From a745d7718cedae36f6ec9cd4222da6e69e754ae1 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 30 Mar 2016 19:36:20 -0400 Subject: [PATCH] MC Dev fixes diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index c3e990bdff..e2a7b4be2c 100644 +index a553fb7476..4048937c63 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -93,7 +93,7 @@ public class BaseBlockPosition implements Comparable { - return MoreObjects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString(); +@@ -99,7 +99,7 @@ public class BaseBlockPosition implements Comparable { } + // $FF: synthetic method - public int compareTo(Object object) { + public int compareTo(BaseBlockPosition object) { // Paper - decompile fix - return this.l((BaseBlockPosition) object); + return this.l((BaseBlockPosition)object); } } diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 002da2a191..9f3aa24590 100644 +index 7f8802b2ef..6ffc535146 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -150,7 +150,7 @@ public class BlockPosition extends BaseBlockPosition { - return a(Math.min(blockposition.getX(), blockposition1.getX()), Math.min(blockposition.getY(), blockposition1.getY()), Math.min(blockposition.getZ(), blockposition1.getZ()), Math.max(blockposition.getX(), blockposition1.getX()), Math.max(blockposition.getY(), blockposition1.getY()), Math.max(blockposition.getZ(), blockposition1.getZ())); - } +@@ -179,7 +179,7 @@ public class BlockPosition extends BaseBlockPosition { + } -- public static Iterable a(int i, int j, int k, int l, int i1, int j1) { -+ public static Iterable a(int x0, int y0, int z0, int l, int i1, int j1) { - return () -> { - return new AbstractIterator() { - private boolean g = true; -@@ -161,21 +161,21 @@ public class BlockPosition extends BaseBlockPosition { - protected BlockPosition a() { - if (this.g) { - this.g = false; -- this.h = i; -- this.i = j; -- this.j = k; -- return new BlockPosition(i, j, k); -+ this.h = x0; -+ this.i = y0; -+ this.j = z0; -+ return new BlockPosition(x0, y0, z0); - } else if (this.h == l && this.i == i1 && this.j == j1) { - return (BlockPosition) this.endOfData(); - } else { - if (this.h < l) { - ++this.h; - } else if (this.i < i1) { -- this.h = i; -+ this.h = x0; - ++this.i; - } else if (this.j < j1) { -- this.h = i; -- this.i = j; -+ this.h = x0; -+ this.i = y0; - ++this.j; - } - -@@ -213,8 +213,11 @@ public class BlockPosition extends BaseBlockPosition { + // $FF: synthetic method +- protected Object computeNext() { ++ protected BlockPosition computeNext() { // Paper - decompile fix + return this.a(); + } + }; +@@ -209,8 +209,11 @@ public class BlockPosition extends BaseBlockPosition { if (this.g.b < l) { ++this.g.b; } else if (this.g.c < i1) { -+ this.g.b = i; // Paper - Readd line removed by the decompiler ++ this.g.b = ix; // Paper - decompile fix Readd line removed by the decompiler ++this.g.c; } else if (this.g.d < j1) { -+ this.g.b = i; // Paper - Readd line removed by the decompiler -+ this.g.c = j; // Paper - Readd line removed by the decompiler ++ this.g.b = ix; // Paper - decompile fix Readd line removed by the decompiler ++ this.g.c = jx; // Paper - decompile fix Readd line removed by the decompiler ++this.g.d; } -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 650ef14758..35aea4829f 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -15,7 +15,7 @@ public class ChunkSection { +@@ -219,7 +222,7 @@ public class BlockPosition extends BaseBlockPosition { + } - public ChunkSection(int i, boolean flag) { - this.yPos = i; -- this.blockIds = new DataPaletteBlock(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); -+ this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // Paper - Decompile error - this.emittedLight = new NibbleArray(); - if (flag) { - this.skyLight = new NibbleArray(); + // $FF: synthetic method +- protected Object computeNext() { ++ protected BlockPosition.MutableBlockPosition computeNext() { // Paper - decompile fix + return this.a(); + } + }; diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 20b1bc1b48..030ec87047 100644 +index 3bd0c56d46..304e47bf20 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -75,14 +75,14 @@ public class DataPaletteBlock implements DataPaletteExpandable { - public int onResize(int i, T t0) { +@@ -72,11 +72,11 @@ public class DataPaletteBlock implements DataPaletteExpandable { + public int onResize(int ix, T object) { this.b(); DataBits databits = this.a; - DataPalette datapalette = this.h; + DataPalette datapalette = this.h; // Paper - decompile fix + this.b(ix); - this.b(i); - - int j; - - for (j = 0; j < databits.b(); ++j) { -- Object object = datapalette.a(databits.a(j)); -+ T object = datapalette.a(databits.a(j)); // Paper - decompile fix - - if (object != null) { - this.setBlockIndex(j, object); -@@ -111,7 +111,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { + for(int jx = 0; jx < databits.b(); ++jx) { +- Object object1 = datapalette.a(databits.a(jx)); ++ T object1 = datapalette.a(databits.a(jx)); // Paper - decompile fix + if (object1 != null) { + this.setBlockIndex(jx, object1); + } +@@ -103,7 +103,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { } - protected T a(int i) { -- Object object = this.h.a(this.a.a(i)); -+ T object = this.h.a(this.a.a(i)); // Paper - decompile fix - - return object == null ? this.g : object; + protected T a(int ix) { +- Object object = this.h.a(this.a.a(ix)); ++ T object = this.h.a(this.a.a(ix)); // Paper - decompile fix + return (T)(object == null ? this.g : object); } -@@ -138,7 +138,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { - int j = along.length * 64 / 4096; +@@ -127,7 +127,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { + long[] along = nbttagcompound.o(s1); + int jx = along.length * 64 / 4096; if (this.h == this.b) { -- DataPaletteHash datapalettehash = new DataPaletteHash(this.d, i, this.c, this.e, this.f); -+ DataPaletteHash datapalettehash = new DataPaletteHash<>(this.d, i, this.c, this.e, this.f); // Paper - decompile fix - +- DataPaletteHash datapalettehash = new DataPaletteHash(this.d, ix, this.c, this.e, this.f); ++ DataPaletteHash datapalettehash = new DataPaletteHash(this.d, ix, this.c, this.e, this.f); // Paper - decompile fix datapalettehash.a(nbttaglist); - DataBits databits = new DataBits(i, 4096, along); + DataBits databits = new DataBits(ix, 4096, along); + diff --git a/src/main/java/net/minecraft/server/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/DedicatedPlayerList.java -index 1b91759cb2..ba1e38f8e0 100644 +index 5eded6dc20..11f9642e6e 100644 --- a/src/main/java/net/minecraft/server/DedicatedPlayerList.java +++ b/src/main/java/net/minecraft/server/DedicatedPlayerList.java -@@ -135,8 +135,4 @@ public class DedicatedPlayerList extends PlayerList { - public boolean f(GameProfile gameprofile) { - return this.getOPs().b(gameprofile); +@@ -136,7 +136,7 @@ public class DedicatedPlayerList extends PlayerList { } -- + + // $FF: synthetic method - public MinecraftServer getServer() { -- return this.getServer(); -- } ++ public MinecraftServer getMinecraftServer() { // Paper - decompile fix + return this.getServer(); + } } diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java -index cd883e8529..bb1d00e440 100644 +index 4dd4b01c82..987d944dbd 100644 --- a/src/main/java/net/minecraft/server/DefinedStructure.java +++ b/src/main/java/net/minecraft/server/DefinedStructure.java -@@ -88,7 +88,7 @@ public class DefinedStructure { +@@ -77,7 +77,7 @@ public class DefinedStructure { } private void a(World world, BlockPosition blockposition, BlockPosition blockposition1) { -- List list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1), (entity) -> { -+ List list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1),(Predicate) (entity) -> { // Paper - decompile fix - return !(entity instanceof EntityHuman); +- List list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1), (entity1) -> { ++ List list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1),(java.util.function.Predicate) (entity1) -> { // Paper - decompile fix + return !(entity1 instanceof EntityHuman); }); + this.b.clear(); +@@ -145,12 +145,12 @@ public class DefinedStructure { + if (this.a.isEmpty()) { + return false; + } else { +- List list = definedstructureinfo.a(this.a, blockposition); ++ List list = definedstructureinfo.a(this.a, blockposition); // Paper - decompile fix + if ((!list.isEmpty() || !definedstructureinfo.h() && !this.b.isEmpty()) && this.c.getX() >= 1 && this.c.getY() >= 1 && this.c.getZ() >= 1) { + Block block = definedstructureinfo.i(); + StructureBoundingBox structureboundingbox = definedstructureinfo.j(); +- ArrayList arraylist = Lists.newArrayListWithCapacity(definedstructureinfo.m() ? list.size() : 0); +- ArrayList arraylist1 = Lists.newArrayListWithCapacity(list.size()); ++ ArrayList arraylist = Lists.newArrayListWithCapacity(definedstructureinfo.m() ? list.size() : 0); // Paper - decompile fix ++ ArrayList arraylist1 = Lists.newArrayListWithCapacity(list.size()); // Paper - decompile fix + int j = Integer.MAX_VALUE; + int k = Integer.MAX_VALUE; + int l = Integer.MAX_VALUE; +@@ -427,7 +427,7 @@ public class DefinedStructure { + nbttagcompound.set("blocks", new NBTTagList()); + nbttagcompound.set("palette", new NBTTagList()); + } else { +- ArrayList arraylist = Lists.newArrayList(); ++ ArrayList arraylist = Lists.newArrayList(); // Paper - decompile fix + DefinedStructure.a definedstructure$a = new DefinedStructure.a(); + arraylist.add(definedstructure$a); -@@ -285,21 +285,24 @@ public class DefinedStructure { - voxelshapebitset.a(blockposition3.getX() - i2, blockposition3.getY() - j2, blockposition3.getZ() - l1, true, true); - } +diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java +index 5c2d50f974..fd6df39f17 100644 +--- a/src/main/java/net/minecraft/server/EnchantmentManager.java ++++ b/src/main/java/net/minecraft/server/EnchantmentManager.java +@@ -51,7 +51,7 @@ public class EnchantmentManager { + public static void a(Map map, ItemStack itemstack) { + NBTTagList nbttaglist = new NBTTagList(); -- voxelshapebitset.a((enumdirection, i, j, k) -> { -- BlockPosition blockposition = new BlockPosition(l + i, i1 + j, j1 + k); -- BlockPosition blockposition1 = blockposition.shift(enumdirection); -- IBlockData iblockdata = generatoraccess.getType(blockposition); -+ // Paper start - decompile fixes -+ int finalL = l1; -+ voxelshapebitset.a((enumdirection, i_, j_, k_) -> { -+ BlockPosition innerBlockposition = new BlockPosition(i2 + i_, j2 + j_, finalL + k_); -+ BlockPosition blockposition1 = innerBlockposition.shift(enumdirection); -+ IBlockData iblockdata = generatoraccess.getType(innerBlockposition); - IBlockData iblockdata1 = generatoraccess.getType(blockposition1); -- IBlockData iblockdata2 = iblockdata.updateState(enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1); -+ IBlockData iblockdata2 = iblockdata.updateState(enumdirection, iblockdata1, generatoraccess, innerBlockposition, blockposition1); +- for(Entry entry : map.entrySet()) { ++ for(Entry entry : map.entrySet()) { // Paper - decompile fix + Enchantment enchantment = (Enchantment)entry.getKey(); + if (enchantment != null) { + int i = entry.getValue(); +@@ -146,7 +146,7 @@ public class EnchantmentManager { + } - if (iblockdata != iblockdata2) { -- generatoraccess.setTypeAndData(blockposition, iblockdata2, k1 & -2 | 16); -+ generatoraccess.setTypeAndData(innerBlockposition, iblockdata2, i & -2 | 16); - } + public static int a(Enchantment enchantment, EntityLiving entityliving) { +- List list = enchantment.a(entityliving); ++ List list = enchantment.a(entityliving); // Paper - decompile fix + if (list == null) { + return 0; + } else { +@@ -224,7 +224,7 @@ public class EnchantmentManager { + } -- IBlockData iblockdata3 = iblockdata1.updateState(enumdirection.opposite(), iblockdata2, generatoraccess, blockposition1, blockposition); -+ IBlockData iblockdata3 = iblockdata1.updateState(enumdirection.opposite(), iblockdata2, generatoraccess, blockposition1, innerBlockposition); + public static ItemStack b(Enchantment enchantment, EntityLiving entityliving) { +- List list = enchantment.a(entityliving); ++ List list = enchantment.a(entityliving);// Paper - decompile fix + if (list.isEmpty()) { + return ItemStack.a; + } else { +@@ -260,7 +260,7 @@ public class EnchantmentManager { + } - if (iblockdata1 != iblockdata3) { -- generatoraccess.setTypeAndData(blockposition1, iblockdata3, k1 & -2 | 16); -+ generatoraccess.setTypeAndData(blockposition1, iblockdata3, i & -2 | 16); -+ // Paper end - decompile fixes - } + public static ItemStack a(Random random, ItemStack itemstack, int i, boolean flag) { +- List list = b(random, itemstack, i, flag); ++ List list = b(random, itemstack, i, flag); // Paper - decompile fix + boolean flag1 = itemstack.getItem() == Items.BOOK; + if (flag1) { + itemstack = new ItemStack(Items.ENCHANTED_BOOK); +@@ -328,7 +328,7 @@ public class EnchantmentManager { + } - }); -@@ -734,7 +737,7 @@ public class DefinedStructure { - public IBlockData a(int i) { - IBlockData iblockdata = (IBlockData) this.b.fromId(i); + public static List a(int i, ItemStack itemstack, boolean flag) { +- ArrayList arraylist = Lists.newArrayList(); ++ ArrayList arraylist = Lists.newArrayList(); + Item item = itemstack.getItem(); + boolean flag1 = itemstack.getItem() == Items.BOOK; -- return iblockdata == null ? DefinedStructure.a.a : iblockdata; -+ return iblockdata == null ? a : iblockdata; // Paper - decompile error - Blocks.AIR.getBlockData() - } - - public Iterator iterator() { +diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java +index 04cff50cb7..e746a6a0da 100644 +--- a/src/main/java/net/minecraft/server/EntityDragonFireball.java ++++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java +@@ -14,7 +14,7 @@ public class EntityDragonFireball extends EntityFireball { + protected void a(MovingObjectPosition movingobjectposition) { + if (movingobjectposition.entity == null || !movingobjectposition.entity.s(this.shooter)) { + if (!this.world.isClientSide) { +- List list = this.world.a(EntityLiving.class, this.getBoundingBox().grow(4.0D, 2.0D, 4.0D)); ++ List list = this.world.a(EntityLiving.class, this.getBoundingBox().grow(4.0D, 2.0D, 4.0D)); // Paper - decompile fix + EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX, this.locY, this.locZ); + entityareaeffectcloud.setSource(this.shooter); + entityareaeffectcloud.setParticle(Particles.j); diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java -index 188d49d820..854ad49b6c 100644 +index 38c85f4ab7..c0853f0fcd 100644 --- a/src/main/java/net/minecraft/server/EnumDirection.java +++ b/src/main/java/net/minecraft/server/EnumDirection.java -@@ -255,7 +255,7 @@ public enum EnumDirection implements INamable { - return Iterators.forArray(this.c); - } +@@ -233,7 +233,7 @@ public enum EnumDirection implements INamable { + } + // $FF: synthetic method +- public boolean test(@Nullable Object object) { ++ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix + return super.a((EnumDirection)object); + } + }, +@@ -247,7 +247,7 @@ public enum EnumDirection implements INamable { + } + + // $FF: synthetic method +- public boolean test(@Nullable Object object) { ++ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix + return super.a((EnumDirection)object); + } + }, +@@ -261,7 +261,7 @@ public enum EnumDirection implements INamable { + } + + // $FF: synthetic method +- public boolean test(@Nullable Object object) { ++ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix + return super.a((EnumDirection)object); + } + }; +@@ -316,7 +316,7 @@ public enum EnumDirection implements INamable { + public abstract double a(double var1, double var3, double var5); + + // $FF: synthetic method - public boolean test(@Nullable Object object) { -+ public boolean test(@Nullable EnumDirection object) { // Paper - Decompile fix - return this.a((EnumDirection) object); ++ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix + return this.a((EnumDirection)object); } } -@@ -293,9 +293,10 @@ public enum EnumDirection implements INamable { - return d0; - } - -- public boolean test(@Nullable Object object) { -- return super.a((EnumDirection) object); -- } -+ // Paper - Decompile fix -+ //public boolean test(@Nullable Object object) { -+ // return super.a((EnumDirection) object); -+ //} - }, - Y("y") { - ; -@@ -307,9 +308,10 @@ public enum EnumDirection implements INamable { - return d1; - } - -- public boolean test(@Nullable Object object) { -- return super.a((EnumDirection) object); -- } -+ // Paper - Decompile fix -+ //public boolean test(@Nullable Object object) { -+ // return super.a((EnumDirection) object); -+ //} - }, - Z("z") { - ; -@@ -321,9 +323,10 @@ public enum EnumDirection implements INamable { - return d2; - } - -- public boolean test(@Nullable Object object) { -- return super.a((EnumDirection) object); -- } -+ // Paper - Decompile fix -+ //public boolean test(@Nullable Object object) { -+ // return super.a((EnumDirection) object); -+ //} - }; - - private static final Map d = (Map) Arrays.stream(values()).collect(Collectors.toMap(EnumDirection.EnumAxis::a, (enumdirection_enumaxis) -> { -@@ -377,7 +380,7 @@ public enum EnumDirection implements INamable { - - public abstract double a(double d0, double d1, double d2); - -- public boolean test(@Nullable Object object) { -+ public boolean test(@Nullable EnumDirection object) { // Paper - Decompile fix - return this.a((EnumDirection) object); +@@ -367,7 +367,7 @@ public enum EnumDirection implements INamable { } + // $FF: synthetic method +- public boolean test(@Nullable Object object) { ++ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix + return this.a((EnumDirection)object); + } + } diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java -index 8f06c58485..4361b2cee5 100644 +index 0c9249cd8d..0648c76a07 100644 --- a/src/main/java/net/minecraft/server/LocaleLanguage.java +++ b/src/main/java/net/minecraft/server/LocaleLanguage.java -@@ -34,7 +34,7 @@ public class LocaleLanguage { - Entry entry = (Entry) iterator.next(); - String s = LocaleLanguage.b.matcher(ChatDeserializer.a((JsonElement) entry.getValue(), (String) entry.getKey())).replaceAll("%$1s"); +@@ -27,7 +27,7 @@ public class LocaleLanguage { + JsonElement jsonelement = (JsonElement)(new Gson()).fromJson(new InputStreamReader(inputstream, StandardCharsets.UTF_8), JsonElement.class); + JsonObject jsonobject = ChatDeserializer.m(jsonelement, "strings"); -- this.d.put(entry.getKey(), s); -+ this.d.put((String) entry.getKey(), s); // Paper - Decompile fix +- for(Entry entry : jsonobject.entrySet()) { ++ for(Entry entry : jsonobject.entrySet()) {// Paper - Decompile fix + String s = b.matcher(ChatDeserializer.a((JsonElement)entry.getValue(), (String)entry.getKey())).replaceAll("%$1s"); + this.d.put(entry.getKey(), s); } - - this.e = SystemUtils.b(); diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java -index 3cd5045636..3d501aee30 100644 +index 9d01b70c7f..8daccdd6e9 100644 --- a/src/main/java/net/minecraft/server/LootSelectorEntry.java +++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java -@@ -85,11 +85,11 @@ public abstract class LootSelectorEntry { - return jsonobject; +@@ -83,12 +83,12 @@ public abstract class LootSelectorEntry { } + // $FF: synthetic method - public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { -+ public JsonElement serialize(LootSelectorEntry object, Type type, JsonSerializationContext jsonserializationcontext) { // Paper - decompile fix - return this.a((LootSelectorEntry) object, type, jsonserializationcontext); ++ public JsonElement serialize(LootSelectorEntry object, Type type, JsonSerializationContext jsonserializationcontext) {// Paper - Decompile fix + return this.a((LootSelectorEntry)object, type, jsonserializationcontext); } + // $FF: synthetic method - public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -+ public LootSelectorEntry deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // Paper - decompile fix ++ public LootSelectorEntry deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {// Paper - Decompile fix return this.a(jsonelement, type, jsondeserializationcontext); } } -diff --git a/src/main/java/net/minecraft/server/MathHelper.java b/src/main/java/net/minecraft/server/MathHelper.java -index 28fb88dade..5329102dd7 100644 ---- a/src/main/java/net/minecraft/server/MathHelper.java -+++ b/src/main/java/net/minecraft/server/MathHelper.java -@@ -8,7 +8,7 @@ import java.util.function.IntPredicate; - public class MathHelper { - - public static final float a = c(2.0F); -- private static final float[] b = (float[]) SystemUtils.a((Object) (new float[65536]), (afloat) -> { -+ private static final float[] b = (float[]) SystemUtils.a((new float[65536]), (afloat) -> { // Paper - Decompile fix - for (int i = 0; i < afloat.length; ++i) { - afloat[i] = (float) Math.sin((double) i * 3.141592653589793D * 2.0D / 65536.0D); - } diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java -index 8170a84280..e21e60b003 100644 +index 7e88bcd6e4..b98dfe27d5 100644 --- a/src/main/java/net/minecraft/server/NBTBase.java +++ b/src/main/java/net/minecraft/server/NBTBase.java -@@ -20,7 +20,7 @@ public interface NBTBase { - - byte getTypeId(); - -- static default NBTBase createTag(byte b0) { -+ static NBTBase createTag(byte b0) { // Paper - decompile fix - switch (b0) { - case 0: - return new NBTTagEnd(); -@@ -66,7 +66,7 @@ public interface NBTBase { +@@ -87,7 +87,7 @@ public interface NBTBase { } } -- static default String n(int i) { -+ static String n(int i) { // Paper - decompile fix - switch (i) { - case 0: - return "TAG_End"; +- NBTBase clone(); ++ public NBTBase clone(); // Paper - decompile fix + + default String b_() { + return this.toString(); diff --git a/src/main/java/net/minecraft/server/NBTList.java b/src/main/java/net/minecraft/server/NBTList.java -index 1a81d8e5f6..057c2077a0 100644 +index 456b5f4925..54f2935c08 100644 --- a/src/main/java/net/minecraft/server/NBTList.java +++ b/src/main/java/net/minecraft/server/NBTList.java -@@ -13,7 +13,7 @@ public abstract class NBTList extends AbstractList impleme +@@ -25,6 +25,7 @@ public abstract class NBTList extends AbstractList impleme + public abstract void b(int var1); + + // $FF: synthetic method ++ /* // Paper start- Decompile fix + public Object set(int i, Object object) { + return this.set(i, (NBTBase)object); } - - public T set(int i, T t0) { -- NBTBase nbtbase = this.get(i); -+ T nbtbase = this.get(i); // Paper - decompile fix - - this.a(i, t0); - return nbtbase; -@@ -25,11 +25,5 @@ public abstract class NBTList extends AbstractList impleme - - public abstract void b(int i); - -- public Object set(int i, Object object) { -- return this.set(i, (NBTBase) object); +@@ -32,5 +33,9 @@ public abstract class NBTList extends AbstractList impleme + // $FF: synthetic method + public Object get(int i) { + return this.get(i); - } -- -- public Object get(int i) { -- return this.get(i); -- } -+ public abstract NBTList clone(); // Paper - decompile fix ++ }*/ ++ ++ @Override ++ public abstract NBTBase clone(); ++ // Paper end- Decompile fix } diff --git a/src/main/java/net/minecraft/server/NBTTagByteArray.java b/src/main/java/net/minecraft/server/NBTTagByteArray.java index 11ffa6c342..5d61cf70bc 100644 @@ -375,227 +345,134 @@ index f5c9b97d5c..d121ad4f7a 100644 } } diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index b3c944d701..a8280acf94 100644 +index 5b54cbde18..769d599c59 100644 --- a/src/main/java/net/minecraft/server/NBTTagList.java +++ b/src/main/java/net/minecraft/server/NBTTagList.java -@@ -14,7 +14,7 @@ import org.apache.logging.log4j.Logger; - public class NBTTagList extends NBTList { +@@ -12,7 +12,7 @@ import org.apache.logging.log4j.Logger; + public class NBTTagList extends NBTList { private static final Logger f = LogManager.getLogger(); - private List list = Lists.newArrayList(); + public List list = Lists.newArrayList(); // Paper private byte type = 0; - public NBTTagList() {} -@@ -294,23 +294,7 @@ public class NBTTagList extends NBTList { - return this.type; - } - -- public NBTBase clone() { -+ public NBTTagList clone() { + public NBTTagList() { +@@ -286,6 +286,7 @@ public class NBTTagList extends NBTList { return this.c(); } -- -- public Object remove(int i) { -- return this.remove(i); -- } -- -- public Object set(int i, Object object) { -- return this.set(i, (NBTBase) object); -- } -- -- public Object get(int i) { -- return this.get(i); -- } -- -- public boolean add(Object object) { -- return this.add((NBTBase) object); -- } + ++ /* // Paper start - Decompile fix + // $FF: synthetic method + public Object remove(int i) { + return this.remove(i); +@@ -305,4 +306,5 @@ public class NBTTagList extends NBTList { + public boolean add(Object object) { + return this.add((NBTBase)object); + } ++ */ // Paper end - Decompile fix } -diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 528eb255ec..541435d3e5 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunk.java -+++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -65,7 +65,7 @@ public class ProtoChunk implements IChunkAccess { - this.b = chunkcoordintpair; - this.p = chunkconverter; - Predicate predicate = (block) -> { -- return block == null || block.getBlockData().isAir(); -+ return block == null || ((Block) block).getBlockData().isAir(); // Paper - decompile fix - }; - IRegistry iregistry = IRegistry.BLOCK; +diff --git a/src/main/java/net/minecraft/server/Registry.java b/src/main/java/net/minecraft/server/Registry.java +index 5be9f0ff2f..9efec49d66 100644 +--- a/src/main/java/net/minecraft/server/Registry.java ++++ b/src/main/java/net/minecraft/server/Registry.java +@@ -1,4 +1,8 @@ + package net.minecraft.server; -@@ -325,8 +325,8 @@ public class ProtoChunk implements IChunkAccess { - } - - private HeightMap c(HeightMap.Type heightmap_type) { -- return (HeightMap) this.f.computeIfAbsent(heightmap_type, (heightmap_type) -> { -- HeightMap heightmap = new HeightMap(this, heightmap_type); -+ return (HeightMap) this.f.computeIfAbsent(heightmap_type, (heightmap_type1) -> { // Paper - decompile fix -+ HeightMap heightmap = new HeightMap(this, heightmap_type1); // Paper - decompile fix - - heightmap.a(); - return heightmap; -@@ -372,13 +372,13 @@ public class ProtoChunk implements IChunkAccess { - - @Nullable - public LongSet b(String s) { -- return (LongSet) this.o.computeIfAbsent(s, (s) -> { -+ return (LongSet) this.o.computeIfAbsent(s, (s1) -> { // Paper - decompile fix - return new LongOpenHashSet(); - }); - } - - public void a(String s, long i) { -- ((LongSet) this.o.computeIfAbsent(s, (s) -> { -+ ((LongSet) this.o.computeIfAbsent(s, (s1) -> { // Paper - decompile fix - return new LongOpenHashSet(); - })).add(i); - this.c = true; -@@ -493,7 +493,7 @@ public class ProtoChunk implements IChunkAccess { - } - - public BitSet a(WorldGenStage.Features worldgenstage_features) { -- return (BitSet) this.t.computeIfAbsent(worldgenstage_features, (worldgenstage_features) -> { -+ return (BitSet) this.t.computeIfAbsent(worldgenstage_features, (worldgenstage_features1) -> { // Paper - decompile fix - return new BitSet(65536); - }); - } +-public interface Registry extends Iterable { ++import java.util.Iterator; ++public interface Registry extends Iterable { // Paper - decompile fix ++ ++ @Override ++ Iterator iterator(); // Paper - decompile fix + } diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java -index ef332d6517..7cc7eb7735 100644 +index 8d1f9237aa..a21006290c 100644 --- a/src/main/java/net/minecraft/server/RegistryBlockID.java +++ b/src/main/java/net/minecraft/server/RegistryBlockID.java -@@ -8,7 +8,7 @@ import java.util.Iterator; - import java.util.List; - import javax.annotation.Nullable; +@@ -26,7 +26,7 @@ public class RegistryBlockID implements Registry { + this.b.put(object, i); --public class RegistryBlockID implements Registry { -+public class RegistryBlockID implements Registry { // Paper - decompile fix - - private int a; - private final IdentityHashMap b; -@@ -27,7 +27,7 @@ public class RegistryBlockID implements Registry { - this.b.put(t0, Integer.valueOf(i)); - - while (this.c.size() <= i) { -- this.c.add((Object) null); + while(this.c.size() <= i) { +- this.c.add((Object)null); + this.c.add(null); // Paper - decompile fix } - this.c.set(i, t0); + this.c.set(i, object); diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java -index 3b8f6ec167..bde5714dd6 100644 +index 03c6033622..d03ac0e70c 100644 --- a/src/main/java/net/minecraft/server/RegistryID.java +++ b/src/main/java/net/minecraft/server/RegistryID.java -@@ -6,7 +6,7 @@ import java.util.Arrays; - import java.util.Iterator; - import javax.annotation.Nullable; - --public class RegistryID implements Registry { -+public class RegistryID implements Registry { // Paper - decompile fix - - private static final Object a = null; - private K[] b; -@@ -17,9 +17,9 @@ public class RegistryID implements Registry { - - public RegistryID(int i) { - i = (int) ((float) i / 0.8F); -- this.b = (Object[]) (new Object[i]); -+ this.b = (K[]) (new Object[i]); // Paper - decompile fix - this.c = new int[i]; -- this.d = (Object[]) (new Object[i]); -+ this.d = (K[]) (new Object[i]); // Paper - decompile fix - } - - public int getId(@Nullable K k0) { -@@ -51,12 +51,12 @@ public class RegistryID implements Registry { +@@ -49,7 +49,7 @@ public class RegistryID implements Registry { } private void d(int i) { - Object[] aobject = this.b; + K[] aobject = this.b; // Paper - decompile fix int[] aint = this.c; - -- this.b = (Object[]) (new Object[i]); -+ this.b = (K[]) (new Object[i]); // Paper - decompile fix + this.b = (K[])(new Object[i]); this.c = new int[i]; -- this.d = (Object[]) (new Object[i]); -+ this.d = (K[]) (new Object[i]); // Paper - decompile fix - this.e = 0; - this.f = 0; - diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java -index 2179664a0c..d7e1ecc031 100644 +index 7b8a8064b8..615aa2cd04 100644 --- a/src/main/java/net/minecraft/server/ServerPing.java +++ b/src/main/java/net/minecraft/server/ServerPing.java -@@ -102,11 +102,11 @@ public class ServerPing { - return jsonobject; +@@ -101,12 +101,12 @@ public class ServerPing { } + // $FF: synthetic method - public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { -+ public JsonElement serialize(ServerPing object, Type type, JsonSerializationContext jsonserializationcontext) { // Paper - decompile fix - return this.a((ServerPing) object, type, jsonserializationcontext); ++ public JsonElement serialize(ServerPing object, Type type, JsonSerializationContext jsonserializationcontext) {// Paper - Decompile fix + return this.a((ServerPing)object, type, jsonserializationcontext); } + // $FF: synthetic method - public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -+ public ServerPing deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // Paper - decompile fix ++ public ServerPing deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {// Paper - Decompile fix return this.a(jsonelement, type, jsondeserializationcontext); } } -@@ -147,11 +147,11 @@ public class ServerPing { - return jsonobject; +@@ -145,12 +145,12 @@ public class ServerPing { } + // $FF: synthetic method - public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { -+ public JsonElement serialize(ServerPing.ServerData object, Type type, JsonSerializationContext jsonserializationcontext) { // Paper - decompile fix - return this.a((ServerPing.ServerData) object, type, jsonserializationcontext); ++ public JsonElement serialize(ServerPing.ServerData object, Type type, JsonSerializationContext jsonserializationcontext) {// Paper - Decompile fix + return this.a((ServerPing.ServerData)object, type, jsonserializationcontext); } + // $FF: synthetic method - public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -+ public ServerPing.ServerData deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // Paper - decompile fix ++ public ServerPing.ServerData deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {// Paper - Decompile fix return this.a(jsonelement, type, jsondeserializationcontext); } } -@@ -235,11 +235,11 @@ public class ServerPing { - return jsonobject; +@@ -229,12 +229,12 @@ public class ServerPing { } + // $FF: synthetic method - public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { -+ public JsonElement serialize(ServerPing.ServerPingPlayerSample object, Type type, JsonSerializationContext jsonserializationcontext) { // Paper - decompile fix - return this.a((ServerPing.ServerPingPlayerSample) object, type, jsonserializationcontext); ++ public JsonElement serialize(ServerPing.ServerPingPlayerSample object, Type type, JsonSerializationContext jsonserializationcontext) {// Paper - Decompile fix + return this.a((ServerPing.ServerPingPlayerSample)object, type, jsonserializationcontext); } + // $FF: synthetic method - public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -+ public ServerPing.ServerPingPlayerSample deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // Paper - decompile fix ++ public ServerPing.ServerPingPlayerSample deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {// Paper - Decompile fix return this.a(jsonelement, type, jsondeserializationcontext); } } diff --git a/src/main/java/net/minecraft/server/ShapeDetector.java b/src/main/java/net/minecraft/server/ShapeDetector.java -index 43596cb2d5..3faf74a22f 100644 +index ef9d8e06fe..0c9910d9a5 100644 --- a/src/main/java/net/minecraft/server/ShapeDetector.java +++ b/src/main/java/net/minecraft/server/ShapeDetector.java -@@ -171,7 +171,7 @@ public class ShapeDetector { - return new ShapeDetectorBlock(this.a, blockposition, this.b); +@@ -107,7 +107,7 @@ public class ShapeDetector { } + // $FF: synthetic method - public Object load(Object object) throws Exception { -+ public ShapeDetectorBlock load(BlockPosition object) throws Exception { // Paper - Decompile fix - return this.a((BlockPosition) object); ++ public ShapeDetectorBlock load(BlockPosition object) throws Exception {// Paper - Decompile fix + return this.a((BlockPosition)object); } } -diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java -index 0b3141d3e7..700900256b 100644 ---- a/src/main/java/net/minecraft/server/VoxelShape.java -+++ b/src/main/java/net/minecraft/server/VoxelShape.java -@@ -69,7 +69,7 @@ public abstract class VoxelShape { - ArrayList arraylist = Lists.newArrayList(); - - this.b((d0, d1, d2, d3, d4, d5) -> { -- list.add(new AxisAlignedBB(d0, d1, d2, d3, d4, d5)); -+ arraylist.add(new AxisAlignedBB(d0, d1, d2, d3, d4, d5)); // Paper - decompile fix - }); - return arraylist; - } -- 2.18.0 diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index 42cff9189..ded973375 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -1,31 +1,31 @@ -From 00a8a9abe20b6993d8063665ac50086f2a36b3d4 Mon Sep 17 00:00:00 2001 +From b5a8729e2faa400beaa6db9bf7b65d496ba30353 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:55:47 -0400 Subject: [PATCH] MC Utils diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 9f3aa2459..ca5c56c2b 100644 +index 6ffc535146..5ed34cf7e3 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -10,7 +10,7 @@ import org.apache.logging.log4j.Logger; +@@ -9,7 +9,7 @@ import org.apache.logging.log4j.Logger; + @Immutable public class BlockPosition extends BaseBlockPosition { - - private static final Logger b = LogManager.getLogger(); + //private static final Logger b = LogManager.getLogger(); // Paper - variable name conflict, logger isn't used public static final BlockPosition ZERO = new BlockPosition(0, 0, 0); private static final int c = 1 + MathHelper.e(MathHelper.c(30000000)); - private static final int d = BlockPosition.c; -@@ -45,6 +45,7 @@ public class BlockPosition extends BaseBlockPosition { - return d0 == 0.0D && d1 == 0.0D && d2 == 0.0D ? this : new BlockPosition((double) this.getX() + d0, (double) this.getY() + d1, (double) this.getZ() + d2); + private static final int d = c; +@@ -44,6 +44,7 @@ public class BlockPosition extends BaseBlockPosition { + return d0 == 0.0D && d1 == 0.0D && d2 == 0.0D ? this : new BlockPosition((double)this.getX() + d0, (double)this.getY() + d1, (double)this.getZ() + d2); } + public BlockPosition add(int i, int j, int k) {return a(i, j, k);} // Paper - OBFHELPER - public BlockPosition a(int i, int j, int k) { - return i == 0 && j == 0 && k == 0 ? this : new BlockPosition(this.getX() + i, this.getY() + j, this.getZ() + k); + public BlockPosition a(int ix, int jx, int kx) { + return ix == 0 && jx == 0 && kx == 0 ? this : new BlockPosition(this.getX() + ix, this.getY() + jx, this.getZ() + kx); } -@@ -385,6 +386,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -282,6 +283,7 @@ public class BlockPosition extends BaseBlockPosition { return this.d; } @@ -33,7 +33,7 @@ index 9f3aa2459..ca5c56c2b 100644 public BlockPosition.MutableBlockPosition c(int i, int j, int k) { this.b = i; this.c = j; -@@ -392,6 +394,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -289,6 +291,7 @@ public class BlockPosition extends BaseBlockPosition { return this; } @@ -42,7 +42,7 @@ index 9f3aa2459..ca5c56c2b 100644 return this.c(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index fe5328ef4..b7c40d5ce 100644 +index fe5328ef47..b7c40d5ce6 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -28,7 +28,7 @@ import com.google.common.collect.Lists; // CraftBukkit @@ -63,20 +63,20 @@ index fe5328ef4..b7c40d5ce 100644 public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index 34586bca6..b0c004b1f 100644 +index 744762b8b9..d9608121b6 100644 --- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -@@ -24,6 +24,8 @@ public class ChunkCoordIntPair { +@@ -23,6 +23,8 @@ public class ChunkCoordIntPair { return a(this.x, this.z); } + public static long asLong(final BlockPosition pos) { return a(pos.getX() >> 4, pos.getZ() >> 4); } // Paper - OBFHELPER + public static long asLong(int x, int z) { return a(x, z); } // Paper - OBFHELPER public static long a(int i, int j) { - return (long) i & 4294967295L | ((long) j & 4294967295L) << 32; + return (long)i & 4294967295L | ((long)j & 4294967295L) << 32; } diff --git a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java -index 3b6b3b9a9..22af9c188 100644 +index 3b6b3b9a99..22af9c1885 100644 --- a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java +++ b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java @@ -16,7 +16,7 @@ import org.apache.logging.log4j.Logger; @@ -89,10 +89,10 @@ index 3b6b3b9a9..22af9c188 100644 private final IChunkLoader e; private final IAsyncTaskHandler f; diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index d24ec3d53..9e83610f1 100644 +index 95ca5f6d80..0dc948a375 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java -@@ -60,6 +60,7 @@ public class DataBits { +@@ -54,6 +54,7 @@ public class DataBits { } } @@ -101,34 +101,37 @@ index d24ec3d53..9e83610f1 100644 return this.a; } diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java -index dae40b9cd..0be0b0ef5 100644 +index 7f905b1e09..5a88e8c911 100644 --- a/src/main/java/net/minecraft/server/DataPalette.java +++ b/src/main/java/net/minecraft/server/DataPalette.java -@@ -4,8 +4,10 @@ import javax.annotation.Nullable; +@@ -3,10 +3,11 @@ package net.minecraft.server; + import javax.annotation.Nullable; public interface DataPalette { - + default int getDataBits(T object) { return this.a(object); } // Paper - OBFHELPER - int a(T t0); + int a(T var1); +- @Nullable +- T a(int var1); + @Nullable default T getObject(int dataBits) { return this.a(dataBits); } // Paper - OBFHELPER - @Nullable - T a(int i); ++ @Nullable T a(int var1); + + void b(PacketDataSerializer var1); diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 030ec8704..575f9b558 100644 +index 304e47bf20..6e7454b134 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -9,7 +9,7 @@ import java.util.stream.Collectors; +@@ -7,7 +7,7 @@ import java.util.function.Function; + import java.util.stream.Collectors; public class DataPaletteBlock implements DataPaletteExpandable { - - private final DataPalette b; -+ private final DataPalette b; private final DataPalette getDataPaletteGlobal() { return this.b; } // Paper - OBFHELPER - private final DataPaletteExpandable c = (i, object) -> { ++ private final DataPalette b;private final DataPalette getDataPaletteGlobal() { return this.b; } // Paper - OBFHELPER + private final DataPaletteExpandable c = (var0, var1) -> { return 0; }; -@@ -17,9 +17,9 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -15,9 +15,9 @@ public class DataPaletteBlock implements DataPaletteExpandable { private final Function e; private final Function f; private final T g; @@ -141,16 +144,16 @@ index 030ec8704..575f9b558 100644 private final ReentrantLock j = new ReentrantLock(); private void b() { -@@ -54,6 +54,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { - return j << 8 | k << 4 | i; +@@ -51,6 +51,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { + return jx << 8 | k << 4 | ix; } + private void initialize(int bitsPerObject) { this.b(bitsPerObject); } // Paper - OBFHELPER - private void b(int i) { - if (i != this.i) { - this.i = i; -@@ -116,6 +117,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { - return object == null ? this.g : object; + private void b(int ix) { + if (ix != this.i) { + this.i = ix; +@@ -107,6 +108,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { + return (T)(object == null ? this.g : object); } + public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER @@ -158,43 +161,56 @@ index 030ec8704..575f9b558 100644 this.b(); packetdataserializer.writeByte(this.i); diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index 2c6fbd1d6..3790039f1 100644 +index 2c6fbd1d6f..a5c147b989 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -6,6 +6,7 @@ import org.bukkit.event.entity.EntityUnleashEvent; public abstract class EntityCreature extends EntityInsentient { -+ public org.bukkit.craftbukkit.entity.CraftCreature getBukkitEntity() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper ++ public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper private BlockPosition a; private float b; +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index ebb177927f..60b1dcd8ea 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -124,6 +124,7 @@ public abstract class EntityInsentient extends EntityLiving { + return this.goalTarget; + } + ++ public org.bukkit.craftbukkit.entity.CraftMob getBukkitMob() { return (org.bukkit.craftbukkit.entity.CraftMob) super.getBukkitEntity(); } // Paper + public void setGoalTarget(@Nullable EntityLiving entityliving) { + // CraftBukkit start - fire event + setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index fd050c5f3..91c478588 100644 +index fd050c5f32..8d33c16580 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -122,6 +122,7 @@ public abstract class EntityLiving extends Entity { public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes; public boolean collides = true; public boolean canPickUpLoot; -+ public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper ++ public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper @Override public float getBukkitYaw() { diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index 96e012215..a3449e9a8 100644 +index c0f48bbc29..f3cc2cef0a 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java -@@ -2,6 +2,7 @@ package net.minecraft.server; +@@ -1,6 +1,8 @@ + package net.minecraft.server; public abstract class EntityMonster extends EntityCreature implements IMonster { - -+ public org.bukkit.craftbukkit.entity.CraftMonster getBukkitEntity() { return (org.bukkit.craftbukkit.entity.CraftMonster) super.getBukkitEntity(); } // Paper ++ ++ public org.bukkit.craftbukkit.entity.CraftMonster getBukkitMonster() { return (org.bukkit.craftbukkit.entity.CraftMonster) super.getBukkitEntity(); } // Paper protected EntityMonster(EntityTypes entitytypes, World world) { super(entitytypes, world); this.b_ = 5; diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 17bfa356f..5c1ab6a0b 100644 +index 17bfa356f1..5c1ab6a0b6 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -3,6 +3,7 @@ package net.minecraft.server; @@ -245,7 +261,7 @@ index 17bfa356f..5c1ab6a0b 100644 // Paper end } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index c54275bc2..318c4204d 100644 +index c54275bc2f..318c4204df 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -26,6 +26,7 @@ import org.bukkit.TreeType; @@ -276,7 +292,7 @@ index c54275bc2..318c4204d 100644 } diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java new file mode 100644 -index 000000000..9f9341c98 +index 0000000000..9f9341c98f --- /dev/null +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +1,296 @@ @@ -577,19 +593,19 @@ index 000000000..9f9341c98 + } +} diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index 7fc9b5ff3..e658816c2 100644 +index 41cd3ceabe..2a66a30264 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -24,7 +24,7 @@ public class NBTTagCompound implements NBTBase { - +@@ -23,7 +23,7 @@ import org.apache.logging.log4j.Logger; + public class NBTTagCompound implements NBTBase { private static final Logger f = LogManager.getLogger(); private static final Pattern g = Pattern.compile("[A-Za-z0-9._+-]+"); - private final Map map = Maps.newHashMap(); + public final Map map = Maps.newHashMap(); // Paper - public NBTTagCompound() {} - -@@ -96,11 +96,13 @@ public class NBTTagCompound implements NBTBase { + public NBTTagCompound() { + } +@@ -89,11 +89,13 @@ public class NBTTagCompound implements NBTBase { this.map.put(s, new NBTTagLong(i)); } @@ -603,17 +619,26 @@ index 7fc9b5ff3..e658816c2 100644 @Nullable public UUID a(String s) { return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); -@@ -492,8 +494,4 @@ public class NBTTagCompound implements NBTBase { - return chatcomponenttext; - } +@@ -322,7 +324,7 @@ public class NBTTagCompound implements NBTBase { + + public String toString() { + StringBuilder stringbuilder = new StringBuilder("{"); +- Object object = this.map.keySet(); ++ Collection object = this.map.keySet(); // Paper - decompile fix + if (f.isDebugEnabled()) { + ArrayList arraylist = Lists.newArrayList(this.map.keySet()); + Collections.sort(arraylist); +@@ -476,7 +478,7 @@ public class NBTTagCompound implements NBTBase { } -- + + // $FF: synthetic method - public NBTBase clone() { -- return this.clone(); -- } ++ public NBTBase clone_bad() { // Paper - decompile fix + return this.clone(); + } } diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 0afaea810..26da89724 100644 +index 0afaea8109..26da897243 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -44,7 +44,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -654,7 +679,7 @@ index 0afaea810..26da89724 100644 public QueuedPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { this.a = packet; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index d04afceb7..a63a5811d 100644 +index d04afceb70..a63a5811d6 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java @@ -33,6 +33,7 @@ public class PacketDataSerializer extends ByteBuf { @@ -666,10 +691,10 @@ index d04afceb7..a63a5811d 100644 for (int j = 1; j < 5; ++j) { if ((i & -1 << j * 7) == 0) { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index a8363f47b..33436ac65 100644 +index 12d6c99cf0..af382815f3 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -13,7 +13,7 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -11,7 +11,7 @@ public class PacketPlayOutMapChunk implements Packet { private int a; private int b; private int c; @@ -678,7 +703,7 @@ index a8363f47b..33436ac65 100644 private List e; private boolean f; -@@ -97,6 +97,7 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -85,6 +85,7 @@ public class PacketPlayOutMapChunk implements Packet { return bytebuf; } @@ -687,7 +712,7 @@ index a8363f47b..33436ac65 100644 int j = 0; ChunkSection[] achunksection = chunk.getSections(); diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 43bd6aba9..7dee734a7 100644 +index d465608f37..1c57f6e738 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -68,9 +68,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -704,10 +729,10 @@ index 43bd6aba9..7dee734a7 100644 private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java -index 7cc7eb773..a804a67e1 100644 +index a21006290c..6c6f006f3a 100644 --- a/src/main/java/net/minecraft/server/RegistryBlockID.java +++ b/src/main/java/net/minecraft/server/RegistryBlockID.java -@@ -56,6 +56,7 @@ public class RegistryBlockID implements Registry { // Paper - decompile fix +@@ -54,6 +54,7 @@ public class RegistryBlockID implements Registry { return Iterators.filter(this.c.iterator(), Predicates.notNull()); } diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch index dc10d5fc2..d56b71aad 100644 --- a/Spigot-Server-Patches/0009-Timings-v2.patch +++ b/Spigot-Server-Patches/0009-Timings-v2.patch @@ -1,4 +1,4 @@ -From 4292492f940a001ab9538708c54fd6525c918f99 Mon Sep 17 00:00:00 2001 +From e4063a497d5fc1ab2b32054b7277edbb39807d03 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 04:00:11 -0600 Subject: [PATCH] Timings v2 @@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2 diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java new file mode 100644 -index 00000000..984044b0 +index 0000000000..984044b02a --- /dev/null +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java @@ -0,0 +1,129 @@ @@ -141,7 +141,7 @@ index 00000000..984044b0 +} diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java new file mode 100644 -index 00000000..145cb274 +index 0000000000..145cb274b0 --- /dev/null +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -0,0 +1,104 @@ @@ -250,7 +250,7 @@ index 00000000..145cb274 + } +} diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index d2efcca8..4812da0d 100644 +index d2efcca80a..4812da0dac 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -14,11 +14,14 @@ import java.util.concurrent.TimeUnit; @@ -294,7 +294,7 @@ index d2efcca8..4812da0d 100644 + } } diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 8811dbc9..7818a3b6 100644 +index 8811dbc9b3..7818a3b6a7 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -23,6 +23,15 @@ public class Block implements IMaterial { @@ -314,7 +314,7 @@ index 8811dbc9..7818a3b6 100644 private final float frictionFactor; protected final BlockStateList blockStateList; diff --git a/src/main/java/net/minecraft/server/ChunkMap.java b/src/main/java/net/minecraft/server/ChunkMap.java -index e3d1761b..fbebd459 100644 +index e3d1761b49..fbebd4591c 100644 --- a/src/main/java/net/minecraft/server/ChunkMap.java +++ b/src/main/java/net/minecraft/server/ChunkMap.java @@ -14,6 +14,7 @@ public class ChunkMap extends Long2ObjectOpenHashMap { @@ -345,7 +345,7 @@ index e3d1761b..fbebd459 100644 // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 9e805c5d..0034956a 100644 +index 9e805c5d22..0034956af9 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -90,7 +90,7 @@ public class ChunkProviderServer implements IChunkProvider { @@ -386,7 +386,7 @@ index 9e805c5d..0034956a 100644 this.chunkLoader.saveChunk(this.world, ichunkaccess, unloaded); // Spigot } catch (IOException ioexception) { diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index df07b2b8..f969c036 100644 +index df07b2b889..f969c036f3 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -1,5 +1,6 @@ @@ -433,7 +433,7 @@ index df07b2b8..f969c036 100644 } diff --git a/src/main/java/net/minecraft/server/CustomFunction.java b/src/main/java/net/minecraft/server/CustomFunction.java -index b7cdc495..8b9b076d 100644 +index b7cdc495a3..8b9b076ded 100644 --- a/src/main/java/net/minecraft/server/CustomFunction.java +++ b/src/main/java/net/minecraft/server/CustomFunction.java @@ -13,12 +13,22 @@ public class CustomFunction { @@ -460,7 +460,7 @@ index b7cdc495..8b9b076d 100644 return this.b; } diff --git a/src/main/java/net/minecraft/server/CustomFunctionData.java b/src/main/java/net/minecraft/server/CustomFunctionData.java -index 4d7e1517..40ff72f7 100644 +index 4d7e151793..40ff72f725 100644 --- a/src/main/java/net/minecraft/server/CustomFunctionData.java +++ b/src/main/java/net/minecraft/server/CustomFunctionData.java @@ -109,7 +109,7 @@ public class CustomFunctionData implements ITickable, IResourcePackListener { @@ -473,7 +473,7 @@ index 4d7e1517..40ff72f7 100644 int j = 0; CustomFunction.c[] acustomfunction_c = customfunction.b(); diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index efa738d4..dabad6b0 100644 +index efa738d4ec..dabad6b055 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -29,7 +29,7 @@ import org.apache.logging.log4j.Level; @@ -526,7 +526,7 @@ index efa738d4..dabad6b0 100644 return waitable.get(); } catch (java.util.concurrent.ExecutionException e) { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 591ae114..ec5c9fd7 100644 +index 591ae114cf..ec5c9fd735 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -29,7 +29,8 @@ import org.bukkit.command.CommandSender; @@ -565,7 +565,7 @@ index 591ae114..ec5c9fd7 100644 protected float ab() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 91c47858..8a41a1dc 100644 +index 8d33c16580..603208caf8 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -32,7 +32,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; @@ -641,7 +641,7 @@ index 91c47858..8a41a1dc 100644 } diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java -index ae31935c..70c9b1f5 100644 +index ae31935c48..70c9b1f50c 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java +++ b/src/main/java/net/minecraft/server/EntityTracker.java @@ -168,7 +168,7 @@ public class EntityTracker { @@ -672,7 +672,7 @@ index ae31935c..70c9b1f5 100644 } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2c69e682..0ebe7546 100644 +index 2c69e68276..0ebe754619 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1,5 +1,6 @@ @@ -825,7 +825,7 @@ index 2c69e682..0ebe7546 100644 this.methodProfiler.e(); } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index ac6d8cc6..d975c2cc 100644 +index ac6d8cc6e6..d975c2ccf1 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -1,5 +1,6 @@ @@ -919,7 +919,7 @@ index ac6d8cc6..d975c2cc 100644 } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 7dee734a..37284fae 100644 +index 1c57f6e738..ca19c6c172 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -59,6 +59,7 @@ import org.bukkit.inventory.CraftingInventory; @@ -958,19 +958,17 @@ index 7dee734a..37284fae 100644 // this.minecraftServer.getCommandDispatcher().a(this.player.getCommandListener(), s); // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -index 889b3228..69da194f 100644 +index 616797dc6e..3a5daf6705 100644 --- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java +++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -@@ -1,11 +1,17 @@ +@@ -1,10 +1,16 @@ package net.minecraft.server; +import co.aikar.timings.MinecraftTimings; // Paper +import co.aikar.timings.Timing; // Paper + public class PlayerConnectionUtils { - -- public static void ensureMainThread(Packet packet, T t0, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { -+ public static void ensureMainThread(Packet packet, T packetlistener, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { // Paper fix name of param + public static void ensureMainThread(Packet packet, T packetlistener, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { if (!iasynctaskhandler.isMainThread()) { + Timing timing = MinecraftTimings.getPacketTiming(packet); // Paper iasynctaskhandler.postToMainThread(() -> { @@ -981,7 +979,7 @@ index 889b3228..69da194f 100644 throw CancelledPacketHandleException.INSTANCE; } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index ead9697e..26df2ff3 100644 +index ead9697e65..26df2ff32f 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -1,5 +1,6 @@ @@ -1005,7 +1003,7 @@ index ead9697e..26df2ff3 100644 public WhiteList getWhitelist() { diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java -index a0789593..ee5c2421 100644 +index a07895935e..ee5c2421bb 100644 --- a/src/main/java/net/minecraft/server/TickListServer.java +++ b/src/main/java/net/minecraft/server/TickListServer.java @@ -24,13 +24,19 @@ public class TickListServer implements TickList { @@ -1059,7 +1057,7 @@ index a0789593..ee5c2421 100644 } diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index c6920949..68ac014a 100644 +index c69209497b..68ac014aab 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -4,12 +4,13 @@ import javax.annotation.Nullable; @@ -1079,7 +1077,7 @@ index c6920949..68ac014a 100644 private final TileEntityTypes e; public TileEntityTypes getTileEntityType() { return e; } // Paper - OBFHELPER protected World world; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 02867837..c3c435ca 100644 +index 169294b3c3..2f7fab0907 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1,5 +1,6 @@ @@ -1194,7 +1192,7 @@ index 02867837..c3c435ca 100644 public boolean a(@Nullable Entity entity, VoxelShape voxelshape) { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index c276c259..badec349 100644 +index c276c259ae..badec349b7 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -1,5 +1,6 @@ @@ -1301,7 +1299,7 @@ index c276c259..badec349 100644 // CraftBukkit start diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 46a9ff94..9ba50a2d 100644 +index 46a9ff9482..9ba50a2daa 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1867,12 +1867,31 @@ public final class CraftServer implements Server { @@ -1338,7 +1336,7 @@ index 46a9ff94..9ba50a2d 100644 org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java deleted file mode 100644 -index 4c8ab2bc..00000000 +index 4c8ab2bc97..0000000000 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java +++ /dev/null @@ -1,174 +0,0 @@ @@ -1517,7 +1515,7 @@ index 4c8ab2bc..00000000 - } -} diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java -index 413dd35f..52a8c48f 100644 +index 413dd35f06..52a8c48fa4 100644 --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java @@ -1,6 +1,8 @@ @@ -1553,7 +1551,7 @@ index 413dd35f..52a8c48f 100644 public void callStage3(QueuedChunk queuedChunk, Chunk chunk, Runnable runnable) throws RuntimeException { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9f78f2c4..b8bdcb6b 100644 +index 9f78f2c4ae..b8bdcb6b74 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1715,6 +1715,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1570,7 +1568,7 @@ index 9f78f2c4..b8bdcb6b 100644 public Player.Spigot spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index f11bd754..93b9134d 100644 +index f11bd7545f..93b9134d6e 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -14,6 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger; @@ -1646,7 +1644,7 @@ index f11bd754..93b9134d 100644 private boolean isReady(final int currentTick) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -index 7e7ce9a8..46029ce2 100644 +index 7e7ce9a81b..46029ce246 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java @@ -1,8 +1,8 @@ @@ -1728,7 +1726,7 @@ index 7e7ce9a8..46029ce2 100644 - // Spigot end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java -index e52ef47b..3d90b342 100644 +index e52ef47b78..3d90b34268 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java @@ -5,6 +5,7 @@ import org.bukkit.util.CachedServerIcon; @@ -1740,7 +1738,7 @@ index e52ef47b..3d90b342 100644 this.value = value; } diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index e60fe5a9..f68e42c4 100644 +index e60fe5a920..f68e42c4d4 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -30,7 +30,7 @@ import net.minecraft.server.EntityWither; @@ -1801,5 +1799,5 @@ index e60fe5a9..f68e42c4 100644 } } -- -2.16.2.windows.1 +2.18.0 diff --git a/Spigot-Server-Patches/0013-Allow-nerfed-mobs-to-jump.patch b/Spigot-Server-Patches/0013-Allow-nerfed-mobs-to-jump.patch index fa0c66b99..a00c602aa 100644 --- a/Spigot-Server-Patches/0013-Allow-nerfed-mobs-to-jump.patch +++ b/Spigot-Server-Patches/0013-Allow-nerfed-mobs-to-jump.patch @@ -1,11 +1,11 @@ -From 4796b2090e28ed3bbd5f9c26752a9e2d31763434 Mon Sep 17 00:00:00 2001 +From f7425160315958110c7f90c5248e4b681133ef3f Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 1 Mar 2016 13:24:16 -0600 Subject: [PATCH] Allow nerfed mobs to jump diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index cacf58607c..de8680e4dd 100644 +index a55163a458..341038fc4d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -87,4 +87,9 @@ public class PaperWorldConfig { @@ -19,10 +19,10 @@ index cacf58607c..de8680e4dd 100644 + } } diff --git a/src/main/java/net/minecraft/server/ControllerJump.java b/src/main/java/net/minecraft/server/ControllerJump.java -index 4ed5192c65..489beed269 100644 +index 74a40671e9..5d6260ded1 100644 --- a/src/main/java/net/minecraft/server/ControllerJump.java +++ b/src/main/java/net/minecraft/server/ControllerJump.java -@@ -13,6 +13,7 @@ public class ControllerJump { +@@ -12,6 +12,7 @@ public class ControllerJump { this.a = true; } @@ -31,7 +31,7 @@ index 4ed5192c65..489beed269 100644 this.b.o(this.a); this.a = false; diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 25413c70b5..6e324ad589 100644 +index 60b1dcd8ea..cc74150dae 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -32,6 +32,7 @@ public abstract class EntityInsentient extends EntityLiving { @@ -42,7 +42,7 @@ index 25413c70b5..6e324ad589 100644 public PathfinderGoalSelector targetSelector; private EntityLiving goalTarget; private final EntitySenses bC; -@@ -646,6 +647,12 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -647,6 +648,12 @@ public abstract class EntityInsentient extends EntityLiving { // Spigot Start if ( this.fromMobSpawner ) { @@ -56,10 +56,10 @@ index 25413c70b5..6e324ad589 100644 } // Spigot End diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java -index 0d95051383..38a0b2db1e 100644 +index 15c04f890d..7db180fa90 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java -@@ -6,14 +6,17 @@ public class PathfinderGoalFloat extends PathfinderGoal { +@@ -5,14 +5,17 @@ public class PathfinderGoalFloat extends PathfinderGoal { public PathfinderGoalFloat(EntityInsentient entityinsentient) { this.a = entityinsentient; diff --git a/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch index 8d3bbea84..14844e3aa 100644 --- a/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch +++ b/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch @@ -1,11 +1,11 @@ -From e8b18bc8a81789c57bb9b9af47ba408d3fb10756 Mon Sep 17 00:00:00 2001 +From 96a39a206b1aa7c7e2352d77ddde5cac303fc270 Mon Sep 17 00:00:00 2001 From: Suddenly Date: Tue, 1 Mar 2016 13:51:54 -0600 Subject: [PATCH] Add configurable despawn distances for living entities diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index de8680e4dd..02f7e506e3 100644 +index 341038fc4d..3e1f4be10f 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -92,4 +92,20 @@ public class PaperWorldConfig { @@ -30,10 +30,10 @@ index de8680e4dd..02f7e506e3 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 6e324ad589..98b28e8573 100644 +index cc74150dae..9e95ede7fe 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -625,13 +625,13 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -626,13 +626,13 @@ public abstract class EntityInsentient extends EntityLiving { double d2 = entityhuman.locZ - this.locZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; diff --git a/Spigot-Server-Patches/0017-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/Spigot-Server-Patches/0017-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 173441174..37ad24433 100644 --- a/Spigot-Server-Patches/0017-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/Spigot-Server-Patches/0017-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -1,4 +1,4 @@ -From ecb394dbc65b8055e6ad852c4544a8a396f94577 Mon Sep 17 00:00:00 2001 +From efeb6f9214e94370e797ab1ea0dd4350515ee516 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 1 Mar 2016 14:32:43 -0600 Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang @@ -6,17 +6,17 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java -index 220ca7bca0..eb4b08be46 100644 +index b64cac2523..cc333de50b 100644 --- a/src/main/java/net/minecraft/server/EULA.java +++ b/src/main/java/net/minecraft/server/EULA.java -@@ -52,13 +52,12 @@ public class EULA { - +@@ -49,13 +49,12 @@ public class EULA { + Properties properties = new Properties(); fileoutputstream = new FileOutputStream(this.b); properties.setProperty("eula", "false"); - properties.store(fileoutputstream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)."); + properties.store(fileoutputstream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).\nYou also agree that tacos are tasty, and the best food in the world."); // Paper - fix lag); } catch (Exception exception) { - EULA.a.warn("Failed to save {}", this.b, exception); + a.warn("Failed to save {}", this.b, exception); } finally { IOUtils.closeQuietly(fileoutputstream); } diff --git a/Spigot-Server-Patches/0018-Player-affects-spawning-API.patch b/Spigot-Server-Patches/0018-Player-affects-spawning-API.patch index 49018f2a6..41551a8d1 100644 --- a/Spigot-Server-Patches/0018-Player-affects-spawning-API.patch +++ b/Spigot-Server-Patches/0018-Player-affects-spawning-API.patch @@ -1,11 +1,11 @@ -From aee8a7585f861c88ebca81c869f19e645de71abb Mon Sep 17 00:00:00 2001 +From 68ff51ddebbce42ce5b66cde1a790887799d0fc0 Mon Sep 17 00:00:00 2001 From: Jedediah Smith Date: Tue, 1 Mar 2016 14:47:52 -0600 Subject: [PATCH] Player affects spawning API diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 72477ec9ad..63f78924cb 100644 +index 9996c7f77b..89f3d17f24 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -72,6 +72,9 @@ public abstract class EntityHuman extends EntityLiving { @@ -19,10 +19,10 @@ index 72477ec9ad..63f78924cb 100644 // CraftBukkit start public boolean fauxSleeping; diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index d4e688d4c0..ec06f4badb 100644 +index 9e95ede7fe..6f5f3f8cd0 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -619,7 +619,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -620,7 +620,7 @@ public abstract class EntityInsentient extends EntityLiving { } else { EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); @@ -58,7 +58,7 @@ index cbdd2431fd..9e24b77ad1 100644 j = MathHelper.floor(entityhuman.locZ / 16.0D); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 30a46a50fb..dc49d9917e 100644 +index 237e6136f1..ce97cc99fa 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -34,6 +34,7 @@ import org.bukkit.craftbukkit.block.data.CraftBlockData; diff --git a/Spigot-Server-Patches/0020-Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/0020-Optimize-TileEntity-Ticking.patch index 0779f29f9..8170370ba 100644 --- a/Spigot-Server-Patches/0020-Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/0020-Optimize-TileEntity-Ticking.patch @@ -1,11 +1,24 @@ -From 13443f9b6f42a4de1fa7b993ef0a6b9bb3be23e2 Mon Sep 17 00:00:00 2001 +From fe5d1f6d166e14ba309e16fb90c12c82ab35e5c4 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 8 Mar 2015 22:55:25 -0600 Subject: [PATCH] Optimize TileEntity Ticking +diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java +index 9ffec378a9..5401f7d754 100644 +--- a/src/main/java/net/minecraft/server/BlockChest.java ++++ b/src/main/java/net/minecraft/server/BlockChest.java +@@ -216,7 +216,7 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC + } + + private boolean b(World world, BlockPosition blockposition) { +- List list = world.a(EntityOcelot.class, new AxisAlignedBB((double)blockposition.getX(), (double)(blockposition.getY() + 1), (double)blockposition.getZ(), (double)(blockposition.getX() + 1), (double)(blockposition.getY() + 2), (double)(blockposition.getZ() + 1))); ++ List list = world.a(EntityOcelot.class, new AxisAlignedBB((double)blockposition.getX(), (double)(blockposition.getY() + 1), (double)blockposition.getZ(), (double)(blockposition.getX() + 1), (double)(blockposition.getY() + 2), (double)(blockposition.getZ() + 1))); // Paper - decompile fix + if (!list.isEmpty()) { + for(EntityOcelot entityocelot : list) { + if (entityocelot.isSitting()) { diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index a534c441a..591524f1e 100644 +index ad601a39d9..9573a4ecdf 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; @@ -91,7 +104,7 @@ index a534c441a..591524f1e 100644 int newPower = Math.max(0, Math.min(15, this.f)); diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -index 61edd7cc6..9407a8c97 100644 +index 05de26405e..bc851d2a04 100644 --- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java +++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java @@ -1,6 +1,6 @@ @@ -99,10 +112,10 @@ index 61edd7cc6..9407a8c97 100644 -public class TileEntityEnderChest extends TileEntity implements ITickable { +public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickable - public float a; public float e; -@@ -17,19 +17,37 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { + public int f; +@@ -16,16 +16,34 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { } this.e = this.a; @@ -111,9 +124,7 @@ index 61edd7cc6..9407a8c97 100644 int i = this.position.getX(); int j = this.position.getY(); int k = this.position.getZ(); - float f = 0.1F; - double d0; -- + float fx = 0.1F; + */ + // Paper start + } @@ -121,13 +132,11 @@ index 61edd7cc6..9407a8c97 100644 + int i = this.position.getX(); + int j = this.position.getY(); + int k = this.position.getZ(); -+ double d0; + // Paper end if (this.f > 0 && this.a == 0.0F) { - double d1 = (double) i + 0.5D; - - d0 = (double) k + 0.5D; - this.world.a((EntityHuman) null, d1, (double) j + 0.5D, d0, SoundEffects.BLOCK_ENDER_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + double d0 = (double)i + 0.5D; + double d1 = (double)k + 0.5D; + this.world.a((EntityHuman)null, d0, (double)j + 0.5D, d1, SoundEffects.BLOCK_ENDER_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); } - + // Paper start @@ -140,9 +149,9 @@ index 61edd7cc6..9407a8c97 100644 + double d0; + // Paper end if (this.f == 0 && this.a > 0.0F || this.f > 0 && this.a < 1.0F) { - float f1 = this.a; - -@@ -76,11 +94,13 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { + float f2 = this.a; + if (this.f > 0) { +@@ -69,11 +87,13 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { public void c() { ++this.f; this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.f); diff --git a/Spigot-Server-Patches/0023-Entity-Origin-API.patch b/Spigot-Server-Patches/0023-Entity-Origin-API.patch index 1341519f8..a5a170a71 100644 --- a/Spigot-Server-Patches/0023-Entity-Origin-API.patch +++ b/Spigot-Server-Patches/0023-Entity-Origin-API.patch @@ -1,4 +1,4 @@ -From 461fec266464fc475ee8800bed57be571fcd9670 Mon Sep 17 00:00:00 2001 +From 43ff1bdb607251450bc4ff1afb74108eddb1d4d2 Mon Sep 17 00:00:00 2001 From: Byteflux Date: Tue, 1 Mar 2016 23:45:08 -0600 Subject: [PATCH] Entity Origin API @@ -89,19 +89,19 @@ index 5ceb3f2068..87f3205f82 100644 @Nullable diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index a8280acf94..38dd8f17a6 100644 +index 769d599c59..e37da10e09 100644 --- a/src/main/java/net/minecraft/server/NBTTagList.java +++ b/src/main/java/net/minecraft/server/NBTTagList.java -@@ -182,6 +182,7 @@ public class NBTTagList extends NBTList { +@@ -174,6 +174,7 @@ public class NBTTagList extends NBTList { return new int[0]; } + public final double getDoubleAt(int i) { return this.k(i); } // Paper - OBFHELPER public double k(int i) { if (i >= 0 && i < this.list.size()) { - NBTBase nbtbase = (NBTBase) this.list.get(i); + NBTBase nbtbase = (NBTBase)this.list.get(i); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index dc49d9917e..be2feb441d 100644 +index ce97cc99fa..cf359d6d9e 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -961,6 +961,12 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc diff --git a/Spigot-Server-Patches/0044-Configurable-Disabling-Cat-Chest-Detection.patch b/Spigot-Server-Patches/0044-Configurable-Disabling-Cat-Chest-Detection.patch index dfeb21d8b..d4b668c89 100644 --- a/Spigot-Server-Patches/0044-Configurable-Disabling-Cat-Chest-Detection.patch +++ b/Spigot-Server-Patches/0044-Configurable-Disabling-Cat-Chest-Detection.patch @@ -1,4 +1,4 @@ -From 450ef34e2ad19b38f7904431dc535982919b165d Mon Sep 17 00:00:00 2001 +From b24a519f9092f69021b72e5a48e3c8514669932a Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 01:13:45 -0600 Subject: [PATCH] Configurable Disabling Cat Chest Detection @@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Disabling Cat Chest Detection Offers a gameplay feature to stop cats from blocking chests diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f8d2aae08..d91b48b0a 100644 +index 34007dbf4f..b27934cfc5 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -173,4 +173,9 @@ public class PaperWorldConfig { @@ -20,10 +20,10 @@ index f8d2aae08..d91b48b0a 100644 + } } diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java -index 0f6902747..1ad39aca3 100644 +index 5401f7d754..27e6d2b5f2 100644 --- a/src/main/java/net/minecraft/server/BlockChest.java +++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -235,6 +235,11 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC +@@ -216,6 +216,11 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC } private boolean b(World world, BlockPosition blockposition) { @@ -32,9 +32,9 @@ index 0f6902747..1ad39aca3 100644 + return false; + } + // Paper end - List list = world.a(EntityOcelot.class, new AxisAlignedBB((double) blockposition.getX(), (double) (blockposition.getY() + 1), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 2), (double) (blockposition.getZ() + 1))); - + List list = world.a(EntityOcelot.class, new AxisAlignedBB((double)blockposition.getX(), (double)(blockposition.getY() + 1), (double)blockposition.getZ(), (double)(blockposition.getX() + 1), (double)(blockposition.getY() + 2), (double)(blockposition.getZ() + 1))); // Paper - decompile fix if (!list.isEmpty()) { + for(EntityOcelot entityocelot : list) { -- 2.18.0 diff --git a/Spigot-Server-Patches/0047-Optimize-Pathfinding.patch b/Spigot-Server-Patches/0047-Optimize-Pathfinding.patch index ed5f4093c..9d18a3948 100644 --- a/Spigot-Server-Patches/0047-Optimize-Pathfinding.patch +++ b/Spigot-Server-Patches/0047-Optimize-Pathfinding.patch @@ -1,4 +1,4 @@ -From a582f2795d2b29ef1c1d52de9dafde6db552ec36 Mon Sep 17 00:00:00 2001 +From 715fb2ad02cc5da7554f941ec7d7958406f0bffb Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 02:02:07 -0600 Subject: [PATCH] Optimize Pathfinding @@ -7,10 +7,10 @@ Prevents pathfinding from spamming failures for things such as arrow attacks. diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 62cb81516..8111317e3 100644 +index d1d16b25d0..5d6f726d05 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -122,10 +122,26 @@ public abstract class NavigationAbstract { +@@ -113,9 +113,26 @@ public abstract class NavigationAbstract { } public boolean a(Entity entity, double d0) { @@ -20,8 +20,8 @@ index 62cb81516..8111317e3 100644 + } + PathEntity pathentity = this.a(entity); - - return pathentity != null && this.a(pathentity, d0); ++ + if (pathentity != null && this.a(pathentity, d0)) { + this.lastFailure = 0; + this.pathfindFailures = 0; @@ -38,7 +38,7 @@ index 62cb81516..8111317e3 100644 public boolean a(@Nullable PathEntity pathentity, double d0) { if (pathentity == null) { -@@ -258,6 +274,7 @@ public abstract class NavigationAbstract { +@@ -241,6 +258,7 @@ public abstract class NavigationAbstract { } public void q() { diff --git a/Spigot-Server-Patches/0051-Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/0051-Player-Tab-List-and-Title-APIs.patch index 00e832e99..95478f2dd 100644 --- a/Spigot-Server-Patches/0051-Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-Server-Patches/0051-Player-Tab-List-and-Title-APIs.patch @@ -1,17 +1,17 @@ -From 5e5577be71456db68a07895d330eb51ef93d542a Mon Sep 17 00:00:00 2001 +From 912940219423c9a3d0ceacbc4d7628285dcd35f4 Mon Sep 17 00:00:00 2001 From: Techcable Date: Thu, 3 Mar 2016 02:32:10 -0600 Subject: [PATCH] Player Tab List and Title APIs diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java -index 7b18c16402..900bd83570 100644 +index 267b69de30..29cbe15a82 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java -@@ -11,6 +11,18 @@ public class PacketPlayOutTitle implements Packet { - private int d; - private int e; +@@ -12,6 +12,17 @@ public class PacketPlayOutTitle implements Packet { + public PacketPlayOutTitle() { + } + // Paper start + public net.md_5.bungee.api.chat.BaseComponent[] components; + @@ -23,13 +23,12 @@ index 7b18c16402..900bd83570 100644 + this.e = fadeOut; + } + // Paper end -+ - public PacketPlayOutTitle() {} - public PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent) { -@@ -46,7 +58,13 @@ public class PacketPlayOutTitle implements Packet { + public PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction packetplayouttitle$enumtitleaction, IChatBaseComponent ichatbasecomponent) { + this(packetplayouttitle$enumtitleaction, ichatbasecomponent, -1, -1, -1); +@@ -46,7 +57,13 @@ public class PacketPlayOutTitle implements Packet { public void b(PacketDataSerializer packetdataserializer) throws IOException { - packetdataserializer.a((Enum) this.a); + packetdataserializer.a((Enum)this.a); if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE || this.a == PacketPlayOutTitle.EnumTitleAction.ACTIONBAR) { - packetdataserializer.a(this.b); + // Paper start diff --git a/Spigot-Server-Patches/0057-Add-exception-reporting-event.patch b/Spigot-Server-Patches/0057-Add-exception-reporting-event.patch index 770f6be57..957e55171 100644 --- a/Spigot-Server-Patches/0057-Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/0057-Add-exception-reporting-event.patch @@ -1,4 +1,4 @@ -From 46bd7a802f08c9106ebb2057d140b8f59e423e7e Mon Sep 17 00:00:00 2001 +From f619275b362dced2e0f375bb68620b2c7e20355d Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld Date: Thu, 3 Mar 2016 03:15:41 -0600 Subject: [PATCH] Add exception reporting event @@ -6,7 +6,7 @@ Subject: [PATCH] Add exception reporting event diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java new file mode 100644 -index 000000000..93397188b +index 0000000000..93397188b7 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java @@ -0,0 +1,38 @@ @@ -50,7 +50,7 @@ index 000000000..93397188b +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index d41cd7a6e..68f845986 100644 +index d41cd7a6e9..68f8459861 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -1,5 +1,6 @@ @@ -89,7 +89,7 @@ index d41cd7a6e..68f845986 100644 } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 1379b574e..6b041f06e 100644 +index 1379b574ef..6b041f06e4 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -15,6 +15,7 @@ import java.util.function.BooleanSupplier; @@ -118,7 +118,7 @@ index 1379b574e..6b041f06e 100644 } diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index 1d830dff6..58d971cf2 100644 +index 1d830dff64..58d971cf20 100644 --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java @@ -1,5 +1,6 @@ @@ -145,7 +145,7 @@ index 1d830dff6..58d971cf2 100644 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 31899549d..cc7cad8be 100644 +index f991fddf7d..e888c9bdba 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -1,5 +1,6 @@ @@ -155,7 +155,7 @@ index 31899549d..cc7cad8be 100644 import com.google.common.collect.Lists; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; -@@ -82,6 +83,7 @@ public class RegionFile { +@@ -75,6 +76,7 @@ public class RegionFile { } } catch (IOException ioexception) { ioexception.printStackTrace(); @@ -163,8 +163,8 @@ index 31899549d..cc7cad8be 100644 } } -@@ -237,6 +239,7 @@ public class RegionFile { - this.b(i, j, (int) (SystemUtils.d() / 1000L)); +@@ -221,6 +223,7 @@ public class RegionFile { + this.b(i, j, (int)(SystemUtils.d() / 1000L)); } catch (IOException ioexception) { ioexception.printStackTrace(); + ServerInternalException.reportInternalException(ioexception); // Paper @@ -172,7 +172,7 @@ index 31899549d..cc7cad8be 100644 } diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index d18921271..e5115863e 100644 +index d18921271f..e5115863ec 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java @@ -1,5 +1,6 @@ @@ -191,7 +191,7 @@ index d18921271..e5115863e 100644 } diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 9e24b77ad..f32191c5a 100644 +index 9e24b77ad1..f32191c5a2 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -10,6 +10,7 @@ import org.apache.logging.log4j.LogManager; @@ -219,7 +219,7 @@ index 9e24b77ad..f32191c5a 100644 } diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index e649d662a..560edb523 100644 +index e649d662ae..560edb523f 100644 --- a/src/main/java/net/minecraft/server/VillageSiege.java +++ b/src/main/java/net/minecraft/server/VillageSiege.java @@ -1,5 +1,7 @@ @@ -239,7 +239,7 @@ index e649d662a..560edb523 100644 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 8af8cf2ee..561bcd07b 100644 +index 8af8cf2ee5..561bcd07b3 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1,6 +1,8 @@ @@ -276,7 +276,7 @@ index 8af8cf2ee..561bcd07b 100644 this.tileEntityListTick.remove(tileTickPosition--); continue; diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java -index 65931bfb5..625335c60 100644 +index 65931bfb5f..625335c60f 100644 --- a/src/main/java/net/minecraft/server/WorldPersistentData.java +++ b/src/main/java/net/minecraft/server/WorldPersistentData.java @@ -138,6 +138,7 @@ public class WorldPersistentData { @@ -288,7 +288,7 @@ index 65931bfb5..625335c60 100644 throw throwable1; } finally { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 93b9134d6..26753fac5 100644 +index 93b9134d6e..26753fac5e 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -15,6 +15,9 @@ import java.util.concurrent.atomic.AtomicReference; diff --git a/Spigot-Server-Patches/0062-Chunk-save-queue-improvements.patch b/Spigot-Server-Patches/0062-Chunk-save-queue-improvements.patch index 75ed4230f..f0264c85d 100644 --- a/Spigot-Server-Patches/0062-Chunk-save-queue-improvements.patch +++ b/Spigot-Server-Patches/0062-Chunk-save-queue-improvements.patch @@ -1,4 +1,4 @@ -From 5cf50182ea6201707d4281655d44182f4272fd8f Mon Sep 17 00:00:00 2001 +From e5c85fe8b8be9af8965d9b2ab7aa871edfa14b96 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 4 Mar 2016 18:18:37 -0600 Subject: [PATCH] Chunk save queue improvements @@ -137,15 +137,15 @@ index f969c036f3..2b0a088a6a 100644 NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); dataoutputstream.close(); diff --git a/src/main/java/net/minecraft/server/FileIOThread.java b/src/main/java/net/minecraft/server/FileIOThread.java -index 8c3537ab8d..3c688f546c 100644 +index a3aba244af..97917551a4 100644 --- a/src/main/java/net/minecraft/server/FileIOThread.java +++ b/src/main/java/net/minecraft/server/FileIOThread.java -@@ -38,20 +38,21 @@ public class FileIOThread implements Runnable { - IAsyncChunkSaver iasyncchunksaver = (IAsyncChunkSaver) this.c.get(i); +@@ -35,20 +35,21 @@ public class FileIOThread implements Runnable { + for(int i = 0; i < this.c.size(); ++i) { + IAsyncChunkSaver iasyncchunksaver = (IAsyncChunkSaver)this.c.get(i); boolean flag; - -- synchronized (iasyncchunksaver) { -+ //synchronized (iasyncchunksaver) { // Paper - remove synchronized +- synchronized(iasyncchunksaver) { ++ //synchronized(iasyncchunksaver) { // Paper - remove synchronized flag = iasyncchunksaver.a(); - } + //} // Paper @@ -159,8 +159,8 @@ index 8c3537ab8d..3c688f546c 100644 try { - Thread.sleep(this.f ? 0L : 10L); + Thread.sleep(this.f ? 0L : 1L); // Paper - } catch (InterruptedException interruptedexception) { - interruptedexception.printStackTrace(); + } catch (InterruptedException interruptedexception1) { + interruptedexception1.printStackTrace(); - } + }} // Paper } diff --git a/Spigot-Server-Patches/0063-Chunk-Save-Reattempt.patch b/Spigot-Server-Patches/0063-Chunk-Save-Reattempt.patch index ad9fd7fa0..dcfeed070 100644 --- a/Spigot-Server-Patches/0063-Chunk-Save-Reattempt.patch +++ b/Spigot-Server-Patches/0063-Chunk-Save-Reattempt.patch @@ -1,4 +1,4 @@ -From 63f3b781dc0ddb6de219759f112f4d18cae510a5 Mon Sep 17 00:00:00 2001 +From 3cd840042adadf44252ecfc09aa287e8d531c74b Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 4 Mar 2013 23:46:10 -0500 Subject: [PATCH] Chunk Save Reattempt @@ -6,12 +6,12 @@ Subject: [PATCH] Chunk Save Reattempt We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks. diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index cc7cad8be4..b8b514c874 100644 +index e888c9bdba..f4405be395 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -238,8 +238,7 @@ public class RegionFile { +@@ -222,8 +222,7 @@ public class RegionFile { - this.b(i, j, (int) (SystemUtils.d() / 1000L)); + this.b(i, j, (int)(SystemUtils.d() / 1000L)); } catch (IOException ioexception) { - ioexception.printStackTrace(); - ServerInternalException.reportInternalException(ioexception); // Paper diff --git a/Spigot-Server-Patches/0071-Optimized-Light-Level-Comparisons.patch b/Spigot-Server-Patches/0071-Optimized-Light-Level-Comparisons.patch index c4357a9cb..31204b5e5 100644 --- a/Spigot-Server-Patches/0071-Optimized-Light-Level-Comparisons.patch +++ b/Spigot-Server-Patches/0071-Optimized-Light-Level-Comparisons.patch @@ -1,4 +1,4 @@ -From 9bea77a9d0eb0bba8a3c97c3782630e66e802bd5 Mon Sep 17 00:00:00 2001 +From 75b8c8e24cd6b38751500103dee0b8add52379a5 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 18 Mar 2016 21:22:56 -0400 Subject: [PATCH] Optimized Light Level Comparisons @@ -47,15 +47,14 @@ index 4fc8c5d3c6..0fc39bb9fb 100644 if (random.nextInt((int) ((100.0F / (this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier)) * (25.0F / f)) + 1) == 0) { // Spigot diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index a3449e9a8d..5f60bf04e6 100644 +index f3cc2cef0a..7cba60e475 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java -@@ -65,9 +65,18 @@ public abstract class EntityMonster extends EntityCreature implements IMonster { +@@ -63,8 +63,18 @@ public abstract class EntityMonster extends EntityCreature implements IMonster { if (this.world.getBrightness(EnumSkyBlock.SKY, blockposition) > this.random.nextInt(32)) { return false; } else { - int i = this.world.Y() ? this.world.d(blockposition, 10) : this.world.getLightLevel(blockposition); -- - return i <= this.random.nextInt(8); + // Paper start - optimized light check, returns faster + boolean passes; diff --git a/Spigot-Server-Patches/0072-Pass-world-to-Village-creation.patch b/Spigot-Server-Patches/0072-Pass-world-to-Village-creation.patch index f47750e69..9ff4709e1 100644 --- a/Spigot-Server-Patches/0072-Pass-world-to-Village-creation.patch +++ b/Spigot-Server-Patches/0072-Pass-world-to-Village-creation.patch @@ -1,4 +1,4 @@ -From 4bf18616eaab7071c7f2b337dd9195d419103f4e Mon Sep 17 00:00:00 2001 +From e1a7033e3c4af7eb6dae4c51bf3a2f02ea02654d Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 19 Mar 2016 15:16:54 -0400 Subject: [PATCH] Pass world to Village creation @@ -6,18 +6,18 @@ Subject: [PATCH] Pass world to Village creation fixes NPE bug #95 diff --git a/src/main/java/net/minecraft/server/PersistentVillage.java b/src/main/java/net/minecraft/server/PersistentVillage.java -index 98c6bbc183..7a9fb97530 100644 +index d58f6b2a86..d14a9e3a3e 100644 --- a/src/main/java/net/minecraft/server/PersistentVillage.java +++ b/src/main/java/net/minecraft/server/PersistentVillage.java -@@ -237,7 +237,7 @@ public class PersistentVillage extends PersistentBase { +@@ -202,7 +202,7 @@ public class PersistentVillage extends PersistentBase { - for (int i = 0; i < nbttaglist.size(); ++i) { + for(int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompound(i); - Village village = new Village(); + Village village = new Village(world); // Paper - village.a(nbttagcompound1); this.villages.add(village); + } diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java index f87e8e05af..bda67faefe 100644 --- a/src/main/java/net/minecraft/server/Village.java diff --git a/Spigot-Server-Patches/0076-Waving-banner-workaround.patch b/Spigot-Server-Patches/0076-Waving-banner-workaround.patch index cf2674599..8577692a6 100644 --- a/Spigot-Server-Patches/0076-Waving-banner-workaround.patch +++ b/Spigot-Server-Patches/0076-Waving-banner-workaround.patch @@ -1,4 +1,4 @@ -From 2a68d81ec369c7a193a9c0923daddb9f92db523d Mon Sep 17 00:00:00 2001 +From be2605540c49de075459ddf5825d142b945c57eb Mon Sep 17 00:00:00 2001 From: Gabscap Date: Sat, 19 Mar 2016 22:25:11 +0100 Subject: [PATCH] Waving banner workaround @@ -6,13 +6,13 @@ Subject: [PATCH] Waving banner workaround This patch is a workaround for MC-63720 diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java -index c5c3f40ce0..6413f76e78 100644 +index 731b96dea2..2a0fd2fbc0 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java -@@ -4,7 +4,13 @@ import java.io.IOException; +@@ -3,7 +3,13 @@ package net.minecraft.server; + import java.io.IOException; public class PacketPlayOutUpdateTime implements Packet { - + // World Age in ticks + // Not changed by server commands + // World Age must not be negative @@ -22,7 +22,7 @@ index c5c3f40ce0..6413f76e78 100644 + // Displayed in the debug screen (F3) private long b; - public PacketPlayOutUpdateTime() {} + public PacketPlayOutUpdateTime() { @@ -19,6 +25,9 @@ public class PacketPlayOutUpdateTime implements Packet { } } diff --git a/Spigot-Server-Patches/0081-Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/0081-Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 96a02a99d..9a79283db 100644 --- a/Spigot-Server-Patches/0081-Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/0081-Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -1,4 +1,4 @@ -From fab7f2c8c325f68616b896713a552c7336180264 Mon Sep 17 00:00:00 2001 +From 2429e8939eb62f6c57e3b5a6ab067e0942371932 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 02:07:55 -0600 Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for inling @@ -12,10 +12,10 @@ Replace all calls to the new place to the unnecessary forward. Optimize getType and getBlockData to manually inline and optimize the calls diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index e2a7b4be2c..58f8b4b720 100644 +index 4048937c63..680764b342 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -10,6 +10,14 @@ public class BaseBlockPosition implements Comparable { +@@ -9,6 +9,14 @@ public class BaseBlockPosition implements Comparable { private final int a; private final int b; private final int c; @@ -31,10 +31,10 @@ index e2a7b4be2c..58f8b4b720 100644 public BaseBlockPosition(int i, int j, int k) { this.a = i; diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index ca5c56c2b6..42e5e9ad8f 100644 +index 5ed34cf7e3..f4ed98d2d9 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -342,6 +342,16 @@ public class BlockPosition extends BaseBlockPosition { +@@ -239,6 +239,16 @@ public class BlockPosition extends BaseBlockPosition { protected int b; protected int c; protected int d; @@ -52,7 +52,7 @@ index ca5c56c2b6..42e5e9ad8f 100644 public MutableBlockPosition() { this(0, 0, 0); diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index d86b925f0d..30dc4fb6df 100644 +index dcd122d8b5..dee1f7bfe9 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -427,12 +427,24 @@ public class Chunk implements IChunkAccess { @@ -84,10 +84,10 @@ index d86b925f0d..30dc4fb6df 100644 IBlockData iblockdata = null; diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 35aea4829f..233cbb6d60 100644 +index 274c449480..7e4c79a1ce 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -9,7 +9,7 @@ public class ChunkSection { +@@ -6,7 +6,7 @@ public class ChunkSection { private int nonEmptyBlockCount; private int tickingBlockCount; private int e; @@ -97,7 +97,7 @@ index 35aea4829f..233cbb6d60 100644 private NibbleArray skyLight; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index fd6f070417..45b0880607 100644 +index 94872593b1..ee5d4c5272 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -263,11 +263,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc diff --git a/Spigot-Server-Patches/0086-EntityPathfindEvent.patch b/Spigot-Server-Patches/0086-EntityPathfindEvent.patch index 1918380c3..affe2d4eb 100644 --- a/Spigot-Server-Patches/0086-EntityPathfindEvent.patch +++ b/Spigot-Server-Patches/0086-EntityPathfindEvent.patch @@ -1,4 +1,4 @@ -From da0eaa98bb3f62b2ddc2b3c3b4a29719605594da Mon Sep 17 00:00:00 2001 +From dcfdcaf5f2a8ecd65785d2c4b729e674bf262523 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 21:22:26 -0400 Subject: [PATCH] EntityPathfindEvent @@ -6,34 +6,34 @@ Subject: [PATCH] EntityPathfindEvent Fires when an Entity decides to start moving to a location. diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 8111317e31..76d1f4bd21 100644 +index 5d6f726d05..a8b070ed32 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -4,7 +4,7 @@ import javax.annotation.Nullable; +@@ -3,7 +3,7 @@ package net.minecraft.server; + import javax.annotation.Nullable; public abstract class NavigationAbstract { - - protected EntityInsentient a; + protected EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER protected World b; @Nullable protected PathEntity c; -@@ -78,6 +78,7 @@ public abstract class NavigationAbstract { +@@ -74,6 +74,7 @@ public abstract class NavigationAbstract { } else if (this.c != null && !this.c.b() && blockposition.equals(this.q)) { return this.c; } else { + if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), MCUtil.toLocation(getEntity().world, blockposition), null).callEvent()) { return null; } // Paper this.q = blockposition; - float f = this.j(); - -@@ -102,6 +103,7 @@ public abstract class NavigationAbstract { + float fx = this.j(); + this.b.methodProfiler.a("pathfind"); +@@ -95,6 +96,7 @@ public abstract class NavigationAbstract { if (this.c != null && !this.c.b() && blockposition.equals(this.q)) { return this.c; } else { + if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), MCUtil.toLocation(entity.world, blockposition), entity.getBukkitEntity()).callEvent()) { return null; } // Paper this.q = blockposition; - float f = this.j(); - + float fx = this.j(); + this.b.methodProfiler.a("pathfind"); -- 2.18.0 diff --git a/Spigot-Server-Patches/0087-Reduce-IO-ops-opening-a-new-region-file.patch b/Spigot-Server-Patches/0087-Reduce-IO-ops-opening-a-new-region-file.patch index ca23a1e80..6d8e45f24 100644 --- a/Spigot-Server-Patches/0087-Reduce-IO-ops-opening-a-new-region-file.patch +++ b/Spigot-Server-Patches/0087-Reduce-IO-ops-opening-a-new-region-file.patch @@ -1,11 +1,11 @@ -From 37a926f3964c8a76bead6516f01cf84b75646f00 Mon Sep 17 00:00:00 2001 +From 7e1a19b733518affda90a116c3576335ae14f565 Mon Sep 17 00:00:00 2001 From: Antony Riley Date: Tue, 29 Mar 2016 06:56:23 +0300 Subject: [PATCH] Reduce IO ops opening a new region file. diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index b8b514c874..cba2373125 100644 +index f4405be395..5d2853b9ce 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -8,9 +8,12 @@ import java.io.ByteArrayInputStream; @@ -21,9 +21,9 @@ index b8b514c874..cba2373125 100644 import java.util.List; import java.util.zip.DeflaterOutputStream; import java.util.zip.GZIPInputStream; -@@ -67,8 +70,16 @@ public class RegionFile { - - int k; +@@ -60,8 +63,16 @@ public class RegionFile { + this.f.set(1, false); + this.c.seek(0L); + // Paper Start + ByteBuffer header = ByteBuffer.allocate(8192); @@ -33,19 +33,19 @@ index b8b514c874..cba2373125 100644 + header.clear(); + IntBuffer headerAsInts = header.asIntBuffer(); + // Paper End - for (j = 0; j < 1024; ++j) { -- k = this.c.readInt(); -+ k = headerAsInts.get(); // Paper - this.d[j] = k; + for(int j1 = 0; j1 < 1024; ++j1) { +- int k = this.c.readInt(); ++ int k = headerAsInts.get(); // Paper + this.d[j1] = k; if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) { - for (int l = 0; l < (k & 255); ++l) { -@@ -78,7 +89,7 @@ public class RegionFile { + for(int l = 0; l < (k & 255); ++l) { +@@ -71,7 +82,7 @@ public class RegionFile { } - for (j = 0; j < 1024; ++j) { -- k = this.c.readInt(); -+ k = headerAsInts.get(); // Paper - this.e[j] = k; + for(int k1 = 0; k1 < 1024; ++k1) { +- int l1 = this.c.readInt(); ++ int l1 = headerAsInts.get(); // Paper + this.e[k1] = l1; } } catch (IOException ioexception) { -- diff --git a/Spigot-Server-Patches/0091-Add-PlayerUseUnknownEntityEvent.patch b/Spigot-Server-Patches/0091-Add-PlayerUseUnknownEntityEvent.patch index 006480297..a6d24efd8 100644 --- a/Spigot-Server-Patches/0091-Add-PlayerUseUnknownEntityEvent.patch +++ b/Spigot-Server-Patches/0091-Add-PlayerUseUnknownEntityEvent.patch @@ -1,24 +1,24 @@ -From 1a421550b37ed9ab1ebc5ce9982d279eb701db40 Mon Sep 17 00:00:00 2001 +From a4e04803a51a04f1963738c2c8b147ad162daed0 Mon Sep 17 00:00:00 2001 From: Jedediah Smith Date: Sat, 2 Apr 2016 05:09:16 -0400 Subject: [PATCH] Add PlayerUseUnknownEntityEvent diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -index 77440ac81f..8711462e16 100644 +index a4b98c81f5..53d38ea40f 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -@@ -5,7 +5,7 @@ import javax.annotation.Nullable; +@@ -4,7 +4,7 @@ import java.io.IOException; + import javax.annotation.Nullable; public class PacketPlayInUseEntity implements Packet { - - private int a; + private int a; public int getEntityId() { return this.a; } // Paper - add accessor private PacketPlayInUseEntity.EnumEntityUseAction action; private Vec3D c; private EnumHand d; diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 3257f41713..096e4e0d8c 100644 +index 62f35d2672..306ef5bf79 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -1903,6 +1903,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { diff --git a/Spigot-Server-Patches/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch b/Spigot-Server-Patches/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch index d5af6f012..d2490272a 100644 --- a/Spigot-Server-Patches/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch +++ b/Spigot-Server-Patches/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch @@ -1,11 +1,11 @@ -From 662ab65f604cf092e448c87a514adb3150c11449 Mon Sep 17 00:00:00 2001 +From 1285cf28b6ff0e40cd76bc64122577d31fcbbcc5 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 5 Apr 2016 19:42:22 -0400 Subject: [PATCH] Don't spam reload spawn chunks in nether/end diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0cdebf702a..8abe3cdd92 100644 +index 4ea7bc53e6..f5741b2b36 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -2864,6 +2864,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc @@ -25,11 +25,11 @@ index 0cdebf702a..8abe3cdd92 100644 ForcedChunk forcedchunk = (ForcedChunk) this.a(this.worldProvider.getDimensionManager(), ForcedChunk::new, "chunks"); diff --git a/src/main/java/net/minecraft/server/WorldProvider.java b/src/main/java/net/minecraft/server/WorldProvider.java -index bca5e50d98..088e7306cb 100644 +index 517b1e7124..0e654ebf70 100644 --- a/src/main/java/net/minecraft/server/WorldProvider.java +++ b/src/main/java/net/minecraft/server/WorldProvider.java -@@ -69,7 +69,7 @@ public abstract class WorldProvider { - public void l() {} +@@ -72,7 +72,7 @@ public abstract class WorldProvider { + } public boolean a(int i, int j) { - return !this.b.f(i, j); diff --git a/Spigot-Server-Patches/0097-Remove-Debug-checks-from-DataBits.patch b/Spigot-Server-Patches/0097-Remove-Debug-checks-from-DataBits.patch index 65e95ca3f..7567e3d7a 100644 --- a/Spigot-Server-Patches/0097-Remove-Debug-checks-from-DataBits.patch +++ b/Spigot-Server-Patches/0097-Remove-Debug-checks-from-DataBits.patch @@ -1,4 +1,4 @@ -From ca661277ab0b0df75c267368ac65590de2561fff Mon Sep 17 00:00:00 2001 +From 15c0961341cb53d2ff8701e59812bd92a462b07e Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 5 Apr 2016 21:38:58 -0400 Subject: [PATCH] Remove Debug checks from DataBits @@ -9,34 +9,34 @@ Before: http://i.imgur.com/nQsMzAE.png After: http://i.imgur.com/nJ46crB.png diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index d24ec3d53c..0fb3162e65 100644 +index 0dc948a375..f4de7fcf4b 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java -@@ -14,7 +14,7 @@ public class DataBits { +@@ -13,7 +13,7 @@ public class DataBits { } public DataBits(int i, int j, long[] along) { -- Validate.inclusiveBetween(1L, 32L, (long) i); -+ //Validate.inclusiveBetween(1L, 32L, (long) i); // Paper +- Validate.inclusiveBetween(1L, 32L, (long)i); ++ //Validate.inclusiveBetween(1L, 32L, (long)i); // Paper this.d = j; this.b = i; this.a = along; -@@ -27,8 +27,8 @@ public class DataBits { +@@ -25,8 +25,8 @@ public class DataBits { } public void a(int i, int j) { -- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); -- Validate.inclusiveBetween(0L, this.c, (long) j); -+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper -+ //Validate.inclusiveBetween(0L, this.c, (long) j); // Paper +- Validate.inclusiveBetween(0L, (long)(this.d - 1), (long)i); +- Validate.inclusiveBetween(0L, this.c, (long)j); ++ //Validate.inclusiveBetween(0L, (long)(this.d - 1), (long)i); // Paper ++ //Validate.inclusiveBetween(0L, this.c, (long)j); // Paper int k = i * this.b; int l = k / 64; int i1 = ((i + 1) * this.b - 1) / 64; -@@ -45,7 +45,7 @@ public class DataBits { +@@ -41,7 +41,7 @@ public class DataBits { } public int a(int i) { -- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); +- Validate.inclusiveBetween(0L, (long)(this.d - 1), (long)i); + //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper int j = i * this.b; int k = j / 64; diff --git a/Spigot-Server-Patches/0102-Configurable-Player-Collision.patch b/Spigot-Server-Patches/0102-Configurable-Player-Collision.patch index 306256a1b..87bb0649a 100644 --- a/Spigot-Server-Patches/0102-Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/0102-Configurable-Player-Collision.patch @@ -1,4 +1,4 @@ -From 6a566069cdf12ba0a87144cc0f2da39bdbee1b82 Mon Sep 17 00:00:00 2001 +From 2646887209eb8d478346b5d4ec3ff68011d4405b Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 13 Apr 2016 02:10:49 -0400 Subject: [PATCH] Configurable Player Collision @@ -19,7 +19,7 @@ index a6042ca607..9fe1311143 100644 + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3fe374acb2..b45cdcd09f 100644 +index f96da53b18..c7791dd925 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -424,6 +424,19 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -43,16 +43,16 @@ index 3fe374acb2..b45cdcd09f 100644 protected void a(File file, WorldData worlddata) { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -index a6aed2531f..575e3762b2 100644 +index f7a9b9d885..7befd80cf5 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -@@ -94,7 +94,7 @@ public class PacketPlayOutScoreboardTeam implements Packet Date: Sat, 16 Apr 2016 00:39:33 -0400 Subject: [PATCH] Configurable RCON IP address @@ -6,10 +6,10 @@ Subject: [PATCH] Configurable RCON IP address For servers with multiple IP's, ability to bind to a specific interface. diff --git a/src/main/java/net/minecraft/server/RemoteControlListener.java b/src/main/java/net/minecraft/server/RemoteControlListener.java -index f91da84ff9..3d831b358b 100644 +index 32244b55a2..4bfd41af18 100644 --- a/src/main/java/net/minecraft/server/RemoteControlListener.java +++ b/src/main/java/net/minecraft/server/RemoteControlListener.java -@@ -24,7 +24,7 @@ public class RemoteControlListener extends RemoteConnectionThread { +@@ -23,7 +23,7 @@ public class RemoteControlListener extends RemoteConnectionThread { super(iminecraftserver, "RCON Listener"); this.h = iminecraftserver.a("rcon.port", 0); this.l = iminecraftserver.a("rcon.password", ""); diff --git a/Spigot-Server-Patches/0108-Add-ability-to-configure-frosted_ice-properties.patch b/Spigot-Server-Patches/0108-Add-ability-to-configure-frosted_ice-properties.patch index dc8b2792a..0cfe7b0fd 100644 --- a/Spigot-Server-Patches/0108-Add-ability-to-configure-frosted_ice-properties.patch +++ b/Spigot-Server-Patches/0108-Add-ability-to-configure-frosted_ice-properties.patch @@ -1,11 +1,11 @@ -From b10a2ee44d33c6b5cd078b16becfba07f9b57fa3 Mon Sep 17 00:00:00 2001 +From 20e4fb71f59a552f2df178ab805c5c911a76d2e2 Mon Sep 17 00:00:00 2001 From: kashike Date: Thu, 21 Apr 2016 23:51:55 -0700 Subject: [PATCH] Add ability to configure frosted_ice properties diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 56a25531b4..25a5333219 100644 +index 3628ddb4db..df2863ce1b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -247,4 +247,14 @@ public class PaperWorldConfig { @@ -24,26 +24,32 @@ index 56a25531b4..25a5333219 100644 + } } diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java -index 39b3c88d64..302d420512 100644 +index af6c744ad3..7bea86f52b 100644 --- a/src/main/java/net/minecraft/server/BlockIceFrost.java +++ b/src/main/java/net/minecraft/server/BlockIceFrost.java -@@ -12,6 +12,7 @@ public class BlockIceFrost extends BlockIce { +@@ -11,19 +11,20 @@ public class BlockIceFrost extends BlockIce { } public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice - if ((random.nextInt(3) == 0 || this.a(world, blockposition, 4)) && world.getLightLevel(blockposition) > 11 - ((Integer) iblockdata.get(BlockIceFrost.a)).intValue() - iblockdata.b(world, blockposition) && this.c(iblockdata, world, blockposition)) { - BlockPosition.b blockposition_b = BlockPosition.b.r(); - Throwable throwable = null; -@@ -27,7 +28,7 @@ public class BlockIceFrost extends BlockIce { - IBlockData iblockdata1 = world.getType(blockposition_b); - - if (iblockdata1.getBlock() == this && !this.c(iblockdata1, world, blockposition_b)) { -- world.J().a(blockposition_b, this, MathHelper.nextInt(random, 20, 40)); -+ world.J().a(blockposition_b, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay + if ((random.nextInt(3) == 0 || this.a(world, blockposition, 4)) && world.getLightLevel(blockposition) > 11 - iblockdata.get(a) - iblockdata.b(world, blockposition) && this.c(iblockdata, world, blockposition)) { + try (BlockPosition.b blockposition$b = BlockPosition.b.r()) { + for(EnumDirection enumdirection : EnumDirection.values()) { + blockposition$b.j(blockposition).d(enumdirection); + IBlockData iblockdata1 = world.getType(blockposition$b); + if (iblockdata1.getBlock() == this && !this.c(iblockdata1, world, blockposition$b)) { +- world.J().a(blockposition$b, this, MathHelper.nextInt(random, 20, 40)); ++ world.J().a(blockposition$b, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay } } - } catch (Throwable throwable1) { + } + + } else { +- world.J().a(blockposition, this, MathHelper.nextInt(random, 20, 40)); ++ world.J().a(blockposition, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay + } + } + -- 2.18.0 diff --git a/Spigot-Server-Patches/0111-LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/0111-LootTable-API-Replenishable-Lootables-Feature.patch index 18d37fede..e1bd6d5e4 100644 --- a/Spigot-Server-Patches/0111-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/0111-LootTable-API-Replenishable-Lootables-Feature.patch @@ -1,4 +1,4 @@ -From f87b03b9d893ea3c081afef79107c62f14ca2407 Mon Sep 17 00:00:00 2001 +From e3250da854818c3f910dbc641c51a86995c4df86 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 1 May 2016 21:19:14 -0400 Subject: [PATCH] LootTable API & Replenishable Lootables Feature @@ -591,13 +591,13 @@ index 8945ab275b..184809b832 100644 if (this.lootTableSeed == 0L) { diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java -index 60d200f9eb..228d6b2800 100644 +index 25328bf414..6e3779c417 100644 --- a/src/main/java/net/minecraft/server/TileEntityLootable.java +++ b/src/main/java/net/minecraft/server/TileEntityLootable.java -@@ -5,9 +5,10 @@ import javax.annotation.Nullable; +@@ -4,9 +4,10 @@ import java.util.Random; + import javax.annotation.Nullable; public abstract class TileEntityLootable extends TileEntityContainer implements ILootable { - - protected MinecraftKey g; - protected long h; + protected MinecraftKey g; public MinecraftKey getLootTableKey() { return g; } public void setLootTable(MinecraftKey key) { g = key; } // Paper - OBFHELPER @@ -607,7 +607,7 @@ index 60d200f9eb..228d6b2800 100644 protected TileEntityLootable(TileEntityTypes tileentitytypes) { super(tileentitytypes); -@@ -23,16 +24,18 @@ public abstract class TileEntityLootable extends TileEntityContainer implements +@@ -21,16 +22,18 @@ public abstract class TileEntityLootable extends TileEntityContainer implements } protected boolean d(NBTTagCompound nbttagcompound) { @@ -627,7 +627,7 @@ index 60d200f9eb..228d6b2800 100644 if (this.g == null) { return false; } else { -@@ -41,15 +44,15 @@ public abstract class TileEntityLootable extends TileEntityContainer implements +@@ -39,14 +42,14 @@ public abstract class TileEntityLootable extends TileEntityContainer implements nbttagcompound.setLong("LootTableSeed", this.h); } @@ -640,12 +640,11 @@ index 60d200f9eb..228d6b2800 100644 - if (this.g != null && this.world.getMinecraftServer() != null) { + if (lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.g); - - this.g = null; + lootableData.processRefill(entityhuman); // Paper Random random; - if (this.h == 0L) { + random = new Random(); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java index ac9b4297b2..0558cafe31 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -681,7 +680,7 @@ index dff5bb5171..c3e40aa172 100644 public CraftChest(final Block block) { super(block, TileEntityChest.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java -index d519252521..a2324c7c8b 100644 +index 7ef68bb626..daf183fb10 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java @@ -1,5 +1,6 @@ diff --git a/Spigot-Server-Patches/0112-Do-not-load-chunks-for-pathfinding.patch b/Spigot-Server-Patches/0112-Do-not-load-chunks-for-pathfinding.patch index b76f6c8d4..c76422f7e 100644 --- a/Spigot-Server-Patches/0112-Do-not-load-chunks-for-pathfinding.patch +++ b/Spigot-Server-Patches/0112-Do-not-load-chunks-for-pathfinding.patch @@ -1,17 +1,17 @@ -From b24b2307edfb6818ab904d60d55288bbf7a318ff Mon Sep 17 00:00:00 2001 +From 4e72245ef416b9e944f5ab2db64458f4fde5c065 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 19 Jan 2016 00:13:19 -0500 Subject: [PATCH] Do not load chunks for pathfinding diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java -index 96c0c762ac..7020152a2d 100644 +index ff740bc1a7..78adbf9062 100644 --- a/src/main/java/net/minecraft/server/ChunkCache.java +++ b/src/main/java/net/minecraft/server/ChunkCache.java -@@ -26,7 +26,7 @@ public class ChunkCache implements IIBlockAccess { +@@ -21,7 +21,7 @@ public class ChunkCache implements IIBlockAccess { - for (l = this.a; l <= j; ++l) { - for (i1 = this.b; i1 <= k; ++i1) { + for(int l = this.a; l <= j; ++l) { + for(int i1 = this.b; i1 <= k; ++i1) { - this.c[l - this.a][i1 - this.b] = world.getChunkAt(l, i1); + this.c[l - this.a][i1 - this.b] = world.getChunkIfLoaded(l, i1); // Paper } diff --git a/Spigot-Server-Patches/0114-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/Spigot-Server-Patches/0114-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index 6a88392d2..1fa6d1516 100644 --- a/Spigot-Server-Patches/0114-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/Spigot-Server-Patches/0114-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -1,4 +1,4 @@ -From b4fa1d376f3a2981f359620f3b5814a1bd71fc98 Mon Sep 17 00:00:00 2001 +From e55c4df2d0b9ab32522e632bb4db0b35066f3f70 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 7 May 2016 23:33:08 -0400 Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat @@ -19,17 +19,17 @@ index 9fe1311143..a1110da38e 100644 + } } diff --git a/src/main/java/net/minecraft/server/PersistentScoreboard.java b/src/main/java/net/minecraft/server/PersistentScoreboard.java -index 0260fb7ec9..45d8de1b7b 100644 +index f2e8eface3..895ea0eb41 100644 --- a/src/main/java/net/minecraft/server/PersistentScoreboard.java +++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java -@@ -177,6 +177,7 @@ public class PersistentScoreboard extends PersistentBase { +@@ -160,6 +160,7 @@ public class PersistentScoreboard extends PersistentBase { + NBTTagList nbttaglist = new NBTTagList(); - while (iterator.hasNext()) { - ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next(); + for(ScoreboardTeam scoreboardteam : this.b.getTeams()) { + if (!com.destroystokyo.paper.PaperConfig.saveEmptyScoreboardTeams && scoreboardteam.getPlayerNameSet().isEmpty()) continue; // Paper NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.setString("Name", scoreboardteam.getName()); + nbttagcompound.setString("DisplayName", IChatBaseComponent.ChatSerializer.a(scoreboardteam.getDisplayName())); -- 2.18.0 diff --git a/Spigot-Server-Patches/0126-Fix-Old-Sign-Conversion.patch b/Spigot-Server-Patches/0126-Fix-Old-Sign-Conversion.patch index d13de63fc..26909211f 100644 --- a/Spigot-Server-Patches/0126-Fix-Old-Sign-Conversion.patch +++ b/Spigot-Server-Patches/0126-Fix-Old-Sign-Conversion.patch @@ -1,4 +1,4 @@ -From 80700c3208205e80f59a8d4b0f0f3c1f73bb6d2d Mon Sep 17 00:00:00 2001 +From f272cc446d703160be856e5630def2168f8f002e Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 17 Jun 2016 20:50:11 -0400 Subject: [PATCH] Fix Old Sign Conversion @@ -9,18 +9,18 @@ Subject: [PATCH] Fix Old Sign Conversion This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java -index bb1d00e440..9f29225cbd 100644 +index 987d944dbd..5f6fb44ffa 100644 --- a/src/main/java/net/minecraft/server/DefinedStructure.java +++ b/src/main/java/net/minecraft/server/DefinedStructure.java -@@ -218,9 +218,11 @@ public class DefinedStructure { - definedstructure_blockinfo1.c.setInt("x", blockposition1.getX()); - definedstructure_blockinfo1.c.setInt("y", blockposition1.getY()); - definedstructure_blockinfo1.c.setInt("z", blockposition1.getZ()); -+ tileentity.isLoadingStructure = true; // Paper - tileentity.load(definedstructure_blockinfo1.c); - tileentity.a(definedstructureinfo.b()); - tileentity.a(definedstructureinfo.c()); -+ tileentity.isLoadingStructure = false; // Paper +@@ -190,9 +190,11 @@ public class DefinedStructure { + definedstructure$blockinfo1.c.setInt("x", blockposition1.getX()); + definedstructure$blockinfo1.c.setInt("y", blockposition1.getY()); + definedstructure$blockinfo1.c.setInt("z", blockposition1.getZ()); ++ tileentity2.isLoadingStructure = true; // Paper + tileentity2.load(definedstructure$blockinfo1.c); + tileentity2.a(definedstructureinfo.b()); + tileentity2.a(definedstructureinfo.c()); ++ tileentity2.isLoadingStructure = false; // Paper } } diff --git a/Spigot-Server-Patches/0131-Optimise-BlockStateEnum-hashCode-and-equals.patch b/Spigot-Server-Patches/0131-Optimise-BlockStateEnum-hashCode-and-equals.patch index 8c6c47260..71b013707 100644 --- a/Spigot-Server-Patches/0131-Optimise-BlockStateEnum-hashCode-and-equals.patch +++ b/Spigot-Server-Patches/0131-Optimise-BlockStateEnum-hashCode-and-equals.patch @@ -1,39 +1,42 @@ -From dd5091874dfece083093092af4cbda9ba622537c Mon Sep 17 00:00:00 2001 +From 6d92bd624a75098dfeae5b99362e4fd0e13df989 Mon Sep 17 00:00:00 2001 From: Alfie Cleveland Date: Fri, 19 Aug 2016 01:52:56 +0100 Subject: [PATCH] Optimise BlockStateEnum hashCode and equals diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java -index 725087de59..5e6cb5d7de 100644 +index 73623a21c5..9d8a03be8d 100644 --- a/src/main/java/net/minecraft/server/BlockStateEnum.java +++ b/src/main/java/net/minecraft/server/BlockStateEnum.java -@@ -17,6 +17,11 @@ public class BlockStateEnum & INamable> extends BlockState +@@ -8,6 +8,7 @@ import java.util.Arrays; + import java.util.Collection; + import java.util.Map; + import java.util.Optional; ++import java.util.concurrent.atomic.AtomicInteger; + import java.util.function.Predicate; + import java.util.stream.Collectors; + +@@ -15,11 +16,17 @@ public class BlockStateEnum & INamable> extends BlockState private final ImmutableSet a; private final Map b = Maps.newHashMap(); + // Paper start - BlockStateEnum is a singleton, so we can use our own hashCode -+ private static int hashId = 0; ++ private static AtomicInteger hashId = new AtomicInteger(1); + private int hashCode; + // Paper end + protected BlockStateEnum(String s, Class oclass, Collection collection) { super(s, oclass); this.a = ImmutableSet.copyOf(collection); -@@ -30,9 +35,10 @@ public class BlockStateEnum & INamable> extends BlockState - throw new IllegalArgumentException("Multiple values have the same name \'" + s1 + "\'"); - } -- this.b.put(s1, oenum); -+ this.b.put(s1, (T) oenum); // Paper - decompile fix - } - -+ this.hashCode = hashId++; // Paper - } - - public Collection d() { -@@ -47,24 +53,14 @@ public class BlockStateEnum & INamable> extends BlockState - return ((INamable) t0).getName(); +- for(Enum oenum : collection) { ++ this.hashCode = hashId.getAndIncrement() * 61; // Paper ++ for(T oenum : collection) { // Paper - decompile fix + String s1 = ((INamable)oenum).getName(); + if (this.b.containsKey(s1)) { + throw new IllegalArgumentException("Multiple values have the same name '" + s1 + "'"); +@@ -42,22 +49,14 @@ public class BlockStateEnum & INamable> extends BlockState + return ((INamable)oenum).getName(); } + @Override // Paper start - override equals as BlockStateEnum is a singleton @@ -41,9 +44,8 @@ index 725087de59..5e6cb5d7de 100644 - if (this == object) { - return true; - } else if (object instanceof BlockStateEnum && super.equals(object)) { -- BlockStateEnum blockstateenum = (BlockStateEnum) object; -- -- return this.a.equals(blockstateenum.a) && this.b.equals(blockstateenum.b); +- BlockStateEnum blockstateenum1 = (BlockStateEnum)object; +- return this.a.equals(blockstateenum1.a) && this.b.equals(blockstateenum1.b); - } else { - return false; - } @@ -53,7 +55,6 @@ index 725087de59..5e6cb5d7de 100644 public int c() { - int i = super.c(); -- - i = 31 * i + this.a.hashCode(); - i = 31 * i + this.b.hashCode(); - return i; diff --git a/Spigot-Server-Patches/0143-Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/Spigot-Server-Patches/0143-Don-t-load-Chunks-from-Hoppers-and-other-things.patch index 71fbf8d5f..b14e05250 100644 --- a/Spigot-Server-Patches/0143-Don-t-load-Chunks-from-Hoppers-and-other-things.patch +++ b/Spigot-Server-Patches/0143-Don-t-load-Chunks-from-Hoppers-and-other-things.patch @@ -1,4 +1,4 @@ -From d1ec7e8b6b6c83d3f142b5533340ae10a2ac9048 Mon Sep 17 00:00:00 2001 +From 73c75f27648ff2c90326d37c4be63ca064278ea4 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Nov 2016 20:28:12 -0400 Subject: [PATCH] Don't load Chunks from Hoppers and other things @@ -13,11 +13,11 @@ This of course is undesirable, so just return the loaded side as "primary" and treat it as a single chest if the other sides are unloaded diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java -index dd2d62bfba..8afd48de96 100644 +index 27e6d2b5f2..b3882930ea 100644 --- a/src/main/java/net/minecraft/server/BlockChest.java +++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -196,7 +196,12 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC - return (ITileInventory) object; +@@ -181,7 +181,12 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC + return (ITileInventory)object; } else { BlockPosition blockposition1 = blockposition.shift(k(iblockdata)); - IBlockData iblockdata1 = world.getType(blockposition1); @@ -27,9 +27,9 @@ index dd2d62bfba..8afd48de96 100644 + return null; + } + // Paper end - if (iblockdata1.getBlock() == this) { - BlockPropertyChestType blockpropertychesttype1 = (BlockPropertyChestType) iblockdata1.get(BlockChest.b); + BlockPropertyChestType blockpropertychesttype1 = (BlockPropertyChestType)iblockdata1.get(b); + if (blockpropertychesttype1 != BlockPropertyChestType.SINGLE && blockpropertychesttype != blockpropertychesttype1 && iblockdata1.get(FACING) == iblockdata.get(FACING)) { -- 2.18.0 diff --git a/Spigot-Server-Patches/0154-Prevent-Pathfinding-out-of-World-Border.patch b/Spigot-Server-Patches/0154-Prevent-Pathfinding-out-of-World-Border.patch index b73654401..468b0e519 100644 --- a/Spigot-Server-Patches/0154-Prevent-Pathfinding-out-of-World-Border.patch +++ b/Spigot-Server-Patches/0154-Prevent-Pathfinding-out-of-World-Border.patch @@ -1,4 +1,4 @@ -From a51800a28e394769c3410665328f4e43337f980b Mon Sep 17 00:00:00 2001 +From f35437d281706ae7e892fd454f2bd8035bbafde9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 19 Dec 2016 23:07:42 -0500 Subject: [PATCH] Prevent Pathfinding out of World Border @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent Pathfinding out of World Border This prevents Entities from trying to run outside of the World Border diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 76d1f4bd21..76b2787bae 100644 +index a8b070ed32..452da80f11 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -73,6 +73,7 @@ public abstract class NavigationAbstract { +@@ -69,6 +69,7 @@ public abstract class NavigationAbstract { @Nullable public PathEntity b(BlockPosition blockposition) { @@ -17,14 +17,14 @@ index 76d1f4bd21..76b2787bae 100644 if (!this.b()) { return null; } else if (this.c != null && !this.c.b() && blockposition.equals(this.q)) { -@@ -99,6 +100,7 @@ public abstract class NavigationAbstract { +@@ -93,6 +94,7 @@ public abstract class NavigationAbstract { return null; } else { BlockPosition blockposition = new BlockPosition(entity); + if (!getEntity().getWorld().getWorldBorder().isInBounds(blockposition)) return null; // Paper - don't path out of world border - if (this.c != null && !this.c.b() && blockposition.equals(this.q)) { return this.c; + } else { diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java index acd76e13bb..1a87480f09 100644 --- a/src/main/java/net/minecraft/server/WorldBorder.java diff --git a/Spigot-Server-Patches/0162-Activation-Range-Improvements.patch b/Spigot-Server-Patches/0162-Activation-Range-Improvements.patch index a9cffb1aa..6000ad52b 100644 --- a/Spigot-Server-Patches/0162-Activation-Range-Improvements.patch +++ b/Spigot-Server-Patches/0162-Activation-Range-Improvements.patch @@ -1,24 +1,36 @@ -From e0b6b4859c0c2753033823614bd3b1217cee79be Mon Sep 17 00:00:00 2001 +From 9a2fb172b54d40c416117cb3c658adcb7d9a86fd Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 27 Dec 2016 22:38:06 -0500 Subject: [PATCH] Activation Range Improvements Fixes and adds new Immunities to improve gameplay behavior +diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java +index f4ed98d2d9..1dfd71df0a 100644 +--- a/src/main/java/net/minecraft/server/BlockPosition.java ++++ b/src/main/java/net/minecraft/server/BlockPosition.java +@@ -326,6 +326,7 @@ public class BlockPosition extends BaseBlockPosition { + this.c = i; + } + ++ public BlockPosition toBlockPosition() { return h(); } // Paper - OBFHELPER + public BlockPosition h() { + return new BlockPosition(this); + } diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index 3790039f18..a644f393af 100644 +index a5c147b989..9e88897a07 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -7,6 +7,7 @@ import org.bukkit.event.entity.EntityUnleashEvent; public abstract class EntityCreature extends EntityInsentient { - public org.bukkit.craftbukkit.entity.CraftCreature getBukkitEntity() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper + public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper + public BlockPosition movingTarget = null; public BlockPosition getMovingTarget() { return movingTarget; } // Paper private BlockPosition a; private float b; diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 7e13a78411..60f22959b5 100644 +index fd59710b2b..426c6ac68f 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -74,7 +74,7 @@ public abstract class EntityLiving extends Entity { @@ -31,10 +43,10 @@ index 7e13a78411..60f22959b5 100644 protected int ticksFarFromPlayer; protected float aZ; diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java -index cdf50ed1cf..10b325043c 100644 +index b661a86901..26184f463a 100644 --- a/src/main/java/net/minecraft/server/EntityLlama.java +++ b/src/main/java/net/minecraft/server/EntityLlama.java -@@ -363,6 +363,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn +@@ -340,6 +340,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn return this.bR != null; } @@ -43,29 +55,27 @@ index cdf50ed1cf..10b325043c 100644 return this.bQ != null; } diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java -index a146a8b459..a19853463c 100644 +index acc099e955..339c78eec9 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoal.java +++ b/src/main/java/net/minecraft/server/PathfinderGoal.java -@@ -18,7 +18,10 @@ public abstract class PathfinderGoal { +@@ -20,7 +20,9 @@ public abstract class PathfinderGoal { + } - public void c() {} - -- public void d() {} -+ public void d() { + public void d() { + onTaskReset(); // Paper -+ } + } + public void onTaskReset() {} // Paper - public void e() {} - + public void e() { + } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -index d5c08aa7cb..fe6570c88d 100644 +index 9a75cb63ba..cf10605aaa 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -@@ -2,17 +2,24 @@ package net.minecraft.server; +@@ -1,12 +1,12 @@ + package net.minecraft.server; public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - - private final EntityCreature f; + private final EntityCreature f; public EntityCreature getEntity() { return f; } // Paper - OBFHELPER public double a; @@ -77,8 +87,10 @@ index d5c08aa7cb..fe6570c88d 100644 private boolean h; private final int i; private final int j; - public int e; - +@@ -15,6 +15,13 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int ix) { + this(entitycreature, d0, ix, 1); + } + // Paper start - activation range improvements + @Override + public void onTaskReset() { @@ -86,15 +98,14 @@ index d5c08aa7cb..fe6570c88d 100644 + setTarget(BlockPosition.ZERO); + } + // Paper end - public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i) { - this(entitycreature, d0, i, 1); - } -@@ -93,7 +100,7 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - for (int j1 = i1 < l && i1 > -l ? l : 0; j1 <= l; j1 = j1 > 0 ? -j1 : 1 - j1) { - blockposition_mutableblockposition.g(blockposition).d(i1, k - 1, j1); - if (this.f.f((BlockPosition) blockposition_mutableblockposition) && this.a(this.f.world, blockposition_mutableblockposition)) { -- this.d = blockposition_mutableblockposition; -+ setTarget(blockposition_mutableblockposition); // Paper + + public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int ix, int jx) { + this.d = BlockPosition.ZERO; +@@ -93,6 +100,7 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + blockposition$mutableblockposition.g(blockposition).d(i1, k - 1, j1); + if (this.f.f(blockposition$mutableblockposition) && this.a(this.f.world, blockposition$mutableblockposition)) { + this.d = blockposition$mutableblockposition; ++ setTarget(blockposition$mutableblockposition.toBlockPosition()); // Paper return true; } } diff --git a/Spigot-Server-Patches/0163-Firework-API-s.patch b/Spigot-Server-Patches/0163-Firework-API-s.patch index 40c2510a9..0b14ea37c 100644 --- a/Spigot-Server-Patches/0163-Firework-API-s.patch +++ b/Spigot-Server-Patches/0163-Firework-API-s.patch @@ -1,11 +1,11 @@ -From 2f347649f80f9ab29d035f5e7024c26bbd88bf5e Mon Sep 17 00:00:00 2001 +From ac66f2245259ac48df1900cb170f67b3c4b0571b Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 28 Dec 2016 01:18:33 -0500 Subject: [PATCH] Firework API's diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java -index 6e2592e96d..f9332d3fda 100644 +index 6e2592e96d..7ff57d9cda 100644 --- a/src/main/java/net/minecraft/server/EntityFireworks.java +++ b/src/main/java/net/minecraft/server/EntityFireworks.java @@ -2,6 +2,8 @@ package net.minecraft.server; @@ -27,19 +27,20 @@ index 6e2592e96d..f9332d3fda 100644 public EntityFireworks(World world) { super(EntityTypes.FIREWORK_ROCKET, world); -@@ -196,6 +199,11 @@ public class EntityFireworks extends Entity { - if (!itemstack.isEmpty()) { +@@ -197,6 +200,12 @@ public class EntityFireworks extends Entity { nbttagcompound.set("FireworksItem", itemstack.save(new NBTTagCompound())); } + + // Paper start + if (spawningEntity != null) { + nbttagcompound.setUUID("SpawningEntity", spawningEntity); + } + // Paper end - ++ } -@@ -207,7 +215,11 @@ public class EntityFireworks extends Entity { + public void a(NBTTagCompound nbttagcompound) { +@@ -207,7 +216,11 @@ public class EntityFireworks extends Entity { if (!itemstack.isEmpty()) { this.datawatcher.set(EntityFireworks.FIREWORK_ITEM, itemstack); } @@ -53,30 +54,30 @@ index 6e2592e96d..f9332d3fda 100644 public boolean bk() { diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java -index 5eae1724ed..d4420e68fb 100644 +index 936faccbf8..d971bbc76c 100644 --- a/src/main/java/net/minecraft/server/ItemFireworks.java +++ b/src/main/java/net/minecraft/server/ItemFireworks.java -@@ -19,6 +19,7 @@ public class ItemFireworks extends Item { +@@ -14,6 +14,7 @@ public class ItemFireworks extends Item { + BlockPosition blockposition = itemactioncontext.getClickPosition(); ItemStack itemstack = itemactioncontext.getItemStack(); - EntityFireworks entityfireworks = new EntityFireworks(world, (double) ((float) blockposition.getX() + itemactioncontext.m()), (double) ((float) blockposition.getY() + itemactioncontext.n()), (double) ((float) blockposition.getZ() + itemactioncontext.o()), itemstack); - + EntityFireworks entityfireworks = new EntityFireworks(world, (double)((float)blockposition.getX() + itemactioncontext.m()), (double)((float)blockposition.getY() + itemactioncontext.n()), (double)((float)blockposition.getZ() + itemactioncontext.o()), itemstack); + entityfireworks.spawningEntity = itemactioncontext.b.getUniqueID(); // Paper world.addEntity(entityfireworks); itemstack.subtract(1); } -@@ -33,6 +34,7 @@ public class ItemFireworks extends Item { +@@ -26,6 +27,7 @@ public class ItemFireworks extends Item { + ItemStack itemstack = entityhuman.b(enumhand); if (!world.isClientSide) { EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman); - + entityfireworks.spawningEntity = entityhuman.getUniqueID(); // Paper world.addEntity(entityfireworks); if (!entityhuman.abilities.canInstantlyBuild) { itemstack.subtract(1); diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index e658816c24..0d69deb51c 100644 +index 2a66a30264..6046e3e7b9 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -108,7 +108,7 @@ public class NBTTagCompound implements NBTBase { +@@ -101,7 +101,7 @@ public class NBTTagCompound implements NBTBase { return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); } diff --git a/Spigot-Server-Patches/0174-Shame-on-you-Mojang.patch b/Spigot-Server-Patches/0174-Shame-on-you-Mojang.patch index fed5167a7..2bee18860 100644 --- a/Spigot-Server-Patches/0174-Shame-on-you-Mojang.patch +++ b/Spigot-Server-Patches/0174-Shame-on-you-Mojang.patch @@ -1,4 +1,4 @@ -From 8cbd912cf60f5989d4b7fdd54f58466b5455906a Mon Sep 17 00:00:00 2001 +From 3dad1401f1bc22c4d037e64161992b62221a480f Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 5 Feb 2017 19:17:28 -0500 Subject: [PATCH] Shame on you Mojang @@ -12,10 +12,10 @@ This then triggers async chunk loads! What in the hell were you thinking? diff --git a/src/main/java/net/minecraft/server/BlockBeacon.java b/src/main/java/net/minecraft/server/BlockBeacon.java -index 1181d45fad..d081166d86 100644 +index 7148ea3692..6d4e82b404 100644 --- a/src/main/java/net/minecraft/server/BlockBeacon.java +++ b/src/main/java/net/minecraft/server/BlockBeacon.java -@@ -49,7 +49,7 @@ public class BlockBeacon extends BlockTileEntity { +@@ -46,7 +46,7 @@ public class BlockBeacon extends BlockTileEntity { } public static void a(World world, BlockPosition blockposition) { @@ -23,8 +23,8 @@ index 1181d45fad..d081166d86 100644 + //HttpUtilities.a.submit(() -> { // Paper Chunk chunk = world.getChunkAtWorldCoords(blockposition); - for (int i = blockposition.getY() - 1; i >= 0; --i) { -@@ -73,7 +73,6 @@ public class BlockBeacon extends BlockTileEntity { + for(int i = blockposition.getY() - 1; i >= 0; --i) { +@@ -67,7 +67,6 @@ public class BlockBeacon extends BlockTileEntity { }); } } diff --git a/Spigot-Server-Patches/0183-Item-canEntityPickup.patch b/Spigot-Server-Patches/0183-Item-canEntityPickup.patch index b7cbe01ab..0cdcbfbc0 100644 --- a/Spigot-Server-Patches/0183-Item-canEntityPickup.patch +++ b/Spigot-Server-Patches/0183-Item-canEntityPickup.patch @@ -1,14 +1,14 @@ -From 0ed2995d925d4bf1a86f7212f4e3ae914d0d144d Mon Sep 17 00:00:00 2001 +From b076d81196c1378797a0d37d050d0fc193590b82 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 5 May 2017 03:57:17 -0500 Subject: [PATCH] Item#canEntityPickup diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index ec06f4badb..d4c86c2d65 100644 +index 6f5f3f8cd0..04a1218ed9 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -517,6 +517,11 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -518,6 +518,11 @@ public abstract class EntityInsentient extends EntityLiving { EntityItem entityitem = (EntityItem) iterator.next(); if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.q()) { diff --git a/Spigot-Server-Patches/0196-Implement-getI18NDisplayName.patch b/Spigot-Server-Patches/0196-Implement-getI18NDisplayName.patch index e95734267..e00a8aba2 100644 --- a/Spigot-Server-Patches/0196-Implement-getI18NDisplayName.patch +++ b/Spigot-Server-Patches/0196-Implement-getI18NDisplayName.patch @@ -1,4 +1,4 @@ -From 792f97956c253f4eae704aa180c5eac621b3a9b0 Mon Sep 17 00:00:00 2001 +From 70189f3c39051e0bbd3a6fd2071b6aba7f089dfd Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 May 2016 23:59:38 -0400 Subject: [PATCH] Implement getI18NDisplayName @@ -8,16 +8,16 @@ Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java -index 4361b2cee..f81887c66 100644 +index 0648c76a07..bea146630d 100644 --- a/src/main/java/net/minecraft/server/LocaleLanguage.java +++ b/src/main/java/net/minecraft/server/LocaleLanguage.java -@@ -44,10 +44,12 @@ public class LocaleLanguage { +@@ -39,10 +39,12 @@ public class LocaleLanguage { } + public static LocaleLanguage getInstance() { return a(); } // Paper - OBFHELPER public static LocaleLanguage a() { - return LocaleLanguage.c; + return c; } + public synchronized String translateKey(String key) { return a(key); } // Paper - OBFHELPER @@ -25,7 +25,7 @@ index 4361b2cee..f81887c66 100644 return this.c(s); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index be5f922cb..caaed7cf0 100644 +index be5f922cb6..caaed7cf0b 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java @@ -300,5 +300,18 @@ public final class CraftItemFactory implements ItemFactory { diff --git a/Spigot-Server-Patches/0216-Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/0216-Add-PlayerArmorChangeEvent.patch index 94ff8cca3..1d5ef994d 100644 --- a/Spigot-Server-Patches/0216-Add-PlayerArmorChangeEvent.patch +++ b/Spigot-Server-Patches/0216-Add-PlayerArmorChangeEvent.patch @@ -1,11 +1,11 @@ -From 37bd8ea924c7ec4f22345b6c25751e02928ce96f Mon Sep 17 00:00:00 2001 +From ba92e8671f51c00dca93612905edd40b342da041 Mon Sep 17 00:00:00 2001 From: pkt77 Date: Fri, 10 Nov 2017 23:46:34 -0500 Subject: [PATCH] Add PlayerArmorChangeEvent diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 2ff82694b4..e2ceb7ae4b 100644 +index 72a2164fdf..61af2621c5 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -1,5 +1,6 @@ @@ -30,11 +30,11 @@ index 2ff82694b4..e2ceb7ae4b 100644 if (!itemstack.isEmpty()) { this.getAttributeMap().a(itemstack.a(enumitemslot)); diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java -index cdf3a3ba4a..be5d0bf898 100644 +index a90ac68c30..49592e5572 100644 --- a/src/main/java/net/minecraft/server/EnumItemSlot.java +++ b/src/main/java/net/minecraft/server/EnumItemSlot.java -@@ -16,6 +16,7 @@ public enum EnumItemSlot { - this.j = s; +@@ -20,6 +20,7 @@ public enum EnumItemSlot { + this.j = s1; } + public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER diff --git a/Spigot-Server-Patches/0224-Ability-to-apply-mending-to-XP-API.patch b/Spigot-Server-Patches/0224-Ability-to-apply-mending-to-XP-API.patch index 94e2810e8..c56d15de9 100644 --- a/Spigot-Server-Patches/0224-Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-Server-Patches/0224-Ability-to-apply-mending-to-XP-API.patch @@ -1,4 +1,4 @@ -From 4672fc0942d4d2f48066ec4fb9bbd9c95649954e Mon Sep 17 00:00:00 2001 +From 65f0017a20693d08e7505bacc012ce1acc342be6 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 20 Dec 2017 17:36:49 -0500 Subject: [PATCH] Ability to apply mending to XP API @@ -10,22 +10,22 @@ of giving the player experience points. Both an API To standalone mend, and apply mending logic to .giveExp has been added. diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java -index c90e413f8c..c365bfea04 100644 +index fd6df39f17..f03aef2fed 100644 --- a/src/main/java/net/minecraft/server/EnchantmentManager.java +++ b/src/main/java/net/minecraft/server/EnchantmentManager.java -@@ -244,6 +244,7 @@ public class EnchantmentManager { +@@ -223,6 +223,7 @@ public class EnchantmentManager { return getEnchantmentLevel(Enchantments.F, itemstack) > 0; } + public static ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) { return b(enchantment, entityliving); } // Paper - OBFHELPER public static ItemStack b(Enchantment enchantment, EntityLiving entityliving) { - List list = enchantment.a(entityliving); - + List list = enchantment.a(entityliving);// Paper - decompile fix + if (list.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/Enchantments.java b/src/main/java/net/minecraft/server/Enchantments.java -index 836fe13c3d..27093a672e 100644 +index 8cfb38b826..44b2d428b3 100644 --- a/src/main/java/net/minecraft/server/Enchantments.java +++ b/src/main/java/net/minecraft/server/Enchantments.java -@@ -36,7 +36,7 @@ public class Enchantments { +@@ -35,7 +35,7 @@ public class Enchantments { public static final Enchantment D = a("impaling"); public static final Enchantment E = a("riptide"); public static final Enchantment F = a("channeling"); diff --git a/Spigot-Server-Patches/0238-Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/Spigot-Server-Patches/0238-Prevent-Frosted-Ice-from-loading-holding-chunks.patch index 740981a59..86befc06c 100644 --- a/Spigot-Server-Patches/0238-Prevent-Frosted-Ice-from-loading-holding-chunks.patch +++ b/Spigot-Server-Patches/0238-Prevent-Frosted-Ice-from-loading-holding-chunks.patch @@ -1,37 +1,32 @@ -From 383a42b10e28e543f3e36282d70a5bec1488ffc7 Mon Sep 17 00:00:00 2001 +From d98a2ce8557954a8e01732faa85d2e64995de321 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 10 Mar 2018 16:33:15 -0500 Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java -index 302d420512..c97937e810 100644 +index 7bea86f52b..ea3a6f2fb1 100644 --- a/src/main/java/net/minecraft/server/BlockIceFrost.java +++ b/src/main/java/net/minecraft/server/BlockIceFrost.java -@@ -25,6 +25,12 @@ public class BlockIceFrost extends BlockIce { - EnumDirection enumdirection = aenumdirection[j]; - - blockposition_b.j(blockposition).d(enumdirection); -+ -+ // Paper start - Prevent Frosted Ice from loading/holding chunks -+ if (!world.isChunkLoaded(blockposition_b.getX() >> 4, blockposition_b.getZ() >> 4, true)) -+ continue; -+ // Paper end - Prevent Frosted Ice from loading/holding chunks -+ - IBlockData iblockdata1 = world.getType(blockposition_b); - - if (iblockdata1.getBlock() == this && !this.c(iblockdata1, world, blockposition_b)) { -@@ -87,6 +93,10 @@ public class BlockIceFrost extends BlockIce { - EnumDirection enumdirection = aenumdirection[l]; - - blockposition_b.j(blockposition).d(enumdirection); -+ // Paper start - Prevent Frosted Ice from loading/holding chunks -+ if (!((World) iblockaccess).isChunkLoaded(blockposition_b.getX() >> 4, blockposition_b.getZ() >> 4, true)) -+ continue; -+ // Paper end - Prevent Frosted Ice from loading/holding chunks - if (iblockaccess.getType(blockposition_b).getBlock() == this) { +@@ -16,7 +16,8 @@ public class BlockIceFrost extends BlockIce { + try (BlockPosition.b blockposition$b = BlockPosition.b.r()) { + for(EnumDirection enumdirection : EnumDirection.values()) { + blockposition$b.j(blockposition).d(enumdirection); +- IBlockData iblockdata1 = world.getType(blockposition$b); ++ IBlockData iblockdata1 = world.getTypeIfLoaded(blockposition$b); // Paper - don't load chunks ++ if (iblockdata1 == null) continue; // Paper + if (iblockdata1.getBlock() == this && !this.c(iblockdata1, world, blockposition$b)) { + world.J().a(blockposition$b, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay + } +@@ -53,7 +54,7 @@ public class BlockIceFrost extends BlockIce { + try (BlockPosition.b blockposition$b = BlockPosition.b.r()) { + for(EnumDirection enumdirection : EnumDirection.values()) { + blockposition$b.j(blockposition).d(enumdirection); +- if (iblockaccess.getType(blockposition$b).getBlock() == this) { ++ if (((World) iblockaccess).getBlockIfLoaded(blockposition$b) == this) { // Paper - don't load chunks ++j; if (j >= i) { + boolean flag = false; -- 2.18.0 diff --git a/Spigot-Server-Patches/0240-Implement-extended-PaperServerListPingEvent.patch b/Spigot-Server-Patches/0240-Implement-extended-PaperServerListPingEvent.patch index 5a3094f5f..20f8b336b 100644 --- a/Spigot-Server-Patches/0240-Implement-extended-PaperServerListPingEvent.patch +++ b/Spigot-Server-Patches/0240-Implement-extended-PaperServerListPingEvent.patch @@ -1,4 +1,4 @@ -From 4305123c0458309d67e39c873edfaa8df355c881 Mon Sep 17 00:00:00 2001 +From bab7db69e8d1867bdfbf4808929cbde2f8bd8190 Mon Sep 17 00:00:00 2001 From: Minecrell Date: Wed, 11 Oct 2017 15:56:26 +0200 Subject: [PATCH] Implement extended PaperServerListPingEvent @@ -234,7 +234,7 @@ index c9edd289ac..8aa121e2f7 100644 // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java -index d7e1ecc031..f20cddc41c 100644 +index 615aa2cd04..408aad098a 100644 --- a/src/main/java/net/minecraft/server/ServerPing.java +++ b/src/main/java/net/minecraft/server/ServerPing.java @@ -29,6 +29,7 @@ public class ServerPing { @@ -245,7 +245,7 @@ index d7e1ecc031..f20cddc41c 100644 public ServerPing.ServerPingPlayerSample b() { return this.b; } -@@ -176,10 +177,12 @@ public class ServerPing { +@@ -174,10 +175,12 @@ public class ServerPing { return this.b; } diff --git a/Spigot-Server-Patches/0245-Fix-Dragon-Server-Crashes.patch b/Spigot-Server-Patches/0245-Fix-Dragon-Server-Crashes.patch index 41c12ca24..b6c867262 100644 --- a/Spigot-Server-Patches/0245-Fix-Dragon-Server-Crashes.patch +++ b/Spigot-Server-Patches/0245-Fix-Dragon-Server-Crashes.patch @@ -1,4 +1,4 @@ -From 323d78929cc2fe12158a6d63a430a6bc2ba6295c Mon Sep 17 00:00:00 2001 +From 88efcbefbf681a65f0c9a7e87669f91cdc4f85fe Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 21 Mar 2018 20:52:07 -0400 Subject: [PATCH] Fix Dragon Server Crashes @@ -7,17 +7,17 @@ If the dragon tries to find "ground" and hits a hole, or off edge, it will infinitely keep looking for non air and eventually crash. diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -index 41b5a4519b..b78d3fe508 100644 +index da89a69ed6..45f96078c5 100644 --- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java +++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -@@ -51,7 +51,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded - double d2 = this.a.bD.locY + (double) (this.a.bD.length / 2.0F); - BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(MathHelper.floor(d0), MathHelper.floor(d2), MathHelper.floor(d1)); +@@ -49,7 +49,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded + double d2 = this.a.bD.locY + (double)(this.a.bD.length / 2.0F); + BlockPosition.MutableBlockPosition blockposition$mutableblockposition = new BlockPosition.MutableBlockPosition(MathHelper.floor(d0), MathHelper.floor(d2), MathHelper.floor(d1)); -- while (this.a.world.isEmpty(blockposition_mutableblockposition)) { -+ while (this.a.world.isEmpty(blockposition_mutableblockposition) && d2 > 0) { // Paper +- while(this.a.world.isEmpty(blockposition$mutableblockposition)) { ++ while(this.a.world.isEmpty(blockposition$mutableblockposition) && d2 > 0) { // Paper --d2; - blockposition_mutableblockposition.c(MathHelper.floor(d0), MathHelper.floor(d2), MathHelper.floor(d1)); + blockposition$mutableblockposition.c(MathHelper.floor(d0), MathHelper.floor(d2), MathHelper.floor(d1)); } -- 2.18.0 diff --git a/Spigot-Server-Patches/0248-Make-legacy-ping-handler-more-reliable.patch b/Spigot-Server-Patches/0248-Make-legacy-ping-handler-more-reliable.patch index c62f74861..cb60e3939 100644 --- a/Spigot-Server-Patches/0248-Make-legacy-ping-handler-more-reliable.patch +++ b/Spigot-Server-Patches/0248-Make-legacy-ping-handler-more-reliable.patch @@ -1,4 +1,4 @@ -From bfa21f1ccd2de884b932be3cb954e7e0347fd418 Mon Sep 17 00:00:00 2001 +From 564fbb85dd3c175df607e688011c4a9dbf82c71f Mon Sep 17 00:00:00 2001 From: Minecrell Date: Wed, 11 Oct 2017 18:22:50 +0200 Subject: [PATCH] Make legacy ping handler more reliable @@ -28,22 +28,21 @@ respond to the request. [2]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h4-13 diff --git a/src/main/java/net/minecraft/server/LegacyPingHandler.java b/src/main/java/net/minecraft/server/LegacyPingHandler.java -index 64fe1d7e83..f7fbf1d76e 100644 +index 5691d0aeaf..aafca9c9c4 100644 --- a/src/main/java/net/minecraft/server/LegacyPingHandler.java +++ b/src/main/java/net/minecraft/server/LegacyPingHandler.java -@@ -14,6 +14,7 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { - +@@ -13,6 +13,7 @@ import org.apache.logging.log4j.Logger; + public class LegacyPingHandler extends ChannelInboundHandlerAdapter { private static final Logger a = LogManager.getLogger(); private final ServerConnection b; + private ByteBuf buf; // Paper public LegacyPingHandler(ServerConnection serverconnection) { this.b = serverconnection; -@@ -21,7 +22,16 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { +@@ -20,6 +21,16 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { public void channelRead(ChannelHandlerContext channelhandlercontext, Object object) throws Exception { - ByteBuf bytebuf = (ByteBuf) object; -- + ByteBuf bytebuf = (ByteBuf)object; + // Paper start - Make legacy ping handler more reliable + if (this.buf != null) { + try { @@ -57,27 +56,26 @@ index 64fe1d7e83..f7fbf1d76e 100644 bytebuf.markReaderIndex(); boolean flag = true; -@@ -53,6 +63,10 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { - break; - - default: +@@ -44,6 +55,10 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { + this.a(channelhandlercontext, this.a(s)); + break; + default: + // Paper start - Replace with improved version below + if (bytebuf.readUnsignedByte() != 0x01 || bytebuf.readUnsignedByte() != 0xFA) return; + readLegacy1_6(channelhandlercontext, bytebuf); + /* - boolean flag1 = bytebuf.readUnsignedByte() == 1; - - flag1 &= bytebuf.readUnsignedByte() == 250; -@@ -76,6 +90,8 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { - } finally { - bytebuf1.release(); + boolean flag1 = bytebuf.readUnsignedByte() == 1; + flag1 = flag1 & bytebuf.readUnsignedByte() == 250; + flag1 = flag1 & "MC|PingHost".equals(new String(bytebuf.readBytes(bytebuf.readShort() * 2).array(), StandardCharsets.UTF_16BE)); +@@ -65,6 +80,7 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { + } finally { + bytebuf1.release(); + } ++ */ // Paper end- end commenting out } -+ */ -+ // Paper end - } - bytebuf.release(); -@@ -93,6 +109,90 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { + bytebuf.release(); +@@ -84,6 +100,90 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { } diff --git a/Spigot-Server-Patches/0249-Call-PaperServerListPingEvent-for-legacy-pings.patch b/Spigot-Server-Patches/0249-Call-PaperServerListPingEvent-for-legacy-pings.patch index f3d58b1c8..2c18c4b4b 100644 --- a/Spigot-Server-Patches/0249-Call-PaperServerListPingEvent-for-legacy-pings.patch +++ b/Spigot-Server-Patches/0249-Call-PaperServerListPingEvent-for-legacy-pings.patch @@ -1,4 +1,4 @@ -From d564f907024e4d839cc52657be957872b1f133aa Mon Sep 17 00:00:00 2001 +From ab0a6d4deff47bdb159cb413bb4d93ab3dada3de Mon Sep 17 00:00:00 2001 From: Minecrell Date: Wed, 11 Oct 2017 19:30:51 +0200 Subject: [PATCH] Call PaperServerListPingEvent for legacy pings @@ -84,7 +84,7 @@ index 0000000000..74c012fd40 + +} diff --git a/src/main/java/net/minecraft/server/LegacyPingHandler.java b/src/main/java/net/minecraft/server/LegacyPingHandler.java -index f7fbf1d76e..1ed2b193a5 100644 +index aafca9c9c4..860076fc23 100644 --- a/src/main/java/net/minecraft/server/LegacyPingHandler.java +++ b/src/main/java/net/minecraft/server/LegacyPingHandler.java @@ -9,6 +9,7 @@ import java.net.InetSocketAddress; @@ -94,48 +94,44 @@ index f7fbf1d76e..1ed2b193a5 100644 +import com.destroystokyo.paper.network.PaperLegacyStatusClient; // Paper public class LegacyPingHandler extends ChannelInboundHandlerAdapter { + private static final Logger a = LogManager.getLogger(); +@@ -39,10 +40,18 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { + InetSocketAddress inetsocketaddress = (InetSocketAddress)channelhandlercontext.channel().remoteAddress(); + MinecraftServer minecraftserver = this.b.d(); + int i = bytebuf.readableBytes(); ++ com.destroystokyo.paper.event.server.PaperServerListPingEvent event; // Paper + switch(i) { + case 0: + a.debug("Ping: (<1.3.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); +- String s2 = String.format("%s\u00a7%d\u00a7%d", minecraftserver.getMotd(), minecraftserver.y(), minecraftserver.z()); ++ // Paper start - Call PaperServerListPingEvent and use results ++ event = PaperLegacyStatusClient.processRequest(minecraftserver, inetsocketaddress, 39, null); ++ if (event == null) { ++ channelhandlercontext.close(); ++ break; ++ } ++ String s2 = String.format("%s\u00a7%d\u00a7%d", PaperLegacyStatusClient.getUnformattedMotd(event), event.getNumPlayers(), event.getMaxPlayers()); ++ // Paper end + this.a(channelhandlercontext, this.a(s2)); + break; + case 1: +@@ -51,7 +60,14 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { + } -@@ -44,11 +45,20 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { - MinecraftServer minecraftserver = this.b.d(); - int i = bytebuf.readableBytes(); - String s; -+ com.destroystokyo.paper.event.server.PaperServerListPingEvent event; // Paper - - switch (i) { - case 0: - LegacyPingHandler.a.debug("Ping: (<1.3.x) from {}:{}", inetsocketaddress.getAddress(), Integer.valueOf(inetsocketaddress.getPort())); -- s = String.format("%s\u00a7%d\u00a7%d", new Object[] { minecraftserver.getMotd(), Integer.valueOf(minecraftserver.y()), Integer.valueOf(minecraftserver.z())}); -+ // Paper start - Call PaperServerListPingEvent and use results -+ event = PaperLegacyStatusClient.processRequest(minecraftserver, inetsocketaddress, 39, null); -+ if (event == null) { -+ channelhandlercontext.close(); -+ break; -+ } -+ s = String.format("%s\u00a7%d\u00a7%d", PaperLegacyStatusClient.getUnformattedMotd(event), event.getNumPlayers(), event.getMaxPlayers()); -+ -+ // Paper end - this.a(channelhandlercontext, this.a(s)); - break; - -@@ -57,8 +67,15 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { - return; - } - -- LegacyPingHandler.a.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), Integer.valueOf(inetsocketaddress.getPort())); -- s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { Integer.valueOf(127), minecraftserver.getVersion(), minecraftserver.getMotd(), Integer.valueOf(minecraftserver.y()), Integer.valueOf(minecraftserver.z())}); -+ // Paper start - Call PaperServerListPingEvent and use results -+ event = PaperLegacyStatusClient.processRequest(minecraftserver, inetsocketaddress, 61, null); -+ if (event == null) { -+ channelhandlercontext.close(); -+ break; -+ } -+ s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", event.getProtocolVersion(), event.getVersion(), -+ PaperLegacyStatusClient.getMotd(event), event.getNumPlayers(), event.getMaxPlayers()); -+ // Paper end - this.a(channelhandlercontext, this.a(s)); - break; - -@@ -170,8 +187,16 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { + a.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); +- String s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.y(), minecraftserver.z()); ++ // Paper start - Call PaperServerListPingEvent and use results ++ event = PaperLegacyStatusClient.processRequest(minecraftserver, inetsocketaddress, 61, null); ++ if (event == null) { ++ channelhandlercontext.close(); ++ break; ++ } ++ String s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", event.getProtocolVersion(), event.getVersion(), PaperLegacyStatusClient.getMotd(event), event.getNumPlayers(), event.getMaxPlayers()); ++ // Paper end + this.a(channelhandlercontext, this.a(s)); + break; + default: +@@ -161,8 +177,16 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { a.debug("Ping: (1.6) from {}", ctx.channel().remoteAddress()); diff --git a/Spigot-Server-Patches/0270-Configurable-Alternative-LootPool-Luck-Formula.patch b/Spigot-Server-Patches/0270-Configurable-Alternative-LootPool-Luck-Formula.patch index 67940d671..9bab109a9 100644 --- a/Spigot-Server-Patches/0270-Configurable-Alternative-LootPool-Luck-Formula.patch +++ b/Spigot-Server-Patches/0270-Configurable-Alternative-LootPool-Luck-Formula.patch @@ -1,4 +1,4 @@ -From c7b9fab1eac83cdedff92cca952c01acb3499fa1 Mon Sep 17 00:00:00 2001 +From c68f5a2cbfee772cbf26e1634365a13825064573 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 15 Jun 2018 00:30:32 -0400 Subject: [PATCH] Configurable Alternative LootPool Luck Formula @@ -53,13 +53,13 @@ index 9bfbaf61e5..bcdf4f91d8 100644 + } } diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java -index 3d501aee30..464f74b269 100644 +index 8daccdd6e9..c2a4ed6cf0 100644 --- a/src/main/java/net/minecraft/server/LootSelectorEntry.java +++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java -@@ -14,8 +14,8 @@ import java.util.Random; +@@ -13,8 +13,8 @@ import java.util.Collection; + import java.util.Random; public abstract class LootSelectorEntry { - - protected final int c; - protected final int d; + protected final int c; public int getWeight() { return c; } // Paper - OBFHELPER @@ -67,11 +67,11 @@ index 3d501aee30..464f74b269 100644 protected final LootItemCondition[] e; protected LootSelectorEntry(int i, int j, LootItemCondition[] alootitemcondition) { -@@ -25,8 +25,34 @@ public abstract class LootSelectorEntry { +@@ -24,8 +24,34 @@ public abstract class LootSelectorEntry { } public int a(float f) { -- return Math.max(MathHelper.d((float) this.c + (float) this.d * f), 0); +- return Math.max(MathHelper.d((float)this.c + (float)this.d * f), 0); + // Paper start - Offer an alternative loot formula to refactor how luck bonus applies + // SEE: https://luckformula.emc.gs for details and data + if (lastLuck != null && lastLuck == f) { @@ -101,7 +101,7 @@ index 3d501aee30..464f74b269 100644 + private int lastWeight = 0; + // Paper end - public abstract void a(Collection collection, Random random, LootTableInfo loottableinfo); + public abstract void a(Collection var1, Random var2, LootTableInfo var3); -- 2.18.0 diff --git a/Spigot-Server-Patches/0273-Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch b/Spigot-Server-Patches/0273-Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch index 8e1ac24b1..54d5d7e7d 100644 --- a/Spigot-Server-Patches/0273-Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch +++ b/Spigot-Server-Patches/0273-Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch @@ -1,4 +1,4 @@ -From 3eabe2d2409ef3d178aa5ff6c4768e05552d2844 Mon Sep 17 00:00:00 2001 +From a1d6c6d4804c230258877a959278864f477778a6 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 16 Jun 2018 16:23:38 -0400 Subject: [PATCH] Ignore Missing Recipes in RecipeBook to avoid data errors @@ -6,32 +6,29 @@ Subject: [PATCH] Ignore Missing Recipes in RecipeBook to avoid data errors This code was causing NPE's in saving player data, potentially related to reloads. diff --git a/src/main/java/net/minecraft/server/RecipeBookServer.java b/src/main/java/net/minecraft/server/RecipeBookServer.java -index 71d6c45529..799f2be707 100644 +index b0c726be19..34e34b7855 100644 --- a/src/main/java/net/minecraft/server/RecipeBookServer.java +++ b/src/main/java/net/minecraft/server/RecipeBookServer.java -@@ -77,7 +77,11 @@ public class RecipeBookServer extends RecipeBook { - while (iterator.hasNext()) { - MinecraftKey minecraftkey = (MinecraftKey) iterator.next(); +@@ -65,6 +65,10 @@ public class RecipeBookServer extends RecipeBook { + NBTTagList nbttaglist = new NBTTagList(); -- nbttaglist.add((NBTBase) (new NBTTagString(minecraftkey.toString()))); + for(MinecraftKey minecraftkey : this.a) { + // Paper start - ignore missing recipes + IRecipe recipe = this.h.a(minecraftkey); + if (recipe == null) continue; -+ nbttaglist.add(new NBTTagString(minecraftkey.toString())); + // Paper end + nbttaglist.add((NBTBase)(new NBTTagString(minecraftkey.toString()))); } - nbttagcompound.set("recipes", nbttaglist); -@@ -87,6 +91,11 @@ public class RecipeBookServer extends RecipeBook { - while (iterator1.hasNext()) { - MinecraftKey minecraftkey1 = (MinecraftKey) iterator1.next(); +@@ -72,6 +76,10 @@ public class RecipeBookServer extends RecipeBook { + NBTTagList nbttaglist1 = new NBTTagList(); + for(MinecraftKey minecraftkey1 : this.b) { + // Paper start - ignore missing recipes + IRecipe recipe = this.h.a(minecraftkey1); + if (recipe == null) continue; + // Paper end -+ - nbttaglist1.add((NBTBase) (new NBTTagString(minecraftkey1.toString()))); + nbttaglist1.add((NBTBase)(new NBTTagString(minecraftkey1.toString()))); } -- diff --git a/Spigot-Server-Patches/0280-RangedEntity-API.patch b/Spigot-Server-Patches/0280-RangedEntity-API.patch index 00eecebd0..91823596b 100644 --- a/Spigot-Server-Patches/0280-RangedEntity-API.patch +++ b/Spigot-Server-Patches/0280-RangedEntity-API.patch @@ -1,4 +1,4 @@ -From 9dfb186b44e9a3b90d65f688f83910a87a2ed2e0 Mon Sep 17 00:00:00 2001 +From e95d340b6ab3c78e0aed42b131e18b1c7b262766 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 26 Jun 2018 22:00:49 -0400 Subject: [PATCH] RangedEntity API @@ -32,18 +32,18 @@ index 0000000000..696660b089 + } +} diff --git a/src/main/java/net/minecraft/server/IRangedEntity.java b/src/main/java/net/minecraft/server/IRangedEntity.java -index 4fd69850fd..7fe65b7c24 100644 +index 1b06ce8537..94533d19af 100644 --- a/src/main/java/net/minecraft/server/IRangedEntity.java +++ b/src/main/java/net/minecraft/server/IRangedEntity.java -@@ -2,7 +2,7 @@ package net.minecraft.server; +@@ -1,7 +1,7 @@ + package net.minecraft.server; public interface IRangedEntity { +- void a(EntityLiving var1, float var2); ++ void a(EntityLiving var1, float var2);default void rangedAttack(EntityLiving entityliving, float f) { a(entityliving, f); } // Paper OBF HELPER -- void a(EntityLiving entityliving, float f); -+ void a(EntityLiving entityliving, float f); default void rangedAttack(EntityLiving entityliving, float f) { a(entityliving, f); } // Paper OBF HELPER - -- void s(boolean flag); -+ void s(boolean flag); default void setChargingAttack(boolean flag) { s(flag); } // Paper OBF HELPER +- void s(boolean var1); ++ void s(boolean var1); default void setChargingAttack(boolean flag) { s(flag); } // Paper OBF HELPER } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java index 2ec1af8be4..f31d3eed3a 100644 diff --git a/Spigot-Server-Patches/0282-Add-config-to-disable-ender-dragon-legacy-check.patch b/Spigot-Server-Patches/0282-Add-config-to-disable-ender-dragon-legacy-check.patch index c5a437839..94295c105 100644 --- a/Spigot-Server-Patches/0282-Add-config-to-disable-ender-dragon-legacy-check.patch +++ b/Spigot-Server-Patches/0282-Add-config-to-disable-ender-dragon-legacy-check.patch @@ -1,4 +1,4 @@ -From 9ca273cb980a3d4803495edd318c6b7b9a208a03 Mon Sep 17 00:00:00 2001 +From 265868945184568370507db8a877ef1ec7a987d3 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 22 Jun 2018 10:38:31 -0500 Subject: [PATCH] Add config to disable ender dragon legacy check @@ -19,10 +19,10 @@ index 2e3e48637a..8724c2816b 100644 + } } diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java -index a20d54ee34..48bcda0f50 100644 +index 96e920ead8..e083ea483a 100644 --- a/src/main/java/net/minecraft/server/EnderDragonBattle.java +++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java -@@ -29,9 +29,12 @@ public class EnderDragonBattle { +@@ -27,16 +27,21 @@ public class EnderDragonBattle { private int h; private int i; private int j; @@ -30,16 +30,14 @@ index a20d54ee34..48bcda0f50 100644 private boolean k; private boolean l; private UUID m; -+ private void setScanForLegacyFight(boolean scanForLegacyFight) { this.n = scanForLegacyFight; } // Paper - OBFHELPER -+ private boolean scanForLegacyFight() { return this.n; } // Paper - OBFHELPER - private boolean n; +- private boolean n = true; ++ private boolean n = true; private void setScanForLegacyFight(boolean scanForLegacyFight) { this.n = scanForLegacyFight; } private boolean scanForLegacyFight() { return this.n; } // Paper - OBFHELPER private BlockPosition o; private EnumDragonRespawn p; -@@ -41,7 +44,10 @@ public class EnderDragonBattle { + private int q; + private List r; + public EnderDragonBattle(WorldServer worldserver, NBTTagCompound nbttagcompound) { - this.c = (BossBattleServer) (new BossBattleServer(new ChatMessage("entity.minecraft.ender_dragon", new Object[0]), BossBattle.BarColor.PINK, BossBattle.BarStyle.PROGRESS)).setPlayMusic(true).c(true); - this.e = Lists.newArrayList(); -- this.n = true; + // Paper start + setScanForLegacyFight(worldserver.paperConfig.scanForLegacyEnderDragon); + if (!scanForLegacyFight()) setDragonKilled(true); @@ -47,6 +45,23 @@ index a20d54ee34..48bcda0f50 100644 this.d = worldserver; if (nbttagcompound.hasKeyOfType("DragonKilled", 99)) { if (nbttagcompound.b("DragonUUID")) { +@@ -286,14 +291,14 @@ public class EnderDragonBattle { + } + + private void k() { +- HashSet hashset = Sets.newHashSet(); ++ HashSet hashset = Sets.newHashSet(); // Paper - decompile fix + + for(EntityPlayer entityplayer : this.d.b(EntityPlayer.class, b)) { + this.c.addPlayer(entityplayer); + hashset.add(entityplayer); + } + +- HashSet hashset1 = Sets.newHashSet(this.c.getPlayers()); ++ HashSet hashset1 = Sets.newHashSet(this.c.getPlayers()); // Paper - decompile fix + hashset1.removeAll(hashset); + + for(EntityPlayer entityplayer1 : hashset1) { -- 2.18.0 diff --git a/Spigot-Server-Patches/0286-Configurable-Bed-Search-Radius.patch b/Spigot-Server-Patches/0286-Configurable-Bed-Search-Radius.patch index 803cdf5a4..179dc6181 100644 --- a/Spigot-Server-Patches/0286-Configurable-Bed-Search-Radius.patch +++ b/Spigot-Server-Patches/0286-Configurable-Bed-Search-Radius.patch @@ -1,4 +1,4 @@ -From d05da60b77c74b53dab47f6dffb3896a8c99aefe Mon Sep 17 00:00:00 2001 +From a6ee93a38a6a034c6b4b2b2ae4ecf4a3f2c70143 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 Jul 2018 15:22:06 -0400 Subject: [PATCH] Configurable Bed Search Radius @@ -30,17 +30,15 @@ index 8724c2816b..fb2467636a 100644 + } } diff --git a/src/main/java/net/minecraft/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java -index 4e60509891..47cf1db6ae 100644 +index 4f97ff6f18..230c05ff07 100644 --- a/src/main/java/net/minecraft/server/BlockBed.java +++ b/src/main/java/net/minecraft/server/BlockBed.java -@@ -174,7 +174,54 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { - +@@ -166,6 +166,52 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { @Nullable public static BlockPosition a(IBlockAccess iblockaccess, BlockPosition blockposition, int i) { -+ World world = (World) iblockaccess; -+ - EnumDirection enumdirection = (EnumDirection) iblockaccess.getType(blockposition).get(BlockBed.FACING); + EnumDirection enumdirection = (EnumDirection)iblockaccess.getType(blockposition).get(FACING); + // Paper - replace whole method ++ World world = (World) iblockaccess; + int radius = world.paperConfig.bedSearchRadius; + for (int r = 1; r <= radius; r++) { + int x = -r; @@ -88,7 +86,7 @@ index 4e60509891..47cf1db6ae 100644 int j = blockposition.getX(); int k = blockposition.getY(); int l = blockposition.getZ(); -@@ -200,9 +247,12 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { +@@ -190,9 +236,12 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { } } diff --git a/Spigot-Server-Patches/0291-Don-t-process-despawn-if-entity-is-in-a-chunk-schedu.patch b/Spigot-Server-Patches/0291-Don-t-process-despawn-if-entity-is-in-a-chunk-schedu.patch index 2e8da2cf8..96f988446 100644 --- a/Spigot-Server-Patches/0291-Don-t-process-despawn-if-entity-is-in-a-chunk-schedu.patch +++ b/Spigot-Server-Patches/0291-Don-t-process-despawn-if-entity-is-in-a-chunk-schedu.patch @@ -1,4 +1,4 @@ -From a9019db13cb7580b4cf30d940575446f0964854e Mon Sep 17 00:00:00 2001 +From 2bdea8b9e4d2c2450e2a4fe8e414764dcb9266cf Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 19 Jul 2018 01:23:00 -0400 Subject: [PATCH] Don't process despawn if entity is in a chunk scheduled for @@ -12,10 +12,10 @@ keep it vanilla in behavior a player may teleport away, and trigger instant despawn diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index d4c86c2d65..4a8c3a428d 100644 +index 04a1218ed9..141db48f16 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -622,6 +622,8 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -623,6 +623,8 @@ public abstract class EntityInsentient extends EntityLiving { if (this.persistent) { this.ticksFarFromPlayer = 0; } else { diff --git a/Spigot-Server-Patches/0296-EnderDragon-Events.patch b/Spigot-Server-Patches/0296-EnderDragon-Events.patch index 528b7dc0b..4a84c82d8 100644 --- a/Spigot-Server-Patches/0296-EnderDragon-Events.patch +++ b/Spigot-Server-Patches/0296-EnderDragon-Events.patch @@ -1,14 +1,14 @@ -From 8f7eca760bb5d7e6a932cf26fa200c680f7288cc Mon Sep 17 00:00:00 2001 +From 788553e0245c1df064ccea0ffe5e66754cba6bd9 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sat, 21 Jul 2018 01:51:27 -0500 Subject: [PATCH] EnderDragon Events diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -index b78d3fe508..ef8b0e765f 100644 +index 45f96078c5..fed3e9daf1 100644 --- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java +++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -@@ -63,7 +63,9 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded +@@ -61,7 +61,9 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded this.d.setDuration(200); this.d.setParticle(Particles.j); this.d.a(new MobEffect(MobEffects.HARM)); @@ -18,7 +18,7 @@ index b78d3fe508..ef8b0e765f 100644 } } -@@ -73,6 +75,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded +@@ -71,6 +73,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded ++this.c; } @@ -27,28 +27,28 @@ index b78d3fe508..ef8b0e765f 100644 if (this.d != null) { this.d.die(); diff --git a/src/main/java/net/minecraft/server/DragonControllerStrafe.java b/src/main/java/net/minecraft/server/DragonControllerStrafe.java -index 9c158fd588..b4887d6586 100644 +index 66223af9a8..7aa8a5708d 100644 --- a/src/main/java/net/minecraft/server/DragonControllerStrafe.java +++ b/src/main/java/net/minecraft/server/DragonControllerStrafe.java -@@ -67,7 +67,9 @@ public class DragonControllerStrafe extends AbstractDragonController { +@@ -57,7 +57,9 @@ public class DragonControllerStrafe extends AbstractDragonController { + this.a.world.a((EntityHuman)null, 1017, new BlockPosition(this.a), 0); EntityDragonFireball entitydragonfireball = new EntityDragonFireball(this.a.world, this.a, d9, d10, d11); - entitydragonfireball.setPositionRotation(d6, d7, d8, 0.0F, 0.0F); + if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) a.getBukkitEntity(), (org.bukkit.entity.DragonFireball) entitydragonfireball.getBukkitEntity()).callEvent()) // Paper this.a.world.addEntity(entitydragonfireball); + else entitydragonfireball.die(); // Paper this.c = 0; if (this.d != null) { - while (!this.d.b()) { + while(!this.d.b()) { diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java -index 862ffc9543..2b55cc68b5 100644 +index e746a6a0da..366ebb8d2d 100644 --- a/src/main/java/net/minecraft/server/EntityDragonFireball.java +++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java -@@ -39,8 +39,10 @@ public class EntityDragonFireball extends EntityFireball { +@@ -32,8 +32,10 @@ public class EntityDragonFireball extends EntityFireball { } } -+ if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list, (org.bukkit.entity.AreaEffectCloud) entityareaeffectcloud.getBukkitEntity()).callEvent()) { // Paper ++ if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(EntityLiving::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) entityareaeffectcloud.getBukkitEntity()).callEvent()) { // Paper this.world.triggerEffect(2006, new BlockPosition(this.locX, this.locY, this.locZ), 0); this.world.addEntity(entityareaeffectcloud); + } else entityareaeffectcloud.die(); // Paper diff --git a/Spigot-Server-Patches/0297-PlayerElytraBoostEvent.patch b/Spigot-Server-Patches/0297-PlayerElytraBoostEvent.patch index 592c5de1d..1edc1a5f3 100644 --- a/Spigot-Server-Patches/0297-PlayerElytraBoostEvent.patch +++ b/Spigot-Server-Patches/0297-PlayerElytraBoostEvent.patch @@ -1,16 +1,16 @@ -From 79bf51175409a0f147e0e122f4cdaddbeb24b22e Mon Sep 17 00:00:00 2001 +From 8790989ae27d534a733be291f45d2f840cca9259 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sat, 21 Jul 2018 01:59:59 -0500 Subject: [PATCH] PlayerElytraBoostEvent diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java -index d4420e68fb..82da8dd387 100644 +index d971bbc76c..4ce9c60895 100644 --- a/src/main/java/net/minecraft/server/ItemFireworks.java +++ b/src/main/java/net/minecraft/server/ItemFireworks.java -@@ -35,9 +35,15 @@ public class ItemFireworks extends Item { +@@ -28,9 +28,15 @@ public class ItemFireworks extends Item { + if (!world.isClientSide) { EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman); - entityfireworks.spawningEntity = entityhuman.getUniqueID(); // Paper - world.addEntity(entityfireworks); - if (!entityhuman.abilities.canInstantlyBuild) { diff --git a/Spigot-Server-Patches/0298-PlayerLaunchProjectileEvent.patch b/Spigot-Server-Patches/0298-PlayerLaunchProjectileEvent.patch index 4b485df9d..4810a0686 100644 --- a/Spigot-Server-Patches/0298-PlayerLaunchProjectileEvent.patch +++ b/Spigot-Server-Patches/0298-PlayerLaunchProjectileEvent.patch @@ -1,22 +1,22 @@ -From 7d913989b8a65f7e3739673c2ddb9221caf9aadc Mon Sep 17 00:00:00 2001 +From 5db9f5cec37287aadff02842e15cf321933e4dfd Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sat, 21 Jul 2018 03:11:03 -0500 Subject: [PATCH] PlayerLaunchProjectileEvent diff --git a/src/main/java/net/minecraft/server/ItemEgg.java b/src/main/java/net/minecraft/server/ItemEgg.java -index 9ae1f5b318..0a9680bf5d 100644 +index adc38763b9..776c86f1fe 100644 --- a/src/main/java/net/minecraft/server/ItemEgg.java +++ b/src/main/java/net/minecraft/server/ItemEgg.java -@@ -9,16 +9,34 @@ public class ItemEgg extends Item { +@@ -7,15 +7,34 @@ public class ItemEgg extends Item { + public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); - - if (!entityhuman.abilities.canInstantlyBuild) { - itemstack.subtract(1); - } -- -- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemEgg.i.nextFloat() * 0.4F + 0.8F)); + +- world.a((EntityHuman)null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (i.nextFloat() * 0.4F + 0.8F)); + // Paper start - moved down + //if (!entityhuman.abilities.canInstantlyBuild) { + // itemstack.subtract(1); @@ -26,7 +26,6 @@ index 9ae1f5b318..0a9680bf5d 100644 + // Paper end if (!world.isClientSide) { EntityEgg entityegg = new EntityEgg(world, entityhuman); - entityegg.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F); - world.addEntity(entityegg); + // Paper start @@ -98,18 +97,18 @@ index 876384f37b..8b8bc8ec1c 100644 entityhuman.b(StatisticList.ITEM_USED.b(this)); return new InteractionResultWrapper(EnumInteractionResult.SUCCESS, itemstack); diff --git a/src/main/java/net/minecraft/server/ItemExpBottle.java b/src/main/java/net/minecraft/server/ItemExpBottle.java -index 5312c473ea..7b5eca925f 100644 +index b167c54417..42a0329c29 100644 --- a/src/main/java/net/minecraft/server/ItemExpBottle.java +++ b/src/main/java/net/minecraft/server/ItemExpBottle.java -@@ -9,16 +9,34 @@ public class ItemExpBottle extends Item { +@@ -7,15 +7,34 @@ public class ItemExpBottle extends Item { + public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); - - if (!entityhuman.abilities.canInstantlyBuild) { - itemstack.subtract(1); - } -- -- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_EXPERIENCE_BOTTLE_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemExpBottle.i.nextFloat() * 0.4F + 0.8F)); + +- world.a((EntityHuman)null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_EXPERIENCE_BOTTLE_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (i.nextFloat() * 0.4F + 0.8F)); + // Paper start - moved down + //if (!entityhuman.abilities.canInstantlyBuild) { + // itemstack.subtract(1); @@ -119,7 +118,6 @@ index 5312c473ea..7b5eca925f 100644 + // Paper end if (!world.isClientSide) { EntityThrownExpBottle entitythrownexpbottle = new EntityThrownExpBottle(world, entityhuman); - entitythrownexpbottle.a(entityhuman, entityhuman.pitch, entityhuman.yaw, -20.0F, 0.7F, 1.0F); - world.addEntity(entitythrownexpbottle); + // Paper start @@ -143,18 +141,18 @@ index 5312c473ea..7b5eca925f 100644 entityhuman.b(StatisticList.ITEM_USED.b(this)); diff --git a/src/main/java/net/minecraft/server/ItemLingeringPotion.java b/src/main/java/net/minecraft/server/ItemLingeringPotion.java -index e1c6ad80f0..7acdb63f7b 100644 +index ab7807d832..46c64c760f 100644 --- a/src/main/java/net/minecraft/server/ItemLingeringPotion.java +++ b/src/main/java/net/minecraft/server/ItemLingeringPotion.java -@@ -8,14 +8,38 @@ public class ItemLingeringPotion extends ItemPotion { +@@ -7,12 +7,37 @@ public class ItemLingeringPotion extends ItemPotion { public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); - ItemStack itemstack1 = entityhuman.abilities.canInstantlyBuild ? itemstack.cloneItemStack() : itemstack.cloneAndSubtract(1); +- world.a((EntityHuman)null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (i.nextFloat() * 0.4F + 0.8F)); + // Paper start - moved down + //ItemStack itemstack1 = entityhuman.abilities.canInstantlyBuild ? itemstack.cloneItemStack() : itemstack.cloneAndSubtract(1); - -- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemLingeringPotion.i.nextFloat() * 0.4F + 0.8F)); ++ + //world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemLingeringPotion.i.nextFloat() * 0.4F + 0.8F)); + // Paper end if (!world.isClientSide) { @@ -165,7 +163,6 @@ index e1c6ad80f0..7acdb63f7b 100644 + } + // Paper end EntityPotion entitypotion = new EntityPotion(world, entityhuman, itemstack1); - entitypotion.a(entityhuman, entityhuman.pitch, entityhuman.yaw, -20.0F, 0.5F, 1.0F); - world.addEntity(entitypotion); + // Paper start @@ -222,19 +219,18 @@ index 332145c32b..5c23c9ae0c 100644 // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/ItemSplashPotion.java b/src/main/java/net/minecraft/server/ItemSplashPotion.java -index 593009579b..d935ae834f 100644 +index 426b42a12c..a4e2f70c7c 100644 --- a/src/main/java/net/minecraft/server/ItemSplashPotion.java +++ b/src/main/java/net/minecraft/server/ItemSplashPotion.java -@@ -8,14 +8,38 @@ public class ItemSplashPotion extends ItemPotion { +@@ -7,12 +7,36 @@ public class ItemSplashPotion extends ItemPotion { public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); - ItemStack itemstack1 = entityhuman.abilities.canInstantlyBuild ? itemstack.cloneItemStack() : itemstack.cloneAndSubtract(1); +- world.a((EntityHuman)null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (i.nextFloat() * 0.4F + 0.8F)); + // Paper start - moved sound down, clone handled diff + //ItemStack itemstack1 = entityhuman.abilities.canInstantlyBuild ? itemstack.cloneItemStack() : itemstack.cloneAndSubtract(1); - -- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemSplashPotion.i.nextFloat() * 0.4F + 0.8F)); -+ //world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemSplashPotion.i.nextFloat() * 0.4F + 0.8F)); ++ //world.a((EntityHuman)null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (i.nextFloat() * 0.4F + 0.8F)); + // Paper end if (!world.isClientSide) { + // Paper start - ensure stack count matches vanilla behavior without modifying original stack yet @@ -244,7 +240,6 @@ index 593009579b..d935ae834f 100644 + } + // Paper end EntityPotion entitypotion = new EntityPotion(world, entityhuman, itemstack1); - entitypotion.a(entityhuman, entityhuman.pitch, entityhuman.yaw, -20.0F, 0.5F, 1.0F); - world.addEntity(entitypotion); + // Paper start diff --git a/Spigot-Server-Patches/0301-Speedup-BlockPos-by-fixing-inlining.patch b/Spigot-Server-Patches/0301-Speedup-BlockPos-by-fixing-inlining.patch index 8e142c481..39b809756 100644 --- a/Spigot-Server-Patches/0301-Speedup-BlockPos-by-fixing-inlining.patch +++ b/Spigot-Server-Patches/0301-Speedup-BlockPos-by-fixing-inlining.patch @@ -1,4 +1,4 @@ -From 5915dd6d1ddf969a6103b5674c0baab8e1c27b02 Mon Sep 17 00:00:00 2001 +From 7ea14626e7aa995df770fe5bfb91e6a8cbb3b9b0 Mon Sep 17 00:00:00 2001 From: Techcable Date: Wed, 30 Nov 2016 20:56:58 -0600 Subject: [PATCH] Speedup BlockPos by fixing inlining @@ -21,12 +21,12 @@ This is based upon conclusions drawn from inspecting the assenmbly generated byt They had 'callq' (invoke) instead of 'mov' (get from memory) instructions. diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index 58f8b4b720..98992513da 100644 +index 680764b342..25334377a2 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -7,22 +7,22 @@ import javax.annotation.concurrent.Immutable; +@@ -6,22 +6,22 @@ import javax.annotation.concurrent.Immutable; + @Immutable public class BaseBlockPosition implements Comparable { - public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0); - private final int a; - private final int b; @@ -55,8 +55,8 @@ index 58f8b4b720..98992513da 100644 } public BaseBlockPosition(double d0, double d1, double d2) { -@@ -49,17 +49,19 @@ public class BaseBlockPosition implements Comparable { - return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY(); +@@ -57,17 +57,19 @@ public class BaseBlockPosition implements Comparable { + } } - public int getX() { @@ -77,47 +77,47 @@ index 58f8b4b720..98992513da 100644 } + // Paper end - public BaseBlockPosition d(BaseBlockPosition baseblockposition) { - return new BaseBlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX()); + public BaseBlockPosition d(BaseBlockPosition baseblockposition1) { + return new BaseBlockPosition(this.getY() * baseblockposition1.getZ() - this.getZ() * baseblockposition1.getY(), this.getZ() * baseblockposition1.getX() - this.getX() * baseblockposition1.getZ(), this.getX() * baseblockposition1.getY() - this.getY() * baseblockposition1.getX()); diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 42e5e9ad8f..936a49a3e8 100644 +index 1dfd71df0a..986b1e13a5 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -208,18 +208,20 @@ public class BlockPosition extends BaseBlockPosition { +@@ -204,18 +204,20 @@ public class BlockPosition extends BaseBlockPosition { if (this.g == null) { - this.g = new BlockPosition.MutableBlockPosition(i, j, k); + this.g = new BlockPosition.MutableBlockPosition(ix, jx, kx); return this.g; - } else if (this.g.b == l && this.g.c == i1 && this.g.d == j1) { -+ } else if (this.g.x == l && this.g.y == i1 && this.g.z == j1) { // Paper - return (BlockPosition.MutableBlockPosition) this.endOfData(); ++ } else if (this.g.x == l && this.g.y == i1 && this.g.z == j1) { // Paper - use x/y/z + return (BlockPosition.MutableBlockPosition)this.endOfData(); } else { - if (this.g.b < l) { - ++this.g.b; - } else if (this.g.c < i1) { -- this.g.b = i; // Paper - Readd line removed by the decompiler +- this.g.b = ix; // Paper - decompile fix Readd line removed by the decompiler - ++this.g.c; - } else if (this.g.d < j1) { -- this.g.b = i; // Paper - Readd line removed by the decompiler -- this.g.c = j; // Paper - Readd line removed by the decompiler +- this.g.b = ix; // Paper - decompile fix Readd line removed by the decompiler +- this.g.c = jx; // Paper - decompile fix Readd line removed by the decompiler - ++this.g.d; + // Paper start - use xyz + if (this.g.x < l) { + ++this.g.x; + } else if (this.g.y < i1) { -+ this.g.x = i; // Paper - Readd line removed by the decompiler ++ this.g.x = ix; // Paper - decompile fix Readd line removed by the decompiler + ++this.g.y; + } else if (this.g.z < j1) { -+ this.g.x = i; // Paper - Readd line removed by the decompiler -+ this.g.y = j; // Paper - Readd line removed by the decompiler ++ this.g.x = ix; // Paper - decompile fix Readd line removed by the decompiler ++ this.g.y = jx; // Paper - decompile fix Readd line removed by the decompiler + ++this.g.z; + // Paper end } return this.g; -@@ -339,10 +341,12 @@ public class BlockPosition extends BaseBlockPosition { +@@ -236,10 +238,12 @@ public class BlockPosition extends BaseBlockPosition { + } public static class MutableBlockPosition extends BlockPosition { - + // Paper start - comment out + /* protected int b; @@ -128,7 +128,7 @@ index 42e5e9ad8f..936a49a3e8 100644 @Override public boolean isValidLocation() { return b >= -30000000 && d >= -30000000 && b < 30000000 && d < 30000000 && c >= 0 && c < 256; -@@ -351,6 +355,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -248,6 +252,7 @@ public class BlockPosition extends BaseBlockPosition { public boolean isInvalidYLocation() { return c < 0 || c >= 256; } @@ -136,7 +136,7 @@ index 42e5e9ad8f..936a49a3e8 100644 // Paper end public MutableBlockPosition() { -@@ -362,10 +367,13 @@ public class BlockPosition extends BaseBlockPosition { +@@ -259,10 +264,13 @@ public class BlockPosition extends BaseBlockPosition { } public MutableBlockPosition(int i, int j, int k) { @@ -152,7 +152,7 @@ index 42e5e9ad8f..936a49a3e8 100644 } public BlockPosition a(double d0, double d1, double d2) { -@@ -384,6 +392,8 @@ public class BlockPosition extends BaseBlockPosition { +@@ -281,6 +289,8 @@ public class BlockPosition extends BaseBlockPosition { return super.a(enumblockrotation).h(); } @@ -161,7 +161,7 @@ index 42e5e9ad8f..936a49a3e8 100644 public int getX() { return this.b; } -@@ -394,13 +404,16 @@ public class BlockPosition extends BaseBlockPosition { +@@ -291,13 +301,16 @@ public class BlockPosition extends BaseBlockPosition { public int getZ() { return this.d; @@ -182,7 +182,7 @@ index 42e5e9ad8f..936a49a3e8 100644 return this; } -@@ -418,15 +431,15 @@ public class BlockPosition extends BaseBlockPosition { +@@ -315,15 +328,15 @@ public class BlockPosition extends BaseBlockPosition { } public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) { @@ -200,7 +200,7 @@ index 42e5e9ad8f..936a49a3e8 100644 + this.y = i; // Paper change to y } - public BlockPosition h() { + public BlockPosition toBlockPosition() { return h(); } // Paper - OBFHELPER -- 2.18.0 diff --git a/Spigot-Server-Patches/0303-Optimize-RegistryID.c.patch b/Spigot-Server-Patches/0303-Optimize-RegistryID.c.patch index 11a803b02..be789afe5 100644 --- a/Spigot-Server-Patches/0303-Optimize-RegistryID.c.patch +++ b/Spigot-Server-Patches/0303-Optimize-RegistryID.c.patch @@ -1,4 +1,4 @@ -From fa670184f6b30408f73ebe46e89578a4bd2b68b4 Mon Sep 17 00:00:00 2001 +From b30fb91663c75adb7a5138e6f03a70c63d93c0f6 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 23 Jul 2018 13:08:19 -0400 Subject: [PATCH] Optimize RegistryID.c() @@ -6,31 +6,31 @@ Subject: [PATCH] Optimize RegistryID.c() This is a frequent hotspot for world loading/saving. diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java -index bde5714dd6..a01cda9d81 100644 +index d03ac0e70c..9242999f70 100644 --- a/src/main/java/net/minecraft/server/RegistryID.java +++ b/src/main/java/net/minecraft/server/RegistryID.java -@@ -14,12 +14,14 @@ public class RegistryID implements Registry { // Paper - decompile fix +@@ -13,12 +13,14 @@ public class RegistryID implements Registry { private K[] d; private int e; private int f; + private java.util.BitSet usedIds; // Paper public RegistryID(int i) { - i = (int) ((float) i / 0.8F); - this.b = (K[]) (new Object[i]); // Paper - decompile fix + i = (int)((float)i / 0.8F); + this.b = (K[])(new Object[i]); this.c = new int[i]; - this.d = (K[]) (new Object[i]); // Paper - decompile fix + this.d = (K[])(new Object[i]); + this.usedIds = new java.util.BitSet(); // Paper } - public int getId(@Nullable K k0) { -@@ -43,9 +45,14 @@ public class RegistryID implements Registry { // Paper - decompile fix + public int getId(@Nullable K object) { +@@ -41,9 +43,14 @@ public class RegistryID implements Registry { } private int c() { + // Paper start + /* - while (this.e < this.d.length && this.d[this.e] != null) { + while(this.e < this.d.length && this.d[this.e] != null) { ++this.e; } + */ @@ -39,24 +39,24 @@ index bde5714dd6..a01cda9d81 100644 return this.e; } -@@ -59,6 +66,7 @@ public class RegistryID implements Registry { // Paper - decompile fix - this.d = (K[]) (new Object[i]); // Paper - decompile fix +@@ -56,6 +63,7 @@ public class RegistryID implements Registry { + this.d = (K[])(new Object[i]); this.e = 0; this.f = 0; + this.usedIds.clear(); // Paper - for (int j = 0; j < aobject.length; ++j) { + for(int j = 0; j < aobject.length; ++j) { if (aobject[j] != null) { -@@ -84,6 +92,7 @@ public class RegistryID implements Registry { // Paper - decompile fix - this.b[k] = k0; - this.c[k] = i; - this.d[i] = k0; +@@ -80,6 +88,7 @@ public class RegistryID implements Registry { + this.b[l] = object; + this.c[l] = i; + this.d[i] = object; + this.usedIds.set(i); // Paper ++this.f; if (i == this.e) { ++this.e; -@@ -148,6 +157,7 @@ public class RegistryID implements Registry { // Paper - decompile fix - Arrays.fill(this.d, (Object) null); +@@ -140,6 +149,7 @@ public class RegistryID implements Registry { + Arrays.fill(this.d, (Object)null); this.e = 0; this.f = 0; + this.usedIds.clear(); // Paper diff --git a/Spigot-Server-Patches/0305-Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/0305-Vanished-players-don-t-have-rights.patch index 4ee1f5acb..811e6a134 100644 --- a/Spigot-Server-Patches/0305-Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/0305-Vanished-players-don-t-have-rights.patch @@ -1,4 +1,4 @@ -From ed0e15209a73c658ffe750456744084ff00ee55a Mon Sep 17 00:00:00 2001 +From c00e706c2239a7aef32a535ab1433f84706bbb4a Mon Sep 17 00:00:00 2001 From: Hugo Manrique Date: Mon, 23 Jul 2018 14:22:26 +0200 Subject: [PATCH] Vanished players don't have rights @@ -18,10 +18,10 @@ index 89a83548b8..9339b3255d 100644 protected int k; private Entity vehicle; diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 0a4ee39d67..6f80876990 100644 +index 24ce9137ae..bf06a90312 100644 --- a/src/main/java/net/minecraft/server/IBlockData.java +++ b/src/main/java/net/minecraft/server/IBlockData.java -@@ -179,6 +179,7 @@ public interface IBlockData extends IBlockDataHolder { +@@ -165,6 +165,7 @@ public interface IBlockData extends IBlockDataHolder { return this.getBlock().a(this, iblockaccess, blockposition); } @@ -44,20 +44,20 @@ index 1cecccef23..afc881d9af 100644 BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), CraftBlockData.fromData(iblockdata), defaultReturn); blockactioncontext.getWorld().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java -index 700900256b..b7d2fa2f0e 100644 +index ea8f1c170a..fdfc0d442e 100644 --- a/src/main/java/net/minecraft/server/VoxelShape.java +++ b/src/main/java/net/minecraft/server/VoxelShape.java -@@ -28,6 +28,7 @@ public abstract class VoxelShape { - return i <= 0 ? Double.NEGATIVE_INFINITY : this.a(enumdirection_enumaxis, i); +@@ -24,6 +24,7 @@ public abstract class VoxelShape { + return i <= 0 ? Double.NEGATIVE_INFINITY : this.a(enumdirection$enumaxis, i); } + public AxisAlignedBB getBounds() { return a(); } // Paper - OBFHELPER public AxisAlignedBB a() { if (this.b()) { throw new UnsupportedOperationException("No bounds for empty shape."); -@@ -42,6 +43,7 @@ public abstract class VoxelShape { +@@ -38,6 +39,7 @@ public abstract class VoxelShape { - protected abstract DoubleList a(EnumDirection.EnumAxis enumdirection_enumaxis); + protected abstract DoubleList a(EnumDirection.EnumAxis var1); + public boolean isEmpty() { return b(); } // Paper - OBFHELPER public boolean b() { diff --git a/Spigot-Server-Patches/0310-SkeletonHorse-Additions.patch b/Spigot-Server-Patches/0310-SkeletonHorse-Additions.patch index 5e6f90e43..ab0f7860f 100644 --- a/Spigot-Server-Patches/0310-SkeletonHorse-Additions.patch +++ b/Spigot-Server-Patches/0310-SkeletonHorse-Additions.patch @@ -1,15 +1,15 @@ -From 15ab3b8cf98f836b88a3562ff13965054ba4e725 Mon Sep 17 00:00:00 2001 +From 4d96f10c728379d6569099d30c3b52c9f25901fa Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 27 Jul 2018 22:36:31 -0500 Subject: [PATCH] SkeletonHorse Additions diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java -index e643201ebf..edd272eabd 100644 +index e3690db471..ba6c0e96a3 100644 --- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java +++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java -@@ -6,7 +6,7 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { - +@@ -5,7 +5,7 @@ import javax.annotation.Nullable; + public class EntityHorseSkeleton extends EntityHorseAbstract { private final PathfinderGoalHorseTrap bM = new PathfinderGoalHorseTrap(this); private boolean bN; - private int bO; diff --git a/Spigot-Server-Patches/0323-Make-portal-teleportation-adjustment-math-more-accur.patch b/Spigot-Server-Patches/0323-Make-portal-teleportation-adjustment-math-more-accur.patch index a69923912..ec6271b35 100644 --- a/Spigot-Server-Patches/0323-Make-portal-teleportation-adjustment-math-more-accur.patch +++ b/Spigot-Server-Patches/0323-Make-portal-teleportation-adjustment-math-more-accur.patch @@ -1,14 +1,14 @@ -From 00e6ceab7ffd6294c820ac08362954f8e9774078 Mon Sep 17 00:00:00 2001 +From 505af35b52f62cdda8013adee6a920ce82b2b5d4 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 31 Jul 2018 19:32:57 -0500 Subject: [PATCH] Make portal teleportation adjustment math more accurate diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java -index 854ad49b6c..3ee310a9aa 100644 +index c0853f0fcd..7aa940672e 100644 --- a/src/main/java/net/minecraft/server/EnumDirection.java +++ b/src/main/java/net/minecraft/server/EnumDirection.java -@@ -85,6 +85,7 @@ public enum EnumDirection implements INamable { +@@ -95,6 +95,7 @@ public enum EnumDirection implements INamable { return this.i; } @@ -16,16 +16,16 @@ index 854ad49b6c..3ee310a9aa 100644 public EnumDirection.EnumAxisDirection c() { return this.l; } -@@ -93,6 +94,7 @@ public enum EnumDirection implements INamable { +@@ -103,6 +104,7 @@ public enum EnumDirection implements INamable { return fromType1(this.h); } + public final EnumDirection rotateY() { return e(); } // Paper - OBFHELPER public EnumDirection e() { - switch (this) { + switch(this) { case NORTH: -@@ -272,6 +274,7 @@ public enum EnumDirection implements INamable { - this.d = s; +@@ -333,6 +335,7 @@ public enum EnumDirection implements INamable { + this.d = s1; } + public final int getOffset() { return a(); } // Paper - OBFHELPER @@ -33,17 +33,17 @@ index 854ad49b6c..3ee310a9aa 100644 return this.c; } diff --git a/src/main/java/net/minecraft/server/MathHelper.java b/src/main/java/net/minecraft/server/MathHelper.java -index 5329102dd7..2e5b89af82 100644 +index d53d0c2422..49fba0979e 100644 --- a/src/main/java/net/minecraft/server/MathHelper.java +++ b/src/main/java/net/minecraft/server/MathHelper.java -@@ -82,6 +82,7 @@ public class MathHelper { - return f < f1 ? f1 : (f > f2 ? f2 : f); +@@ -83,6 +83,7 @@ public class MathHelper { + } } + public static double clamp(double d0, double d1, double d2) { return a(d0, d1, d2); } // Paper - OBFHELPER public static double a(double d0, double d1, double d2) { - return d0 < d1 ? d1 : (d0 > d2 ? d2 : d0); - } + if (d0 < d1) { + return d1; diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java index 20f2a9197c..fd372103be 100644 --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java @@ -79,10 +79,10 @@ index 20f2a9197c..fd372103be 100644 float f1 = 0.0F; float f2 = 0.0F; diff --git a/src/main/java/net/minecraft/server/ShapeDetector.java b/src/main/java/net/minecraft/server/ShapeDetector.java -index 3faf74a22f..4e1f8c211d 100644 +index 0c9910d9a5..446cdb86d8 100644 --- a/src/main/java/net/minecraft/server/ShapeDetector.java +++ b/src/main/java/net/minecraft/server/ShapeDetector.java -@@ -140,6 +140,7 @@ public class ShapeDetector { +@@ -143,6 +143,7 @@ public class ShapeDetector { return this.c; } diff --git a/Spigot-Server-Patches/0327-Fix-client-rendering-skulls-from-same-user.patch b/Spigot-Server-Patches/0327-Fix-client-rendering-skulls-from-same-user.patch index 5e9e0cd25..0c2bb29cd 100644 --- a/Spigot-Server-Patches/0327-Fix-client-rendering-skulls-from-same-user.patch +++ b/Spigot-Server-Patches/0327-Fix-client-rendering-skulls-from-same-user.patch @@ -1,4 +1,4 @@ -From 8791766f99dac3a0544b3da3a695b80bafceb1b9 Mon Sep 17 00:00:00 2001 +From f86adbbb5a758faffc7a2997a10a31462a80b381 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 22 Nov 2016 00:40:42 -0500 Subject: [PATCH] Fix client rendering skulls from same user @@ -62,26 +62,17 @@ index a63a5811d6..cab8374832 100644 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 33436ac65b..6321010246 100644 +index af382815f3..22a262bb60 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -38,6 +38,7 @@ public class PacketPlayOutMapChunk implements Packet { - +@@ -33,6 +33,7 @@ public class PacketPlayOutMapChunk implements Packet { + int j = blockposition.getY() >> 4; if (this.f() || (i & 1 << j) != 0) { NBTTagCompound nbttagcompound = tileentity.aa_(); + if (tileentity instanceof TileEntitySkull) { TileEntitySkull.sanitizeTileEntityUUID(nbttagcompound); } // Paper - this.e.add(nbttagcompound); } -@@ -122,7 +123,7 @@ public class PacketPlayOutMapChunk implements Packet { - BiomeBase[] abiomebase = chunk.getBiomeIndex(); - - for (l = 0; l < abiomebase.length; ++l) { -- packetdataserializer.writeInt(IRegistry.BIOME.a((Object) abiomebase[l])); -+ packetdataserializer.writeInt(IRegistry.BIOME.a(abiomebase[l])); // Paper - decompile fix - } } - diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java index e59f3c21d7..05fca47f34 100644 --- a/src/main/java/net/minecraft/server/TileEntitySkull.java diff --git a/Spigot-Server-Patches/0330-Detect-and-repair-corrupt-Region-Files.patch b/Spigot-Server-Patches/0330-Detect-and-repair-corrupt-Region-Files.patch index 170565bce..e32d5c8f7 100644 --- a/Spigot-Server-Patches/0330-Detect-and-repair-corrupt-Region-Files.patch +++ b/Spigot-Server-Patches/0330-Detect-and-repair-corrupt-Region-Files.patch @@ -1,4 +1,4 @@ -From af0e968ff12e7722492e40654510e740fbaa2652 Mon Sep 17 00:00:00 2001 +From e232364bbe6742e92b63345842d63483cdcfe77f Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 11 Aug 2018 00:49:20 -0400 Subject: [PATCH] Detect and repair corrupt Region Files @@ -11,30 +11,30 @@ I don't know why mojang only checks for 4096, when anything less than 8192 is a But to be safe, it will attempt to back up the file. diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index cba2373125..0703922332 100644 +index 5d2853b9ce..c35974aa7c 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -41,7 +41,20 @@ public class RegionFile { +@@ -40,7 +40,20 @@ public class RegionFile { } - this.c = new RandomAccessFile(file, "rw"); + this.c = new RandomAccessFile(file1, "rw"); - if (this.c.length() < 4096L) { + // Paper start - detect and fix incomplete headers + long length = this.c.length(); + if (length < 8192 && length > 0) { -+ File corrupt = new File(file.getParentFile(), file.getName() + ".bak"); ++ File corrupt = new File(file1.getParentFile(), file1.getName() + ".bak"); + org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(); -+ logger.error("Region file " + file + " was incomplete. Backing up to " + corrupt + " and repairing"); ++ logger.error("Region file " + file1 + " was incomplete. Backing up to " + corrupt + " and repairing"); + try { -+ java.nio.file.Files.copy(file.toPath(), corrupt.toPath()); ++ java.nio.file.Files.copy(file1.toPath(), corrupt.toPath()); + } catch (IOException e) { + logger.error("Error backing up corrupt file", e); + } + } + if (length < 8192L) { + // Paper end - this.c.write(RegionFile.a); - this.c.write(RegionFile.a); + this.c.write(a); + this.c.write(a); this.g += 8192; -- 2.18.0 diff --git a/Spigot-Server-Patches/0337-Optimize-BlockPosition-helper-methods.patch b/Spigot-Server-Patches/0337-Optimize-BlockPosition-helper-methods.patch index 2a98247cb..648e7bd79 100644 --- a/Spigot-Server-Patches/0337-Optimize-BlockPosition-helper-methods.patch +++ b/Spigot-Server-Patches/0337-Optimize-BlockPosition-helper-methods.patch @@ -1,4 +1,4 @@ -From 76e318afd422c05c58c4ba5e761ce6d7c8cb38c8 Mon Sep 17 00:00:00 2001 +From fa8038c2779fe4080fd5ad15be4128adee1ddcc1 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Wed, 15 Aug 2018 12:05:12 -0700 Subject: [PATCH] Optimize BlockPosition helper methods @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize BlockPosition helper methods Resolves #1338 diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 936a49a3e8..7215056bd1 100644 +index 986b1e13a5..45f7794613 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -59,59 +59,96 @@ public class BlockPosition extends BaseBlockPosition { +@@ -58,59 +58,96 @@ public class BlockPosition extends BaseBlockPosition { } public BlockPosition up() { @@ -17,9 +17,9 @@ index 936a49a3e8..7215056bd1 100644 + return new BlockPosition(this.getX(), this.getY() + 1, this.getZ()); // Paper - Optimize BlockPosition } - public BlockPosition up(int i) { -- return this.shift(EnumDirection.UP, i); -+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY() + i, this.getZ()); // Paper - Optimize BlockPosition + public BlockPosition up(int ix) { +- return this.shift(EnumDirection.UP, ix); ++ return ix == 0 ? this : new BlockPosition(this.getX(), this.getY() + ix, this.getZ()); // Paper - Optimize BlockPosition } public BlockPosition down() { @@ -27,9 +27,9 @@ index 936a49a3e8..7215056bd1 100644 + return new BlockPosition(this.getX(), this.getY() - 1, this.getZ()); // Paper - Optimize BlockPosition } - public BlockPosition down(int i) { -- return this.shift(EnumDirection.DOWN, i); -+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY() - i, this.getZ()); // Paper - Optimize BlockPosition + public BlockPosition down(int ix) { +- return this.shift(EnumDirection.DOWN, ix); ++ return ix == 0 ? this : new BlockPosition(this.getX(), this.getY() - ix, this.getZ()); // Paper - Optimize BlockPosition } public BlockPosition north() { @@ -37,9 +37,9 @@ index 936a49a3e8..7215056bd1 100644 + return new BlockPosition(this.getX(), this.getY(), this.getZ() - 1); // Paper - Optimize BlockPosition } - public BlockPosition north(int i) { -- return this.shift(EnumDirection.NORTH, i); -+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() - i); // Paper - Optimize BlockPosition + public BlockPosition north(int ix) { +- return this.shift(EnumDirection.NORTH, ix); ++ return ix == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() - ix); // Paper - Optimize BlockPosition } public BlockPosition south() { @@ -47,9 +47,9 @@ index 936a49a3e8..7215056bd1 100644 + return new BlockPosition(this.getX(), this.getY(), this.getZ() + 1); // Paper - Optimize BlockPosition } - public BlockPosition south(int i) { -- return this.shift(EnumDirection.SOUTH, i); -+ return i == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() + i); // Paper - Optimize BlockPosition + public BlockPosition south(int ix) { +- return this.shift(EnumDirection.SOUTH, ix); ++ return ix == 0 ? this : new BlockPosition(this.getX(), this.getY(), this.getZ() + ix); // Paper - Optimize BlockPosition } public BlockPosition west() { @@ -57,9 +57,9 @@ index 936a49a3e8..7215056bd1 100644 + return new BlockPosition(this.getX() - 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition } - public BlockPosition west(int i) { -- return this.shift(EnumDirection.WEST, i); -+ return i == 0 ? this : new BlockPosition(this.getX() - i, this.getY(), this.getZ()); // Paper - Optimize BlockPosition + public BlockPosition west(int ix) { +- return this.shift(EnumDirection.WEST, ix); ++ return ix == 0 ? this : new BlockPosition(this.getX() - ix, this.getY(), this.getZ()); // Paper - Optimize BlockPosition } public BlockPosition east() { @@ -67,9 +67,9 @@ index 936a49a3e8..7215056bd1 100644 + return new BlockPosition(this.getX() + 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition } - public BlockPosition east(int i) { -- return this.shift(EnumDirection.EAST, i); -+ return i == 0 ? this : new BlockPosition(this.getX() + i, this.getY(), this.getZ()); // Paper - Optimize BlockPosition + public BlockPosition east(int ix) { +- return this.shift(EnumDirection.EAST, ix); ++ return ix == 0 ? this : new BlockPosition(this.getX() + ix, this.getY(), this.getZ()); // Paper - Optimize BlockPosition } public BlockPosition shift(EnumDirection enumdirection) { @@ -94,27 +94,27 @@ index 936a49a3e8..7215056bd1 100644 + // Paper End } - public BlockPosition shift(EnumDirection enumdirection, int i) { -- return i == 0 ? this : new BlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i); + public BlockPosition shift(EnumDirection enumdirection, int ix) { +- return ix == 0 ? this : new BlockPosition(this.getX() + enumdirection.getAdjacentX() * ix, this.getY() + enumdirection.getAdjacentY() * ix, this.getZ() + enumdirection.getAdjacentZ() * ix); + // Paper Start - Optimize BlockPosition -+ if (i == 0) { ++ if (ix == 0) { + return this; + } + switch(enumdirection) { + case UP: -+ return new BlockPosition(this.getX(), this.getY() + i, this.getZ()); ++ return new BlockPosition(this.getX(), this.getY() + ix, this.getZ()); + case DOWN: -+ return new BlockPosition(this.getX(), this.getY() - i, this.getZ()); ++ return new BlockPosition(this.getX(), this.getY() - ix, this.getZ()); + case NORTH: -+ return new BlockPosition(this.getX(), this.getY(), this.getZ() - i); ++ return new BlockPosition(this.getX(), this.getY(), this.getZ() - ix); + case SOUTH: -+ return new BlockPosition(this.getX(), this.getY(), this.getZ() + i); ++ return new BlockPosition(this.getX(), this.getY(), this.getZ() + ix); + case WEST: -+ return new BlockPosition(this.getX() - i, this.getY(), this.getZ()); ++ return new BlockPosition(this.getX() - ix, this.getY(), this.getZ()); + case EAST: -+ return new BlockPosition(this.getX() + i, this.getY(), this.getZ()); ++ return new BlockPosition(this.getX() + ix, this.getY(), this.getZ()); + default: -+ return new BlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i); ++ return new BlockPosition(this.getX() + enumdirection.getAdjacentX() * ix, this.getY() + enumdirection.getAdjacentY() * ix, this.getZ() + enumdirection.getAdjacentZ() * ix); + } + // Paper End } diff --git a/Spigot-Server-Patches/0339-Cache-World-Entity-Type-counts.patch b/Spigot-Server-Patches/0339-Cache-World-Entity-Type-counts.patch index 57733ac66..c01caf011 100644 --- a/Spigot-Server-Patches/0339-Cache-World-Entity-Type-counts.patch +++ b/Spigot-Server-Patches/0339-Cache-World-Entity-Type-counts.patch @@ -1,4 +1,4 @@ -From fa807b36de0c4f45acd8cc57912b446dc7b65860 Mon Sep 17 00:00:00 2001 +From f5d3a976a51d35831486560b52f70aba7285ba67 Mon Sep 17 00:00:00 2001 From: Colin Godsey Date: Wed, 8 Aug 2018 10:10:06 -0600 Subject: [PATCH] Cache World Entity Type counts @@ -145,10 +145,10 @@ index 4252e8c02a..2b1affd03c 100644 public float length; public float J; diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 4a8c3a428d..8f610c013a 100644 +index 141db48f16..56542d531a 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -614,6 +614,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -615,6 +615,7 @@ public abstract class EntityInsentient extends EntityLiving { return true; } @@ -157,10 +157,10 @@ index 4a8c3a428d..8f610c013a 100644 return true; } diff --git a/src/main/java/net/minecraft/server/EnumCreatureType.java b/src/main/java/net/minecraft/server/EnumCreatureType.java -index 79e52f7bac..42f6a6a93a 100644 +index 8874a05be5..0af387c059 100644 --- a/src/main/java/net/minecraft/server/EnumCreatureType.java +++ b/src/main/java/net/minecraft/server/EnumCreatureType.java -@@ -16,6 +16,8 @@ public enum EnumCreatureType { +@@ -18,6 +18,8 @@ public enum EnumCreatureType { this.h = flag1; } @@ -183,7 +183,7 @@ index 32808558bb..62b4c64f68 100644 if (l1 <= k) { BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 4ea31bc201..abf3796d91 100644 +index f99cdf1003..c479828d49 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -50,7 +50,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc diff --git a/Spigot-Server-Patches/0342-Optimize-CraftBlockData-Creation.patch b/Spigot-Server-Patches/0342-Optimize-CraftBlockData-Creation.patch index ba6f4cd9b..2b6a24e40 100644 --- a/Spigot-Server-Patches/0342-Optimize-CraftBlockData-Creation.patch +++ b/Spigot-Server-Patches/0342-Optimize-CraftBlockData-Creation.patch @@ -1,4 +1,4 @@ -From 60322b509f65a591ad5dcce5985e6895cd7b26bc Mon Sep 17 00:00:00 2001 +From 328689b5cc58e53615c8fde2642e9f0d096f2a75 Mon Sep 17 00:00:00 2001 From: miclebrick Date: Thu, 23 Aug 2018 11:45:32 -0400 Subject: [PATCH] Optimize CraftBlockData Creation @@ -7,7 +7,7 @@ Avoids a hashmap lookup by cacheing a reference to the CraftBlockData and cloning it when one is needed. diff --git a/src/main/java/net/minecraft/server/BlockData.java b/src/main/java/net/minecraft/server/BlockData.java -index 4dd6c32761..1b226a77e0 100644 +index fbe181c1fd..bd86cd2e54 100644 --- a/src/main/java/net/minecraft/server/BlockData.java +++ b/src/main/java/net/minecraft/server/BlockData.java @@ -1,6 +1,7 @@ @@ -17,10 +17,10 @@ index 4dd6c32761..1b226a77e0 100644 +import org.bukkit.craftbukkit.block.data.CraftBlockData; public class BlockData extends BlockDataAbstract implements IBlockData { - -@@ -11,4 +12,14 @@ public class BlockData extends BlockDataAbstract implements I + public BlockData(Block block, ImmutableMap, Comparable> immutablemap) { +@@ -10,4 +11,14 @@ public class BlockData extends BlockDataAbstract implements I public Block getBlock() { - return (Block) this.e_; + return this.e_; } + + // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time @@ -34,10 +34,10 @@ index 4dd6c32761..1b226a77e0 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 6f80876990..726b178fd8 100644 +index bf06a90312..4d62d0093d 100644 --- a/src/main/java/net/minecraft/server/IBlockData.java +++ b/src/main/java/net/minecraft/server/IBlockData.java -@@ -28,6 +28,8 @@ public interface IBlockData extends IBlockDataHolder { +@@ -23,6 +23,8 @@ public interface IBlockData extends IBlockDataHolder { Block getBlock(); diff --git a/Spigot-Server-Patches/0347-Anti-Xray.patch b/Spigot-Server-Patches/0347-Anti-Xray.patch index a69e1e346..743813e37 100644 --- a/Spigot-Server-Patches/0347-Anti-Xray.patch +++ b/Spigot-Server-Patches/0347-Anti-Xray.patch @@ -1,11 +1,11 @@ -From 2f0929b908a4efcd1d3315902bb2b90bfbff13f9 Mon Sep 17 00:00:00 2001 +From 57f394938e0a725caa306557459d93867d85d34d Mon Sep 17 00:00:00 2001 From: stonar96 Date: Mon, 20 Aug 2018 03:03:58 +0200 Subject: [PATCH] Anti-Xray diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 19f4c61cd..3acb1ff9f 100644 +index 19f4c61cdc..3acb1ff9fd 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -1,7 +1,10 @@ @@ -49,7 +49,7 @@ index 19f4c61cd..3acb1ff9f 100644 } diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java new file mode 100644 -index 000000000..1ba8477bf +index 0000000000..1ba8477bf9 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java @@ -0,0 +1,45 @@ @@ -100,7 +100,7 @@ index 000000000..1ba8477bf +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 000000000..65d3e88c3 +index 0000000000..65d3e88c3b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java @@ -0,0 +1,670 @@ @@ -776,7 +776,7 @@ index 000000000..65d3e88c3 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java new file mode 100644 -index 000000000..41618994b +index 0000000000..41618994b4 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java @@ -0,0 +1,81 @@ @@ -863,7 +863,7 @@ index 000000000..41618994b +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java new file mode 100644 -index 000000000..e255a45fa +index 0000000000..e255a45fa3 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java @@ -0,0 +1,29 @@ @@ -898,7 +898,7 @@ index 000000000..e255a45fa +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java new file mode 100644 -index 000000000..cc586827a +index 0000000000..cc586827aa --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java @@ -0,0 +1,56 @@ @@ -960,7 +960,7 @@ index 000000000..cc586827a +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java new file mode 100644 -index 000000000..37093419c +index 0000000000..37093419cf --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java @@ -0,0 +1,84 @@ @@ -1049,7 +1049,7 @@ index 000000000..37093419c + } +} diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 56c378341..f3d9211ba 100644 +index 56c3783412..f3d9211baa 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -541,7 +541,7 @@ public class Chunk implements IChunkAccess { @@ -1071,7 +1071,7 @@ index 56c378341..f3d9211ba 100644 this.initLighting(); } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 867b0db77..06968974c 100644 +index 867b0db770..06968974c5 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -843,7 +843,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -1093,10 +1093,10 @@ index 867b0db77..06968974c 100644 chunksection.getBlocks().a(nbttagcompound, "Palette", "BlockStates"); chunksection.a(new NibbleArray(nbttagcompound.getByteArray("BlockLight"))); diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 233cbb6d6..8c116b74c 100644 +index 7e4c79a1ce..bdfc7d81ff 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -13,9 +13,15 @@ public class ChunkSection { +@@ -10,9 +10,15 @@ public class ChunkSection { private NibbleArray emittedLight; private NibbleArray skyLight; @@ -1108,13 +1108,13 @@ index 233cbb6d6..8c116b74c 100644 + + public ChunkSection(int i, boolean flag, IChunkAccess chunk, IWorldReader world, boolean initializeBlocks) { // Paper - Anti-Xray this.yPos = i; -- this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // Paper - Decompile error -+ this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData(), world instanceof GeneratorAccess ? ((GeneratorAccess) world).getMinecraftWorld().chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, flag, initializeBlocks) : null, initializeBlocks); // Paper - Decompile error // Paper - Anti-Xray - Add predefined block data +- this.blockIds = new DataPaletteBlock(GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); ++ this.blockIds = new DataPaletteBlock(GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData(), world instanceof GeneratorAccess ? ((GeneratorAccess) world).getMinecraftWorld().chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, flag, initializeBlocks) : null, initializeBlocks); // Paper - Anti-Xray - Add predefined block data this.emittedLight = new NibbleArray(); if (flag) { this.skyLight = new NibbleArray(); diff --git a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java -index 95eb1a84a..34019bd1b 100644 +index 95eb1a84ac..34019bd1b3 100644 --- a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java +++ b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java @@ -42,7 +42,7 @@ public class ChunkTaskScheduler extends Scheduler implements DataPaletteExpandable { +@@ -15,6 +16,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { private final Function e; private final Function f; private final T g; @@ -1154,22 +1154,21 @@ index 575f9b558..5d2561a94 100644 protected DataBits a; protected DataBits getDataBits() { return this.a; } // Paper - OBFHELPER private DataPalette h; private DataPalette getDataPalette() { return this.h; } // Paper - OBFHELPER private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER -@@ -41,13 +43,44 @@ public class DataPaletteBlock implements DataPaletteExpandable { - this.j.unlock(); +@@ -39,12 +41,43 @@ public class DataPaletteBlock implements DataPaletteExpandable { } -+ // Paper start - Anti-Xray - Support default constructor - public DataPaletteBlock(DataPalette datapalette, RegistryBlockID registryblockid, Function function, Function function1, T t0) { -+ this(datapalette, registryblockid, function, function1, t0, null, true); + public DataPaletteBlock(DataPalette datapalette, RegistryBlockID registryblockid, Function function, Function function1, T object) { ++ // Paper start - Anti-Xray - Support default constructor ++ this(datapalette, registryblockid, function, function1, object, null, true); + } -+ // Paper end + -+ public DataPaletteBlock(DataPalette datapalette, RegistryBlockID registryblockid, Function function, Function function1, T t0, T[] predefinedObjects, boolean initialize) { // Paper - Anti-Xray - Add predefined objects ++ public DataPaletteBlock(DataPalette datapalette, RegistryBlockID registryblockid, Function function, Function function1, T object, T[] predefinedObjects, boolean initialize) { ++ // Paper end - Anti-Xray - Add predefined objects this.b = datapalette; this.d = registryblockid; this.e = function; this.f = function1; - this.g = t0; + this.g = (T)object; - this.b(4); + // Paper start - Anti-Xray - Add predefined objects + this.predefinedObjects = predefinedObjects; @@ -1199,8 +1198,8 @@ index 575f9b558..5d2561a94 100644 + // Paper end } - private static int b(int i, int j, int k) { -@@ -73,12 +106,23 @@ public class DataPaletteBlock implements DataPaletteExpandable { + private static int b(int ix, int jx, int k) { +@@ -70,12 +103,22 @@ public class DataPaletteBlock implements DataPaletteExpandable { } } @@ -1213,19 +1212,18 @@ index 575f9b558..5d2561a94 100644 + } + } + // Paper end -+ - public int onResize(int i, T t0) { + public int onResize(int ix, T object) { this.b(); DataBits databits = this.a; DataPalette datapalette = this.h; // Paper - decompile fix + this.b(ix); - this.b(i); + this.addPredefinedObjects(); // Paper - Anti-Xray - Add predefined objects - - int j; - -@@ -117,11 +161,28 @@ public class DataPaletteBlock implements DataPaletteExpandable { - return object == null ? this.g : object; + for(int jx = 0; jx < databits.b(); ++jx) { + T object1 = datapalette.a(databits.a(jx)); // Paper - decompile fix + if (object1 != null) { +@@ -108,11 +151,28 @@ public class DataPaletteBlock implements DataPaletteExpandable { + return (T)(object == null ? this.g : object); } - public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER @@ -1254,26 +1252,26 @@ index 575f9b558..5d2561a94 100644 packetdataserializer.a(this.a.a()); this.c(); } -@@ -129,13 +190,15 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -120,12 +180,15 @@ public class DataPaletteBlock implements DataPaletteExpandable { public void a(NBTTagCompound nbttagcompound, String s, String s1) { this.b(); NBTTagList nbttaglist = nbttagcompound.getList(s, 10); -- int i = Math.max(4, MathHelper.d(nbttaglist.size())); +- int ix = Math.max(4, MathHelper.d(nbttaglist.size())); +- if (ix != this.i) { + // Paper - Anti-Xray - TODO: Should this.predefinedObjects.length just be added here (faster) or should the contents be compared to calculate the size (less RAM)? -+ int i = Math.max(4, MathHelper.d(nbttaglist.size() + (this.predefinedObjects == null ? 0 : this.predefinedObjects.length))); // Paper - Anti-Xray - Calculate the size with predefined objects - -- if (i != this.i) { -+ if (true || i != this.i) { // Paper - Anti-Xray - Not initialized yet - this.b(i); ++ int ix = Math.max(4, MathHelper.d(nbttaglist.size() + (this.predefinedObjects == null ? 0 : this.predefinedObjects.length))); // Paper - Anti-Xray - Calculate the size with predefined objects ++ ++ if (true || ix != this.i) { // Paper - Anti-Xray - Not initialized yet + this.b(ix); } this.h.a(nbttaglist); + this.addPredefinedObjects(); // Paper - Anti-Xray - Add predefined objects long[] along = nbttagcompound.o(s1); - int j = along.length * 64 / 4096; - + int jx = along.length * 64 / 4096; + if (this.h == this.b) { diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index f8facddb4..b2afec5e4 100644 +index f8facddb40..b2afec5e4b 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -158,8 +158,8 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -1334,7 +1332,7 @@ index f8facddb4..b2afec5e4 100644 public void a() { this.o(); diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 632101024..d0ff96812 100644 +index 22a262bb60..40ec398eef 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -1,5 +1,6 @@ @@ -1344,26 +1342,22 @@ index 632101024..d0ff96812 100644 import com.google.common.collect.Lists; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -@@ -16,17 +17,30 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -14,17 +15,27 @@ public class PacketPlayOutMapChunk implements Packet { private byte[] d; private byte[] getData() { return this.d; } // Paper - OBFHELPER private List e; private boolean f; + private volatile boolean ready = false; // Paper - Async-Anti-Xray - Ready flag for the network manager -- public PacketPlayOutMapChunk() {} -+ // Paper start - Async-Anti-Xray - Set the ready flag to true -+ public PacketPlayOutMapChunk() { -+ this.ready = true; -+ } -+ // Paper end + public PacketPlayOutMapChunk() { ++ this.ready = true; // Paper - Async-Anti-Xray - Set the ready flag to true + } public PacketPlayOutMapChunk(Chunk chunk, int i) { + ChunkPacketInfo chunkPacketInfo = chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info this.a = chunk.locX; this.b = chunk.locZ; - this.f = i == '\uffff'; + this.f = i == 65535; boolean flag = chunk.getWorld().worldProvider.g(); - this.d = new byte[this.a(chunk, flag, i)]; - this.c = this.a(new PacketDataSerializer(this.h()), chunk, flag, i); + @@ -1375,9 +1369,9 @@ index 632101024..d0ff96812 100644 + + this.c = this.writeChunk(new PacketDataSerializer(this.h()), chunk, flag, i, chunkPacketInfo); // Paper - Anti-Xray - Add chunk packet info this.e = Lists.newArrayList(); - Iterator iterator = chunk.getTileEntities().entrySet().iterator(); -@@ -44,7 +58,18 @@ public class PacketPlayOutMapChunk implements Packet { + for(Entry entry : chunk.getTileEntities().entrySet()) { +@@ -38,8 +49,19 @@ public class PacketPlayOutMapChunk implements Packet { } } @@ -1387,16 +1381,17 @@ index 632101024..d0ff96812 100644 + // Paper start - Async-Anti-Xray - Getter and Setter for the ready flag + public boolean isReady() { + return this.ready; -+ } -+ + } + + public void setReady(boolean ready) { + this.ready = ready; - } ++ } + // Paper end - ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { this.a = packetdataserializer.readInt(); -@@ -98,8 +123,15 @@ public class PacketPlayOutMapChunk implements Packet { + this.b = packetdataserializer.readInt(); +@@ -86,8 +108,15 @@ public class PacketPlayOutMapChunk implements Packet { return bytebuf; } @@ -1413,8 +1408,8 @@ index 632101024..d0ff96812 100644 int j = 0; ChunkSection[] achunksection = chunk.getSections(); int k = 0; -@@ -111,7 +143,7 @@ public class PacketPlayOutMapChunk implements Packet { - +@@ -96,7 +125,7 @@ public class PacketPlayOutMapChunk implements Packet { + ChunkSection chunksection = achunksection[k]; if (chunksection != Chunk.a && (!this.f() || !chunksection.a()) && (i & 1 << k) != 0) { j |= 1 << k; - chunksection.getBlocks().b(packetdataserializer); @@ -1423,7 +1418,7 @@ index 632101024..d0ff96812 100644 if (flag) { packetdataserializer.writeBytes(chunksection.getSkyLightArray().asBytes()); diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index f8d8a44a8..e7d465fb8 100644 +index f8d8a44a88..e7d465fb8a 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -108,6 +108,8 @@ public class PlayerChunk { @@ -1454,7 +1449,7 @@ index f8d8a44a8..e7d465fb8 100644 } else { this.a((Packet) (new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, this.chunk))); diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index cae24961f..a9690fb1c 100644 +index cae24961fd..a9690fb1c3 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -206,6 +206,8 @@ public class PlayerInteractManager { @@ -1467,19 +1462,20 @@ index cae24961f..a9690fb1c 100644 public void a(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 541435d3e..0b4f0d241 100644 +index 688b4ab8be..f78d5fbb86 100644 --- a/src/main/java/net/minecraft/server/ProtoChunk.java +++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -44,12 +44,24 @@ public class ProtoChunk implements IChunkAccess { +@@ -40,12 +40,25 @@ public class ProtoChunk implements IChunkAccess { private long s; private final Map t; private boolean u; + private final GeneratorAccess world; // Paper - Anti-Xray ++ + // Paper start - Anti-Xray - Support default constructors - public ProtoChunk(int i, int j, ChunkConverter chunkconverter) { -- this(new ChunkCoordIntPair(i, j), chunkconverter); -+ this(i, j, chunkconverter, null); + public ProtoChunk(int ix, int jx, ChunkConverter chunkconverter) { +- this(new ChunkCoordIntPair(ix, jx), chunkconverter); ++ this(ix, jx, chunkconverter, null); } public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter) { @@ -1496,34 +1492,16 @@ index 541435d3e..0b4f0d241 100644 this.d = new AtomicInteger(); this.f = Maps.newEnumMap(HeightMap.Type.class); this.g = ChunkStatus.EMPTY; -@@ -74,7 +86,7 @@ public class ProtoChunk implements IChunkAccess { - IRegistry iregistry1 = IRegistry.BLOCK; - - IRegistry.BLOCK.getClass(); -- this.q = new ProtoChunkTickList(predicate, function, iregistry1::getOrDefault, chunkcoordintpair); -+ this.q = new ProtoChunkTickList(predicate, function, IRegistry.BLOCK::getOrDefault, chunkcoordintpair); // Paper - decompile fix - predicate = (fluidtype) -> { - return fluidtype == null || fluidtype == FluidTypes.a; - }; -@@ -83,7 +95,7 @@ public class ProtoChunk implements IChunkAccess { - function = iregistry::getKey; - iregistry1 = IRegistry.FLUID; - IRegistry.FLUID.getClass(); -- this.r = new ProtoChunkTickList(predicate, function, iregistry1::getOrDefault, chunkcoordintpair); -+ this.r = new ProtoChunkTickList(predicate, function, IRegistry.FLUID::getOrDefault, chunkcoordintpair); // Paper - decompile fix - } - - public static ShortList a(ShortList[] ashortlist, int i) { -@@ -152,7 +164,7 @@ public class ProtoChunk implements IChunkAccess { +@@ -132,7 +145,7 @@ public class ProtoChunk implements IChunkAccess { return iblockdata; } -- this.j[j >> 4] = new ChunkSection(j >> 4 << 4, this.x()); -+ this.j[j >> 4] = new ChunkSection(j >> 4 << 4, this.x(), this, this.world, true); // Paper - Anti-Xray +- this.j[jx >> 4] = new ChunkSection(jx >> 4 << 4, this.x()); ++ this.j[jx >> 4] = new ChunkSection(jx >> 4 << 4, this.x(), this, this.world, true); // Paper - Anti-Xray } - IBlockData iblockdata1 = this.j[j >> 4].getType(i & 15, j & 15, k & 15); -@@ -406,7 +418,7 @@ public class ProtoChunk implements IChunkAccess { + IBlockData iblockdata1 = this.j[jx >> 4].getType(ix & 15, jx & 15, kx & 15); +@@ -375,7 +388,7 @@ public class ProtoChunk implements IChunkAccess { return; } @@ -1533,7 +1511,7 @@ index 541435d3e..0b4f0d241 100644 if (enumskyblock == EnumSkyBlock.SKY) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 20bead54b..49809372d 100644 +index 20bead54bf..49809372d8 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1,6 +1,8 @@ @@ -1570,7 +1548,7 @@ index 20bead54b..49809372d 100644 if (iblockdata1 == null) { // CraftBukkit start - remove blockstate if failed diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java -index c26f0ed16..f6915d32a 100644 +index c26f0ed16b..f6915d32ab 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java @@ -17,9 +17,11 @@ import org.bukkit.material.MaterialData; diff --git a/Spigot-Server-Patches/0349-Optimize-RegistryMaterials.patch b/Spigot-Server-Patches/0349-Optimize-RegistryMaterials.patch index 1496d1af3..84592e3d1 100644 --- a/Spigot-Server-Patches/0349-Optimize-RegistryMaterials.patch +++ b/Spigot-Server-Patches/0349-Optimize-RegistryMaterials.patch @@ -1,4 +1,4 @@ -From 02c2f6575eb8ecea97cbd43517c6cdabb2879174 Mon Sep 17 00:00:00 2001 +From 825b7b20507d171d3c14a620f650f33ae97d89cc Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 26 Aug 2018 20:49:50 -0400 Subject: [PATCH] Optimize RegistryMaterials @@ -8,29 +8,20 @@ Use larger initial sizes to increase bucket capacity on the BiMap BiMap.get was seen to be using a good bit of CPU time. diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java -index 2aa6f89c18..1974baff83 100644 +index 83ce386e05..a47110bba8 100644 --- a/src/main/java/net/minecraft/server/RegistryMaterials.java +++ b/src/main/java/net/minecraft/server/RegistryMaterials.java -@@ -14,8 +14,8 @@ import org.apache.logging.log4j.Logger; - public class RegistryMaterials implements IRegistry { +@@ -13,8 +13,8 @@ import org.apache.logging.log4j.Logger; + public class RegistryMaterials implements IRegistry { protected static final Logger a = LogManager.getLogger(); -- protected final RegistryID b = new RegistryID(256); +- protected final RegistryID b = new RegistryID(256); - protected final BiMap c = HashBiMap.create(); -+ protected final RegistryID b = new RegistryID<>(2048); // Paper - use bigger expected size to reduce collisions ++ protected final RegistryID b = new RegistryID(2048); // Paper - use bigger expected size to reduce collisions + protected final BiMap c = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions protected Object[] d; private int x; -@@ -92,7 +92,7 @@ public class RegistryMaterials implements IRegistry { - this.d = set.toArray(new Object[set.size()]); - } - -- return this.d[random.nextInt(this.d.length)]; -+ return (V) this.d[random.nextInt(this.d.length)]; // Paper - decompile fix - } - - public boolean c(MinecraftKey minecraftkey) { -- 2.18.0 diff --git a/scripts/decompile.sh b/scripts/decompile.sh index 032abdb70..86d60a679 100755 --- a/scripts/decompile.sh +++ b/scripts/decompile.sh @@ -8,27 +8,89 @@ workdir="$basedir/work" minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) windows="$([[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]] && echo "true" || echo "false")" decompiledir="$workdir/Minecraft/$minecraftversion" +spigotdecompiledir="$decompiledir/spigot" +forgedecompiledir="$decompiledir/forge" +forgeflowerversion="1.5.380.19" +forgeflowerurl="http://files.minecraftforge.net/maven/net/minecraftforge/forgeflower/$forgeflowerversion/forgeflower-$forgeflowerversion.jar" +# temp use patched version +forgeflowerurl="https://zachbr.keybase.pub/paper/forgeflower-patched/forgeflower-1.5.380.19.jar?dl=1" +forgeflowerbin="$workdir/ForgeFlower/$forgeflowerversion.jar" +# TODO: Make this better? We don't need spigot compat for this stage +forgefloweroptions="-dgs=1 -hdc=0 -asc=1 -udv=1 -jvn=1" +forgeflowercachefile="$decompiledir/forgeflowercache" +forgeflowercachevalue="$forgeflowerurl - $forgeflowerversion - $forgefloweroptions"; classdir="$decompiledir/classes" + +mkdir -p "$workdir/ForgeFlower" + echo "Extracting NMS classes..." if [ ! -d "$classdir" ]; then mkdir -p "$classdir" cd "$classdir" + set +e jar xf "$decompiledir/$minecraftversion-mapped.jar" net/minecraft/server if [ "$?" != "0" ]; then cd "$basedir" echo "Failed to extract NMS classes." exit 1 fi + set -e fi -echo "Decompiling classes..." -if [ ! -d "$decompiledir/net/minecraft/server" ]; then +# prep folders +mkdir -p "$spigotdecompiledir" +mkdir -p "$forgedecompiledir" + +needsDecomp=0 +if [ ! -f "$forgeflowercachefile" ]; then + needsDecomp=1 +elif [ "$(cat ${forgeflowercachefile})" != "$forgeflowercachevalue" ]; then + needsDecomp=1 +fi +if [ "$needsDecomp" == "1" ]; then + # our local cache is now invalidated, we can update forgeflower to get better deobfuscation + rm -rf "$forgedecompiledir" +fi + +# Forge (for Paper mc-dev imports, and dev src folders for unimported files) +if [ ! -d "$forgedecompiledir/net" ] ; then + echo "Decompiling classes (stage 1)..." cd "$basedir" - java -jar "$workdir/BuildData/bin/fernflower.jar" -dgs=1 -hdc=0 -asc=1 -udv=0 "$classdir" "$decompiledir" + + if [ ! -f "$forgeflowerbin" ]; then + echo "Downloading ForgeFlower ($forgeflowerversion)..." + curl -s -o "$forgeflowerbin" "$forgeflowerurl" + fi + + set +e + java -Ddecomp.renameparams=true -jar "$forgeflowerbin" ${forgefloweroptions} -ind=' ' "$classdir" "$forgedecompiledir" if [ "$?" != "0" ]; then + rm -rf "$forgedecompiledir/net" echo "Failed to decompile classes." exit 1 fi + echo "$forgeflowercachevalue" > "$forgeflowercachefile" + set -e +fi + +# Spigot (for CraftBukkit patches) + +# if we see the old net folder, copy it to spigot to avoid redecompiling +if [ -d "$decompiledir/net" ]; then + cp -r "$decompiledir/net" "$spigotdecompiledir/" +fi + +if [ ! -d "$spigotdecompiledir/net" ]; then + echo "Decompiling classes (stage 2)..." + cd "$basedir" + set +e + java -jar "$workdir/BuildData/bin/fernflower.jar" -dgs=1 -hdc=0 -asc=1 -udv=0 "$classdir" "$spigotdecompiledir" + if [ "$?" != "0" ]; then + rm -rf "$spigotdecompiledir/net" + echo "Failed to decompile classes." + exit 1 + fi + set -e fi # set a symlink to current diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 9217d06df..c87a9f246 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -11,7 +11,7 @@ gitcmd="git -c commit.gpgsign=false" workdir="$basedir/work" minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) -decompiledir="$workdir/Minecraft/$minecraftversion" +decompiledir="$workdir/Minecraft/$minecraftversion/forge" export importedmcdev="" function import { diff --git a/scripts/init.sh b/scripts/init.sh index 2b75ec894..7af206111 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -6,8 +6,8 @@ PS1="$" basedir="$(cd "$1" && pwd -P)" workdir="$basedir/work" minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) -decompiledir="$workdir/Minecraft/$minecraftversion" -nms="$decompiledir/net/minecraft/server" +spigotdecompiledir="$workdir/Minecraft/$minecraftversion/spigot" +nms="$spigotdecompiledir/net/minecraft/server" cb="src/main/java/net/minecraft/server" gitcmd="git -c commit.gpgsign=false" diff --git a/scripts/makemcdevsrc.sh b/scripts/makemcdevsrc.sh index a4123a5a4..d2aea1fef 100755 --- a/scripts/makemcdevsrc.sh +++ b/scripts/makemcdevsrc.sh @@ -9,7 +9,7 @@ cd "$basedir" workdir="$basedir/work" minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) decompiledir="$workdir/Minecraft/$minecraftversion" -nms="$decompiledir/net/minecraft/server" +nms="$decompiledir/forge/net/minecraft/server" papernms="Paper-Server/src/main/java/net/minecraft/server" mcdevsrc="${decompiledir}/src/net/minecraft/server" rm -rf "${mcdevsrc}" diff --git a/scripts/remap.sh b/scripts/remap.sh index b19d564af..3d736e77c 100755 --- a/scripts/remap.sh +++ b/scripts/remap.sh @@ -12,11 +12,12 @@ accesstransforms="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info. classmappings="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info.json" | grep classMappings | cut -d '"' -f 4) membermappings="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info.json" | grep memberMappings | cut -d '"' -f 4) packagemappings="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info.json" | grep packageMappings | cut -d '"' -f 4) -jarpath="$workdir/Minecraft/$minecraftversion/$minecraftversion" +decompiledir="$workdir/Minecraft/$minecraftversion" +jarpath="$decompiledir/$minecraftversion" +mkdir -p "$decompiledir" echo "Downloading unmapped vanilla jar..." if [ ! -f "$jarpath.jar" ]; then - mkdir -p "$workdir/Minecraft/$minecraftversion" curl -s -o "$jarpath.jar" "$minecraftserverurl" if [ "$?" != "0" ]; then echo "Failed to download the vanilla server jar. Check connectivity or try again later." diff --git a/scripts/testServer.sh b/scripts/testServer.sh index 585768fa3..9e9ca4242 100755 --- a/scripts/testServer.sh +++ b/scripts/testServer.sh @@ -5,7 +5,6 @@ PS1="$" basedir="$(cd "$1" && pwd -P)" workdir="$basedir/work" minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) -decompiledir="$workdir/Minecraft/$minecraftversion" gitcmd="git -c commit.gpgsign=false" #