From e82ef9ec058f56038803026a1832e2471f7df649 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 31 Aug 2018 18:56:57 -0400 Subject: [PATCH] Switch to using ForgeFlower for Paper Only mc-dev imports ForgeFlower is better than Spigots FernFlower at decompiling the source. However, in order to maintain the CraftBukkit patches, we must keep using spigots for the primary. However, for any file that we import on top of Spigots imported files there is nothing stopping us from using better decompiled files. So these changes will use ForgeFlower to maintain a better set of decomped files, so anything we add on top of Paper can start off in a better spot. --- .gitignore | 1 + .../Ability-to-apply-mending-to-XP-API.patch | 8 +- .../Activation-Range-Improvements.patch | 61 +- .../Add-PlayerArmorChangeEvent.patch | 6 +- .../Add-PlayerUseUnknownEntityEvent.patch | 8 +- ...-to-configure-frosted_ice-properties.patch | 30 +- ...to-disable-ender-dragon-legacy-check.patch | 31 +- ...-despawn-distances-for-living-entiti.patch | 4 +- .../Add-exception-reporting-event.patch | 24 +- .../Allow-nerfed-mobs-to-jump.patch | 8 +- Spigot-Server-Patches/Anti-Xray.patch | 142 ++-- .../Cache-World-Entity-Type-counts.patch | 6 +- ...ServerListPingEvent-for-legacy-pings.patch | 74 +- .../Chunk-Save-Reattempt.patch | 4 +- .../Chunk-save-queue-improvements.patch | 14 +- ...le-Alternative-LootPool-Luck-Formula.patch | 10 +- .../Configurable-Bed-Search-Radius.patch | 8 +- ...urable-Disabling-Cat-Chest-Detection.patch | 8 +- .../Configurable-Player-Collision.patch | 6 +- .../Configurable-RCON-IP-address.patch | 2 +- ...tect-and-repair-corrupt-Region-Files.patch | 14 +- .../Do-not-load-chunks-for-pathfinding.patch | 6 +- ...Chunks-from-Hoppers-and-other-things.patch | 8 +- ...spawn-if-entity-is-in-a-chunk-schedu.patch | 2 +- ...y-scoreboard-teams-to-scoreboard.dat.patch | 8 +- ...am-reload-spawn-chunks-in-nether-end.patch | 6 +- .../EnderDragon-Events.patch | 12 +- Spigot-Server-Patches/Entity-Origin-API.patch | 6 +- .../EntityPathfindEvent.patch | 14 +- Spigot-Server-Patches/Firework-API-s.patch | 17 +- .../Fix-Dragon-Server-Crashes.patch | 12 +- .../Fix-Old-Sign-Conversion.patch | 18 +- ...ient-rendering-skulls-from-same-user.patch | 13 +- ...ecipes-in-RecipeBook-to-avoid-data-e.patch | 17 +- ...nt-extended-PaperServerListPingEvent.patch | 2 +- .../Implement-getI18NDisplayName.patch | 6 +- .../Item-canEntityPickup.patch | 2 +- ...-API-Replenishable-Lootables-Feature.patch | 11 +- Spigot-Server-Patches/MC-Dev-fixes.patch | 645 +++++++----------- Spigot-Server-Patches/MC-Utils.patch | 133 ++-- ...ke-legacy-ping-handler-more-reliable.patch | 32 +- ...portation-adjustment-math-more-accur.patch | 16 +- ...e-BlockStateEnum-hashCode-and-equals.patch | 39 +- ...ptimize-BlockPosition-helper-methods.patch | 58 +- .../Optimize-CraftBlockData-Creation.patch | 8 +- .../Optimize-Pathfinding.patch | 4 +- .../Optimize-RegistryID.c.patch | 34 +- .../Optimize-RegistryMaterials.patch | 17 +- .../Optimize-TileEntity-Ticking.patch | 35 +- ...Location-getType-and-getBlockData-fo.patch | 10 +- .../Optimized-Light-Level-Comparisons.patch | 3 +- .../Pass-world-to-Village-creation.patch | 6 +- .../Player-Tab-List-and-Title-APIs.patch | 13 +- .../Player-affects-spawning-API.patch | 6 +- .../PlayerElytraBoostEvent.patch | 4 +- .../PlayerLaunchProjectileEvent.patch | 33 +- ...sted-Ice-from-loading-holding-chunks.patch | 37 +- ...vent-Pathfinding-out-of-World-Border.patch | 4 +- Spigot-Server-Patches/RangedEntity-API.patch | 14 +- ...uce-IO-ops-opening-a-new-region-file.patch | 24 +- .../Remove-Debug-checks-from-DataBits.patch | 16 +- .../Shame-on-you-Mojang.patch | 4 +- ...ient-crashes-server-lists-and-Mojang.patch | 6 +- .../SkeletonHorse-Additions.patch | 6 +- .../Speedup-BlockPos-by-fixing-inlining.patch | 34 +- Spigot-Server-Patches/Timings-v2.patch | 64 +- .../Vanished-players-don-t-have-rights.patch | 8 +- .../Waving-banner-workaround.patch | 8 +- scripts/decompile.sh | 68 +- scripts/importmcdev.sh | 2 +- scripts/init.sh | 4 +- scripts/makemcdevsrc.sh | 2 +- scripts/remap.sh | 5 +- scripts/testServer.sh | 1 - 74 files changed, 987 insertions(+), 1045 deletions(-) diff --git a/.gitignore b/.gitignore index 9712169add..3ef869c1ac 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/Ability-to-apply-mending-to-XP-API.patch b/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch index fc2c1e2fc5..29a60ab709 100644 --- a/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch @@ -10,7 +10,7 @@ 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 @@ -0,0 +0,0 @@ public class EnchantmentManager { @@ -19,10 +19,10 @@ index c90e413f8c..c365bfea04 100644 + 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 @@ -0,0 +0,0 @@ public class Enchantments { diff --git a/Spigot-Server-Patches/Activation-Range-Improvements.patch b/Spigot-Server-Patches/Activation-Range-Improvements.patch index 5203bb2d81..c209324ce2 100644 --- a/Spigot-Server-Patches/Activation-Range-Improvements.patch +++ b/Spigot-Server-Patches/Activation-Range-Improvements.patch @@ -5,20 +5,32 @@ 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 +@@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -31,7 +43,7 @@ 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 @@ -0,0 +0,0 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn @@ -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 @@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ package net.minecraft.server; +@@ -0,0 +0,0 @@ + 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; - +@@ -0,0 +0,0 @@ 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); - } + + public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int ix, int jx) { + this.d = BlockPosition.ZERO; @@ -0,0 +0,0 @@ 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 + 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/Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch index 4763a27f13..d73cb6d056 100644 --- a/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ public enum EnumItemSlot { - this.j = s; + this.j = s1; } + public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER diff --git a/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch b/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch index c141a37735..87f3af6f51 100644 --- a/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch @@ -5,20 +5,20 @@ 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 -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +@@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { diff --git a/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch b/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch index 69873bf4f7..609b2e53de 100644 --- a/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch +++ b/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -24,7 +24,7 @@ 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 @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { @@ -32,16 +32,22 @@ index 39b3c88d64..302d420512 100644 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; -@@ -0,0 +0,0 @@ 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 + } + } + -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-config-to-disable-ender-dragon-legacy-check.patch b/Spigot-Server-Patches/Add-config-to-disable-ender-dragon-legacy-check.patch index 6e7ced050d..64ad656591 100644 --- a/Spigot-Server-Patches/Add-config-to-disable-ender-dragon-legacy-check.patch +++ b/Spigot-Server-Patches/Add-config-to-disable-ender-dragon-legacy-check.patch @@ -19,7 +19,7 @@ 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 @@ -0,0 +0,0 @@ public class EnderDragonBattle { @@ -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; -@@ -0,0 +0,0 @@ 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,4 +45,21 @@ index a20d54ee34..48bcda0f50 100644 this.d = worldserver; if (nbttagcompound.hasKeyOfType("DragonKilled", 99)) { if (nbttagcompound.b("DragonUUID")) { +@@ -0,0 +0,0 @@ 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) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch index f088a9a2a3..0af30a372e 100644 --- a/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch +++ b/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -30,7 +30,7 @@ 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 @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { diff --git a/Spigot-Server-Patches/Add-exception-reporting-event.patch b/Spigot-Server-Patches/Add-exception-reporting-event.patch index 5bd4582397..9bcc3e0114 100644 --- a/Spigot-Server-Patches/Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/Add-exception-reporting-event.patch @@ -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 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ @@ -164,7 +164,7 @@ index 31899549d..cc7cad8be 100644 } @@ -0,0 +0,0 @@ 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 @@ -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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ import java.util.concurrent.atomic.AtomicReference; diff --git a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch index de1edcad01..c29194cc1e 100644 --- a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch +++ b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,7 +19,7 @@ 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 @@ -0,0 +0,0 @@ public class ControllerJump { @@ -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 @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -56,7 +56,7 @@ 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 @@ -0,0 +0,0 @@ public class PathfinderGoalFloat extends PathfinderGoal { diff --git a/Spigot-Server-Patches/Anti-Xray.patch b/Spigot-Server-Patches/Anti-Xray.patch index 3bafa75819..043b17d2c8 100644 --- a/Spigot-Server-Patches/Anti-Xray.patch +++ b/Spigot-Server-Patches/Anti-Xray.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ @@ -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 +0,0 @@ @@ -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 +0,0 @@ @@ -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 +0,0 @@ @@ -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 +0,0 @@ @@ -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 +0,0 @@ @@ -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 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -1093,7 +1093,7 @@ 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 @@ -0,0 +0,0 @@ public class ChunkSection { @@ -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 @@ -0,0 +0,0 @@ public class ChunkTaskScheduler extends Scheduler h; private DataPalette getDataPalette() { return this.h; } // Paper - OBFHELPER private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { - this.j.unlock(); } -+ // 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,7 +1198,7 @@ index 575f9b558..5d2561a94 100644 + // Paper end } - private static int b(int i, int j, int k) { + private static int b(int ix, int jx, int k) { @@ -0,0 +0,0 @@ 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; - + for(int jx = 0; jx < databits.b(); ++jx) { + T object1 = datapalette.a(databits.a(jx)); // Paper - decompile fix + if (object1 != null) { @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { - return object == null ? this.g : object; + return (T)(object == null ? this.g : object); } - public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER @@ -1258,22 +1256,22 @@ index 575f9b558..5d2561a94 100644 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ @@ -1350,20 +1348,16 @@ index 632101024..d0ff96812 100644 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,8 +1369,8 @@ 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(); + for(Entry entry : chunk.getTileEntities().entrySet()) { @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { } } @@ -1387,15 +1381,16 @@ 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(); + this.b = packetdataserializer.readInt(); @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { return bytebuf; } @@ -1414,7 +1409,7 @@ index 632101024..d0ff96812 100644 ChunkSection[] achunksection = chunk.getSections(); int k = 0; @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public class PlayerInteractManager { @@ -1467,7 +1462,7 @@ 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 @@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess { @@ -1476,10 +1471,11 @@ index 541435d3e..0b4f0d241 100644 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,33 +1492,15 @@ index 541435d3e..0b4f0d241 100644 this.d = new AtomicInteger(); this.f = Maps.newEnumMap(HeightMap.Type.class); this.g = ChunkStatus.EMPTY; -@@ -0,0 +0,0 @@ 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; - }; -@@ -0,0 +0,0 @@ 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) { @@ -0,0 +0,0 @@ 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); + IBlockData iblockdata1 = this.j[jx >> 4].getType(ix & 15, jx & 15, kx & 15); @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData; diff --git a/Spigot-Server-Patches/Cache-World-Entity-Type-counts.patch b/Spigot-Server-Patches/Cache-World-Entity-Type-counts.patch index f0fee9d516..12c35db21a 100644 --- a/Spigot-Server-Patches/Cache-World-Entity-Type-counts.patch +++ b/Spigot-Server-Patches/Cache-World-Entity-Type-counts.patch @@ -145,7 +145,7 @@ 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 @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -157,7 +157,7 @@ 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 @@ -0,0 +0,0 @@ public enum EnumCreatureType { @@ -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 @@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc diff --git a/Spigot-Server-Patches/Call-PaperServerListPingEvent-for-legacy-pings.patch b/Spigot-Server-Patches/Call-PaperServerListPingEvent-for-legacy-pings.patch index 693bfbcefd..8512c71e6b 100644 --- a/Spigot-Server-Patches/Call-PaperServerListPingEvent-for-legacy-pings.patch +++ b/Spigot-Server-Patches/Call-PaperServerListPingEvent-for-legacy-pings.patch @@ -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 @@ -0,0 +0,0 @@ import java.net.InetSocketAddress; @@ -94,47 +94,43 @@ index f7fbf1d76e..1ed2b193a5 100644 +import com.destroystokyo.paper.network.PaperLegacyStatusClient; // Paper public class LegacyPingHandler extends ChannelInboundHandlerAdapter { - + private static final Logger a = LogManager.getLogger(); @@ -0,0 +0,0 @@ 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; - + 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: @@ -0,0 +0,0 @@ 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; + } + 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: @@ -0,0 +0,0 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { a.debug("Ping: (1.6) from {}", ctx.channel().remoteAddress()); diff --git a/Spigot-Server-Patches/Chunk-Save-Reattempt.patch b/Spigot-Server-Patches/Chunk-Save-Reattempt.patch index a515a3d3fe..3def4c810c 100644 --- a/Spigot-Server-Patches/Chunk-Save-Reattempt.patch +++ b/Spigot-Server-Patches/Chunk-Save-Reattempt.patch @@ -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 @@ -0,0 +0,0 @@ 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/Chunk-save-queue-improvements.patch b/Spigot-Server-Patches/Chunk-save-queue-improvements.patch index 94558fe81b..c639329e5b 100644 --- a/Spigot-Server-Patches/Chunk-save-queue-improvements.patch +++ b/Spigot-Server-Patches/Chunk-save-queue-improvements.patch @@ -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 @@ -0,0 +0,0 @@ public class FileIOThread implements Runnable { - IAsyncChunkSaver iasyncchunksaver = (IAsyncChunkSaver) this.c.get(i); + 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/Configurable-Alternative-LootPool-Luck-Formula.patch b/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch index 365945bd15..5bf52ea24e 100644 --- a/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch +++ b/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch @@ -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 -@@ -0,0 +0,0 @@ import java.util.Random; +@@ -0,0 +0,0 @@ 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 @@ -71,7 +71,7 @@ index 3d501aee30..464f74b269 100644 } 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,6 +101,6 @@ 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); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-Bed-Search-Radius.patch b/Spigot-Server-Patches/Configurable-Bed-Search-Radius.patch index 47133b6a1b..a94ab5be4f 100644 --- a/Spigot-Server-Patches/Configurable-Bed-Search-Radius.patch +++ b/Spigot-Server-Patches/Configurable-Bed-Search-Radius.patch @@ -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 @@ -0,0 +0,0 @@ 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; diff --git a/Spigot-Server-Patches/Configurable-Disabling-Cat-Chest-Detection.patch b/Spigot-Server-Patches/Configurable-Disabling-Cat-Chest-Detection.patch index 9d4d90cbf9..94a5814b60 100644 --- a/Spigot-Server-Patches/Configurable-Disabling-Cat-Chest-Detection.patch +++ b/Spigot-Server-Patches/Configurable-Disabling-Cat-Chest-Detection.patch @@ -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 @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -20,7 +20,7 @@ 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 @@ -0,0 +0,0 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC @@ -32,7 +32,7 @@ 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) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-Player-Collision.patch b/Spigot-Server-Patches/Configurable-Player-Collision.patch index ad85b2f881..ffc40e6c50 100644 --- a/Spigot-Server-Patches/Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/Configurable-Player-Collision.patch @@ -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 @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati @@ -43,7 +43,7 @@ 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 @@ -0,0 +0,0 @@ public class PacketPlayOutScoreboardTeam implements Packet 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; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Do-not-load-chunks-for-pathfinding.patch b/Spigot-Server-Patches/Do-not-load-chunks-for-pathfinding.patch index c27145d0ac..5c16cbe028 100644 --- a/Spigot-Server-Patches/Do-not-load-chunks-for-pathfinding.patch +++ b/Spigot-Server-Patches/Do-not-load-chunks-for-pathfinding.patch @@ -5,13 +5,13 @@ 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 @@ -0,0 +0,0 @@ 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/Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/Spigot-Server-Patches/Don-t-load-Chunks-from-Hoppers-and-other-things.patch index 01288a6ddb..a0635a5a35 100644 --- a/Spigot-Server-Patches/Don-t-load-Chunks-from-Hoppers-and-other-things.patch +++ b/Spigot-Server-Patches/Don-t-load-Chunks-from-Hoppers-and-other-things.patch @@ -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 @@ -0,0 +0,0 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC - return (ITileInventory) object; + return (ITileInventory)object; } else { BlockPosition blockposition1 = blockposition.shift(k(iblockdata)); - IBlockData iblockdata1 = world.getType(blockposition1); @@ -27,7 +27,7 @@ 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)) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-process-despawn-if-entity-is-in-a-chunk-schedu.patch b/Spigot-Server-Patches/Don-t-process-despawn-if-entity-is-in-a-chunk-schedu.patch index f2731dda5a..998be4d7d2 100644 --- a/Spigot-Server-Patches/Don-t-process-despawn-if-entity-is-in-a-chunk-schedu.patch +++ b/Spigot-Server-Patches/Don-t-process-despawn-if-entity-is-in-a-chunk-schedu.patch @@ -12,7 +12,7 @@ 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 @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { diff --git a/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index 2268b9ed27..32a701a0dd 100644 --- a/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -19,15 +19,15 @@ 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 @@ -0,0 +0,0 @@ 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())); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch b/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch index 82ce6246a2..3d48c22c72 100644 --- a/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch +++ b/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public abstract class WorldProvider { - public void l() {} + } public boolean a(int i, int j) { - return !this.b.f(i, j); diff --git a/Spigot-Server-Patches/EnderDragon-Events.patch b/Spigot-Server-Patches/EnderDragon-Events.patch index 75346e098e..12f8c650c8 100644 --- a/Spigot-Server-Patches/EnderDragon-Events.patch +++ b/Spigot-Server-Patches/EnderDragon-Events.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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/Entity-Origin-API.patch b/Spigot-Server-Patches/Entity-Origin-API.patch index 72301446fe..9eb6476103 100644 --- a/Spigot-Server-Patches/Entity-Origin-API.patch +++ b/Spigot-Server-Patches/Entity-Origin-API.patch @@ -89,7 +89,7 @@ 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 @@ -0,0 +0,0 @@ public class NBTTagList extends NBTList { @@ -99,9 +99,9 @@ index a8280acf94..38dd8f17a6 100644 + 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 @@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc diff --git a/Spigot-Server-Patches/EntityPathfindEvent.patch b/Spigot-Server-Patches/EntityPathfindEvent.patch index 2c7543df38..a03b7d4401 100644 --- a/Spigot-Server-Patches/EntityPathfindEvent.patch +++ b/Spigot-Server-Patches/EntityPathfindEvent.patch @@ -6,13 +6,13 @@ 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 -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +@@ -0,0 +0,0 @@ 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; @@ -24,14 +24,14 @@ index 8111317e31..76d1f4bd21 100644 } 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(); - + float fx = this.j(); + this.b.methodProfiler.a("pathfind"); @@ -0,0 +0,0 @@ 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"); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Firework-API-s.patch b/Spigot-Server-Patches/Firework-API-s.patch index dbf586ead7..a3fd8dc260 100644 --- a/Spigot-Server-Patches/Firework-API-s.patch +++ b/Spigot-Server-Patches/Firework-API-s.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ package net.minecraft.server; @@ -28,17 +28,18 @@ index 6e2592e96d..f9332d3fda 100644 public EntityFireworks(World world) { super(EntityTypes.FIREWORK_ROCKET, world); @@ -0,0 +0,0 @@ public class EntityFireworks extends Entity { - if (!itemstack.isEmpty()) { nbttagcompound.set("FireworksItem", itemstack.save(new NBTTagCompound())); } + + // Paper start + if (spawningEntity != null) { + nbttagcompound.setUUID("SpawningEntity", spawningEntity); + } + // Paper end - ++ } + public void a(NBTTagCompound nbttagcompound) { @@ -0,0 +0,0 @@ public class EntityFireworks extends Entity { if (!itemstack.isEmpty()) { this.datawatcher.set(EntityFireworks.FIREWORK_ITEM, itemstack); @@ -53,27 +54,27 @@ 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 @@ -0,0 +0,0 @@ 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); } @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { diff --git a/Spigot-Server-Patches/Fix-Dragon-Server-Crashes.patch b/Spigot-Server-Patches/Fix-Dragon-Server-Crashes.patch index b411daa5f3..89722fc063 100644 --- a/Spigot-Server-Patches/Fix-Dragon-Server-Crashes.patch +++ b/Spigot-Server-Patches/Fix-Dragon-Server-Crashes.patch @@ -7,16 +7,16 @@ 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 @@ -0,0 +0,0 @@ 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)); + 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)); } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-Old-Sign-Conversion.patch b/Spigot-Server-Patches/Fix-Old-Sign-Conversion.patch index 2647a47802..694bad1a71 100644 --- a/Spigot-Server-Patches/Fix-Old-Sign-Conversion.patch +++ b/Spigot-Server-Patches/Fix-Old-Sign-Conversion.patch @@ -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 @@ -0,0 +0,0 @@ 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 + 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/Fix-client-rendering-skulls-from-same-user.patch b/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch index 6c74495dff..f7dddf5caf 100644 --- a/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch +++ b/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch @@ -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 @@ -0,0 +0,0 @@ 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); } -@@ -0,0 +0,0 @@ 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/Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch b/Spigot-Server-Patches/Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch index add2e4a629..f43f3d269c 100644 --- a/Spigot-Server-Patches/Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch +++ b/Spigot-Server-Patches/Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch @@ -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 @@ -0,0 +0,0 @@ public class RecipeBookServer extends RecipeBook { - while (iterator.hasNext()) { - MinecraftKey minecraftkey = (MinecraftKey) iterator.next(); + 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); @@ -0,0 +0,0 @@ public class RecipeBookServer extends RecipeBook { - while (iterator1.hasNext()) { - MinecraftKey minecraftkey1 = (MinecraftKey) iterator1.next(); + 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()))); } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch b/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch index e156d2d4e6..1f692388cc 100644 --- a/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch +++ b/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch @@ -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 @@ -0,0 +0,0 @@ public class ServerPing { diff --git a/Spigot-Server-Patches/Implement-getI18NDisplayName.patch b/Spigot-Server-Patches/Implement-getI18NDisplayName.patch index f32236349d..9b66b02407 100644 --- a/Spigot-Server-Patches/Implement-getI18NDisplayName.patch +++ b/Spigot-Server-Patches/Implement-getI18NDisplayName.patch @@ -8,7 +8,7 @@ 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 @@ -0,0 +0,0 @@ public class LocaleLanguage { @@ -17,7 +17,7 @@ index 4361b2cee..f81887c66 100644 + 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 @@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory { diff --git a/Spigot-Server-Patches/Item-canEntityPickup.patch b/Spigot-Server-Patches/Item-canEntityPickup.patch index d98c37b70c..006c7596ce 100644 --- a/Spigot-Server-Patches/Item-canEntityPickup.patch +++ b/Spigot-Server-Patches/Item-canEntityPickup.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { diff --git a/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch index 3f17b9add0..8912a35b96 100644 --- a/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch @@ -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 -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +@@ -0,0 +0,0 @@ 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 @@ -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 @@ -0,0 +0,0 @@ diff --git a/Spigot-Server-Patches/MC-Dev-fixes.patch b/Spigot-Server-Patches/MC-Dev-fixes.patch index dd5f875069..62f4d0b35b 100644 --- a/Spigot-Server-Patches/MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/MC-Dev-fixes.patch @@ -5,347 +5,317 @@ 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 @@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable { - return MoreObjects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString(); } + // $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 @@ -0,0 +0,0 @@ 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())); - } - -- 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; -@@ -0,0 +0,0 @@ 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; - } + } + // $FF: synthetic method +- protected Object computeNext() { ++ protected BlockPosition computeNext() { // Paper - decompile fix + return this.a(); + } + }; @@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ public class ChunkSection { +@@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { - public int onResize(int i, T t0) { + 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); + 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); + } @@ -0,0 +0,0 @@ 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); } -@@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { - int j = along.length * 64 / 4096; +@@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public class DedicatedPlayerList extends PlayerList { - public boolean f(GameProfile gameprofile) { - return this.getOPs().b(gameprofile); } -- + + // $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 @@ -0,0 +0,0 @@ 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(); @@ -0,0 +0,0 @@ public class DefinedStructure { - voxelshapebitset.a(blockposition3.getX() - i2, blockposition3.getY() - j2, blockposition3.getZ() - l1, true, true); - } - -- 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); - - if (iblockdata != iblockdata2) { -- generatoraccess.setTypeAndData(blockposition, iblockdata2, k1 & -2 | 16); -+ generatoraccess.setTypeAndData(innerBlockposition, iblockdata2, i & -2 | 16); - } - -- IBlockData iblockdata3 = iblockdata1.updateState(enumdirection.opposite(), iblockdata2, generatoraccess, blockposition1, blockposition); -+ IBlockData iblockdata3 = iblockdata1.updateState(enumdirection.opposite(), iblockdata2, generatoraccess, blockposition1, innerBlockposition); - - if (iblockdata1 != iblockdata3) { -- generatoraccess.setTypeAndData(blockposition1, iblockdata3, k1 & -2 | 16); -+ generatoraccess.setTypeAndData(blockposition1, iblockdata3, i & -2 | 16); -+ // Paper end - decompile fixes - } - - }); + 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; @@ -0,0 +0,0 @@ public class DefinedStructure { - public IBlockData a(int i) { - IBlockData iblockdata = (IBlockData) this.b.fromId(i); + 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); -- return iblockdata == null ? DefinedStructure.a.a : iblockdata; -+ return iblockdata == null ? a : iblockdata; // Paper - decompile error - Blocks.AIR.getBlockData() - } +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 +@@ -0,0 +0,0 @@ public class EnchantmentManager { + public static void a(Map map, ItemStack itemstack) { + NBTTagList nbttaglist = new NBTTagList(); - public Iterator iterator() { +- 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(); +@@ -0,0 +0,0 @@ public class EnchantmentManager { + } + + 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 { +@@ -0,0 +0,0 @@ public class EnchantmentManager { + } + + 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 { +@@ -0,0 +0,0 @@ public class EnchantmentManager { + } + + 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); +@@ -0,0 +0,0 @@ public class EnchantmentManager { + } + + 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; + +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 +@@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public enum EnumDirection implements INamable { - return Iterators.forArray(this.c); - } + } + // $FF: synthetic method +- public boolean test(@Nullable Object object) { ++ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix + return super.a((EnumDirection)object); + } + }, +@@ -0,0 +0,0 @@ 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); + } + }, +@@ -0,0 +0,0 @@ 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); + } + }; +@@ -0,0 +0,0 @@ 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); } } @@ -0,0 +0,0 @@ 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") { - ; -@@ -0,0 +0,0 @@ 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") { - ; -@@ -0,0 +0,0 @@ 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) -> { -@@ -0,0 +0,0 @@ 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); } + // $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 @@ -0,0 +0,0 @@ public class LocaleLanguage { - Entry entry = (Entry) iterator.next(); - String s = LocaleLanguage.b.matcher(ChatDeserializer.a((JsonElement) entry.getValue(), (String) entry.getKey())).replaceAll("%$1s"); + 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 @@ -0,0 +0,0 @@ public abstract class LootSelectorEntry { - return jsonobject; } + // $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 -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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(); @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ 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); + // $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,139 +345,63 @@ 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 @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - public class NBTTagList extends NBTList { + 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() {} + public NBTTagList() { @@ -0,0 +0,0 @@ public class NBTTagList extends NBTList { - return this.type; - } - -- public NBTBase clone() { -+ public NBTTagList clone() { 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); +@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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 +@@ -0,0 +0,0 @@ + package net.minecraft.server; -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ import java.util.Iterator; - import java.util.List; - import javax.annotation.Nullable; - --public class RegistryBlockID implements Registry { -+public class RegistryBlockID implements Registry { // Paper - decompile fix - - private int a; - private final IdentityHashMap b; @@ -0,0 +0,0 @@ public class RegistryBlockID implements Registry { - this.b.put(t0, Integer.valueOf(i)); + this.b.put(object, 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 -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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) { @@ -0,0 +0,0 @@ public class RegistryID implements Registry { } @@ -515,85 +409,68 @@ index 3b8f6ec167..bde5714dd6 100644 - 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 @@ -0,0 +0,0 @@ public class ServerPing { - return jsonobject; } + // $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); } } @@ -0,0 +0,0 @@ public class ServerPing { - return jsonobject; } + // $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); } } @@ -0,0 +0,0 @@ public class ServerPing { - return jsonobject; } + // $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 @@ -0,0 +0,0 @@ public class ShapeDetector { - return new ShapeDetectorBlock(this.a, blockposition, this.b); } + // $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 -@@ -0,0 +0,0 @@ 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; - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/MC-Utils.patch b/Spigot-Server-Patches/MC-Utils.patch index 9072457f58..b9e5d996ff 100644 --- a/Spigot-Server-Patches/MC-Utils.patch +++ b/Spigot-Server-Patches/MC-Utils.patch @@ -5,25 +5,25 @@ 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 @@ -0,0 +0,0 @@ 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; + private static final int d = c; @@ -0,0 +0,0 @@ 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); + 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); } @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { return this.d; @@ -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 @@ -0,0 +0,0 @@ import com.google.common.collect.Lists; // CraftBukkit @@ -63,7 +63,7 @@ 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 @@ -0,0 +0,0 @@ public class ChunkCoordIntPair { @@ -73,10 +73,10 @@ index 34586bca6..b0c004b1f 100644 + 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 @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; @@ -89,7 +89,7 @@ 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 @@ -0,0 +0,0 @@ public class DataBits { @@ -101,31 +101,34 @@ 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 -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ import java.util.stream.Collectors; +@@ -0,0 +0,0 @@ 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; }; @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { @@ -142,15 +145,15 @@ index 030ec8704..575f9b558 100644 private void b() { @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { - return j << 8 | k << 4 | i; + 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; + private void b(int ix) { + if (ix != this.i) { + this.i = ix; @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { - return object == null ? this.g : object; + 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 @@ -0,0 +0,0 @@ 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 +@@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ package net.minecraft.server; +@@ -0,0 +0,0 @@ + 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 +0,0 @@ @@ -577,18 +593,18 @@ 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 -@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { - +@@ -0,0 +0,0 @@ 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() {} - + public NBTTagCompound() { + } @@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { this.map.put(s, new NBTTagLong(i)); } @@ -604,16 +620,25 @@ index 7fc9b5ff3..e658816c2 100644 public UUID a(String s) { return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); @@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { - return chatcomponenttext; - } + + 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); +@@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { @@ -666,7 +691,7 @@ 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 @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { @@ -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 @@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ public class RegistryBlockID implements Registry { // Paper - decompile fix +@@ -0,0 +0,0 @@ public class RegistryBlockID implements Registry { return Iterators.filter(this.c.iterator(), Predicates.notNull()); } diff --git a/Spigot-Server-Patches/Make-legacy-ping-handler-more-reliable.patch b/Spigot-Server-Patches/Make-legacy-ping-handler-more-reliable.patch index 39b3b01d91..55497408a2 100644 --- a/Spigot-Server-Patches/Make-legacy-ping-handler-more-reliable.patch +++ b/Spigot-Server-Patches/Make-legacy-ping-handler-more-reliable.patch @@ -28,11 +28,11 @@ 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 -@@ -0,0 +0,0 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { - +@@ -0,0 +0,0 @@ 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 @@ -42,8 +42,7 @@ index 64fe1d7e83..f7fbf1d76e 100644 @@ -0,0 +0,0 @@ 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 { @@ -58,25 +57,24 @@ index 64fe1d7e83..f7fbf1d76e 100644 boolean flag = true; @@ -0,0 +0,0 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { - break; - - default: + 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; + 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)); @@ -0,0 +0,0 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { - } finally { - bytebuf1.release(); + } finally { + bytebuf1.release(); + } ++ */ // Paper end- end commenting out } -+ */ -+ // Paper end - } - bytebuf.release(); + bytebuf.release(); @@ -0,0 +0,0 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { } diff --git a/Spigot-Server-Patches/Make-portal-teleportation-adjustment-math-more-accur.patch b/Spigot-Server-Patches/Make-portal-teleportation-adjustment-math-more-accur.patch index b34acf2511..a4d92c3fd1 100644 --- a/Spigot-Server-Patches/Make-portal-teleportation-adjustment-math-more-accur.patch +++ b/Spigot-Server-Patches/Make-portal-teleportation-adjustment-math-more-accur.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ public enum EnumDirection implements INamable { @@ -22,10 +22,10 @@ index 854ad49b6c..3ee310a9aa 100644 + public final EnumDirection rotateY() { return e(); } // Paper - OBFHELPER public EnumDirection e() { - switch (this) { + switch(this) { case NORTH: @@ -0,0 +0,0 @@ public enum EnumDirection implements INamable { - this.d = s; + 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 @@ -0,0 +0,0 @@ public class MathHelper { - return f < f1 ? f1 : (f > f2 ? f2 : f); + } } + 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,7 +79,7 @@ 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 @@ -0,0 +0,0 @@ public class ShapeDetector { diff --git a/Spigot-Server-Patches/Optimise-BlockStateEnum-hashCode-and-equals.patch b/Spigot-Server-Patches/Optimise-BlockStateEnum-hashCode-and-equals.patch index 4c9b10dfc7..00c6b16dc9 100644 --- a/Spigot-Server-Patches/Optimise-BlockStateEnum-hashCode-and-equals.patch +++ b/Spigot-Server-Patches/Optimise-BlockStateEnum-hashCode-and-equals.patch @@ -5,35 +5,38 @@ 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 +@@ -0,0 +0,0 @@ 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; + @@ -0,0 +0,0 @@ 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); + +- 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 + "'"); @@ -0,0 +0,0 @@ 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() { -@@ -0,0 +0,0 @@ public class BlockStateEnum & INamable> extends BlockState - return ((INamable) t0).getName(); + 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/Optimize-BlockPosition-helper-methods.patch b/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch index 472077b0be..e670bda0c9 100644 --- a/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch +++ b/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch @@ -6,7 +6,7 @@ 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 @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { @@ -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/Optimize-CraftBlockData-Creation.patch b/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch index eadeb88b79..9dfee6b22f 100644 --- a/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch +++ b/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch @@ -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 @@ -0,0 +0,0 @@ @@ -17,10 +17,10 @@ index 4dd6c32761..1b226a77e0 100644 +import org.bukkit.craftbukkit.block.data.CraftBlockData; public class BlockData extends BlockDataAbstract implements IBlockData { - + public BlockData(Block block, ImmutableMap, Comparable> immutablemap) { @@ -0,0 +0,0 @@ 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,7 +34,7 @@ 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 @@ -0,0 +0,0 @@ public interface IBlockData extends IBlockDataHolder { diff --git a/Spigot-Server-Patches/Optimize-Pathfinding.patch b/Spigot-Server-Patches/Optimize-Pathfinding.patch index cc02fd7ac4..a57aaf545c 100644 --- a/Spigot-Server-Patches/Optimize-Pathfinding.patch +++ b/Spigot-Server-Patches/Optimize-Pathfinding.patch @@ -7,7 +7,7 @@ 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 @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { @@ -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; diff --git a/Spigot-Server-Patches/Optimize-RegistryID.c.patch b/Spigot-Server-Patches/Optimize-RegistryID.c.patch index 97f312f7e5..60024da1de 100644 --- a/Spigot-Server-Patches/Optimize-RegistryID.c.patch +++ b/Spigot-Server-Patches/Optimize-RegistryID.c.patch @@ -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 -@@ -0,0 +0,0 @@ public class RegistryID implements Registry { // Paper - decompile fix +@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ public class RegistryID implements Registry { // Paper - decompile fix + public int getId(@Nullable K object) { +@@ -0,0 +0,0 @@ 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; } -@@ -0,0 +0,0 @@ public class RegistryID implements Registry { // Paper - decompile fix - this.d = (K[]) (new Object[i]); // Paper - decompile fix +@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ public class RegistryID implements Registry { // Paper - decompile fix - this.b[k] = k0; - this.c[k] = i; - this.d[i] = k0; +@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ public class RegistryID implements Registry { // Paper - decompile fix - Arrays.fill(this.d, (Object) null); +@@ -0,0 +0,0 @@ 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/Optimize-RegistryMaterials.patch b/Spigot-Server-Patches/Optimize-RegistryMaterials.patch index 482bef5eb8..9158313aec 100644 --- a/Spigot-Server-Patches/Optimize-RegistryMaterials.patch +++ b/Spigot-Server-Patches/Optimize-RegistryMaterials.patch @@ -8,27 +8,18 @@ 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 @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - public class RegistryMaterials implements IRegistry { + 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; -@@ -0,0 +0,0 @@ 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) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch index c7b16e41e4..cd0c5db9ec 100644 --- a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch @@ -4,8 +4,21 @@ 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 +@@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ @@ -99,9 +112,9 @@ 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; + public int f; @@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { } @@ -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,8 +149,8 @@ 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; - + float f2 = this.a; + if (this.f > 0) { @@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { public void c() { ++this.f; diff --git a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch index da382981b9..168820d0c4 100644 --- a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -12,7 +12,7 @@ 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 @@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable { @@ -31,7 +31,7 @@ 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 @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { @@ -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 @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -84,7 +84,7 @@ 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 @@ -0,0 +0,0 @@ public class ChunkSection { @@ -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 @@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc diff --git a/Spigot-Server-Patches/Optimized-Light-Level-Comparisons.patch b/Spigot-Server-Patches/Optimized-Light-Level-Comparisons.patch index e3b3d3cba4..a38db13875 100644 --- a/Spigot-Server-Patches/Optimized-Light-Level-Comparisons.patch +++ b/Spigot-Server-Patches/Optimized-Light-Level-Comparisons.patch @@ -47,7 +47,7 @@ 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 @@ -0,0 +0,0 @@ public abstract class EntityMonster extends EntityCreature implements IMonster { @@ -55,7 +55,6 @@ index a3449e9a8d..5f60bf04e6 100644 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/Pass-world-to-Village-creation.patch b/Spigot-Server-Patches/Pass-world-to-Village-creation.patch index cdd966e61b..4a7d93e228 100644 --- a/Spigot-Server-Patches/Pass-world-to-Village-creation.patch +++ b/Spigot-Server-Patches/Pass-world-to-Village-creation.patch @@ -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 @@ -0,0 +0,0 @@ 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/Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch index 72ea4e24cd..c26dbf09ea 100644 --- a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch @@ -5,13 +5,13 @@ 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 @@ -0,0 +0,0 @@ public class PacketPlayOutTitle implements Packet { - private int d; - private int e; + 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) { + public PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction packetplayouttitle$enumtitleaction, IChatBaseComponent ichatbasecomponent) { + this(packetplayouttitle$enumtitleaction, ichatbasecomponent, -1, -1, -1); @@ -0,0 +0,0 @@ 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/Player-affects-spawning-API.patch b/Spigot-Server-Patches/Player-affects-spawning-API.patch index 99b9a2c03e..09edfc1ed8 100644 --- a/Spigot-Server-Patches/Player-affects-spawning-API.patch +++ b/Spigot-Server-Patches/Player-affects-spawning-API.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @@ -19,7 +19,7 @@ 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 @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -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 @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.block.data.CraftBlockData; diff --git a/Spigot-Server-Patches/PlayerElytraBoostEvent.patch b/Spigot-Server-Patches/PlayerElytraBoostEvent.patch index 0861b8c39c..717d474c00 100644 --- a/Spigot-Server-Patches/PlayerElytraBoostEvent.patch +++ b/Spigot-Server-Patches/PlayerElytraBoostEvent.patch @@ -5,12 +5,12 @@ 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 @@ -0,0 +0,0 @@ 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/PlayerLaunchProjectileEvent.patch b/Spigot-Server-Patches/PlayerLaunchProjectileEvent.patch index 7d42083273..9e523652a2 100644 --- a/Spigot-Server-Patches/PlayerLaunchProjectileEvent.patch +++ b/Spigot-Server-Patches/PlayerLaunchProjectileEvent.patch @@ -5,18 +5,18 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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,7 +141,7 @@ 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 @@ -0,0 +0,0 @@ public class ItemLingeringPotion extends ItemPotion { @@ -151,10 +149,10 @@ index e1c6ad80f0..7acdb63f7b 100644 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,7 +219,7 @@ 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 @@ -0,0 +0,0 @@ public class ItemSplashPotion extends ItemPotion { @@ -230,11 +227,10 @@ index 593009579b..d935ae834f 100644 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/Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/Spigot-Server-Patches/Prevent-Frosted-Ice-from-loading-holding-chunks.patch index c575ac7857..16a7319bb1 100644 --- a/Spigot-Server-Patches/Prevent-Frosted-Ice-from-loading-holding-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Frosted-Ice-from-loading-holding-chunks.patch @@ -5,31 +5,26 @@ 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 @@ -0,0 +0,0 @@ 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)) { + 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 + } @@ -0,0 +0,0 @@ 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) { + 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; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Prevent-Pathfinding-out-of-World-Border.patch b/Spigot-Server-Patches/Prevent-Pathfinding-out-of-World-Border.patch index 5505429cc9..f11dc1c72a 100644 --- a/Spigot-Server-Patches/Prevent-Pathfinding-out-of-World-Border.patch +++ b/Spigot-Server-Patches/Prevent-Pathfinding-out-of-World-Border.patch @@ -6,7 +6,7 @@ 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 @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { @@ -22,9 +22,9 @@ index 76d1f4bd21..76b2787bae 100644 } 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/RangedEntity-API.patch b/Spigot-Server-Patches/RangedEntity-API.patch index 83c1a60f4f..e850ed52ec 100644 --- a/Spigot-Server-Patches/RangedEntity-API.patch +++ b/Spigot-Server-Patches/RangedEntity-API.patch @@ -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 -@@ -0,0 +0,0 @@ package net.minecraft.server; +@@ -0,0 +0,0 @@ + 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/Reduce-IO-ops-opening-a-new-region-file.patch b/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch index dbb46dee04..7bd359ad7f 100644 --- a/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch +++ b/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch @@ -5,7 +5,7 @@ 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 @@ -0,0 +0,0 @@ import java.io.ByteArrayInputStream; @@ -22,8 +22,8 @@ index b8b514c874..cba2373125 100644 import java.util.zip.DeflaterOutputStream; import java.util.zip.GZIPInputStream; @@ -0,0 +0,0 @@ public class RegionFile { - - int k; + 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) { + for(int l = 0; l < (k & 255); ++l) { @@ -0,0 +0,0 @@ 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) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch b/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch index 60a7ecdf4e..99102adbd1 100644 --- a/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch +++ b/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch @@ -9,15 +9,15 @@ 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 @@ -0,0 +0,0 @@ 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; @@ -25,10 +25,10 @@ index d24ec3d53c..0fb3162e65 100644 } 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; @@ -36,7 +36,7 @@ index d24ec3d53c..0fb3162e65 100644 } 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/Shame-on-you-Mojang.patch b/Spigot-Server-Patches/Shame-on-you-Mojang.patch index c3b8b2f44e..e12b62ce49 100644 --- a/Spigot-Server-Patches/Shame-on-you-Mojang.patch +++ b/Spigot-Server-Patches/Shame-on-you-Mojang.patch @@ -12,7 +12,7 @@ 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 @@ -0,0 +0,0 @@ public class BlockBeacon extends BlockTileEntity { @@ -23,7 +23,7 @@ index 1181d45fad..d081166d86 100644 + //HttpUtilities.a.submit(() -> { // Paper Chunk chunk = world.getChunkAtWorldCoords(blockposition); - for (int i = blockposition.getY() - 1; i >= 0; --i) { + for(int i = blockposition.getY() - 1; i >= 0; --i) { @@ -0,0 +0,0 @@ public class BlockBeacon extends BlockTileEntity { }); } diff --git a/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 889ff95897..2800943173 100644 --- a/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -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 @@ -0,0 +0,0 @@ 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/SkeletonHorse-Additions.patch b/Spigot-Server-Patches/SkeletonHorse-Additions.patch index a132f190f2..df45962e2d 100644 --- a/Spigot-Server-Patches/SkeletonHorse-Additions.patch +++ b/Spigot-Server-Patches/SkeletonHorse-Additions.patch @@ -5,11 +5,11 @@ 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 -@@ -0,0 +0,0 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { - +@@ -0,0 +0,0 @@ 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/Speedup-BlockPos-by-fixing-inlining.patch b/Spigot-Server-Patches/Speedup-BlockPos-by-fixing-inlining.patch index 43e73fc561..fb7525c7da 100644 --- a/Spigot-Server-Patches/Speedup-BlockPos-by-fixing-inlining.patch +++ b/Spigot-Server-Patches/Speedup-BlockPos-by-fixing-inlining.patch @@ -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 @@ -0,0 +0,0 @@ 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; @@ -56,7 +56,7 @@ index 58f8b4b720..98992513da 100644 public BaseBlockPosition(double d0, double d1, double d2) { @@ -0,0 +0,0 @@ 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(); + } } - 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 @@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { + } public static class MutableBlockPosition extends BlockPosition { - + // Paper start - comment out + /* protected int b; @@ -200,5 +200,5 @@ index 42e5e9ad8f..936a49a3e8 100644 + this.y = i; // Paper change to y } - public BlockPosition h() { + public BlockPosition toBlockPosition() { return h(); } // Paper - OBFHELPER -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Timings-v2.patch b/Spigot-Server-Patches/Timings-v2.patch index 673a683868..5e4f27a948 100644 --- a/Spigot-Server-Patches/Timings-v2.patch +++ b/Spigot-Server-Patches/Timings-v2.patch @@ -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 +0,0 @@ @@ -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 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ import org.bukkit.inventory.CraftingInventory; @@ -958,7 +958,7 @@ 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 @@ -0,0 +0,0 @@ @@ -968,9 +968,7 @@ index 889b3228..69da194f 100644 +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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ @@ -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 @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ import net.minecraft.server.EntityWither; diff --git a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch index 2b916fb6a0..849937f7e4 100644 --- a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch @@ -18,7 +18,7 @@ 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 @@ -0,0 +0,0 @@ public interface IBlockData extends IBlockDataHolder { @@ -44,11 +44,11 @@ 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 @@ -0,0 +0,0 @@ public abstract class VoxelShape { - return i <= 0 ? Double.NEGATIVE_INFINITY : this.a(enumdirection_enumaxis, i); + return i <= 0 ? Double.NEGATIVE_INFINITY : this.a(enumdirection$enumaxis, i); } + public AxisAlignedBB getBounds() { return a(); } // Paper - OBFHELPER @@ -57,7 +57,7 @@ index 700900256b..b7d2fa2f0e 100644 throw new UnsupportedOperationException("No bounds for empty shape."); @@ -0,0 +0,0 @@ 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/Waving-banner-workaround.patch b/Spigot-Server-Patches/Waving-banner-workaround.patch index e5bea7890b..78c71918f6 100644 --- a/Spigot-Server-Patches/Waving-banner-workaround.patch +++ b/Spigot-Server-Patches/Waving-banner-workaround.patch @@ -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 -@@ -0,0 +0,0 @@ import java.io.IOException; +@@ -0,0 +0,0 @@ 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() { @@ -0,0 +0,0 @@ public class PacketPlayOutUpdateTime implements Packet { } } diff --git a/scripts/decompile.sh b/scripts/decompile.sh index 032abdb704..86d60a6791 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 9217d06df0..c87a9f2467 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 2b75ec8947..7af206111f 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 a4123a5a43..d2aea1fefb 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 b19d564af4..3d736e77ce 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 585768fa38..9e9ca42428 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" #