summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-08-26 12:00:00 +1000
committermd_5 <git@md-5.net>2018-08-26 12:00:00 +1000
commitce1af0c348a8477f9ec58d79e6267e9226dc5dba (patch)
tree369972a692f450001c06a13e202d916f9c1bb5a8 /nms-patches
parent162bda93ff76fe96a6138a14176807f21a6ddef4 (diff)
downloadcraftbukkit-ce1af0c348a8477f9ec58d79e6267e9226dc5dba.tar
craftbukkit-ce1af0c348a8477f9ec58d79e6267e9226dc5dba.tar.gz
craftbukkit-ce1af0c348a8477f9ec58d79e6267e9226dc5dba.tar.lz
craftbukkit-ce1af0c348a8477f9ec58d79e6267e9226dc5dba.tar.xz
craftbukkit-ce1af0c348a8477f9ec58d79e6267e9226dc5dba.zip
Update to Minecraft 1.13.1
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/Advancement.patch4
-rw-r--r--nms-patches/AdvancementDataPlayer.patch2
-rw-r--r--nms-patches/Block.patch37
-rw-r--r--nms-patches/BlockButtonAbstract.patch2
-rw-r--r--nms-patches/BlockCactus.patch2
-rw-r--r--nms-patches/BlockCauldron.patch6
-rw-r--r--nms-patches/BlockChorusFlower.patch2
-rw-r--r--nms-patches/BlockCocoa.patch2
-rw-r--r--nms-patches/BlockConcretePowder.patch8
-rw-r--r--nms-patches/BlockCoralFan.patch4
-rw-r--r--nms-patches/BlockCoralFanWall.patch4
-rw-r--r--nms-patches/BlockCrops.patch2
-rw-r--r--nms-patches/BlockDiodeAbstract.patch2
-rw-r--r--nms-patches/BlockDispenser.patch12
-rw-r--r--nms-patches/BlockEnderPortal.patch2
-rw-r--r--nms-patches/BlockFire.patch8
-rw-r--r--nms-patches/BlockFluids.patch8
-rw-r--r--nms-patches/BlockGrass.patch12
-rw-r--r--nms-patches/BlockLeaves.patch2
-rw-r--r--nms-patches/BlockMinecartDetector.patch2
-rw-r--r--nms-patches/BlockObserver.patch2
-rw-r--r--nms-patches/BlockPiston.patch4
-rw-r--r--nms-patches/BlockPortal.patch2
-rw-r--r--nms-patches/BlockPoweredRail.patch2
-rw-r--r--nms-patches/BlockPressurePlateWeighted.patch2
-rw-r--r--nms-patches/BlockRedstoneComparator.patch2
-rw-r--r--nms-patches/BlockRedstoneLamp.patch2
-rw-r--r--nms-patches/BlockRedstoneWire.patch4
-rw-r--r--nms-patches/BlockSapling.patch2
-rw-r--r--nms-patches/BlockSoil.patch6
-rw-r--r--nms-patches/BlockSponge.patch2
-rw-r--r--nms-patches/BlockStem.patch2
-rw-r--r--nms-patches/BlockTNT.patch6
-rw-r--r--nms-patches/BlockTurtleEgg.patch6
-rw-r--r--nms-patches/BlockVine.patch2
-rw-r--r--nms-patches/Chunk.patch62
-rw-r--r--nms-patches/ChunkMap.patch22
-rw-r--r--nms-patches/ChunkProviderServer.patch136
-rw-r--r--nms-patches/ChunkRegionLoader.patch204
-rw-r--r--nms-patches/ChunkTaskScheduler.patch19
-rw-r--r--nms-patches/CommandBlockListenerAbstract.patch2
-rw-r--r--nms-patches/CommandDispatcher.patch25
-rw-r--r--nms-patches/CommandForceload.patch45
-rw-r--r--nms-patches/CommandGamerule.patch6
-rw-r--r--nms-patches/CommandSpreadPlayers.patch2
-rw-r--r--nms-patches/CommandTeleport.patch6
-rw-r--r--nms-patches/ContainerAnvil.patch2
-rw-r--r--nms-patches/ContainerEnchantTable.patch12
-rw-r--r--nms-patches/CustomFunction.patch22
-rw-r--r--nms-patches/DedicatedServer.patch34
-rw-r--r--nms-patches/DispenserRegistry.patch18
-rw-r--r--nms-patches/Enchantment.patch27
-rw-r--r--nms-patches/EnchantmentFrostWalker.patch4
-rw-r--r--nms-patches/Entity.patch186
-rw-r--r--nms-patches/EntityAreaEffectCloud.patch4
-rw-r--r--nms-patches/EntityArmorStand.patch18
-rw-r--r--nms-patches/EntityArrow.patch32
-rw-r--r--nms-patches/EntityCreeper.patch4
-rw-r--r--nms-patches/EntityEnderman.patch2
-rw-r--r--nms-patches/EntityEvokerFangs.patch2
-rw-r--r--nms-patches/EntityFish.patch4
-rw-r--r--nms-patches/EntityFishingHook.patch2
-rw-r--r--nms-patches/EntityHorseAbstract.patch8
-rw-r--r--nms-patches/EntityHuman.patch32
-rw-r--r--nms-patches/EntityInsentient.patch28
-rw-r--r--nms-patches/EntityLiving.patch179
-rw-r--r--nms-patches/EntityMinecartAbstract.patch6
-rw-r--r--nms-patches/EntityMinecartContainer.patch12
-rw-r--r--nms-patches/EntityMushroomCow.patch2
-rw-r--r--nms-patches/EntityPlayer.patch201
-rw-r--r--nms-patches/EntitySheep.patch2
-rw-r--r--nms-patches/EntitySmallFireball.patch19
-rw-r--r--nms-patches/EntityTippedArrow.patch10
-rw-r--r--nms-patches/EntityTurtle.patch20
-rw-r--r--nms-patches/EntityTypes.patch19
-rw-r--r--nms-patches/EntityWither.patch6
-rw-r--r--nms-patches/EntityZombie.patch16
-rw-r--r--nms-patches/EntityZombieVillager.patch2
-rw-r--r--nms-patches/Explosion.patch12
-rw-r--r--nms-patches/FluidTypeFlowing.patch86
-rw-r--r--nms-patches/FluidTypeLava.patch2
-rw-r--r--nms-patches/HandshakeListener.patch4
-rw-r--r--nms-patches/ItemArmor.patch2
-rw-r--r--nms-patches/ItemBow.patch2
-rw-r--r--nms-patches/ItemBucket.patch21
-rw-r--r--nms-patches/ItemChorusFruit.patch2
-rw-r--r--nms-patches/ItemEnderPearl.patch2
-rw-r--r--nms-patches/ItemFireball.patch2
-rw-r--r--nms-patches/ItemFishingRod.patch8
-rw-r--r--nms-patches/ItemFlintAndSteel.patch2
-rw-r--r--nms-patches/ItemFood.patch6
-rw-r--r--nms-patches/ItemSnowball.patch4
-rw-r--r--nms-patches/ItemStack.patch4
-rw-r--r--nms-patches/ItemWorldMap.patch30
-rw-r--r--nms-patches/ItemWrittenBook.patch34
-rw-r--r--nms-patches/LoginListener.patch6
-rw-r--r--nms-patches/LootTableInfo.patch8
-rw-r--r--nms-patches/MinecraftServer.patch402
-rw-r--r--nms-patches/MobEffectList.patch18
-rw-r--r--nms-patches/MobSpawnerAbstract.patch2
-rw-r--r--nms-patches/PacketPlayOutPlayerListHeaderFooter.patch13
-rw-r--r--nms-patches/PathfinderGoalHorseTrap.patch2
-rw-r--r--nms-patches/PathfinderGoalVillagerFarm.patch2
-rw-r--r--nms-patches/PlayerChunk.patch2
-rw-r--r--nms-patches/PlayerConnection.patch136
-rw-r--r--nms-patches/PlayerInventory.patch2
-rw-r--r--nms-patches/PlayerList.patch303
-rw-r--r--nms-patches/PortalTravelAgent.patch6
-rw-r--r--nms-patches/RegionFileCache.patch42
-rw-r--r--nms-patches/RegionLimitedWorldAccess.patch4
-rw-r--r--nms-patches/SecondaryWorldServer.patch23
-rw-r--r--nms-patches/ShapedRecipes.patch4
-rw-r--r--nms-patches/ShapelessRecipes.patch4
-rw-r--r--nms-patches/SpawnerCreature.patch17
-rw-r--r--nms-patches/TagsServer.patch8
-rw-r--r--nms-patches/TileEntityBeacon.patch2
-rw-r--r--nms-patches/TileEntityBrewingStand.patch2
-rw-r--r--nms-patches/TileEntityConduit.patch6
-rw-r--r--nms-patches/TileEntityFurnace.patch4
-rw-r--r--nms-patches/TileEntityHopper.patch2
-rw-r--r--nms-patches/TileEntityShulkerBox.patch2
-rw-r--r--nms-patches/TileEntitySign.patch8
-rw-r--r--nms-patches/TileEntitySkull.patch2
-rw-r--r--nms-patches/Village.patch2
-rw-r--r--nms-patches/World.patch126
-rw-r--r--nms-patches/WorldBorder.patch14
-rw-r--r--nms-patches/WorldData.patch4
-rw-r--r--nms-patches/WorldGenVillagePieces.patch2
-rw-r--r--nms-patches/WorldGenWitchHut.patch2
-rw-r--r--nms-patches/WorldManager.patch4
-rw-r--r--nms-patches/WorldMap.patch38
-rw-r--r--nms-patches/WorldNBTStorage.patch10
-rw-r--r--nms-patches/WorldServer.patch126
133 files changed, 1551 insertions, 1665 deletions
diff --git a/nms-patches/Advancement.patch b/nms-patches/Advancement.patch
index 60be8f15..0d66cce1 100644
--- a/nms-patches/Advancement.patch
+++ b/nms-patches/Advancement.patch
@@ -10,8 +10,8 @@
this.d = minecraftkey;
@@ -46,7 +47,7 @@
EnumChatFormat enumchatformat = advancementdisplay.e().c();
- IChatBaseComponent ichatbasecomponent1 = ichatbasecomponent.e().a(enumchatformat).a("\n").addSibling(advancementdisplay.b());
- IChatBaseComponent ichatbasecomponent2 = ichatbasecomponent.e().a((chatmodifier) -> {
+ IChatBaseComponent ichatbasecomponent1 = ichatbasecomponent.h().a(enumchatformat).a("\n").addSibling(advancementdisplay.b());
+ IChatBaseComponent ichatbasecomponent2 = ichatbasecomponent.h().a((chatmodifier) -> {
- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent));
+ chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent1)); // CraftBukkit - decompile error
});
diff --git a/nms-patches/AdvancementDataPlayer.patch b/nms-patches/AdvancementDataPlayer.patch
index d92b9548..bd0ee401 100644
--- a/nms-patches/AdvancementDataPlayer.patch
+++ b/nms-patches/AdvancementDataPlayer.patch
@@ -29,7 +29,7 @@
dynamic = dynamic.set("DataVersion", dynamic.createInt(1343));
@@ -148,7 +148,7 @@
- dynamic = this.d.aB().update(DataFixTypes.ADVANCEMENTS, dynamic, dynamic.getInt("DataVersion"), 1519);
+ dynamic = this.d.az().update(DataFixTypes.ADVANCEMENTS, dynamic, dynamic.getInt("DataVersion"), 1628);
dynamic = dynamic.remove("DataVersion");
- Map map = (Map) AdvancementDataPlayer.b.getAdapter(AdvancementDataPlayer.c).fromJsonTree((JsonElement) dynamic.getValue());
+ Map<MinecraftKey, AdvancementProgress> map = (Map) AdvancementDataPlayer.b.getAdapter(AdvancementDataPlayer.c).fromJsonTree((JsonElement) dynamic.getValue()); // CraftBukkit - decompile error
diff --git a/nms-patches/Block.patch b/nms-patches/Block.patch
index ee6badf7..87c30356 100644
--- a/nms-patches/Block.patch
+++ b/nms-patches/Block.patch
@@ -1,15 +1,15 @@
--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
-@@ -17,7 +17,7 @@
- public static final RegistryBlocks<MinecraftKey, Block> REGISTRY = new RegistryBlocks(Block.a);
- public static final RegistryBlockID<IBlockData> REGISTRY_ID = new RegistryBlockID();
- protected final int g;
-- protected final float strength;
-+ public final float strength; // PAIL: private -> public
- protected final float durability;
- protected final boolean j;
- protected final SoundEffectType stepSound;
-@@ -212,7 +212,7 @@
+@@ -32,7 +32,7 @@
+ @Nullable
+ private String name;
+ private static final ThreadLocal<Object2ByteLinkedOpenHashMap<Block.a>> q = ThreadLocal.withInitial(() -> {
+- Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) {
++ Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap<Block.a>(200) { // CraftBukkit - decompile error
+ protected void rehash(int i) {}
+ };
+
+@@ -194,7 +194,7 @@
}
public Block(Block.Info block_info) {
@@ -18,7 +18,7 @@
this.a(blockstatelist_a);
this.blockStateList = blockstatelist_a.a(BlockData::new);
-@@ -427,7 +427,8 @@
+@@ -409,7 +409,8 @@
int j = this.getDropCount(iblockdata, i, world, blockposition, world.random);
for (int k = 0; k < j; ++k) {
@@ -28,7 +28,7 @@
Item item = this.getDropType(iblockdata, world, blockposition, i).getItem();
if (item != Items.AIR) {
-@@ -448,7 +449,13 @@
+@@ -430,7 +431,13 @@
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
entityitem.n();
@@ -43,16 +43,16 @@
}
}
-@@ -667,7 +674,7 @@
+@@ -649,7 +656,7 @@
}
public String toString() {
-- return "Block{" + Block.REGISTRY.b(this) + "}";
-+ return Block.REGISTRY.b(this).toString(); // CraftBukkit - cheap hack
+- return "Block{" + IRegistry.BLOCK.getKey(this) + "}";
++ return IRegistry.BLOCK.getKey(this).toString(); // CraftBukkit - cheap hack
}
public static boolean c(Block block) {
-@@ -1406,6 +1413,12 @@
+@@ -1398,8 +1405,14 @@
}
@@ -63,5 +63,8 @@
+ // CraftBukkit end
+
private static void a(MinecraftKey minecraftkey, Block block) {
- Block.REGISTRY.a(minecraftkey, block);
+- IRegistry.BLOCK.a(minecraftkey, (Object) block);
++ IRegistry.BLOCK.a(minecraftkey, block); // CraftBukkit - decompile error
}
+
+ private static void a(String s, Block block) {
diff --git a/nms-patches/BlockButtonAbstract.patch b/nms-patches/BlockButtonAbstract.patch
index 028d1dd1..84ea0233 100644
--- a/nms-patches/BlockButtonAbstract.patch
+++ b/nms-patches/BlockButtonAbstract.patch
@@ -33,7 +33,7 @@
this.a(entityhuman, world, blockposition, true);
this.c(iblockdata, world, blockposition);
@@ -118,6 +136,16 @@
- if (this.F) {
+ if (this.E) {
this.b(iblockdata, world, blockposition);
} else {
+ // CraftBukkit start
diff --git a/nms-patches/BlockCactus.patch b/nms-patches/BlockCactus.patch
index 9be8a495..2103c424 100644
--- a/nms-patches/BlockCactus.patch
+++ b/nms-patches/BlockCactus.patch
@@ -8,7 +8,7 @@
+
public class BlockCactus extends Block {
- public static final BlockStateInteger AGE = BlockProperties.W;
+ public static final BlockStateInteger AGE = BlockProperties.X;
@@ -31,7 +33,7 @@
int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue();
diff --git a/nms-patches/BlockCauldron.patch b/nms-patches/BlockCauldron.patch
index 9b862840..64498ab1 100644
--- a/nms-patches/BlockCauldron.patch
+++ b/nms-patches/BlockCauldron.patch
@@ -7,7 +7,7 @@
+
public class BlockCauldron extends Block {
- public static final BlockStateInteger LEVEL = BlockProperties.ae;
+ public static final BlockStateInteger LEVEL = BlockProperties.af;
@@ -32,8 +34,13 @@
float f = (float) blockposition.getY() + (6.0F + (float) (3 * i)) / 16.0F;
@@ -137,7 +137,7 @@
}
if (itemstack.isEmpty()) {
-@@ -171,9 +208,25 @@
+@@ -172,9 +209,25 @@
}
}
@@ -164,7 +164,7 @@
}
public void c(World world, BlockPosition blockposition) {
-@@ -184,7 +237,7 @@
+@@ -185,7 +238,7 @@
IBlockData iblockdata = world.getType(blockposition);
if (((Integer) iblockdata.get(BlockCauldron.LEVEL)).intValue() < 3) {
diff --git a/nms-patches/BlockChorusFlower.patch b/nms-patches/BlockChorusFlower.patch
index 2e24180c..168e4364 100644
--- a/nms-patches/BlockChorusFlower.patch
+++ b/nms-patches/BlockChorusFlower.patch
@@ -8,7 +8,7 @@
+
public class BlockChorusFlower extends Block {
- public static final BlockStateInteger AGE = BlockProperties.U;
+ public static final BlockStateInteger AGE = BlockProperties.V;
@@ -61,8 +63,12 @@
}
diff --git a/nms-patches/BlockCocoa.patch b/nms-patches/BlockCocoa.patch
index 3affcb74..16a4ec30 100644
--- a/nms-patches/BlockCocoa.patch
+++ b/nms-patches/BlockCocoa.patch
@@ -8,7 +8,7 @@
+
public class BlockCocoa extends BlockFacingHorizontal implements IBlockFragilePlantElement {
- public static final BlockStateInteger AGE = BlockProperties.S;
+ public static final BlockStateInteger AGE = BlockProperties.T;
@@ -21,7 +23,7 @@
int i = ((Integer) iblockdata.get(BlockCocoa.AGE)).intValue();
diff --git a/nms-patches/BlockConcretePowder.patch b/nms-patches/BlockConcretePowder.patch
index 971ac2b5..bebc324a 100644
--- a/nms-patches/BlockConcretePowder.patch
+++ b/nms-patches/BlockConcretePowder.patch
@@ -14,7 +14,7 @@
@@ -11,7 +16,7 @@
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {
- if (iblockdata1.getMaterial().isLiquid()) {
+ if (x(iblockdata1)) {
- world.setTypeAndData(blockposition, this.a, 3);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.a, 3); // CraftBukkit
}
@@ -24,9 +24,9 @@
World world = blockactioncontext.getWorld();
BlockPosition blockposition = blockactioncontext.getClickPosition();
-- return !blockactioncontext.getWorld().getType(blockactioncontext.getClickPosition()).getMaterial().isLiquid() && !a((IBlockAccess) world, blockposition) ? super.getPlacedState(blockactioncontext) : this.a;
+- return !x(world.getType(blockposition)) && !a((IBlockAccess) world, blockposition) ? super.getPlacedState(blockactioncontext) : this.a;
+ // CraftBukkit start
-+ if (!blockactioncontext.getWorld().getType(blockactioncontext.getClickPosition()).getMaterial().isLiquid() && !a((IBlockAccess) world, blockposition)) {
++ if (!x(world.getType(blockposition)) && !a((IBlockAccess) world, blockposition)) {
+ return super.getPlacedState(blockactioncontext);
+ }
+
@@ -46,7 +46,7 @@
}
private static boolean a(IBlockAccess iblockaccess, BlockPosition blockposition) {
-@@ -45,6 +67,20 @@
+@@ -51,6 +73,20 @@
}
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
diff --git a/nms-patches/BlockCoralFan.patch b/nms-patches/BlockCoralFan.patch
index 6214c646..707d5e90 100644
--- a/nms-patches/BlockCoralFan.patch
+++ b/nms-patches/BlockCoralFan.patch
@@ -5,10 +5,10 @@
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!b_(iblockdata, world, blockposition)) {
+ // CraftBukkit start
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.b.getBlockData().set(BlockCoralFan.a, Boolean.valueOf(false))).isCancelled()) {
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.a.getBlockData().set(BlockCoralFan.b, Boolean.valueOf(false))).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
- world.setTypeAndData(blockposition, (IBlockData) this.b.getBlockData().set(BlockCoralFan.a, Boolean.valueOf(false)), 2);
+ world.setTypeAndData(blockposition, (IBlockData) this.a.getBlockData().set(BlockCoralFan.b, Boolean.valueOf(false)), 2);
}
diff --git a/nms-patches/BlockCoralFanWall.patch b/nms-patches/BlockCoralFanWall.patch
index 6c2adc68..87e1d415 100644
--- a/nms-patches/BlockCoralFanWall.patch
+++ b/nms-patches/BlockCoralFanWall.patch
@@ -5,10 +5,10 @@
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!b_(iblockdata, world, blockposition)) {
+ // CraftBukkit start
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.c.getBlockData().set(BlockCoralFanWall.a, Boolean.valueOf(false)).set(BlockCoralFanWall.b, iblockdata.get(BlockCoralFanWall.b))).isCancelled()) {
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.c.getBlockData().set(BlockCoralFanWall.b, Boolean.valueOf(false)).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a))).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
- world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.c.getBlockData().set(BlockCoralFanWall.a, Boolean.valueOf(false))).set(BlockCoralFanWall.b, iblockdata.get(BlockCoralFanWall.b)), 2);
+ world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.c.getBlockData().set(BlockCoralFanWall.b, Boolean.valueOf(false))).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a)), 2);
}
diff --git a/nms-patches/BlockCrops.patch b/nms-patches/BlockCrops.patch
index f5169e79..da3a8644 100644
--- a/nms-patches/BlockCrops.patch
+++ b/nms-patches/BlockCrops.patch
@@ -8,7 +8,7 @@
+
public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
- public static final BlockStateInteger AGE = BlockProperties.V;
+ public static final BlockStateInteger AGE = BlockProperties.W;
@@ -49,7 +51,7 @@
float f = a((Block) this, (IBlockAccess) world, blockposition);
diff --git a/nms-patches/BlockDiodeAbstract.patch b/nms-patches/BlockDiodeAbstract.patch
index 30cf95ab..02a9b093 100644
--- a/nms-patches/BlockDiodeAbstract.patch
+++ b/nms-patches/BlockDiodeAbstract.patch
@@ -27,4 +27,4 @@
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, Boolean.valueOf(true)), 2);
if (!flag1) {
- world.I().a(blockposition, this, this.k(iblockdata), TickListPriority.HIGH);
+ world.J().a(blockposition, this, this.k(iblockdata), TickListPriority.HIGH);
diff --git a/nms-patches/BlockDispenser.patch b/nms-patches/BlockDispenser.patch
index 45431d4b..3292d90a 100644
--- a/nms-patches/BlockDispenser.patch
+++ b/nms-patches/BlockDispenser.patch
@@ -1,14 +1,18 @@
--- a/net/minecraft/server/BlockDispenser.java
+++ b/net/minecraft/server/BlockDispenser.java
-@@ -7,6 +7,7 @@
+@@ -9,9 +9,10 @@
+
public static final BlockStateDirection FACING = BlockDirectional.FACING;
public static final BlockStateBoolean TRIGGERED = BlockProperties.w;
- public static final RegistryDefault<Item, IDispenseBehavior> REGISTRY = new RegistryDefault(new DispenseBehaviorItem());
+- public static final Map<Item, IDispenseBehavior> REGISTRY = (Map) SystemUtils.a((Object) (new Object2ObjectOpenHashMap()), (object2objectopenhashmap) -> {
++ public static final Map<Item, IDispenseBehavior> REGISTRY = (Map) SystemUtils.a((new Object2ObjectOpenHashMap()), (object2objectopenhashmap) -> { // CraftBukkit - decompile error
+ object2objectopenhashmap.defaultReturnValue(new DispenseBehaviorItem());
+ });
+ public static boolean eventFired = false; // CraftBukkit
public static void a(IMaterial imaterial, IDispenseBehavior idispensebehavior) {
- BlockDispenser.REGISTRY.a(imaterial.getItem(), idispensebehavior);
-@@ -52,6 +53,7 @@
+ BlockDispenser.REGISTRY.put(imaterial.getItem(), idispensebehavior);
+@@ -57,6 +58,7 @@
IDispenseBehavior idispensebehavior = this.a(itemstack);
if (idispensebehavior != IDispenseBehavior.NONE) {
diff --git a/nms-patches/BlockEnderPortal.patch b/nms-patches/BlockEnderPortal.patch
index 9f871fba..1de1d724 100644
--- a/nms-patches/BlockEnderPortal.patch
+++ b/nms-patches/BlockEnderPortal.patch
@@ -17,6 +17,6 @@
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
- entity.d(1);
+ entity.a(DimensionManager.THE_END);
}
diff --git a/nms-patches/BlockFire.patch b/nms-patches/BlockFire.patch
index 26c20c6f..0e2e82e0 100644
--- a/nms-patches/BlockFire.patch
+++ b/nms-patches/BlockFire.patch
@@ -16,7 +16,7 @@
+
public class BlockFire extends Block {
- public static final BlockStateInteger AGE = BlockProperties.W;
+ public static final BlockStateInteger AGE = BlockProperties.X;
@@ -32,7 +42,20 @@
}
@@ -58,7 +58,7 @@
int j = Math.min(15, i + random.nextInt(3) / 2);
@@ -103,14 +126,14 @@
- world.I().a(blockposition, this, this.a((IWorldReader) world) + random.nextInt(10));
+ world.J().a(blockposition, this, this.a((IWorldReader) world) + random.nextInt(10));
if (!this.d(world, blockposition)) {
if (!world.getType(blockposition.down()).q() || i > 3) {
- world.setAir(blockposition);
@@ -140,12 +140,12 @@
@@ -241,7 +286,7 @@
if (iblockdata1.getBlock() != iblockdata.getBlock()) {
- if (world.worldProvider.getDimensionManager().getDimensionID() > 0 || !((BlockPortal) Blocks.NETHER_PORTAL).a((GeneratorAccess) world, blockposition)) {
+ if (world.worldProvider.getDimensionManager() != DimensionManager.OVERWORLD && world.worldProvider.getDimensionManager() != DimensionManager.NETHER || !((BlockPortal) Blocks.NETHER_PORTAL).a((GeneratorAccess) world, blockposition)) {
if (!iblockdata.canPlace(world, blockposition)) {
- world.setAir(blockposition);
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
} else {
- world.I().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10));
+ world.J().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10));
}
@@ -387,4 +432,12 @@
blockfire.a(Blocks.BLACK_CARPET, 60, 20);
diff --git a/nms-patches/BlockFluids.patch b/nms-patches/BlockFluids.patch
index cad979d2..b2f16b46 100644
--- a/nms-patches/BlockFluids.patch
+++ b/nms-patches/BlockFluids.patch
@@ -1,12 +1,12 @@
--- a/net/minecraft/server/BlockFluids.java
+++ b/net/minecraft/server/BlockFluids.java
-@@ -46,10 +46,10 @@
+@@ -57,10 +57,10 @@
public VoxelShape a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) {
Fluid fluid = iblockaccess.b(blockposition.up());
-- return fluid.c().a((FluidType) this.b) ? VoxelShapes.b() : (VoxelShape) this.c.computeIfAbsent(iblockdata, (iblockdata) -> {
+- return fluid.c().a((FluidType) this.b) ? VoxelShapes.b() : (VoxelShape) this.o.computeIfAbsent(iblockdata, (iblockdata) -> {
- Fluid fluid = iblockdata.s();
-+ return fluid.c().a((FluidType) this.b) ? VoxelShapes.b() : (VoxelShape) this.c.computeIfAbsent(iblockdata, (iblockdata1) -> { // CraftBukkit - decompile errors
++ return fluid.c().a((FluidType) this.b) ? VoxelShapes.b() : (VoxelShape) this.o.computeIfAbsent(iblockdata, (iblockdata1) -> { // CraftBukkit - decompile errors
+ Fluid fluid1 = iblockdata1.s();
- return VoxelShapes.a(0.0D, 0.0D, 0.0D, 1.0D, (double) fluid.f(), 1.0D);
@@ -14,7 +14,7 @@
});
}
-@@ -106,14 +106,20 @@
+@@ -117,14 +117,20 @@
Fluid fluid = world.b(blockposition);
if (fluid.d()) {
diff --git a/nms-patches/BlockGrass.patch b/nms-patches/BlockGrass.patch
index 68f953a2..7b037795 100644
--- a/nms-patches/BlockGrass.patch
+++ b/nms-patches/BlockGrass.patch
@@ -1,11 +1,11 @@
--- a/net/minecraft/server/BlockGrass.java
+++ b/net/minecraft/server/BlockGrass.java
-@@ -51,7 +51,7 @@
- }
+@@ -58,7 +58,7 @@
+ }
- if (iblockdata2.canPlace(world, blockposition2)) {
-- world.setTypeAndData(blockposition2, iblockdata2, 3);
-+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition2, iblockdata2, 3); // CraftBukkit
+ if (iblockdata3.canPlace(world, blockposition2)) {
+- world.setTypeAndData(blockposition2, iblockdata3, 3);
++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition2, iblockdata3, 3); // CraftBukkit
+ }
}
}
- }
diff --git a/nms-patches/BlockLeaves.patch b/nms-patches/BlockLeaves.patch
index 3aad2770..cce3360d 100644
--- a/nms-patches/BlockLeaves.patch
+++ b/nms-patches/BlockLeaves.patch
@@ -8,7 +8,7 @@
+
public class BlockLeaves extends Block {
- public static final BlockStateInteger DISTANCE = BlockProperties.aa;
+ public static final BlockStateInteger DISTANCE = BlockProperties.ab;
@@ -20,6 +22,14 @@
public void b(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
diff --git a/nms-patches/BlockMinecartDetector.patch b/nms-patches/BlockMinecartDetector.patch
index 071412c9..16fe0b49 100644
--- a/nms-patches/BlockMinecartDetector.patch
+++ b/nms-patches/BlockMinecartDetector.patch
@@ -8,7 +8,7 @@
+
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
- public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.R;
+ public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.S;
@@ -55,6 +57,17 @@
flag1 = true;
}
diff --git a/nms-patches/BlockObserver.patch b/nms-patches/BlockObserver.patch
index 49c01c13..f6b97dcc 100644
--- a/nms-patches/BlockObserver.patch
+++ b/nms-patches/BlockObserver.patch
@@ -26,5 +26,5 @@
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, Boolean.valueOf(true)), 2);
- world.I().a(blockposition, this, 2);
+ world.J().a(blockposition, this, 2);
}
diff --git a/nms-patches/BlockPiston.patch b/nms-patches/BlockPiston.patch
index 7b08e4bd..5f29fcd2 100644
--- a/nms-patches/BlockPiston.patch
+++ b/nms-patches/BlockPiston.patch
@@ -38,7 +38,7 @@
world.playBlockAction(blockposition, this, b0, enumdirection.a());
}
-@@ -271,6 +295,48 @@
+@@ -285,6 +309,48 @@
IBlockData[] aiblockdata = new IBlockData[j];
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
HashSet hashset = Sets.newHashSet(list);
@@ -86,4 +86,4 @@
+ // CraftBukkit end
int k;
- BlockPosition blockposition2;
+ BlockPosition blockposition3;
diff --git a/nms-patches/BlockPortal.patch b/nms-patches/BlockPortal.patch
index 07c4cf20..5863e7e6 100644
--- a/nms-patches/BlockPortal.patch
+++ b/nms-patches/BlockPortal.patch
@@ -12,7 +12,7 @@
+
public class BlockPortal extends Block {
- public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.y;
+ public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.z;
@@ -37,7 +43,8 @@
}
diff --git a/nms-patches/BlockPoweredRail.patch b/nms-patches/BlockPoweredRail.patch
index 5a9e7598..43ee707d 100644
--- a/nms-patches/BlockPoweredRail.patch
+++ b/nms-patches/BlockPoweredRail.patch
@@ -7,7 +7,7 @@
+
public class BlockPoweredRail extends BlockMinecartTrackAbstract {
- public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.R;
+ public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.S;
@@ -106,6 +108,13 @@
boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || this.a(world, blockposition, iblockdata, true, 0) || this.a(world, blockposition, iblockdata, false, 0);
diff --git a/nms-patches/BlockPressurePlateWeighted.patch b/nms-patches/BlockPressurePlateWeighted.patch
index 6550159b..376a6c23 100644
--- a/nms-patches/BlockPressurePlateWeighted.patch
+++ b/nms-patches/BlockPressurePlateWeighted.patch
@@ -7,7 +7,7 @@
+
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
- public static final BlockStateInteger POWER = BlockProperties.ak;
+ public static final BlockStateInteger POWER = BlockProperties.al;
@@ -12,7 +14,31 @@
}
diff --git a/nms-patches/BlockRedstoneComparator.patch b/nms-patches/BlockRedstoneComparator.patch
index 3e607fec..82052199 100644
--- a/nms-patches/BlockRedstoneComparator.patch
+++ b/nms-patches/BlockRedstoneComparator.patch
@@ -8,7 +8,7 @@
+
public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
- public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.ap;
+ public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.aq;
@@ -65,7 +67,8 @@
@Nullable
diff --git a/nms-patches/BlockRedstoneLamp.patch b/nms-patches/BlockRedstoneLamp.patch
index 71ed926c..3b484aeb 100644
--- a/nms-patches/BlockRedstoneLamp.patch
+++ b/nms-patches/BlockRedstoneLamp.patch
@@ -11,7 +11,7 @@
public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
@@ -33,6 +35,11 @@
if (flag) {
- world.I().a(blockposition, this, 4);
+ world.J().a(blockposition, this, 4);
} else {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
diff --git a/nms-patches/BlockRedstoneWire.patch b/nms-patches/BlockRedstoneWire.patch
index 4f8952db..f6f436ac 100644
--- a/nms-patches/BlockRedstoneWire.patch
+++ b/nms-patches/BlockRedstoneWire.patch
@@ -8,8 +8,8 @@
+
public class BlockRedstoneWire extends Block {
- public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.L;
-@@ -215,6 +217,15 @@
+ public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.M;
+@@ -216,6 +218,15 @@
j = k;
}
diff --git a/nms-patches/BlockSapling.patch b/nms-patches/BlockSapling.patch
index 3dab6232..2f9f8966 100644
--- a/nms-patches/BlockSapling.patch
+++ b/nms-patches/BlockSapling.patch
@@ -15,7 +15,7 @@
+
public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement {
- public static final BlockStateInteger STAGE = BlockProperties.al;
+ public static final BlockStateInteger STAGE = BlockProperties.am;
protected static final VoxelShape b = Block.a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
private final WorldGenTreeProvider c;
+ public static TreeType treeType; // CraftBukkit
diff --git a/nms-patches/BlockSoil.patch b/nms-patches/BlockSoil.patch
index 7c6475a0..c10f0062 100644
--- a/nms-patches/BlockSoil.patch
+++ b/nms-patches/BlockSoil.patch
@@ -11,7 +11,7 @@
+
public class BlockSoil extends Block {
- public static final BlockStateInteger MOISTURE = BlockProperties.ah;
+ public static final BlockStateInteger MOISTURE = BlockProperties.ai;
@@ -63,14 +68,37 @@
}
@@ -42,12 +42,12 @@
+ // super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved up
}
- protected static void b(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ public static void b(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ // CraftBukkit start
+ if (CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
- world.setTypeUpdate(blockposition, a(iblockdata, Blocks.DIRT.getBlockData(), (GeneratorAccess) world, blockposition));
+ world.setTypeUpdate(blockposition, a(iblockdata, Blocks.DIRT.getBlockData(), world, blockposition));
}
diff --git a/nms-patches/BlockSponge.patch b/nms-patches/BlockSponge.patch
index a73f8781..c6dac0b0 100644
--- a/nms-patches/BlockSponge.patch
+++ b/nms-patches/BlockSponge.patch
@@ -24,7 +24,7 @@
@@ -49,20 +56,20 @@
Material material = iblockdata.getMaterial();
- if (fluid.a(TagsFluid.a)) {
+ if (fluid.a(TagsFluid.WATER)) {
- if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).a(world, blockposition2, iblockdata) != FluidTypes.a) {
+ if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).a(blockList, blockposition2, iblockdata) != FluidTypes.a) { // CraftBukkit
++i;
diff --git a/nms-patches/BlockStem.patch b/nms-patches/BlockStem.patch
index 2a7b86d1..cc24741d 100644
--- a/nms-patches/BlockStem.patch
+++ b/nms-patches/BlockStem.patch
@@ -8,7 +8,7 @@
+
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
- public static final BlockStateInteger AGE = BlockProperties.V;
+ public static final BlockStateInteger AGE = BlockProperties.W;
@@ -33,14 +35,14 @@
if (i < 7) {
diff --git a/nms-patches/BlockTNT.patch b/nms-patches/BlockTNT.patch
index 1af71a5f..0e087adb 100644
--- a/nms-patches/BlockTNT.patch
+++ b/nms-patches/BlockTNT.patch
@@ -1,7 +1,7 @@
--- a/net/minecraft/server/BlockTNT.java
+++ b/net/minecraft/server/BlockTNT.java
-@@ -72,6 +72,11 @@
- EntityArrow entityarrow = (EntityArrow) entity;
+@@ -90,6 +90,11 @@
+ Entity entity1 = entityarrow.getShooter();
if (entityarrow.isBurning()) {
+ // CraftBukkit start
@@ -9,6 +9,6 @@
+ return;
+ }
+ // CraftBukkit end
- this.a(world, blockposition, entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null);
+ this.a(world, blockposition, entity1 instanceof EntityLiving ? (EntityLiving) entity1 : null);
world.setAir(blockposition);
}
diff --git a/nms-patches/BlockTurtleEgg.patch b/nms-patches/BlockTurtleEgg.patch
index 0e41a792..b56a2002 100644
--- a/nms-patches/BlockTurtleEgg.patch
+++ b/nms-patches/BlockTurtleEgg.patch
@@ -13,7 +13,7 @@
public class BlockTurtleEgg extends Block {
-@@ -35,6 +41,19 @@
+@@ -33,6 +39,19 @@
super.stepOn(world, blockposition, entity);
} else {
if (!world.isClientSide && world.random.nextInt(i) == 0) {
@@ -30,10 +30,10 @@
+ return;
+ }
+ // CraftBukkit end
- this.a(world, blockposition, iblockdata);
+ this.a(world, blockposition, world.getType(blockposition));
}
-@@ -72,7 +91,7 @@
+@@ -70,7 +89,7 @@
entityturtle.setAgeRaw(-24000);
entityturtle.g(blockposition);
entityturtle.setPositionRotation((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);
diff --git a/nms-patches/BlockVine.patch b/nms-patches/BlockVine.patch
index 7a84a4a6..f309579c 100644
--- a/nms-patches/BlockVine.patch
+++ b/nms-patches/BlockVine.patch
@@ -8,7 +8,7 @@
+
public class BlockVine extends Block {
- public static final BlockStateBoolean UP = BlockSprawling.q;
+ public static final BlockStateBoolean UP = BlockSprawling.p;
@@ -183,20 +185,24 @@
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
diff --git a/nms-patches/Chunk.patch b/nms-patches/Chunk.patch
index c98d9aa4..41edc035 100644
--- a/nms-patches/Chunk.patch
+++ b/nms-patches/Chunk.patch
@@ -8,10 +8,10 @@
+
public class Chunk implements IChunkAccess {
- private static final Logger e = LogManager.getLogger();
-@@ -58,6 +60,35 @@
- private int E;
- private final AtomicInteger F;
+ private static final Logger d = LogManager.getLogger();
+@@ -57,6 +59,35 @@
+ private int D;
+ private final AtomicInteger E;
+ // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
+ private int neighbors = 0x1 << 12;
@@ -44,11 +44,11 @@
+
public Chunk(World world, int i, int j, BiomeBase[] abiomebase, ChunkConverter chunkconverter, TickList<Block> ticklist, TickList<FluidType> ticklist1, long k) {
this.sections = new ChunkSection[16];
- this.h = new boolean[256];
-@@ -95,8 +126,16 @@
- this.t = ticklist;
- this.u = ticklist1;
- this.A = k;
+ this.g = new boolean[256];
+@@ -94,8 +125,16 @@
+ this.s = ticklist;
+ this.t = ticklist1;
+ this.z = k;
+ // CraftBukkit start
+ this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
+ this.chunkKey = ChunkCoordIntPair.a(this.locX, this.locZ);
@@ -62,7 +62,7 @@
public Chunk(World world, ProtoChunk protochunk, int i, int j) {
this(world, i, j, protochunk.getBiomeIndex(), protochunk.v(), protochunk.n(), protochunk.o(), protochunk.m());
-@@ -136,14 +175,15 @@
+@@ -135,14 +174,15 @@
HeightMap.Type heightmap_type = (HeightMap.Type) iterator.next();
if (heightmap_type.c() == HeightMap.Use.LIVE_WORLD) {
@@ -74,13 +74,13 @@
}
}
- this.y = true;
+ this.x = true;
this.a(ChunkStatus.FULLCHUNK);
+ this.newChunk = true; // CraftBukkit
}
public Set<BlockPosition> t() {
-@@ -474,7 +514,8 @@
+@@ -473,7 +513,8 @@
}
}
@@ -90,7 +90,7 @@
iblockdata.onPlace(this.world, blockposition, iblockdata1);
}
-@@ -654,7 +695,12 @@
+@@ -653,7 +694,12 @@
@Nullable
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
@@ -104,7 +104,7 @@
if (tileentity == null) {
if (chunk_enumtileentitystate == Chunk.EnumTileEntityState.IMMEDIATE) {
-@@ -689,6 +735,13 @@
+@@ -688,6 +734,13 @@
tileentity.z();
this.tileEntities.put(blockposition, tileentity);
@@ -118,8 +118,8 @@
}
}
-@@ -719,6 +772,17 @@
- this.world.a((Collection) entityslice);
+@@ -720,6 +773,17 @@
+ }));
}
+ // CraftBukkit start
@@ -136,7 +136,7 @@
}
public void removeEntities() {
-@@ -735,9 +799,21 @@
+@@ -736,9 +800,21 @@
int i = aentityslice.length;
for (int j = 0; j < i; ++j) {
@@ -154,13 +154,13 @@
+ }
+ }
-- this.world.c((Collection) entityslice);
-+ this.world.c(newList);
+- this.world.b((Collection) entityslice);
++ this.world.b((Collection) newList);
+ // CraftBukkit end
}
}
-@@ -799,8 +875,8 @@
+@@ -800,8 +876,8 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -171,37 +171,37 @@
}
}
}
-@@ -1006,13 +1082,13 @@
+@@ -1007,13 +1083,13 @@
@Nullable
public LongSet b(String s) {
-- return (LongSet) this.r.computeIfAbsent(s, (s) -> {
-+ return (LongSet) this.r.computeIfAbsent(s, (s1) -> { // CraftBukkit - decompile error
+- return (LongSet) this.q.computeIfAbsent(s, (s) -> {
++ return (LongSet) this.q.computeIfAbsent(s, (s1) -> { // CraftBukkit - decompile error
return new LongOpenHashSet();
});
}
public void a(String s, long i) {
-- ((LongSet) this.r.computeIfAbsent(s, (s) -> {
-+ ((LongSet) this.r.computeIfAbsent(s, (s1) -> { // CraftBukkit - decompile error
+- ((LongSet) this.q.computeIfAbsent(s, (s) -> {
++ ((LongSet) this.q.computeIfAbsent(s, (s1) -> { // CraftBukkit - decompile error
return new LongOpenHashSet();
})).add(i);
}
@@ -1061,14 +1137,14 @@
}
- if (this.t instanceof ProtoChunkTickList) {
-- ((ProtoChunkTickList) this.t).a(this.world.I(), (blockposition) -> {
+ if (this.s instanceof ProtoChunkTickList) {
+- ((ProtoChunkTickList) this.s).a(this.world.J(), (blockposition) -> {
- return this.world.getType(blockposition).getBlock();
-+ ((ProtoChunkTickList<Block>) this.t).a(this.world.I(), (blockposition1) -> { // CraftBukkit - decompile error
++ ((ProtoChunkTickList<Block>) this.s).a(this.world.J(), (blockposition1) -> { // CraftBukkit - decompile error
+ return this.world.getType(blockposition1).getBlock();
});
}
- if (this.u instanceof ProtoChunkTickList) {
-- ((ProtoChunkTickList) this.u).a(this.world.H(), (blockposition) -> {
+ if (this.t instanceof ProtoChunkTickList) {
+- ((ProtoChunkTickList) this.t).a(this.world.I(), (blockposition) -> {
- return this.world.b(blockposition).c();
-+ ((ProtoChunkTickList<FluidType>) this.u).a(this.world.H(), (blockposition1) -> { // CraftBukkit - decompile error
++ ((ProtoChunkTickList<FluidType>) this.t).a(this.world.I(), (blockposition1) -> { // CraftBukkit - decompile error
+ return this.world.b(blockposition1).c();
});
}
diff --git a/nms-patches/ChunkMap.patch b/nms-patches/ChunkMap.patch
index 203c693d..fc1fb260 100644
--- a/nms-patches/ChunkMap.patch
+++ b/nms-patches/ChunkMap.patch
@@ -51,27 +51,27 @@
throw new RuntimeException("Not yet implemented");
}
-- public Object remove(Object object) {
-+ // CraftBukkit start - decompile errors
-+ public Chunk remove(Object object) {
- return this.a(object);
- }
-
- public Object remove(long i) {
++ // CraftBukkit start - decompile errors
+ public Chunk remove(long i) {
return this.a(i);
}
-- public Object put(Long olong, Object object) {
-+ public Chunk put(Long olong, Chunk object) {
- return this.a(olong, (Chunk) object);
- }
-
- public Object put(long i, Object object) {
+ public Chunk put(long i, Chunk object) {
return this.a(i, (Chunk) object);
}
+- public Object remove(Object object) {
++ public Chunk remove(Object object) {
+ return this.a(object);
+ }
+
+- public Object put(Long olong, Object object) {
++ public Chunk put(Long olong, Chunk object) {
+ return this.a(olong, (Chunk) object);
+ }
+
- public Object put(Object object, Object object1) {
+ public Object put(Object object, Chunk object1) {
return this.a((Long) object, (Chunk) object1);
diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch
index aad3ec49..f16a3837 100644
--- a/nms-patches/ChunkProviderServer.patch
+++ b/nms-patches/ChunkProviderServer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkProviderServer.java
+++ b/net/minecraft/server/ChunkProviderServer.java
-@@ -20,6 +20,11 @@
+@@ -18,6 +18,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -12,93 +12,79 @@
public class ChunkProviderServer implements IChunkProvider {
private static final Logger a = LogManager.getLogger();
-@@ -35,7 +40,7 @@
- this.world = worldserver;
+@@ -36,7 +41,7 @@
this.chunkLoader = ichunkloader;
this.chunkGenerator = chunkgenerator;
-- this.f = new ChunkTaskScheduler(2, worldserver, chunkgenerator, ichunkloader, iasynctaskhandler);
-+ this.f = new ChunkTaskScheduler(0, worldserver, chunkgenerator, ichunkloader, iasynctaskhandler); // CraftBukkit - very buggy, broken in lots of __subtle__ ways. Same goes for async chunk loading. Also Bukkit API / plugins can't handle async events at all anyway.
- this.g = new SchedulerBatch(this.f);
+ this.asyncTaskHandler = iasynctaskhandler;
+- this.chunkScheduler = new ChunkTaskScheduler(2, worldserver, chunkgenerator, ichunkloader, iasynctaskhandler);
++ this.chunkScheduler = new ChunkTaskScheduler(0, worldserver, chunkgenerator, ichunkloader, iasynctaskhandler); // CraftBukkit - very buggy, broken in lots of __subtle__ ways. Same goes for async chunk loading. Also Bukkit API / plugins can't handle async events at all anyway.
+ this.batchScheduler = new SchedulerBatch(this.chunkScheduler);
}
-@@ -77,9 +82,10 @@
- @Nullable
- private Chunk loadChunkAt(int i, int j) {
- try {
-- Chunk chunk = this.chunkLoader.a(this.world, i, j, (chunk) -> {
-- chunk.setLastSaved(this.world.getTime());
-- this.chunks.put(ChunkCoordIntPair.a(i, j), chunk);
-+ // CraftBukkit - decompile error
-+ Chunk chunk = this.chunkLoader.a(this.world, i, j, (chunk1) -> {
-+ chunk1.setLastSaved(this.world.getTime());
-+ this.chunks.put(ChunkCoordIntPair.a(i, j), chunk1);
- });
+@@ -86,9 +91,10 @@
- if (chunk != null) {
-@@ -104,6 +110,12 @@
- }
- }
-
-+ // CraftBukkit start
-+ public Chunk getChunkIfLoaded(int x, int z) {
-+ return chunks.get(ChunkCoordIntPair.a(x, z));
-+ }
-+ // CraftBukkit end
-+
- public Chunk getChunkAt(int i, int j) {
- Chunk chunk = this.getOrLoadChunkAt(i, j);
-
-@@ -125,7 +137,7 @@
- synchronized (this.chunks) {
- IChunkAccess ichunkaccess = (IChunkAccess) this.chunks.get(ChunkCoordIntPair.a(i, j));
+ if (flag) {
+ try {
+- chunk = this.chunkLoader.a(this.world, i, j, (chunk) -> {
+- chunk.setLastSaved(this.world.getTime());
+- this.chunks.put(ChunkCoordIntPair.a(i, j), chunk);
++ // CraftBukkit - decompile error
++ chunk = this.chunkLoader.a(this.world, i, j, (chunk1) -> {
++ chunk1.setLastSaved(this.world.getTime());
++ this.chunks.put(ChunkCoordIntPair.a(i, j), chunk1);
+ });
+ } catch (Exception exception) {
+ ChunkProviderServer.a.error("Couldn\'t load chunk", exception);
+@@ -103,7 +109,7 @@
+ try {
+ this.batchScheduler.b();
+ this.batchScheduler.a(new ChunkCoordIntPair(i, j));
+- CompletableFuture completablefuture = this.batchScheduler.c();
++ CompletableFuture<ProtoChunk> completablefuture = this.batchScheduler.c(); // CraftBukkit - decompile error
-- return ichunkaccess != null ? ichunkaccess : (IChunkAccess) this.f.c((Object) (new ChunkCoordIntPair(i, j)));
-+ return ichunkaccess != null ? ichunkaccess : (IChunkAccess) this.f.c((new ChunkCoordIntPair(i, j))); // CraftBukkit - decompile error
+ return (Chunk) completablefuture.thenApply(this::a).join();
+ } catch (RuntimeException runtimeexception) {
+@@ -114,6 +120,22 @@
}
}
-@@ -147,10 +159,21 @@
- return this.g.c();
- }
-
+ // CraftBukkit start
- public CompletableFuture<Chunk> generateChunk(int i, int j) {
-+ return this.generateChunk(i, j, false);
-+ }
-+
-+ public CompletableFuture<Chunk> generateChunk(int i, int j, boolean force) {
- this.g.b();
-- this.g.a(new ChunkCoordIntPair(i, j));
-- CompletableFuture completablefuture = this.g.c();
++ public Chunk generateChunk(int x, int z) {
++ try {
++ this.batchScheduler.b();
++ ChunkCoordIntPair pos = new ChunkCoordIntPair(x, z);
++ this.chunkScheduler.forcePolluteCache(pos);
++ this.batchScheduler.a(pos);
++ CompletableFuture<ProtoChunk> completablefuture = this.batchScheduler.c();
+
-+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
-+ if (force) {
-+ this.f.forcePolluteCache(chunkcoordintpair);
++ return (Chunk) completablefuture.thenApply(this::a).join();
++ } catch (RuntimeException runtimeexception) {
++ throw this.a(x, z, (Throwable) runtimeexception);
+ }
-+ this.g.a(chunkcoordintpair);
-+ // CraftBukkit end
-+ CompletableFuture<ProtoChunk> completablefuture = this.g.c(); // CraftBukkit - decompile error
++ }
++ // CraftBukkit end
++
+ public IChunkAccess a(int i, int j, boolean flag) {
+ Chunk chunk = this.getChunkAt(i, j, true, false);
- return completablefuture.thenApply(this::a);
- }
-@@ -268,10 +291,12 @@
- Chunk chunk = (Chunk) this.chunks.get(olong);
+@@ -251,10 +273,12 @@
+ Chunk chunk = (Chunk) this.chunks.get(olong);
- if (chunk != null && chunk.d) {
-- chunk.removeEntities();
-- this.saveChunk(chunk);
-- this.saveChunkNOP(chunk);
-- this.chunks.remove(olong);
-+ // CraftBukkit start - move unload logic to own method
-+ if (!unloadChunk(chunk, true)) {
-+ continue;
-+ }
-+ // CraftBukkit end
+ if (chunk != null) {
+- chunk.removeEntities();
+- this.saveChunk(chunk);
+- this.chunks.remove(olong);
+- this.lastChunk = null;
++ // CraftBukkit start - move unload logic to own method
++ if (!unloadChunk(chunk, true)) {
++ continue;
++ }
++ // CraftBukkit end
+
- ++i;
+ ++i;
+ }
}
- }
-@@ -284,6 +309,40 @@
+@@ -267,6 +291,40 @@
return false;
}
@@ -118,7 +104,7 @@
+ continue;
+ }
+
-+ Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
++ Chunk neighbor = this.getChunkAt(chunk.locX + x, chunk.locZ + z, false, false);
+ if (neighbor != null) {
+ neighbor.setNeighborUnloaded(-x, -z);
+ chunk.setNeighborUnloaded(x, z);
@@ -129,13 +115,13 @@
+ chunk.removeEntities();
+ if (save) {
+ this.saveChunk(chunk);
-+ this.saveChunkNOP(chunk);
+ }
+ this.chunks.remove(chunk.chunkKey);
++ this.lastChunk = null;
+ return true;
+ }
+ // CraftBukkit end
+
- public boolean e() {
+ public boolean d() {
return !this.world.savingDisabled;
}
diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch
index f08c03d7..b455a239 100644
--- a/nms-patches/ChunkRegionLoader.patch
+++ b/nms-patches/ChunkRegionLoader.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkRegionLoader.java
+++ b/net/minecraft/server/ChunkRegionLoader.java
-@@ -34,7 +34,7 @@
+@@ -31,7 +31,7 @@
private final File c;
private final DataFixer d;
private PersistentStructureLegacy e;
@@ -9,12 +9,12 @@
public ChunkRegionLoader(File file, DataFixer datafixer) {
this.c = file;
-@@ -45,20 +45,56 @@
- private synchronized NBTTagCompound a(GeneratorAccess generatoraccess, int i, int j) throws IOException {
- NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(new ChunkCoordIntPair(i, j));
+@@ -40,25 +40,60 @@
-- return nbttagcompound != null ? nbttagcompound : this.a(generatoraccess.o().getDimensionManager(), generatoraccess.s_(), i, j);
-+ return nbttagcompound != null ? nbttagcompound : this.a(generatoraccess.o().getDimensionManager(), generatoraccess.s_(), i, j, generatoraccess); // CraftBukkit
+ @Nullable
+ private NBTTagCompound a(GeneratorAccess generatoraccess, int i, int j) throws IOException {
+- return this.a(generatoraccess.o().getDimensionManager(), generatoraccess.h(), i, j);
++ return this.a(generatoraccess.o().getDimensionManager(), generatoraccess.h(), i, j, generatoraccess); // CraftBukkit
+ }
+
+ // CraftBukkit start
@@ -46,40 +46,44 @@
@Nullable
- private NBTTagCompound a(DimensionManager dimensionmanager, @Nullable PersistentCollection persistentcollection, int i, int j) throws IOException {
-- DataInputStream datainputstream = RegionFileCache.read(this.c, i, j);
+ private NBTTagCompound a(DimensionManager dimensionmanager, @Nullable PersistentCollection persistentcollection, int i, int j, @Nullable GeneratorAccess generatoraccess) throws IOException {
-+ NBTTagCompound nbttagcompound = RegionFileCache.read(this.c, i, j);
+ NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(new ChunkCoordIntPair(i, j));
-- if (datainputstream == null) {
-+ if (nbttagcompound == null) {
- return null;
+ if (nbttagcompound != null) {
+ return nbttagcompound;
} else {
-- NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a(datainputstream);
+- DataInputStream datainputstream = RegionFileCache.read(this.c, i, j);
++ NBTTagCompound nbttagcompound1 = RegionFileCache.read(this.c, i, j);
+
+- if (datainputstream == null) {
++ if (nbttagcompound1 == null) {
+ return null;
+ } else {
+- NBTTagCompound nbttagcompound1 = NBTCompressedStreamTools.a(datainputstream);
-
-- datainputstream.close();
-+ // CraftBukkit end
- int k = nbttagcompound.hasKeyOfType("DataVersion", 99) ? nbttagcompound.getInt("DataVersion") : -1;
-+ // CraftBukkit start
-+ if (k < 1466) {
-+ NBTTagCompound level = nbttagcompound.getCompound("Level");
-+ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
-+ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkProviderServer();
-+ if (check(cps, i - 1, j) && check(cps, i - 1, j - 1) && check(cps, i, j - 1)) {
-+ level.setBoolean("LightPopulated", true);
+- datainputstream.close();
+ int k = nbttagcompound1.hasKeyOfType("DataVersion", 99) ? nbttagcompound1.getInt("DataVersion") : -1;
++ // CraftBukkit start
++ if (k < 1466) {
++ NBTTagCompound level = nbttagcompound1.getCompound("Level");
++ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
++ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkProviderServer();
++ if (check(cps, i - 1, j) && check(cps, i - 1, j - 1) && check(cps, i, j - 1)) {
++ level.setBoolean("LightPopulated", true);
++ }
+ }
+ }
-+ }
-+ // CraftBukkit end
++ // CraftBukkit end
+
+ if (k < 1493) {
+ nbttagcompound1 = GameProfileSerializer.a(this.d, DataFixTypes.CHUNK, nbttagcompound1, k, 1493);
+@@ -86,13 +121,29 @@
- if (k < 1493) {
- nbttagcompound = GameProfileSerializer.a(this.d, DataFixTypes.CHUNK, nbttagcompound, k, 1493);
-@@ -81,13 +117,29 @@
- }
}
+ // CraftBukkit start - Add async variant, provide compatibility
@Nullable
- public synchronized Chunk a(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException {
+ public Chunk a(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException {
+ Object[] data = loadChunk(generatoraccess, i, j, consumer);
+ if (data != null) {
+ Chunk chunk = (Chunk) data[0];
@@ -92,7 +96,7 @@
+ return null;
+ }
+
-+ public synchronized Object[] loadChunk(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException {
++ public Object[] loadChunk(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException {
+ // CraftBukkit end
NBTTagCompound nbttagcompound = this.a(generatoraccess, i, j);
@@ -103,7 +107,7 @@
Chunk chunk = this.a(generatoraccess, i, j, nbttagcompound);
if (chunk != null) {
-@@ -96,6 +148,9 @@
+@@ -101,6 +152,9 @@
}
return chunk;
@@ -113,7 +117,7 @@
}
}
-@@ -124,7 +179,7 @@
+@@ -132,7 +186,7 @@
}
@Nullable
@@ -122,7 +126,7 @@
if (nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8)) {
ChunkStatus.Type chunkstatus_type = this.a(nbttagcompound);
-@@ -143,10 +198,28 @@
+@@ -151,10 +205,28 @@
ChunkRegionLoader.a.error("Chunk file at {},{} is in the wrong location; relocating. (Expected {}, {}, got {}, {})", Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(chunk.locX), Integer.valueOf(chunk.locZ));
nbttagcompound1.setInt("xPos", i);
nbttagcompound1.setInt("zPos", j);
@@ -152,7 +156,7 @@
}
}
} else {
-@@ -161,7 +234,7 @@
+@@ -169,7 +241,7 @@
ChunkStatus.Type chunkstatus_type = this.a(nbttagcompound);
if (chunkstatus_type == ChunkStatus.Type.LEVELCHUNK) {
@@ -161,69 +165,42 @@
} else {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level");
-@@ -209,19 +282,30 @@
+@@ -217,10 +289,14 @@
}
- public synchronized boolean a() {
-- if (this.b.isEmpty()) {
-- if (this.f) {
+ public boolean a() {
+- Iterator iterator = this.b.entrySet().iterator();
+ // CraftBukkit start
+ return this.processSaveQueueEntry(false);
+ }
-+
-+ private synchronized boolean processSaveQueueEntry(boolean logCompletion) {
-+ Iterator<Map.Entry<ChunkCoordIntPair, NBTTagCompound>> iter = this.b.entrySet().iterator();
-+ if (!iter.hasNext()) {
-+ if (logCompletion) {
-+ // CraftBukkit end
- ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.c.getName());
- }
- return false;
- } else {
-- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.b.keySet().iterator().next();
-+ // CraftBukkit start
-+ Map.Entry<ChunkCoordIntPair, NBTTagCompound> entry = iter.next();
-+ ChunkCoordIntPair chunkcoordintpair = entry.getKey();
-+ NBTTagCompound nbttagcompound = entry.getValue();
-+ // CraftBukkit end
-
- boolean flag;
-
- try {
-- NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(chunkcoordintpair);
-+ // NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(chunkcoordintpair); // CraftBukkit
-
- if (nbttagcompound != null) {
- try {
-@@ -233,7 +317,7 @@
-
- flag = true;
- } finally {
-- this.b.remove(chunkcoordintpair);
-+ this.b.remove(chunkcoordintpair, nbttagcompound); // CraftBukkit
++ private boolean processSaveQueueEntry(boolean logCompletion) {
++ Iterator iterator = this.b.entrySet().iterator();
+ if (!iterator.hasNext()) {
+- if (this.f) {
++ if (logCompletion) { // CraftBukkit
+ ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.c.getName());
}
- return flag;
-@@ -253,10 +337,14 @@
- }
-
- private void b(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
-- DataOutputStream dataoutputstream = RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z);
-+ // CraftBukkit start
-+ RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z, nbttagcompound);
+@@ -236,10 +312,14 @@
+ return true;
+ } else {
+ try {
+- DataOutputStream dataoutputstream = RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z);
++ // CraftBukkit start
++ RegionFileCache.write(this.c, chunkcoordintpair.x, chunkcoordintpair.z, nbttagcompound);
-+ /*
- NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream);
- dataoutputstream.close();
-+ */
-+ // CraftBukkit end
- if (this.e != null) {
- this.e.a(chunkcoordintpair.a());
- }
-@@ -269,15 +357,16 @@
++ /*
+ NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream);
+ dataoutputstream.close();
++ */
++ // CraftBukkit end
+ if (this.e != null) {
+ this.e.a(chunkcoordintpair.a());
+ }
+@@ -266,15 +346,16 @@
- public void c() {
+ public void b() {
try {
- this.f = true;
+ // this.f = true; // CraftBukkit
@@ -241,25 +218,25 @@
}
}
-@@ -306,7 +395,7 @@
+@@ -303,7 +384,7 @@
if (abiomebase != null) {
for (int k = 0; k < abiomebase.length; ++k) {
-- aint[k] = BiomeBase.REGISTRY_ID.a((Object) abiomebase[k]);
-+ aint[k] = BiomeBase.REGISTRY_ID.a(abiomebase[k]); // CraftBukkit - decompile error
+- aint[k] = IRegistry.BIOME.a((Object) abiomebase[k]);
++ aint[k] = IRegistry.BIOME.a(abiomebase[k]); // CraftBukkit - decompile error
}
}
-@@ -388,7 +477,7 @@
+@@ -385,7 +466,7 @@
int[] aint = new int[abiomebase.length];
for (int i = 0; i < abiomebase.length; ++i) {
-- aint[i] = BiomeBase.REGISTRY_ID.a((Object) abiomebase[i]);
-+ aint[i] = BiomeBase.REGISTRY_ID.a(abiomebase[i]); // CraftBukkit - decompile error
+- aint[i] = IRegistry.BIOME.a((Object) abiomebase[i]);
++ aint[i] = IRegistry.BIOME.a(abiomebase[i]); // CraftBukkit - decompile error
}
nbttagcompound.setIntArray("Biomes", aint);
-@@ -490,7 +579,7 @@
+@@ -487,27 +568,27 @@
}
ChunkConverter chunkconverter = nbttagcompound.hasKeyOfType("UpgradeData", 10) ? new ChunkConverter(nbttagcompound.getCompound("UpgradeData")) : ChunkConverter.a;
@@ -267,26 +244,33 @@
+ Predicate<Block> predicate = (block) -> { // CraftBukkit - decompile error
return block.getBlockData().isAir();
};
- RegistryBlocks registryblocks = Block.REGISTRY;
-@@ -502,7 +591,7 @@
- Block.REGISTRY.getClass();
- ProtoChunkTickList protochunkticklist = new ProtoChunkTickList(predicate, function, registryblocks1::get, new ChunkCoordIntPair(i, j));
+ IRegistry iregistry = IRegistry.BLOCK;
+
+ IRegistry.BLOCK.getClass();
+ Function function = iregistry::getKey;
+- IRegistry iregistry1 = IRegistry.BLOCK;
++ IRegistry<Block> iregistry1 = IRegistry.BLOCK; // CraftBukkit - decompile error
+
+ IRegistry.BLOCK.getClass();
+- ProtoChunkTickList protochunkticklist = new ProtoChunkTickList(predicate, function, iregistry1::getOrDefault, new ChunkCoordIntPair(i, j));
++ ProtoChunkTickList protochunkticklist = new ProtoChunkTickList<>(predicate, function, iregistry1::getOrDefault, new ChunkCoordIntPair(i, j)); // CraftBukkit - decompile error
- predicate = (fluidtype) -> {
+ Predicate<FluidType> predicate1 = (fluidtype) -> { // CraftBukkit - decompile error
return fluidtype == FluidTypes.a;
};
- registryblocks = FluidType.c;
-@@ -510,7 +599,7 @@
- function = registryblocks::b;
- registryblocks1 = FluidType.c;
- FluidType.c.getClass();
-- ProtoChunkTickList protochunkticklist1 = new ProtoChunkTickList(predicate, function, registryblocks1::get, new ChunkCoordIntPair(i, j));
-+ ProtoChunkTickList protochunkticklist1 = new ProtoChunkTickList(predicate1, function, registryblocks1::get, new ChunkCoordIntPair(i, j)); // CraftBukkit - decompile error
+ iregistry = IRegistry.FLUID;
+ IRegistry.FLUID.getClass();
+ function = iregistry::getKey;
+- iregistry1 = IRegistry.FLUID;
++ IRegistry<FluidType> iregistry2 = IRegistry.FLUID; // CraftBukkit - decompile error
+ IRegistry.FLUID.getClass();
+- ProtoChunkTickList protochunkticklist1 = new ProtoChunkTickList(predicate, function, iregistry1::getOrDefault, new ChunkCoordIntPair(i, j));
++ ProtoChunkTickList protochunkticklist1 = new ProtoChunkTickList<>(predicate1, function, iregistry2::getOrDefault, new ChunkCoordIntPair(i, j)); // CraftBukkit - decompile error
long i1 = nbttagcompound.getLong("InhabitedTime");
Chunk chunk = new Chunk(generatoraccess.getMinecraftWorld(), i, j, abiomebase, chunkconverter, protochunkticklist, protochunkticklist1, i1);
-@@ -853,17 +942,29 @@
+@@ -850,17 +931,29 @@
}
@Nullable
@@ -318,7 +302,7 @@
});
}
-@@ -877,8 +978,14 @@
+@@ -874,8 +967,14 @@
}
}
@@ -334,12 +318,12 @@
Iterator iterator = entity.bP().iterator();
while (iterator.hasNext()) {
-@@ -894,7 +1001,7 @@
+@@ -891,7 +990,7 @@
boolean flag = false;
try {
- this.a(dimensionmanager, persistentcollection, chunkcoordintpair.x, chunkcoordintpair.z);
+ this.a(dimensionmanager, persistentcollection, chunkcoordintpair.x, chunkcoordintpair.z, null); // CraftBukkit
- while (!this.b.isEmpty()) {
- this.a();
+ while (this.a()) {
+ flag = true;
diff --git a/nms-patches/ChunkTaskScheduler.patch b/nms-patches/ChunkTaskScheduler.patch
index dc448358..a1437645 100644
--- a/nms-patches/ChunkTaskScheduler.patch
+++ b/nms-patches/ChunkTaskScheduler.patch
@@ -1,15 +1,24 @@
--- a/net/minecraft/server/ChunkTaskScheduler.java
+++ b/net/minecraft/server/ChunkTaskScheduler.java
-@@ -39,6 +39,12 @@
+@@ -20,7 +20,7 @@
+ private final ChunkGenerator<?> d;
+ private final IChunkLoader e;
+ private final IAsyncTaskHandler f;
+- private final Long2ObjectMap<Scheduler.a> progressCache = new ExpiringMap(8192, 5000) {
++ private final Long2ObjectMap<Scheduler.a> progressCache = new ExpiringMap<Scheduler.a>(8192, 5000) { // CraftBukkit - decompile error
+ protected boolean a(Scheduler.a scheduler_a) {
+ ProtoChunk protochunk = (ProtoChunk) scheduler_a.a();
+
+@@ -40,6 +40,12 @@
this.f = iasynctaskhandler;
}
+ // CraftBukkit start
+ public void forcePolluteCache(ChunkCoordIntPair chunkcoordintpair) {
-+ this.g.put(chunkcoordintpair.a(), new Scheduler.a(chunkcoordintpair, new ProtoChunk(chunkcoordintpair, ChunkConverter.a), ChunkStatus.EMPTY));
++ this.progressCache.put(chunkcoordintpair.a(), new Scheduler.a(chunkcoordintpair, new ProtoChunk(chunkcoordintpair, ChunkConverter.a), ChunkStatus.EMPTY));
+ }
+ // CraftBukkit end
+
- protected Scheduler.a a(ChunkCoordIntPair chunkcoordintpair) {
- return (Scheduler.a) this.g.computeIfAbsent(Long.valueOf(chunkcoordintpair.a()), (olong) -> {
- ProtoChunk protochunk = this.a(chunkcoordintpair.x, chunkcoordintpair.z);
+ @Nullable
+ protected Scheduler.a a(ChunkCoordIntPair chunkcoordintpair, boolean flag) {
+ IChunkLoader ichunkloader = this.e;
diff --git a/nms-patches/CommandBlockListenerAbstract.patch b/nms-patches/CommandBlockListenerAbstract.patch
index 39842e81..21208d90 100644
--- a/nms-patches/CommandBlockListenerAbstract.patch
+++ b/nms-patches/CommandBlockListenerAbstract.patch
@@ -20,7 +20,7 @@
public CommandBlockListenerAbstract() {}
@@ -103,14 +108,7 @@
- if (minecraftserver != null && minecraftserver.F() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.g)) {
+ if (minecraftserver != null && minecraftserver.D() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.g)) {
try {
this.f = null;
- CommandListenerWrapper commandlistenerwrapper = this.getWrapper().a((commandcontext, flag, i) -> {
diff --git a/nms-patches/CommandDispatcher.patch b/nms-patches/CommandDispatcher.patch
index 945584b0..5939296b 100644
--- a/nms-patches/CommandDispatcher.patch
+++ b/nms-patches/CommandDispatcher.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandDispatcher.java
+++ b/net/minecraft/server/CommandDispatcher.java
-@@ -26,12 +26,21 @@
+@@ -27,12 +27,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -22,8 +22,8 @@
+ public final CommandDispatcher init(boolean flag) {
CommandAdvancement.a(this.b);
CommandExecute.a(this.b);
- CommmandBossBar.a(this.b);
-@@ -100,6 +109,11 @@
+ CommandBossBar.a(this.b);
+@@ -102,6 +111,11 @@
this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
CommandDispatcher.a.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection);
});
@@ -35,7 +35,7 @@
this.b.setConsumer((commandcontext, flag, i) -> {
((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag, i);
});
-@@ -114,8 +128,49 @@
+@@ -116,7 +130,47 @@
}
@@ -75,18 +75,15 @@
+ }
+
public int a(CommandListenerWrapper commandlistenerwrapper, String s) {
-- String s1 = s;
+ return this.a(commandlistenerwrapper, s, s);
+ }
+
+ public int a(CommandListenerWrapper commandlistenerwrapper, String s, String label) {
-+ VanillaCommandWrapper.WorldRescueContext rescue = new VanillaCommandWrapper.WorldRescueContext().start(commandlistenerwrapper.getWorld());
-+ String s1 = label;
+ // CraftBukkit end
+ StringReader stringreader = new StringReader(s);
- if (s.startsWith("/")) {
- s = s.substring(1);
-@@ -126,7 +181,6 @@
+ if (stringreader.canRead() && stringreader.peek() == 47) {
+@@ -128,7 +182,6 @@
byte b0;
try {
@@ -94,7 +91,7 @@
ChatComponentText chatcomponenttext;
try {
-@@ -135,65 +189,95 @@
+@@ -137,52 +190,56 @@
return i;
} catch (CommandException commandexception) {
commandlistenerwrapper.sendFailureMessage(commandexception.a());
@@ -136,7 +133,7 @@
+ chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
+ chatcomponenttext.addSibling(chatmessage);
+ chatcomponenttext.getChatModifier().setColor(EnumChatFormat.GRAY);
-+ chatcomponenttext.getChatModifier().setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, s1));
++ chatcomponenttext.getChatModifier().setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit
+ commandlistenerwrapper.sendFailureMessage(chatcomponenttext);
}
@@ -177,10 +174,8 @@
+ }
} finally {
commandlistenerwrapper.getServer().methodProfiler.e();
-+ rescue.end(); // CraftBukkit
}
-
- return b0;
+@@ -191,11 +248,36 @@
}
public void a(EntityPlayer entityplayer) {
diff --git a/nms-patches/CommandForceload.patch b/nms-patches/CommandForceload.patch
new file mode 100644
index 00000000..05924d1b
--- /dev/null
+++ b/nms-patches/CommandForceload.patch
@@ -0,0 +1,45 @@
+--- a/net/minecraft/server/CommandForceload.java
++++ b/net/minecraft/server/CommandForceload.java
+@@ -47,7 +47,7 @@
+
+ private static int a(CommandListenerWrapper commandlistenerwrapper, ArgumentVec2I.a argumentvec2i_a) throws CommandSyntaxException {
+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(argumentvec2i_a.a >> 4, argumentvec2i_a.b >> 4);
+- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().o().getDimensionManager();
++ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
+ boolean flag = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager).f(chunkcoordintpair.x, chunkcoordintpair.z);
+
+ if (flag) {
+@@ -59,7 +59,7 @@
+ }
+
+ private static int a(CommandListenerWrapper commandlistenerwrapper) {
+- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().o().getDimensionManager();
++ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
+ LongSet longset = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager).ag();
+ int i = longset.size();
+
+@@ -79,12 +79,12 @@
+ }
+
+ private static int b(CommandListenerWrapper commandlistenerwrapper) {
+- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().o().getDimensionManager();
++ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
+ WorldServer worldserver = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager);
+ LongSet longset = worldserver.ag();
+
+- longset.forEach((i) -> {
+- worldserver.b(ChunkCoordIntPair.a(i), ChunkCoordIntPair.b(i), false);
++ longset.forEach((LongConsumer) (ix) -> { // CraftBukkit - decompile error
++ worldserver.b(ChunkCoordIntPair.a(ix), ChunkCoordIntPair.b(ix), false); // CraftBukkit - decompile error
+ });
+ commandlistenerwrapper.sendMessage(new ChatMessage("commands.forceload.removed.all", new Object[] { dimensionmanager}), true);
+ return 0;
+@@ -106,7 +106,7 @@
+ if (i2 > 256L) {
+ throw CommandForceload.a.create(Integer.valueOf(256), Long.valueOf(i2));
+ } else {
+- DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().o().getDimensionManager();
++ DimensionManager dimensionmanager = commandlistenerwrapper.getWorld().dimension; // CraftBukkit
+ WorldServer worldserver = commandlistenerwrapper.getServer().getWorldServer(dimensionmanager);
+ ChunkCoordIntPair chunkcoordintpair = null;
+ int j2 = 0;
diff --git a/nms-patches/CommandGamerule.patch b/nms-patches/CommandGamerule.patch
index 228c3013..055ff955 100644
--- a/nms-patches/CommandGamerule.patch
+++ b/nms-patches/CommandGamerule.patch
@@ -4,16 +4,16 @@
}
private static int a(CommandListenerWrapper commandlistenerwrapper, String s, CommandContext<CommandListenerWrapper> commandcontext) {
-- GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getServer().aQ().get(s);
+- GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getServer().getGameRules().get(s);
+ GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getWorld().getGameRules().get(s); // CraftBukkit
- gamerules_gamerulevalue.e().a(commandcontext, "value", gamerules_gamerulevalue);
+ gamerules_gamerulevalue.getType().a(commandcontext, "value", gamerules_gamerulevalue);
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[] { s, gamerules_gamerulevalue.a()}), true);
@@ -37,7 +37,7 @@
}
private static int a(CommandListenerWrapper commandlistenerwrapper, String s) {
-- GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getServer().aQ().get(s);
+- GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getServer().getGameRules().get(s);
+ GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getWorld().getGameRules().get(s); // CraftBukkit
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.query", new Object[] { s, gamerules_gamerulevalue.a()}), false);
diff --git a/nms-patches/CommandSpreadPlayers.patch b/nms-patches/CommandSpreadPlayers.patch
index 652eaa86..c1af65a4 100644
--- a/nms-patches/CommandSpreadPlayers.patch
+++ b/nms-patches/CommandSpreadPlayers.patch
@@ -25,7 +25,7 @@
+
+ // CraftBukkit start - add a version of getType which force loads chunks
+ private static IBlockData getType(IBlockAccess iblockaccess, BlockPosition position) {
-+ ((ChunkProviderServer) ((World) iblockaccess).chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4);
++ ((ChunkProviderServer) ((World) iblockaccess).chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4, true, true);
+ return iblockaccess.getType(position);
+ }
+ // CraftBukkit end
diff --git a/nms-patches/CommandTeleport.patch b/nms-patches/CommandTeleport.patch
index e57e2d12..76a8dd2a 100644
--- a/nms-patches/CommandTeleport.patch
+++ b/nms-patches/CommandTeleport.patch
@@ -9,9 +9,9 @@
}
if (collection.size() == 1) {
-@@ -116,9 +116,9 @@
- if (entity instanceof EntityPlayer) {
- entity.stopRiding();
+@@ -120,9 +120,9 @@
+ }
+
if (worldserver == entity.world) {
- ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set);
+ ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
diff --git a/nms-patches/ContainerAnvil.patch b/nms-patches/ContainerAnvil.patch
index 7b6e8d92..12c342d8 100644
--- a/nms-patches/ContainerAnvil.patch
+++ b/nms-patches/ContainerAnvil.patch
@@ -76,7 +76,7 @@
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
- return !this.i.getType(this.j).a(TagsBlock.y) ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D;
+ return !this.i.getType(this.j).a(TagsBlock.ANVIL) ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D;
}
@@ -357,4 +368,33 @@
diff --git a/nms-patches/ContainerEnchantTable.patch b/nms-patches/ContainerEnchantTable.patch
index a6d9ffd1..3795eeba 100644
--- a/nms-patches/ContainerEnchantTable.patch
+++ b/nms-patches/ContainerEnchantTable.patch
@@ -70,8 +70,8 @@
if (list != null && !list.isEmpty()) {
WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(this.l.nextInt(list.size()));
-- this.h[j] = Enchantment.enchantments.a((Object) weightedrandomenchant.enchantment);
-+ this.h[j] = Enchantment.enchantments.a(weightedrandomenchant.enchantment); // CraftBukkit - decompile error
+- this.h[j] = IRegistry.ENCHANTMENT.a((Object) weightedrandomenchant.enchantment);
++ this.h[j] = IRegistry.ENCHANTMENT.a(weightedrandomenchant.enchantment); // CraftBukkit - decompile error
this.i[j] = weightedrandomenchant.level;
}
}
@@ -81,7 +81,7 @@
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
+ org.bukkit.enchantments.EnchantmentOffer[] offers = new EnchantmentOffer[3];
+ for (j = 0; j < 3; ++j) {
-+ org.bukkit.enchantments.Enchantment enchantment = (this.h[j] >= 0) ? org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(Enchantment.getId(Enchantment.enchantments.getId(this.h[j])))) : null;
++ org.bukkit.enchantments.Enchantment enchantment = (this.h[j] >= 0) ? org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(IRegistry.ENCHANTMENT.fromId(this.h[j])))) : null;
+ offers[j] = (enchantment != null) ? new EnchantmentOffer(enchantment, this.i[j], this.costs[j]) : null;
+ }
+
@@ -102,7 +102,7 @@
+ EnchantmentOffer offer = event.getOffers()[j];
+ if (offer != null) {
+ this.costs[j] = offer.getCost();
-+ this.h[j] = Enchantment.enchantments.a(Enchantment.fromId(CraftNamespacedKey.toMinecraft(offer.getEnchantment().getKey())));
++ this.h[j] = IRegistry.ENCHANTMENT.a(IRegistry.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(offer.getEnchantment().getKey())));
+ this.i[j] = offer.getEnchantmentLevel();
+ } else {
+ this.costs[j] = 0;
@@ -128,7 +128,7 @@
+ Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new java.util.HashMap<org.bukkit.enchantments.Enchantment, Integer>();
+ for (Object obj : list) {
+ WeightedRandomEnchant instance = (WeightedRandomEnchant) obj;
-+ enchants.put(org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(Enchantment.getId(instance.enchantment))), instance.level);
++ enchants.put(org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(instance.enchantment))), instance.level);
+ }
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
+
@@ -151,7 +151,7 @@
+ try {
+ if (flag) {
+ NamespacedKey enchantId = entry.getKey().getKey();
-+ Enchantment nms = Enchantment.fromId(CraftNamespacedKey.toMinecraft(enchantId));
++ Enchantment nms = IRegistry.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(enchantId));
+ if (nms == null) {
+ continue;
+ }
diff --git a/nms-patches/CustomFunction.patch b/nms-patches/CustomFunction.patch
index b457151c..e4720577 100644
--- a/nms-patches/CustomFunction.patch
+++ b/nms-patches/CustomFunction.patch
@@ -1,27 +1,11 @@
--- a/net/minecraft/server/CustomFunction.java
+++ b/net/minecraft/server/CustomFunction.java
-@@ -45,7 +45,7 @@
+@@ -48,7 +48,7 @@
}
try {
-- ParseResults parseresults = customfunctiondata.a().getCommandDispatcher().a().parse(s, customfunctiondata.f());
-+ ParseResults parseresults = customfunctiondata.d().parse(s, customfunctiondata.f()); // CraftBukkit
+- ParseResults parseresults = customfunctiondata.a().getCommandDispatcher().a().parse(stringreader, customfunctiondata.f());
++ ParseResults parseresults = customfunctiondata.d().parse(stringreader, customfunctiondata.f()); // CraftBukkit
if (parseresults.getReader().canRead()) {
if (parseresults.getExceptions().size() == 1) {
-@@ -142,7 +142,14 @@
- }
-
- public void a(CustomFunctionData customfunctiondata, CommandListenerWrapper commandlistenerwrapper, ArrayDeque<CustomFunctionData.a> arraydeque, int i) throws CommandSyntaxException {
-- customfunctiondata.d().execute(new ParseResults(this.a.getContext().withSource(commandlistenerwrapper), this.a.getReader(), this.a.getExceptions()));
-+ // CraftBukkit start
-+ org.bukkit.craftbukkit.command.VanillaCommandWrapper.WorldRescueContext rescue = new org.bukkit.craftbukkit.command.VanillaCommandWrapper.WorldRescueContext().start(commandlistenerwrapper.getWorld());
-+ try {
-+ customfunctiondata.d().execute(new ParseResults(this.a.getContext().withSource(commandlistenerwrapper), this.a.getReader(), this.a.getExceptions()));
-+ } finally {
-+ rescue.end();
-+ }
-+ // CraftBukkit end
- }
-
- public String toString() {
diff --git a/nms-patches/DedicatedServer.patch b/nms-patches/DedicatedServer.patch
index b4e76915..8881d5e6 100644
--- a/nms-patches/DedicatedServer.patch
+++ b/nms-patches/DedicatedServer.patch
@@ -18,15 +18,15 @@
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
private static final Logger LOGGER = LogManager.getLogger();
- private static final Pattern i = Pattern.compile("^[a-fA-F0-9]{40}$");
+ private static final Pattern h = Pattern.compile("^[a-fA-F0-9]{40}$");
- private final List<ServerCommand> serverCommandQueue = Collections.synchronizedList(Lists.newArrayList());
+ private final List<ServerCommand> serverCommandQueue = Collections.synchronizedList(Lists.<ServerCommand>newArrayList()); // CraftBukkit - fix decompile error
- private RemoteStatusListener k;
+ private RemoteStatusListener j;
public final RemoteControlCommandListener remoteControlCommandListener = new RemoteControlCommandListener(this);
- private RemoteControlListener m;
+ private RemoteControlListener l;
@@ -37,8 +48,10 @@
- private EnumGamemode q;
- private boolean r;
+ private EnumGamemode p;
+ private boolean q;
- public DedicatedServer(File file, DataFixer datafixer, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
- super(file, Proxy.NO_PROXY, datafixer, new CommandDispatcher(true), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, usercache);
@@ -106,8 +106,8 @@
DedicatedServer.LOGGER.info("Loading properties");
- this.propertyManager = new PropertyManager(new File("server.properties"));
+ this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
- this.o = new EULA(new File("eula.txt"));
- if (!this.o.a()) {
+ this.n = new EULA(new File("eula.txt"));
+ if (!this.n.a()) {
DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
@@ -143,6 +191,12 @@
return false;
@@ -133,8 +133,8 @@
if (this.getWorld() == null) {
@@ -228,7 +282,18 @@
DedicatedServer.LOGGER.info("Starting remote control listener");
- this.m = new RemoteControlListener(this);
- this.m.a();
+ this.l = new RemoteControlListener(this);
+ this.l.a();
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(this.remoteControlCommandListener); // CraftBukkit
+ }
+
@@ -148,21 +148,21 @@
}
+ // CraftBukkit end
- if (this.ba() > 0L) {
+ if (this.aY() > 0L) {
Thread thread1 = new Thread(new ThreadWatchdog(this));
@@ -303,11 +368,11 @@
return crashreport;
}
-- protected void u() {
-+ public void u() { // CraftBukkit - decompile error
+- protected void t() {
++ public void t() { // CraftBukkit - decompile error
System.exit(0);
}
-- protected void w() {
-+ public void w() { // CraftBukkit - fix decompile error
- super.w();
- this.aW();
+- protected void b(BooleanSupplier booleansupplier) {
++ public void b(BooleanSupplier booleansupplier) { // CraftBukkit - fix decompile error
+ super.b(booleansupplier);
+ this.aU();
}
@@ -342,7 +407,15 @@
while (!this.serverCommandQueue.isEmpty()) {
@@ -248,7 +248,7 @@
}
public PlayerList getPlayerList() {
- return this.aX();
+ return this.aV();
}
+
+ // CraftBukkit start
diff --git a/nms-patches/DispenserRegistry.patch b/nms-patches/DispenserRegistry.patch
index 7b279b05..bba3fef2 100644
--- a/nms-patches/DispenserRegistry.patch
+++ b/nms-patches/DispenserRegistry.patch
@@ -169,7 +169,7 @@
+ int z = blockposition.getZ();
+ IBlockData iblockdata = world.getType(blockposition);
+ Material material = iblockdata.getMaterial();
-+ if (world.isEmpty(blockposition) || !material.isBuildable() || material.isReplaceable() || ((iblockdata.getBlock() instanceof IFluidContainer) && ((IFluidContainer) iblockdata.getBlock()).a(world, blockposition, iblockdata, itembucket.a))) {
++ if (world.isEmpty(blockposition) || !material.isBuildable() || material.isReplaceable() || ((iblockdata.getBlock() instanceof IFluidContainer) && ((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, itembucket.fluidType))) {
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
@@ -325,7 +325,7 @@
+ world.captureTreeGeneration = true;
+ // CraftBukkit end
- if (!ItemBoneMeal.a(itemstack, world, blockposition) && !ItemBoneMeal.b(itemstack, world, blockposition)) {
+ if (!ItemBoneMeal.a(itemstack, world, blockposition) && !ItemBoneMeal.a(itemstack, world, blockposition, (EnumDirection) null)) {
this.a = false;
} else if (!world.isClientSide) {
world.triggerEffect(2005, blockposition, 0);
@@ -426,7 +426,7 @@
+
this.a = true;
if (world.isEmpty(blockposition) && BlockWitherSkull.b(world, blockposition, itemstack)) {
- world.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.a, Integer.valueOf(enumdirection.opposite().get2DRotationValue() * 4)), 3);
+ world.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.a, Integer.valueOf(enumdirection.k() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.opposite().get2DRotationValue() * 4)), 3);
@@ -318,6 +610,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
@@ -458,7 +458,7 @@
this.a = true;
if (world.isEmpty(blockposition) && blockpumpkincarved.a((IWorldReader) world, blockposition)) {
if (!world.isClientSide) {
-@@ -379,6 +695,51 @@
+@@ -385,6 +701,51 @@
}
d();
@@ -510,16 +510,16 @@
}
}
}
-@@ -387,7 +748,7 @@
+@@ -393,7 +754,7 @@
LocaleLanguage localelanguage = LocaleLanguage.a();
- registrymaterials.iterator().forEachRemaining((object) -> {
+ iregistry.iterator().forEachRemaining((object) -> {
- String s = (String) function.apply(object);
+ String s1 = (String) function.apply(object); // CraftBukkit - decompile error
if (!localelanguage.b(s)) {
- DispenserRegistry.c.warn("Missing translation for {}: {} (key: \'{}\')", s1, registrymaterials.b(object), s);
-@@ -481,6 +842,30 @@
+ DispenserRegistry.c.warn("Missing translation for {}: {} (key: \'{}\')", s1, iregistry.getKey(object), s);
+@@ -487,6 +848,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
EnumDirection enumdirection1 = isourceblock.getWorld().isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP;
@@ -550,7 +550,7 @@
this.a = ((ItemBlock) item).a((BlockActionContext) (new DispenserRegistry.b(isourceblock.getWorld(), blockposition, enumdirection, itemstack, enumdirection1))) == EnumInteractionResult.SUCCESS;
if (this.a) {
itemstack.subtract(1);
-@@ -534,12 +919,40 @@
+@@ -540,12 +925,40 @@
d3 = 0.0D;
}
diff --git a/nms-patches/Enchantment.patch b/nms-patches/Enchantment.patch
index 25991604..8cece083 100644
--- a/nms-patches/Enchantment.patch
+++ b/nms-patches/Enchantment.patch
@@ -1,32 +1,19 @@
--- a/net/minecraft/server/Enchantment.java
+++ b/net/minecraft/server/Enchantment.java
-@@ -15,6 +15,17 @@
- @Nullable
- protected String d;
-
-+ // CraftBukkit start - add back
-+ @Nullable
-+ public static Enchantment fromId(MinecraftKey key) {
-+ return Enchantment.enchantments.get(key);
-+ }
-+
-+ public static MinecraftKey getId(Enchantment enchantment) {
-+ return Enchantment.enchantments.b(enchantment);
-+ }
-+ // CraftBukkit end
-+
- protected Enchantment(Enchantment.Rarity enchantment_rarity, EnchantmentSlotType enchantmentslottype, EnumItemSlot[] aenumitemslot) {
- this.e = enchantment_rarity;
- this.itemTarget = enchantmentslottype;
-@@ -153,6 +164,11 @@
+@@ -154,10 +154,15 @@
a("channeling", new EnchantmentTridentChanneling(Enchantment.Rarity.VERY_RARE, new EnumItemSlot[] { EnumItemSlot.MAINHAND}));
a("mending", new EnchantmentMending(Enchantment.Rarity.RARE, EnumItemSlot.values()));
a("vanishing_curse", new EnchantmentVanishing(Enchantment.Rarity.VERY_RARE, EnumItemSlot.values()));
+ // CraftBukkit start
-+ for (Object enchantment : Enchantment.enchantments) {
++ for (Object enchantment : IRegistry.ENCHANTMENT) {
+ org.bukkit.enchantments.Enchantment.registerEnchantment(new org.bukkit.craftbukkit.enchantments.CraftEnchantment((Enchantment) enchantment));
+ }
+ // CraftBukkit end
}
private static void a(String s, Enchantment enchantment) {
+- IRegistry.ENCHANTMENT.a(new MinecraftKey(s), (Object) enchantment);
++ IRegistry.ENCHANTMENT.a(new MinecraftKey(s), enchantment); // CraftBukkit - decompile error
+ }
+
+ public static enum Rarity {
diff --git a/nms-patches/EnchantmentFrostWalker.patch b/nms-patches/EnchantmentFrostWalker.patch
index 5ebd39a3..8b86af35 100644
--- a/nms-patches/EnchantmentFrostWalker.patch
+++ b/nms-patches/EnchantmentFrostWalker.patch
@@ -14,10 +14,10 @@
if (iblockdata2.getMaterial() == Material.WATER && ((Integer) iblockdata2.get(BlockFluids.LEVEL)).intValue() == 0 && iblockdata.canPlace(world, blockposition_mutableblockposition1) && world.a(iblockdata, (BlockPosition) blockposition_mutableblockposition1)) {
- world.setTypeUpdate(blockposition_mutableblockposition1, iblockdata);
-- world.I().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+- world.J().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ // CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition_mutableblockposition1, iblockdata, entityliving)) {
-+ world.I().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
++ world.J().a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ }
+ // CraftBukkit End
}
diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch
index 9927c26b..0d91d11b 100644
--- a/nms-patches/Entity.patch
+++ b/nms-patches/Entity.patch
@@ -126,15 +126,15 @@
+ if (this.ao++ >= i) {
+ this.ao = i;
+ this.portalCooldown = this.aQ();
-+ byte b0;
++ DimensionManager dimensionmanager;
+
-+ if (this.world.worldProvider.getDimensionManager().getDimensionID() == -1) {
-+ b0 = 0;
++ if (this.world.worldProvider.getDimensionManager() == DimensionManager.NETHER) {
++ dimensionmanager = DimensionManager.OVERWORLD;
+ } else {
-+ b0 = -1;
++ dimensionmanager = DimensionManager.NETHER;
+ }
+
-+ this.d(b0);
++ this.a(dimensionmanager);
+ }
+ }
+
@@ -176,35 +176,32 @@
this.av();
this.r();
-@@ -340,6 +472,27 @@
+@@ -339,7 +471,23 @@
+
protected void burnFromLava() {
if (!this.fireProof) {
- this.damageEntity(DamageSource.LAVA, 4.0F);
-+
+- this.setOnFire(15);
+ // CraftBukkit start - Fallen in lava TODO: this event spams!
-+ if (this instanceof EntityLiving) {
-+ if (fireTicks <= 0) {
-+ // not on fire yet
-+ // TODO: shouldn't be sending null for the block
-+ org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
-+ org.bukkit.entity.Entity damagee = this.getBukkitEntity();
-+ EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
-+ this.world.getServer().getPluginManager().callEvent(combustEvent);
-+
-+ if (!combustEvent.isCancelled()) {
-+ this.setOnFire(combustEvent.getDuration());
-+ }
-+ } else {
-+ // This will be called every single tick the entity is in lava, so don't throw an event
-+ this.setOnFire(15);
++ if (this instanceof EntityLiving && fireTicks <= 0) {
++ // not on fire yet
++ // TODO: shouldn't be sending null for the block
++ org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
++ org.bukkit.entity.Entity damagee = this.getBukkitEntity();
++ EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
++ this.world.getServer().getPluginManager().callEvent(combustEvent);
++
++ if (!combustEvent.isCancelled()) {
++ this.setOnFire(combustEvent.getDuration());
+ }
-+ return;
++ } else {
++ // This will be called every single tick the entity is in lava, so don't throw an event
++ this.setOnFire(15);
+ }
+ // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
- this.setOnFire(15);
+ this.damageEntity(DamageSource.LAVA, 4.0F);
}
}
-@@ -505,7 +658,7 @@
+@@ -505,7 +653,7 @@
}
}
@@ -213,7 +210,7 @@
double d11;
if (this.Q > 0.0F && flag && (d7 != d0 || d9 != d2)) {
-@@ -592,7 +745,7 @@
+@@ -592,7 +740,7 @@
this.world.methodProfiler.a("rest");
this.recalcPosition();
this.positionChanged = d7 != d0 || d9 != d2;
@@ -222,7 +219,7 @@
this.onGround = this.C && d8 < 0.0D;
this.D = this.positionChanged || this.C;
int k = MathHelper.floor(this.locX);
-@@ -627,6 +780,28 @@
+@@ -627,6 +775,28 @@
block1.a((IBlockAccess) this.world, this);
}
@@ -251,7 +248,7 @@
if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) {
double d22 = this.locX - d4;
double d23 = this.locY - d5;
-@@ -679,7 +854,14 @@
+@@ -678,7 +848,14 @@
if (!flag1) {
++this.fireTicks;
if (this.fireTicks == 0) {
@@ -266,8 +263,8 @@
+ // CraftBukkit end
}
}
- } else if (this.fireTicks <= 0) {
-@@ -875,7 +1057,7 @@
+
+@@ -876,7 +1053,7 @@
return null;
}
@@ -276,7 +273,7 @@
if (!this.fireProof) {
this.damageEntity(DamageSource.FIRE, (float) i);
}
-@@ -1094,6 +1276,13 @@
+@@ -1095,6 +1272,13 @@
}
public void spawnIn(World world) {
@@ -290,7 +287,7 @@
this.world = world;
}
-@@ -1301,7 +1490,7 @@
+@@ -1302,7 +1486,7 @@
public boolean c(NBTTagCompound nbttagcompound) {
String s = this.getSaveID();
@@ -299,7 +296,7 @@
nbttagcompound.setString("id", s);
this.save(nbttagcompound);
return true;
-@@ -1318,6 +1507,18 @@
+@@ -1319,6 +1503,18 @@
try {
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ}));
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
@@ -318,7 +315,7 @@
nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.setShort("Fire", (short) this.fireTicks);
-@@ -1327,6 +1528,12 @@
+@@ -1328,6 +1524,12 @@
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
nbttagcompound.a("UUID", this.getUniqueID());
@@ -331,7 +328,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
-@@ -1403,6 +1610,8 @@
+@@ -1404,6 +1606,8 @@
this.motX = nbttaglist1.k(0);
this.motY = nbttaglist1.k(1);
this.motZ = nbttaglist1.k(2);
@@ -340,7 +337,7 @@
if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D;
}
-@@ -1414,6 +1623,7 @@
+@@ -1415,6 +1619,7 @@
if (Math.abs(this.motZ) > 10.0D) {
this.motZ = 0.0D;
}
@@ -348,7 +345,7 @@
this.locX = nbttaglist.k(0);
this.locY = nbttaglist.k(1);
-@@ -1470,6 +1680,57 @@
+@@ -1471,6 +1676,56 @@
this.setPosition(this.locX, this.locY, this.locZ);
}
@@ -395,8 +392,7 @@
+ }
+
+ if (bworld == null) {
-+ EntityPlayer entityPlayer = (EntityPlayer) this;
-+ bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
++ bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(DimensionManager.OVERWORLD).getWorld();
+ }
+
+ spawnIn(bworld == null? null : ((CraftWorld) bworld).getHandle());
@@ -406,7 +402,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
-@@ -1543,9 +1804,22 @@
+@@ -1544,9 +1799,22 @@
if (itemstack.isEmpty()) {
return null;
} else {
@@ -429,16 +425,16 @@
this.world.addEntity(entityitem);
return entityitem;
}
-@@ -1678,7 +1952,7 @@
- Entity entity = this.ax;
+@@ -1679,7 +1947,7 @@
+ Entity entity = this.vehicle;
- this.ax = null;
-- entity.p(this);
-+ if (!entity.p(this)) this.ax = entity; // CraftBukkit
+ this.vehicle = null;
+- entity.removePassenger(this);
++ if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit
}
}
-@@ -1687,6 +1961,24 @@
+@@ -1688,6 +1956,24 @@
if (entity.getVehicle() != this) {
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
} else {
@@ -463,12 +459,12 @@
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bO() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
-@@ -1696,13 +1988,30 @@
+@@ -1697,13 +1983,30 @@
}
}
-- protected void p(Entity entity) {
-+ protected boolean p(Entity entity) { // CraftBukkit
+- protected void removePassenger(Entity entity) {
++ protected boolean removePassenger(Entity entity) { // CraftBukkit
if (entity.getVehicle() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
@@ -495,7 +491,7 @@
}
protected boolean q(Entity entity) {
-@@ -1799,6 +2108,13 @@
+@@ -1800,6 +2103,13 @@
}
public void setSwimming(boolean flag) {
@@ -509,7 +505,7 @@
this.setFlag(4, flag);
}
-@@ -1859,14 +2175,49 @@
+@@ -1860,16 +2170,53 @@
}
public void setAirTicks(int i) {
@@ -525,12 +521,26 @@
}
public void onLightningStrike(EntityLightning entitylightning) {
-- this.damageEntity(DamageSource.LIGHTNING, 5.0F);
+ ++this.fireTicks;
+ // CraftBukkit start
+ final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
+ final org.bukkit.entity.Entity stormBukkitEntity = entitylightning.getBukkitEntity();
+ final PluginManager pluginManager = Bukkit.getPluginManager();
++ // CraftBukkit end
+
+ if (this.fireTicks == 0) {
+- this.setOnFire(8);
++ // CraftBukkit start - Call a combust event when lightning strikes
++ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
++ pluginManager.callEvent(entityCombustEvent);
++ if (!entityCombustEvent.isCancelled()) {
++ this.setOnFire(entityCombustEvent.getDuration());
++ }
++ // CraftBukkit end
+ }
+
+- this.damageEntity(DamageSource.LIGHTNING, 5.0F);
++ // CraftBukkit start
+ if (thisBukkitEntity instanceof Hanging) {
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
+ pluginManager.callEvent(hangingEvent);
@@ -549,38 +559,23 @@
+ return;
+ }
+ // CraftBukkit end
- ++this.fireTicks;
- if (this.fireTicks == 0) {
-- this.setOnFire(8);
-+ // CraftBukkit start - Call a combust event when lightning strikes
-+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
-+ pluginManager.callEvent(entityCombustEvent);
-+ if (!entityCombustEvent.isCancelled()) {
-+ this.setOnFire(entityCombustEvent.getDuration());
-+ }
-+ // CraftBukkit end
- }
-
}
-@@ -2035,19 +2386,76 @@
+
+ public void j(boolean flag) {
+@@ -2036,19 +2383,72 @@
if (!this.world.isClientSide && !this.dead) {
this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = this.bK();
-- int j = this.dimension;
-- WorldServer worldserver = minecraftserver.getWorldServer(j);
-- WorldServer worldserver1 = minecraftserver.getWorldServer(i);
+- DimensionManager dimensionmanager1 = this.dimension;
+- WorldServer worldserver = minecraftserver.getWorldServer(dimensionmanager1);
+- WorldServer worldserver1 = minecraftserver.getWorldServer(dimensionmanager);
+ // CraftBukkit start - Move logic into new function "teleportTo(Location,boolean)"
-+ // int j = this.dimension;
-+ // WorldServer worldserver = minecraftserver.getWorldServer(j);
-+ // WorldServer worldserver1 = minecraftserver.getWorldServer(i);
++ // DimensionManager dimensionmanager1 = this.dimension;
++ // WorldServer worldserver = minecraftserver.getWorldServer(dimensionmanager1);
++ // WorldServer worldserver1 = minecraftserver.getWorldServer(dimensionmanager);
+ WorldServer exitWorld = null;
-+ if (this.dimension < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // Plugins must specify exit from custom Bukkit worlds
-+ // Only target existing worlds (compensate for allow-nether/allow-end as false)
-+ for (WorldServer world : minecraftserver.worlds) {
-+ if (world.dimension == i) {
-+ exitWorld = world;
-+ }
-+ }
++ if (this.dimension.getDimensionID() < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // Plugins must specify exit from custom Bukkit worlds
++ exitWorld = minecraftserver.getWorldServer(dimensionmanager);
+ }
+
+ BlockPosition blockposition = null; // PAIL: CHECK
@@ -590,13 +585,13 @@
+ if (blockposition != null) {
+ exit = new Location(exitWorld.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ } else {
-+ exit = minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i));
++ exit = minecraftserver.getPlayerList().calculateTarget(enter, exitWorld);
+ }
+ }
+ else {
+ exit = null;
+ }
-+ boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END
++ boolean useTravelAgent = exitWorld != null && !(this.dimension == DimensionManager.THE_END && exitWorld.dimension == DimensionManager.THE_END); // don't use agent for custom worlds or return from THE_END
+
+ TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().getTravelAgent() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins
+ boolean oldCanCreate = agent.getCanCreatePortal();
@@ -616,22 +611,23 @@
+ Entity entity = this.teleportTo(exit, true);
+ this.world.methodProfiler.e();
+ return entity;
++ } else {
++ return null;
+ }
-+ return null;
+ }
+
+ public Entity teleportTo(Location exit, boolean portal) {
+ if (true) {
+ WorldServer worldserver = ((CraftWorld) getBukkitEntity().getLocation().getWorld()).getHandle();
+ WorldServer worldserver1 = ((CraftWorld) exit.getWorld()).getHandle();
-+ int i = worldserver1.dimension;
++ DimensionManager dimensionmanager = worldserver1.dimension;
+ // CraftBukkit end
- this.dimension = i;
+ this.dimension = dimensionmanager;
+ /* CraftBukkit start - TODO: Check if we need this
- if (j == 1 && i == 1) {
- worldserver1 = minecraftserver.a(DimensionManager.OVERWORLD);
- this.dimension = 0;
+ if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) {
+ worldserver1 = minecraftserver.getWorldServer(DimensionManager.OVERWORLD);
+ this.dimension = DimensionManager.OVERWORLD;
}
+ // CraftBukkit end */
@@ -641,8 +637,8 @@
+ /* CraftBukkit start - Handled in calculateTarget
BlockPosition blockposition;
- if (i == 1) {
-@@ -2076,12 +2484,18 @@
+ if (dimensionmanager == DimensionManager.THE_END) {
+@@ -2077,12 +2477,18 @@
blockposition = new BlockPosition(this);
}
@@ -659,10 +655,10 @@
if (entity != null) {
entity.v(this);
+ /* CraftBukkit start - We need to do this...
- if (j == 1 && i == 1) {
+ if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) {
BlockPosition blockposition1 = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn());
-@@ -2089,6 +2503,7 @@
+@@ -2090,6 +2496,7 @@
} else {
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
}
@@ -670,7 +666,7 @@
boolean flag = entity.attachedToPlayer;
-@@ -2096,13 +2511,21 @@
+@@ -2097,13 +2504,21 @@
worldserver1.addEntity(entity);
entity.attachedToPlayer = flag;
worldserver1.entityJoinedWorld(entity, false);
@@ -686,14 +682,14 @@
this.dead = true;
this.world.methodProfiler.e();
- worldserver.q_();
- worldserver1.q_();
+ worldserver.p();
+ worldserver1.p();
- this.world.methodProfiler.e();
+ // this.world.methodProfiler.e(); // CraftBukkit: Moved up to keep balanced
return entity;
} else {
return null;
-@@ -2242,7 +2665,26 @@
+@@ -2243,7 +2658,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {
diff --git a/nms-patches/EntityAreaEffectCloud.patch b/nms-patches/EntityAreaEffectCloud.patch
index 1e00f0ad..a3cc245e 100644
--- a/nms-patches/EntityAreaEffectCloud.patch
+++ b/nms-patches/EntityAreaEffectCloud.patch
@@ -23,11 +23,11 @@
+ }
+
+ public String getType() {
-+ return ((MinecraftKey) PotionRegistry.a.b(this.potionRegistry)).toString(); // PAIL: rename
++ return ((MinecraftKey) IRegistry.POTION.getKey(this.potionRegistry)).toString();
+ }
+
+ public void setType(String string) {
-+ a(PotionRegistry.a.get(new MinecraftKey(string))); // PAIL: rename
++ a(IRegistry.POTION.get(new MinecraftKey(string)));
+ }
+ // CraftBukkit end
+
diff --git a/nms-patches/EntityArmorStand.patch b/nms-patches/EntityArmorStand.patch
index a0f06e68..12b02bfb 100644
--- a/nms-patches/EntityArmorStand.patch
+++ b/nms-patches/EntityArmorStand.patch
@@ -30,7 +30,7 @@
public final void setSize(float f, float f1) {
double d0 = this.locX;
double d1 = this.locY;
-@@ -355,6 +371,21 @@
+@@ -357,6 +373,21 @@
if (itemstack1.isEmpty() || (this.bH & 1 << enumitemslot.c() + 8) == 0) {
if (!itemstack1.isEmpty() || (this.bH & 1 << enumitemslot.c() + 16) == 0) {
ItemStack itemstack2;
@@ -52,7 +52,7 @@
if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
itemstack2 = itemstack.cloneItemStack();
-@@ -376,14 +407,19 @@
+@@ -378,14 +409,19 @@
}
public boolean damageEntity(DamageSource damagesource, float f) {
@@ -74,7 +74,7 @@
return false;
} else if (DamageSource.FIRE.equals(damagesource)) {
if (this.isBurning()) {
-@@ -407,7 +443,7 @@
+@@ -409,7 +445,7 @@
} else if (damagesource.v()) {
this.F();
this.A();
@@ -83,7 +83,7 @@
return false;
} else {
long i = this.world.getTime();
-@@ -418,7 +454,7 @@
+@@ -420,7 +456,7 @@
} else {
this.B();
this.A();
@@ -92,7 +92,7 @@
}
return true;
-@@ -445,7 +481,7 @@
+@@ -447,7 +483,7 @@
f1 -= f;
if (f1 <= 0.5F) {
this.D();
@@ -101,7 +101,7 @@
} else {
this.setHealth(f1);
}
-@@ -453,7 +489,7 @@
+@@ -455,7 +491,7 @@
}
private void B() {
@@ -110,7 +110,7 @@
this.D();
}
-@@ -466,7 +502,7 @@
+@@ -468,7 +504,7 @@
for (i = 0; i < this.bE.size(); ++i) {
itemstack = (ItemStack) this.bE.get(i);
if (!itemstack.isEmpty()) {
@@ -119,7 +119,7 @@
this.bE.set(i, ItemStack.a);
}
}
-@@ -474,7 +510,7 @@
+@@ -476,7 +512,7 @@
for (i = 0; i < this.bF.size(); ++i) {
itemstack = (ItemStack) this.bF.get(i);
if (!itemstack.isEmpty()) {
@@ -128,7 +128,7 @@
this.bF.set(i, ItemStack.a);
}
}
-@@ -586,6 +622,7 @@
+@@ -588,6 +624,7 @@
}
public void killEntity() {
diff --git a/nms-patches/EntityArrow.patch b/nms-patches/EntityArrow.patch
index 91b2b41f..b2e47f37 100644
--- a/nms-patches/EntityArrow.patch
+++ b/nms-patches/EntityArrow.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityArrow.java
+++ b/net/minecraft/server/EntityArrow.java
-@@ -5,6 +5,13 @@
+@@ -7,6 +7,13 @@
import java.util.function.Predicate;
import javax.annotation.Nullable;
@@ -13,16 +13,8 @@
+
public abstract class EntityArrow extends Entity implements IProjectile {
- private static final Predicate<Entity> f = IEntitySelector.e.and(IEntitySelector.a.and(Entity::isInteractable));
-@@ -42,6 +49,7 @@
- protected EntityArrow(EntityTypes<?> entitytypes, EntityLiving entityliving, World world) {
- this(entitytypes, entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D, entityliving.locZ, world);
- this.shooter = entityliving;
-+ this.projectileSource = (LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
- if (entityliving instanceof EntityHuman) {
- this.fromPlayer = EntityArrow.PickupStatus.ALLOWED;
- }
-@@ -245,6 +253,7 @@
+ private static final Predicate<Entity> g = IEntitySelector.f.and(IEntitySelector.a.and(Entity::isInteractable));
+@@ -250,6 +257,7 @@
}
protected void a(MovingObjectPosition movingobjectposition) {
@@ -30,7 +22,7 @@
if (movingobjectposition.entity != null) {
this.b(movingobjectposition);
} else {
-@@ -293,7 +302,13 @@
+@@ -299,7 +307,13 @@
}
if (this.isBurning() && !(entity instanceof EntityEnderman)) {
@@ -45,10 +37,18 @@
}
if (entity.damageEntity(damagesource, (float) i)) {
-@@ -430,9 +445,22 @@
+@@ -444,6 +458,7 @@
+
+ public void setShooter(@Nullable Entity entity) {
+ this.shooter = entity == null ? null : entity.getUniqueID();
++ this.projectileSource = entity == null ? null : (LivingEntity) entity.getBukkitEntity(); // CraftBukkit
+ }
+
+ @Nullable
+@@ -453,9 +468,22 @@
public void d(EntityHuman entityhuman) {
- if (!this.world.isClientSide && (this.inGround || this.p()) && this.shake <= 0) {
+ if (!this.world.isClientSide && (this.inGround || this.q()) && this.shake <= 0) {
+ // CraftBukkit start
+ ItemStack itemstack = this.getItemStack();
+ EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
@@ -61,7 +61,7 @@
+ return;
+ }
+ }
- boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.p() && this.shooter == entityhuman;
+ boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.q() && this.getShooter().getUniqueID() == entityhuman.getUniqueID();
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.getItemStack())) {
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item.getItemStack())) {
@@ -69,7 +69,7 @@
flag = false;
}
-@@ -505,7 +533,14 @@
+@@ -528,7 +556,14 @@
}
if (EnchantmentManager.a(Enchantments.ARROW_FIRE, entityliving) > 0) {
diff --git a/nms-patches/EntityCreeper.patch b/nms-patches/EntityCreeper.patch
index 09152034..4a0912c6 100644
--- a/nms-patches/EntityCreeper.patch
+++ b/nms-patches/EntityCreeper.patch
@@ -56,7 +56,7 @@
- this.aX = true;
- this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, flag);
- this.die();
-- this.dG();
+- this.dF();
+ // CraftBukkit start
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
+ this.world.getServer().getPluginManager().callEvent(event);
@@ -64,7 +64,7 @@
+ this.aX = true;
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
+ this.die();
-+ this.dG();
++ this.dF();
+ } else {
+ fuseTicks = 0;
+ }
diff --git a/nms-patches/EntityEnderman.patch b/nms-patches/EntityEnderman.patch
index fdfcc0f5..2aec00aa 100644
--- a/nms-patches/EntityEnderman.patch
+++ b/nms-patches/EntityEnderman.patch
@@ -46,7 +46,7 @@
@@ -277,8 +295,12 @@
boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition);
- if (block.a(TagsBlock.G) && flag) {
+ if (block.a(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
- this.enderman.setCarried(iblockdata);
- world.setAir(blockposition);
+ // CraftBukkit start - Pickup event
diff --git a/nms-patches/EntityEvokerFangs.patch b/nms-patches/EntityEvokerFangs.patch
index b90581a8..d43b7757 100644
--- a/nms-patches/EntityEvokerFangs.patch
+++ b/nms-patches/EntityEvokerFangs.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityEvokerFangs.java
+++ b/net/minecraft/server/EntityEvokerFangs.java
-@@ -108,7 +108,9 @@
+@@ -111,7 +111,9 @@
if (entityliving.isAlive() && !entityliving.bl() && entityliving != entityliving1) {
if (entityliving1 == null) {
diff --git a/nms-patches/EntityFish.patch b/nms-patches/EntityFish.patch
index 9773a887..c4b05830 100644
--- a/nms-patches/EntityFish.patch
+++ b/nms-patches/EntityFish.patch
@@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityFish.java
+++ b/net/minecraft/server/EntityFish.java
-@@ -67,6 +67,7 @@
+@@ -71,6 +71,7 @@
- public void s(boolean flag) {
+ public void setFromBucket(boolean flag) {
this.datawatcher.set(EntityFish.b, Boolean.valueOf(flag));
+ this.persistent = !this.isTypeNotPersistent(); // CraftBukkit - SPIGOT-4106 update persistence
}
diff --git a/nms-patches/EntityFishingHook.patch b/nms-patches/EntityFishingHook.patch
index 387b1763..372d49d5 100644
--- a/nms-patches/EntityFishingHook.patch
+++ b/nms-patches/EntityFishingHook.patch
@@ -86,7 +86,7 @@
+ this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, playerFishEvent.getExpToDrop()));
+ }
+ // CraftBukkit end
- if (itemstack1.getItem().a(TagsItem.D)) {
+ if (itemstack1.getItem().a(TagsItem.FISHES)) {
this.owner.a(StatisticList.FISH_CAUGHT, 1);
}
@@ -425,8 +463,25 @@
diff --git a/nms-patches/EntityHorseAbstract.patch b/nms-patches/EntityHorseAbstract.patch
index c050ff85..04726e1a 100644
--- a/nms-patches/EntityHorseAbstract.patch
+++ b/nms-patches/EntityHorseAbstract.patch
@@ -20,8 +20,8 @@
public void loadChest() {
InventoryHorseChest inventoryhorsechest = this.inventoryChest;
-- this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dB());
-+ this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dB(), this); // CraftBukkit
+- this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dA());
++ this.inventoryChest = new InventoryHorseChest(this.getDisplayName(), this.dA(), this); // CraftBukkit
this.inventoryChest.a(this.getCustomName());
if (inventoryhorsechest != null) {
inventoryhorsechest.b(this);
@@ -68,7 +68,7 @@
+ this.heal(1.0F, RegainReason.REGEN); // CraftBukkit
}
- if (this.dZ()) {
+ if (this.dY()) {
@@ -716,6 +719,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.setString("OwnerUUID", this.getOwnerUUID().toString());
@@ -106,5 +106,5 @@
+ }
+ // CraftBukkit end
this.canSlide = true;
- this.dI();
+ this.dH();
}
diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch
index 8964d550..79cdbe3e 100644
--- a/nms-patches/EntityHuman.patch
+++ b/nms-patches/EntityHuman.patch
@@ -54,7 +54,7 @@
@@ -184,7 +208,7 @@
ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD);
- if (itemstack.getItem() == Items.TURTLE_HELMET && !this.a(TagsFluid.a)) {
+ if (itemstack.getItem() == Items.TURTLE_HELMET && !this.a(TagsFluid.WATER)) {
- this.addEffect(new MobEffect(MobEffects.WATER_BREATHING, 200, 0, false, false, true));
+ this.addEffect(new MobEffect(MobEffects.WATER_BREATHING, 200, 0, false, false, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TURTLE_HELMET); // CraftBukkit
}
@@ -215,7 +215,7 @@
if (!this.isInvulnerable(damagesource)) {
f = this.applyArmorModifier(damagesource, f);
f = this.applyMagicModifier(damagesource, f);
-@@ -817,6 +905,7 @@
+@@ -823,6 +911,7 @@
}
}
@@ -223,7 +223,7 @@
}
public void openSign(TileEntitySign tileentitysign) {}
-@@ -938,8 +1027,15 @@
+@@ -944,8 +1033,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isBurning()) {
@@ -241,10 +241,10 @@
}
}
-@@ -970,8 +1066,11 @@
+@@ -976,8 +1072,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
- if (entityliving != this && entityliving != entity && !this.r(entityliving) && this.h(entityliving) < 9.0D) {
+ if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h(entityliving) < 9.0D) {
+ // CraftBukkit start - Only apply knockback if the damage hits
+ if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) {
entityliving.a(this, 0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
@@ -254,7 +254,7 @@
}
}
-@@ -980,11 +1079,28 @@
+@@ -986,11 +1085,28 @@
}
if (entity instanceof EntityPlayer && entity.velocityChanged) {
@@ -283,7 +283,7 @@
}
if (flag2) {
-@@ -1033,7 +1149,14 @@
+@@ -1039,7 +1155,14 @@
this.a(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@@ -299,7 +299,7 @@
}
if (this.world instanceof WorldServer && f5 > 2.0F) {
-@@ -1049,6 +1172,11 @@
+@@ -1055,6 +1178,11 @@
if (flag4) {
entity.extinguish();
}
@@ -311,7 +311,7 @@
}
}
-@@ -1145,6 +1273,20 @@
+@@ -1151,6 +1279,20 @@
this.stopRiding();
}
@@ -330,9 +330,9 @@
+ // CraftBukkit end
+
this.releaseShoulderEntities();
- this.a(StatisticList.CUSTOM.b(StatisticList.n));
+ this.a(StatisticList.CUSTOM.b(StatisticList.TIME_SINCE_REST));
this.setSize(0.2F, 0.2F);
-@@ -1206,6 +1348,23 @@
+@@ -1212,6 +1354,23 @@
this.world.everyoneSleeping();
}
@@ -356,7 +356,7 @@
this.sleepTicks = flag ? 0 : 100;
if (flag2) {
this.setRespawnPosition(this.bedPosition, false);
-@@ -1257,9 +1416,11 @@
+@@ -1263,9 +1422,11 @@
if (blockposition != null) {
this.e = blockposition;
this.f = flag;
@@ -368,7 +368,7 @@
}
}
-@@ -1325,7 +1486,11 @@
+@@ -1331,7 +1492,11 @@
this.motY = d3 * 0.6D;
this.aU = f3;
this.fallDistance = 0.0F;
@@ -381,7 +381,7 @@
} else {
super.a(f, f1, f2);
}
-@@ -1636,13 +1801,17 @@
+@@ -1631,13 +1796,17 @@
}
protected void releaseShoulderEntities() {
@@ -404,7 +404,7 @@
if (!this.world.isClientSide && !nbttagcompound.isEmpty()) {
Entity entity = EntityTypes.a(nbttagcompound, this.world);
-@@ -1651,9 +1820,10 @@
+@@ -1646,9 +1815,10 @@
}
entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ);
@@ -416,7 +416,7 @@
}
public abstract boolean isSpectator();
-@@ -1864,7 +2034,7 @@
+@@ -1859,7 +2029,7 @@
return entitymonster.c(this.a);
}
diff --git a/nms-patches/EntityInsentient.patch b/nms-patches/EntityInsentient.patch
index d315fadb..ff3997b7 100644
--- a/nms-patches/EntityInsentient.patch
+++ b/nms-patches/EntityInsentient.patch
@@ -19,7 +19,7 @@
public abstract class EntityInsentient extends EntityLiving {
private static final DataWatcherObject<Byte> a = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
-@@ -27,11 +39,11 @@
+@@ -27,7 +39,7 @@
public float[] dropChanceHand;
private final NonNullList<ItemStack> bE;
public float[] dropChanceArmor;
@@ -27,13 +27,7 @@
+ // public boolean canPickUpLoot; // CraftBukkit - moved up to EntityLiving
public boolean persistent;
private final Map<PathType, Float> bH;
-- private MinecraftKey bI;
-- private long bJ;
-+ public MinecraftKey bI; // CraftBukkit private -> public
-+ public long bJ; // CraftBukkit private -> public
- private boolean bK;
- private Entity leashHolder;
- private NBTTagCompound bM;
+ public MinecraftKey lootTableKey;
@@ -57,6 +69,9 @@
this.n();
}
@@ -107,17 +101,17 @@
int i;
@@ -394,6 +449,11 @@
- protected MinecraftKey G() {
+ protected MinecraftKey getDefaultLootTable() {
return null;
}
+ // CraftBukkit - start
+ public MinecraftKey getLootTable() {
-+ return G();
++ return getDefaultLootTable();
+ }
+ // CraftBukkit - end
protected void a(boolean flag, int i, DamageSource damagesource) {
- MinecraftKey minecraftkey = this.bI;
+ MinecraftKey minecraftkey = this.lootTableKey;
@@ -470,11 +530,21 @@
ItemStack itemstack1 = this.getEquipment(enumitemslot);
boolean flag = this.a(itemstack, itemstack1, enumitemslot);
@@ -132,7 +126,7 @@
+ canPickup = !entityEvent.isCancelled();
+ if (canPickup) {
+ // CraftBukkit end
- double d0 = this.c(enumitemslot);
+ double d0 = (double) this.c(enumitemslot);
if (!itemstack1.isEmpty() && (double) (this.random.nextFloat() - 0.1F) < d0) {
+ this.forceDrops = true; // CraftBukkit
@@ -155,7 +149,7 @@
this.die();
} else if (d3 < 1024.0D) {
this.ticksFarFromPlayer = 0;
-@@ -946,12 +1016,24 @@
+@@ -942,12 +1012,24 @@
public final boolean b(EntityHuman entityhuman, EnumHand enumhand) {
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
@@ -180,7 +174,7 @@
this.setLeashHolder(entityhuman, true);
itemstack.subtract(1);
return true;
-@@ -972,10 +1054,12 @@
+@@ -968,10 +1050,12 @@
if (this.bK) {
if (!this.isAlive()) {
@@ -193,7 +187,7 @@
this.unleash(true, true);
}
}
-@@ -986,7 +1070,9 @@
+@@ -982,7 +1066,9 @@
this.bK = false;
this.leashHolder = null;
if (!this.world.isClientSide && flag1) {
@@ -203,7 +197,7 @@
}
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
-@@ -1056,6 +1142,7 @@
+@@ -1052,6 +1138,7 @@
this.setLeashHolder(entityleash, true);
} else {
@@ -211,7 +205,7 @@
this.unleash(false, true);
}
}
-@@ -1151,7 +1238,14 @@
+@@ -1147,7 +1234,14 @@
int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);
if (j > 0) {
diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch
index 1a7b6da4..54d1e474 100644
--- a/nms-patches/EntityLiving.patch
+++ b/nms-patches/EntityLiving.patch
@@ -101,14 +101,14 @@
- if (!this.world.isClientSide && (this.alwaysGivesExp() || this.lastDamageByPlayerTime > 0 && this.isDropExperience() && this.world.getGameRules().getBoolean("doMobLoot"))) {
- i = this.getExpValue(this.killer);
--
-- while (i > 0) {
-- int j = EntityExperienceOrb.getOrbValue(i);
+ // CraftBukkit start - Update getExpReward() above if the removed if() changes!
+ i = this.expToDrop;
+ while (i > 0) {
+ int j = EntityExperienceOrb.getOrbValue(i);
+- while (i > 0) {
+- int j = EntityExperienceOrb.getOrbValue(i);
+-
- i -= j;
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
- }
@@ -375,69 +375,70 @@
this.datawatcher.set(EntityLiving.HEALTH, Float.valueOf(MathHelper.a(f, 0.0F, this.getMaxHealth())));
}
-@@ -712,14 +912,16 @@
- } else {
- float f1 = f;
-
-- if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
-+ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
-+ if (false && (damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
- this.getEquipment(EnumItemSlot.HEAD).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this);
- f *= 0.75F;
- }
+@@ -711,15 +911,17 @@
+ this.ticksFarFromPlayer = 0;
+ float f1 = f;
-- boolean flag = false;
-+ boolean flag = f > 0.0F && this.applyBlockingModifier(damagesource); // Copied from below
-
-- if (f > 0.0F && this.applyBlockingModifier(damagesource)) {
-+ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
-+ if (false && f > 0.0F && this.applyBlockingModifier(damagesource)) {
- this.damageShield(f);
- f = 0.0F;
- if (!damagesource.b()) {
-@@ -738,20 +940,39 @@
-
- if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
- if (f <= this.lastDamage) {
-+ this.forceExplosionKnockback = true; // CraftBukkit - SPIGOT-949 - for vanilla consistency, cooldown does not prevent explosion knockback
- return false;
- }
+- if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
++ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
++ if (false && (damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
+ this.getEquipment(EnumItemSlot.HEAD).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this);
+ f *= 0.75F;
+ }
-- this.damageEntity0(damagesource, f - this.lastDamage);
-+ // CraftBukkit start
-+ if (!this.damageEntity0(damagesource, f - this.lastDamage)) {
-+ return false;
-+ }
-+ // CraftBukkit end
- this.lastDamage = f;
- flag1 = false;
- } else {
-+ // CraftBukkit start
-+ if (!this.damageEntity0(damagesource, f)) {
-+ return false;
-+ }
- this.lastDamage = f;
- this.noDamageTicks = this.maxNoDamageTicks;
-- this.damageEntity0(damagesource, f);
-+ // this.damageEntity0(damagesource, f);
-+ // CraftBukkit end
- this.aC = 10;
- this.hurtTicks = this.aC;
+- boolean flag = false;
++ boolean flag = f > 0.0F && this.applyBlockingModifier(damagesource); // Copied from below
+ float f2 = 0.0F;
+
+- if (f > 0.0F && this.applyBlockingModifier(damagesource)) {
++ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
++ if (false && f > 0.0F && this.applyBlockingModifier(damagesource)) {
+ this.damageShield(f);
+ f2 = f;
+ f = 0.0F;
+@@ -739,20 +941,39 @@
+
+ if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
+ if (f <= this.lastDamage) {
++ this.forceExplosionKnockback = true; // CraftBukkit - SPIGOT-949 - for vanilla consistency, cooldown does not prevent explosion knockback
+ return false;
}
+- this.damageEntity0(damagesource, f - this.lastDamage);
+ // CraftBukkit start
-+ if (this instanceof EntityAnimal) {
-+ ((EntityAnimal) this).resetLove();
-+ if (this instanceof EntityTameableAnimal) {
-+ ((EntityTameableAnimal) this).getGoalSit().setSitting(false);
-+ }
++ if (!this.damageEntity0(damagesource, f - this.lastDamage)) {
++ return false;
+ }
+ // CraftBukkit end
+ this.lastDamage = f;
+ flag1 = false;
+ } else {
++ // CraftBukkit start
++ if (!this.damageEntity0(damagesource, f)) {
++ return false;
++ }
+ this.lastDamage = f;
+ this.noDamageTicks = this.maxNoDamageTicks;
+- this.damageEntity0(damagesource, f);
++ // this.damageEntity0(damagesource, f);
++ // CraftBukkit end
+ this.aC = 10;
+ this.hurtTicks = this.aC;
+ }
+
++ // CraftBukkit start
++ if (this instanceof EntityAnimal) {
++ ((EntityAnimal) this).resetLove();
++ if (this instanceof EntityTameableAnimal) {
++ ((EntityTameableAnimal) this).getGoalSit().setSitting(false);
++ }
++ }
++ // CraftBukkit end
+
- this.aD = 0.0F;
- Entity entity1 = damagesource.getEntity();
+ this.aD = 0.0F;
+ Entity entity1 = damagesource.getEntity();
-@@ -858,19 +1079,29 @@
+@@ -861,19 +1082,29 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@@ -471,7 +472,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.b(StatisticList.ITEM_USED.b(Items.TOTEM_OF_UNDYING));
-@@ -878,13 +1109,15 @@
+@@ -881,13 +1112,15 @@
}
this.setHealth(1.0F);
@@ -491,7 +492,7 @@
}
}
-@@ -955,6 +1188,12 @@
+@@ -958,6 +1191,12 @@
boolean flag = this.lastDamageByPlayerTime > 0;
this.a(flag, i, damagesource);
@@ -504,7 +505,7 @@
}
}
-@@ -1044,8 +1283,13 @@
+@@ -1047,8 +1286,13 @@
int i = MathHelper.f((f - 3.0F - f2) * f1);
if (i > 0) {
@@ -513,13 +514,13 @@
+ return;
+ }
+ // CraftBukkit end
- this.a(this.n(i), 1.0F, 1.0F);
+ this.a(this.m(i), 1.0F, 1.0F);
- this.damageEntity(DamageSource.FALL, (float) i);
+ // this.damageEntity(DamageSource.FALL, (float) i); // CraftBukkit - moved up
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
int l = MathHelper.floor(this.locZ);
-@@ -1072,7 +1316,7 @@
+@@ -1075,7 +1319,7 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
@@ -528,7 +529,7 @@
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.getAttributeInstance(GenericAttributes.i).getValue());
}
-@@ -1085,7 +1329,8 @@
+@@ -1088,7 +1332,8 @@
} else {
int i;
@@ -538,7 +539,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
-@@ -1106,22 +1351,142 @@
+@@ -1119,28 +1364,164 @@
}
}
@@ -547,10 +548,6 @@
- f = this.applyArmorModifier(damagesource, f);
- f = this.applyMagicModifier(damagesource, f);
- float f1 = f;
--
-- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
-- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
-- if (f != 0.0F) {
+ // CraftBukkit start
+ protected boolean damageEntity0(final DamageSource damagesource, float f) { // void -> boolean, add final
+ if (!this.isInvulnerable(damagesource)) {
@@ -623,9 +620,24 @@
+ if (event.isCancelled()) {
+ return false;
+ }
-+
+
+- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
+- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
+- float f2 = f1 - f;
+ f = (float) event.getFinalDamage();
+
++ // Resistance
++ if (event.getDamage(DamageModifier.RESISTANCE) < 0) {
++ float f3 = (float) -event.getDamage(DamageModifier.RESISTANCE);
++ if (f3 > 0.0F && f3 < 3.4028235E37F) {
++ if (this instanceof EntityPlayer) {
++ ((EntityPlayer) this).a(StatisticList.DAMAGE_RESISTED, Math.round(f3 * 10.0F));
++ } else if (damagesource.getEntity() instanceof EntityPlayer) {
++ ((EntityPlayer) damagesource.getEntity()).a(StatisticList.DAMAGE_DEALT_RESISTED, Math.round(f3 * 10.0F));
++ }
++ }
++ }
++
+ // Apply damage to helmet
+ if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(EnumItemSlot.HEAD) != null) {
+ this.getEquipment(EnumItemSlot.HEAD).damage((int) (event.getDamage() * 4.0F + this.random.nextFloat() * event.getDamage() * 2.0F), this);
@@ -649,6 +661,13 @@
+
+ absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION);
+ this.setAbsorptionHearts(Math.max(this.getAbsorptionHearts() - absorptionModifier, 0.0F));
++ float f2 = absorptionModifier;
+
+ if (f2 > 0.0F && f2 < 3.4028235E37F && damagesource.getEntity() instanceof EntityPlayer) {
+ ((EntityPlayer) damagesource.getEntity()).a(StatisticList.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
+ }
+
+- if (f != 0.0F) {
+ if (f > 0 || !human) {
+ if (human) {
+ // PAIL: Be sure to drag all this code from the EntityHuman subclass each update.
@@ -658,10 +677,10 @@
+ }
+ }
+ // CraftBukkit end
- float f2 = this.getHealth();
+ float f3 = this.getHealth();
- this.setHealth(f2 - f);
- this.getCombatTracker().trackDamage(damagesource, f2, f);
+ this.setHealth(f3 - f);
+ this.getCombatTracker().trackDamage(damagesource, f3, f);
- this.setAbsorptionHearts(this.getAbsorptionHearts() - f);
+ // CraftBukkit start
+ if (!human) {
@@ -674,6 +693,10 @@
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
+ if (this instanceof EntityPlayer) {
+ CriterionTriggers.h.a((EntityPlayer) this, damagesource, f, originalDamage, true);
++ f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
++ if (f2 > 0.0F && f2 < 3.4028235E37F) {
++ ((EntityPlayer) this).a(StatisticList.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
++ }
+ }
+
+ if (damagesource.getEntity() instanceof EntityPlayer) {
@@ -691,7 +714,7 @@
}
public CombatTracker getCombatTracker() {
-@@ -1188,6 +1553,7 @@
+@@ -1207,6 +1588,7 @@
public AttributeMapBase getAttributeMap() {
if (this.attributeMap == null) {
this.attributeMap = new AttributeMapServer();
@@ -699,7 +722,7 @@
}
return this.attributeMap;
-@@ -1490,6 +1856,7 @@
+@@ -1509,6 +1891,7 @@
}
if (this.onGround && !this.world.isClientSide) {
@@ -707,7 +730,7 @@
this.setFlag(7, false);
}
} else {
-@@ -1891,6 +2258,7 @@
+@@ -1910,6 +2293,7 @@
}
if (!this.world.isClientSide) {
@@ -715,7 +738,7 @@
this.setFlag(7, flag);
}
-@@ -2018,11 +2386,11 @@
+@@ -2037,11 +2421,11 @@
}
public boolean isInteractable() {
@@ -729,7 +752,7 @@
}
protected void aA() {
-@@ -2182,7 +2550,27 @@
+@@ -2201,7 +2585,27 @@
protected void q() {
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
this.b(this.activeItem, 16);
@@ -758,7 +781,7 @@
this.da();
}
-@@ -2261,10 +2649,18 @@
+@@ -2280,10 +2684,18 @@
}
if (flag1) {
diff --git a/nms-patches/EntityMinecartAbstract.patch b/nms-patches/EntityMinecartAbstract.patch
index d3ac7cc3..3e1c0d16 100644
--- a/nms-patches/EntityMinecartAbstract.patch
+++ b/nms-patches/EntityMinecartAbstract.patch
@@ -51,8 +51,8 @@
+
+ f = (float) event.getDamage();
+ // CraftBukkit end
- this.l(-this.u());
- this.e(10);
+ this.k(-this.u());
+ this.d(10);
this.aA();
@@ -105,6 +138,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
@@ -83,7 +83,7 @@
+ // CraftBukkit end
+
if (this.getType() > 0) {
- this.e(this.getType() - 1);
+ this.d(this.getType() - 1);
}
@@ -157,6 +207,8 @@
diff --git a/nms-patches/EntityMinecartContainer.patch b/nms-patches/EntityMinecartContainer.patch
index b17c7c97..404bb8d9 100644
--- a/nms-patches/EntityMinecartContainer.patch
+++ b/nms-patches/EntityMinecartContainer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityMinecartContainer.java
+++ b/net/minecraft/server/EntityMinecartContainer.java
-@@ -3,23 +3,66 @@
+@@ -3,6 +3,13 @@
import java.util.Iterator;
import java.util.Random;
import javax.annotation.Nullable;
@@ -14,12 +14,10 @@
public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements ITileInventory, ILootable {
- private NonNullList<ItemStack> items;
- private boolean b;
+@@ -11,15 +18,51 @@
private MinecraftKey c;
-- private long d;
-+ public long d; // CraftBukkit private -> public
-+
+ public long lootTableSeed;
+
+ // CraftBukkit start
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
@@ -55,7 +53,7 @@
+ return getBukkitEntity().getLocation();
+ }
+ // CraftBukkit end
-
++
protected EntityMinecartContainer(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
- this.items = NonNullList.a(36, ItemStack.a);
diff --git a/nms-patches/EntityMushroomCow.patch b/nms-patches/EntityMushroomCow.patch
index 8888c99b..0be5ad07 100644
--- a/nms-patches/EntityMushroomCow.patch
+++ b/nms-patches/EntityMushroomCow.patch
@@ -20,6 +20,6 @@
+ return false;
+ }
+ // CraftBukkit end
- this.die();
this.world.addParticle(Particles.u, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D);
if (!this.world.isClientSide) {
+ this.die();
diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch
index fd61e3c1..12687b42 100644
--- a/nms-patches/EntityPlayer.patch
+++ b/nms-patches/EntityPlayer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityPlayer.java
+++ b/net/minecraft/server/EntityPlayer.java
-@@ -15,11 +15,29 @@
+@@ -15,10 +15,28 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -25,13 +25,12 @@
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger cc = LogManager.getLogger();
- private static final IChatBaseComponent cd = (new ChatMessage("multiplayer.message_not_delivered", new Object[0])).a(EnumChatFormat.RED);
- public String locale = "en_US";
+ public String locale = "en_us"; // CraftBukkit - lowercase
public PlayerConnection playerConnection;
public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager;
-@@ -55,6 +73,19 @@
+@@ -54,6 +72,19 @@
public int ping;
public boolean viewingCredits;
@@ -51,8 +50,8 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super((World) worldserver, gameprofile);
playerinteractmanager.player = this;
-@@ -65,8 +96,50 @@
- this.cg = minecraftserver.getPlayerList().h(this);
+@@ -64,8 +95,50 @@
+ this.cf = minecraftserver.getPlayerList().h(this);
this.Q = 1.0F;
this.a(worldserver);
+
@@ -80,7 +79,7 @@
+ }
+
+ int k = (i * 2 + 1) * (i * 2 + 1);
-+ int l = this.s(k);
++ int l = this.r(k);
+ int i1 = (new Random()).nextInt(k);
+
+ for (int j1 = 0; j1 < k; ++j1) {
@@ -102,15 +101,15 @@
private void a(WorldServer worldserver) {
BlockPosition blockposition = worldserver.getSpawn();
-@@ -133,6 +206,7 @@
+@@ -132,6 +205,7 @@
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
- this.cz.a(nbttagcompound.getCompound("recipeBook"));
+ this.cy.a(nbttagcompound.getCompound("recipeBook"));
}
+ this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
}
-@@ -152,7 +226,20 @@
+@@ -151,7 +225,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@@ -132,10 +131,10 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
-@@ -163,8 +250,34 @@
+@@ -162,8 +249,34 @@
}
- nbttagcompound.set("recipeBook", this.cz.e());
+ nbttagcompound.set("recipeBook", this.cy.e());
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
}
@@ -167,7 +166,7 @@
public void a(int i) {
float f = (float) this.getExpToLevel();
float f1 = (f - 1.0F) / f;
-@@ -211,6 +324,11 @@
+@@ -210,6 +323,11 @@
}
public void tick() {
@@ -179,17 +178,17 @@
this.playerInteractManager.a();
--this.invulnerableTicks;
if (this.noDamageTicks > 0) {
-@@ -276,7 +394,7 @@
+@@ -275,7 +393,7 @@
}
- if (this.getHealth() != this.lastHealthSent || this.cp != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cq) {
+ if (this.getHealth() != this.lastHealthSent || this.co != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cp) {
- this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel()));
+ this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel())); // CraftBukkit
this.lastHealthSent = this.getHealth();
- this.cp = this.foodData.getFoodLevel();
- this.cq = this.foodData.getSaturationLevel() == 0.0F;
-@@ -307,6 +425,12 @@
- this.a(IScoreboardCriteria.k, MathHelper.f((float) this.cn));
+ this.co = this.foodData.getFoodLevel();
+ this.cp = this.foodData.getSaturationLevel() == 0.0F;
+@@ -306,6 +424,12 @@
+ this.a(IScoreboardCriteria.k, MathHelper.f((float) this.cm));
}
+ // CraftBukkit start - Force max health updates
@@ -198,10 +197,10 @@
+ }
+ // CraftBukkit end
+
- if (this.expLevel != this.cm) {
- this.cm = this.expLevel;
- this.a(IScoreboardCriteria.l, MathHelper.f((float) this.cm));
-@@ -321,6 +445,16 @@
+ if (this.expLevel != this.cl) {
+ this.cl = this.expLevel;
+ this.a(IScoreboardCriteria.l, MathHelper.f((float) this.cl));
+@@ -320,6 +444,16 @@
CriterionTriggers.p.a(this);
}
@@ -218,7 +217,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
-@@ -331,7 +465,8 @@
+@@ -330,24 +464,50 @@
}
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
@@ -228,12 +227,9 @@
scoreboardscore.setScore(i);
});
}
-@@ -340,27 +475,59 @@
- boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
- this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag));
-- if (flag) {
-- ScoreboardTeamBase scoreboardteambase = this.be();
+ public void die(DamageSource damagesource) {
+ boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
+ // CraftBukkit start - fire PlayerDeathEvent
+ if (this.dead) {
+ return;
@@ -248,36 +244,36 @@
+ }
+ }
+ }
+
+- if (flag) {
+- IChatBaseComponent ichatbasecomponent = this.getCombatTracker().getDeathMessage();
++ IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage();
+
-+ IChatBaseComponent chatmessage = this.getCombatTracker().getDeathMessage();
-+
-+ String deathmessage = chatmessage.getString();
++ String deathmessage = defaultMessage.getString();
+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory);
-
-- if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) {
-- if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) {
-- this.server.getPlayerList().a((EntityHuman) this, this.getCombatTracker().getDeathMessage());
-- } else if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) {
-- this.server.getPlayerList().b((EntityHuman) this, this.getCombatTracker().getDeathMessage());
++
+ String deathMessage = event.getDeathMessage();
+
+ if (deathMessage != null && deathMessage.length() > 0 && flag) { // TODO: allow plugins to override?
++ IChatBaseComponent ichatbasecomponent;
+ if (deathMessage.equals(deathmessage)) {
-+ ScoreboardTeamBase scoreboardteambase = this.be();
-+
-+ if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) {
-+ if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) {
-+ this.server.getPlayerList().a((EntityHuman) this, chatmessage);
-+ } else if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) {
-+ this.server.getPlayerList().b((EntityHuman) this, chatmessage);
-+ }
-+ } else {
-+ this.server.getPlayerList().sendMessage(chatmessage);
- }
- } else {
-- this.server.getPlayerList().sendMessage(this.getCombatTracker().getDeathMessage());
-+ this.server.getPlayerList().sendMessage(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(deathMessage));
- }
++ ichatbasecomponent = this.getCombatTracker().getDeathMessage();
++ } else {
++ ichatbasecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromStringOrNull(deathMessage);
++ }
+
+ this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
+ if (!future.isSuccess()) {
+- boolean flag = true;
+ String s = ichatbasecomponent.a(256);
+ ChatMessage chatmessage = new ChatMessage("death.attack.message_too_long", new Object[] { (new ChatComponentText(s)).a(EnumChatFormat.YELLOW)});
+ IChatBaseComponent ichatbasecomponent1 = (new ChatMessage("death.attack.even_more_magic", new Object[] { this.getScoreboardDisplayName()})).a((chatmodifier) -> {
+- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, ichatbasecomponent));
++ chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatmessage));
+ });
+
+ this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent1));
+@@ -370,12 +530,17 @@
}
this.releaseShoulderEntities();
@@ -296,11 +292,10 @@
+
+ // CraftBukkit - Get our scores instead
+ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getName(), ScoreboardScore::incrementScore);
-+
EntityLiving entityliving = this.cv();
if (entityliving != null) {
-@@ -383,10 +550,12 @@
+@@ -398,10 +563,12 @@
String s = this.getName();
String s1 = entity.getName();
@@ -315,7 +310,7 @@
} else {
this.a(StatisticList.MOB_KILLS);
}
-@@ -404,7 +573,8 @@
+@@ -419,7 +586,8 @@
int i = scoreboardteam.getColor().b();
if (i >= 0 && i < aiscoreboardcriteria.length) {
@@ -325,7 +320,7 @@
}
}
-@@ -445,12 +615,14 @@
+@@ -461,12 +629,14 @@
}
private boolean canPvP() {
@@ -335,34 +330,34 @@
}
@Nullable
- public Entity d(int i) {
+ public Entity a(DimensionManager dimensionmanager) {
- this.worldChangeInvuln = true;
+ if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154
+ // this.worldChangeInvuln = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
- if (this.dimension == 0 && i == -1) {
- this.cD = new Vec3D(this.locX, this.locY, this.locZ);
- } else if (this.dimension != -1 && i != 0) {
-@@ -458,6 +630,7 @@
+ if (this.dimension == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) {
+ this.cC = new Vec3D(this.locX, this.locY, this.locZ);
+ } else if (this.dimension != DimensionManager.NETHER && dimensionmanager != DimensionManager.OVERWORLD) {
+@@ -474,6 +644,7 @@
}
- if (this.dimension == 1 && i == 1) {
+ if (this.dimension == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) {
+ this.worldChangeInvuln = true; // CraftBukkit - Moved down from above
this.world.kill(this);
if (!this.viewingCredits) {
this.viewingCredits = true;
-@@ -471,7 +644,10 @@
- i = 1;
+@@ -487,7 +658,10 @@
+ dimensionmanager = DimensionManager.THE_END;
}
-- this.server.getPlayerList().a(this, i);
+- this.server.getPlayerList().a(this, dimensionmanager);
+ // CraftBukkit start
-+ TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
-+ this.server.getPlayerList().changeDimension(this, i, cause); // PAIL: check all this
++ TeleportCause cause = (this.dimension == DimensionManager.THE_END || i == DimensionManager.THE_END) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
++ this.server.getPlayerList().changeDimension(this, dimensionmanager, cause); // PAIL: check all this
+ // CraftBukkit end
this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false));
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
-@@ -517,6 +693,7 @@
+@@ -533,6 +707,7 @@
}
public void a(boolean flag, boolean flag1, boolean flag2) {
@@ -370,7 +365,7 @@
if (this.isSleeping()) {
this.getWorldServer().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2));
}
-@@ -595,23 +772,55 @@
+@@ -611,23 +786,55 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
}
@@ -381,12 +376,12 @@
}
public void openTileEntity(ITileEntityContainer itileentitycontainer) {
-- if (itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).Q_() != null && this.isSpectator()) {
+- if (itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).getLootTable() != null && this.isSpectator()) {
+ // CraftBukkit start - Inventory open hook
-+ if (false && itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).Q_() != null && this.isSpectator()) {
++ if (false && itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).getLootTable() != null && this.isSpectator()) {
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true);
} else {
-+ boolean cancelled = itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).Q_() != null && this.isSpectator();
++ boolean cancelled = itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).getLootTable()!= null && this.isSpectator();
+ Container container = CraftEventFactory.callInventoryOpenEvent(this, itileentitycontainer.createContainer(this.inventory, this), cancelled);
+ if (container == null) {
+ return;
@@ -426,10 +421,10 @@
+ }
+ // CraftBukkit end
+
- if (iinventory instanceof ILootable && ((ILootable) iinventory).Q_() != null && this.isSpectator()) {
+ if (iinventory instanceof ILootable && ((ILootable) iinventory).getLootTable() != null && this.isSpectator()) {
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true);
} else {
-@@ -625,18 +834,21 @@
+@@ -641,18 +848,21 @@
if (itileinventory.isLocked() && !this.a(itileinventory.getLock()) && !this.isSpectator()) {
this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), ChatMessageType.GAME_INFO));
this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.BLOCK_CHEST_LOCKED, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F));
@@ -453,7 +448,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
-@@ -644,8 +856,14 @@
+@@ -660,8 +870,14 @@
}
public void openTrade(IMerchant imerchant) {
@@ -469,7 +464,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).d();
-@@ -665,13 +883,20 @@
+@@ -681,13 +897,20 @@
}
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@@ -491,7 +486,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
-@@ -712,6 +937,11 @@
+@@ -728,6 +951,11 @@
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
@@ -503,7 +498,7 @@
}
public void setContainerData(Container container, int i, int j) {
-@@ -726,6 +956,7 @@
+@@ -742,6 +970,7 @@
}
public void closeInventory() {
@@ -511,10 +506,10 @@
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.m();
}
-@@ -759,14 +990,14 @@
+@@ -775,14 +1004,14 @@
public void a(Statistic<?> statistic, int i) {
- this.ch.b(this, statistic, i);
+ this.cg.b(this, statistic, i);
- this.getScoreboard().getObjectivesForCriteria(statistic, this.getName(), (scoreboardscore) -> {
+ this.world.getServer().getScoreboardManager().getScoreboardScores(statistic, this.getName(), (scoreboardscore) -> { // CraftBukkit - Get our scores instead
scoreboardscore.addScore(i);
@@ -522,13 +517,13 @@
}
public void a(Statistic<?> statistic) {
- this.ch.setStatistic(this, statistic, 0);
+ this.cg.setStatistic(this, statistic, 0);
- this.getScoreboard().getObjectivesForCriteria(statistic, this.getName(), ScoreboardScore::c);
+ this.world.getServer().getScoreboardManager().getScoreboardScores(statistic, this.getName(), ScoreboardScore::c); // CraftBukkit - Get our scores instead
}
public int a(Collection<IRecipe> collection) {
-@@ -814,8 +1045,17 @@
+@@ -830,8 +1059,17 @@
public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F;
@@ -546,16 +541,16 @@
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT));
}
-@@ -866,7 +1106,7 @@
+@@ -882,7 +1120,7 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
- this.cp = -1;
-- this.cz.a((RecipeBook) entityplayer.cz);
-+ // this.cz.a((RecipeBook) entityplayer.cz); // CraftBukkit
+ this.co = -1;
+- this.cy.a((RecipeBook) entityplayer.cy);
++ // this.cy.a((RecipeBook) entityplayer.cy); // CraftBukkit
this.removeQueue.addAll(entityplayer.removeQueue);
- this.cy = entityplayer.cy;
- this.cD = entityplayer.cD;
-@@ -925,6 +1165,18 @@
+ this.cx = entityplayer.cx;
+ this.cC = entityplayer.cC;
+@@ -941,6 +1179,18 @@
}
public void a(EnumGamemode enumgamemode) {
@@ -574,7 +569,7 @@
this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
if (enumgamemode == EnumGamemode.SPECTATOR) {
-@@ -968,6 +1220,16 @@
+@@ -988,6 +1238,16 @@
}
public void a(PacketPlayInSettings packetplayinsettings) {
@@ -589,18 +584,18 @@
+ }
+ // CraftBukkit end
this.locale = packetplayinsettings.b();
- this.ct = packetplayinsettings.d();
- this.cu = packetplayinsettings.e();
-@@ -1033,7 +1295,7 @@
- this.cw = (Entity) (entity == null ? this : entity);
- if (entity1 != this.cw) {
- this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cw));
-- this.enderTeleportTo(this.cw.locX, this.cw.locY, this.cw.locZ);
-+ this.playerConnection.a(this.cw.locX, this.cw.locY, this.cw.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
+ this.cs = packetplayinsettings.d();
+ this.ct = packetplayinsettings.e();
+@@ -1053,7 +1313,7 @@
+ this.cv = (Entity) (entity == null ? this : entity);
+ if (entity1 != this.cv) {
+ this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cv));
+- this.enderTeleportTo(this.cv.locX, this.cv.locY, this.cv.locZ);
++ this.playerConnection.a(this.cv.locX, this.cv.locY, this.cv.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
}
}
-@@ -1060,7 +1322,7 @@
+@@ -1080,7 +1340,7 @@
@Nullable
public IChatBaseComponent getPlayerListName() {
@@ -609,7 +604,7 @@
}
public void a(EnumHand enumhand) {
-@@ -1077,12 +1339,17 @@
+@@ -1097,12 +1357,17 @@
}
public void J() {
@@ -627,8 +622,8 @@
}
public AdvancementDataPlayer getAdvancementData() {
-@@ -1094,9 +1361,16 @@
- return this.cD;
+@@ -1114,9 +1379,16 @@
+ return this.cC;
}
+ // CraftBukkit start
@@ -644,7 +639,7 @@
if (worldserver == this.world) {
this.playerConnection.a(d0, d1, d2, f, f1);
} else {
-@@ -1121,6 +1395,149 @@
+@@ -1141,6 +1413,149 @@
this.server.getPlayerList().b(this, worldserver);
this.server.getPlayerList().updateClient(this);
}
diff --git a/nms-patches/EntitySheep.patch b/nms-patches/EntitySheep.patch
index d9a10993..f7966714 100644
--- a/nms-patches/EntitySheep.patch
+++ b/nms-patches/EntitySheep.patch
@@ -71,6 +71,6 @@
this.container.setItem(0, new ItemStack(ItemDye.a(enumcolor)));
this.container.setItem(1, new ItemStack(ItemDye.a(enumcolor1)));
+ this.container.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
- ItemStack itemstack = entityanimal.world.D().craft(this.container, ((EntitySheep) entityanimal).world);
+ ItemStack itemstack = entityanimal.world.E().craft(this.container, ((EntitySheep) entityanimal).world);
Item item = itemstack.getItem();
EnumColor enumcolor2;
diff --git a/nms-patches/EntitySmallFireball.patch b/nms-patches/EntitySmallFireball.patch
index 0a93a44c..46d5a041 100644
--- a/nms-patches/EntitySmallFireball.patch
+++ b/nms-patches/EntitySmallFireball.patch
@@ -20,28 +20,25 @@
}
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
-@@ -20,10 +27,17 @@
+@@ -20,7 +27,16 @@
if (movingobjectposition.entity != null) {
if (!movingobjectposition.entity.isFireProof()) {
-- flag = movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
-- if (flag) {
+- movingobjectposition.entity.setOnFire(5);
+ // CraftBukkit start - Entity damage by entity event + combust event
-+ isIncendiary = movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
+ if (isIncendiary) {
- this.a(this.shooter, movingobjectposition.entity);
-- movingobjectposition.entity.setOnFire(5);
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
+ movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ movingobjectposition.entity.setOnFire(event.getDuration());
+ }
-+ // CraftBukkit end
- }
- }
- } else {
-@@ -32,11 +46,15 @@
++ }
++ // CraftBukkit end
+ flag = movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
+ if (flag) {
+ this.a(this.shooter, movingobjectposition.entity);
+@@ -32,11 +48,15 @@
flag = this.world.getGameRules().getBoolean("mobGriefing");
}
diff --git a/nms-patches/EntityTippedArrow.patch b/nms-patches/EntityTippedArrow.patch
index b3e1578b..5628df20 100644
--- a/nms-patches/EntityTippedArrow.patch
+++ b/nms-patches/EntityTippedArrow.patch
@@ -6,16 +6,16 @@
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
-+ this.getDataWatcher().set(EntityTippedArrow.f, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
++ this.getDataWatcher().set(EntityTippedArrow.g, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
+ }
+
+ public String getType() {
-+ return ((MinecraftKey) PotionRegistry.a.b(this.potionRegistry)).toString();
++ return IRegistry.POTION.getKey(this.potionRegistry).toString();
+ }
+
+ public void setType(String string) {
-+ this.potionRegistry = PotionRegistry.a.get(new MinecraftKey(string));
-+ this.datawatcher.set(EntityTippedArrow.f, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
++ this.potionRegistry = IRegistry.POTION.get(new MinecraftKey(string));
++ this.datawatcher.set(EntityTippedArrow.g, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
+ }
+
+ public boolean isTipped() {
@@ -24,7 +24,7 @@
+ // CraftBukkit end
+
public int getColor() {
- return ((Integer) this.datawatcher.get(EntityTippedArrow.f)).intValue();
+ return ((Integer) this.datawatcher.get(EntityTippedArrow.g)).intValue();
}
@@ -180,7 +199,7 @@
diff --git a/nms-patches/EntityTurtle.patch b/nms-patches/EntityTurtle.patch
index 11c6bc4b..30b08c19 100644
--- a/nms-patches/EntityTurtle.patch
+++ b/nms-patches/EntityTurtle.patch
@@ -1,16 +1,16 @@
--- a/net/minecraft/server/EntityTurtle.java
+++ b/net/minecraft/server/EntityTurtle.java
-@@ -231,7 +231,9 @@
-
+@@ -232,7 +232,9 @@
protected void l() {
super.l();
-+ this.forceDrops = true; // CraftBukkit
- this.a((IMaterial) Items.SCUTE, 1);
-+ this.forceDrops = false; // CraftBukkit
- }
+ if (this.world.getGameRules().getBoolean("doMobLoot")) {
++ this.forceDrops = true; // CraftBukkit
+ this.a((IMaterial) Items.SCUTE, 1);
++ this.forceDrops = false; // CraftBukkit
+ }
- public void a(float f, float f1, float f2) {
-@@ -260,7 +262,9 @@
+ }
+@@ -263,7 +265,9 @@
}
public void onLightningStrike(EntityLightning entitylightning) {
@@ -20,7 +20,7 @@
}
public void die(DamageSource damagesource) {
-@@ -438,8 +442,12 @@
+@@ -441,8 +445,12 @@
} else if (this.f.bK > 200) {
World world = this.f.world;
@@ -32,4 +32,4 @@
+ // CraftBukkit end
this.f.s(false);
this.f.t(false);
- this.f.e(600);
+ this.f.d(600);
diff --git a/nms-patches/EntityTypes.patch b/nms-patches/EntityTypes.patch
index 8b0f7041..25a77d34 100644
--- a/nms-patches/EntityTypes.patch
+++ b/nms-patches/EntityTypes.patch
@@ -1,6 +1,15 @@
--- a/net/minecraft/server/EntityTypes.java
+++ b/net/minecraft/server/EntityTypes.java
-@@ -148,10 +148,16 @@
+@@ -121,7 +121,7 @@
+ public static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.a<T> entitytypes_a) {
+ EntityTypes entitytypes = entitytypes_a.a(s);
+
+- IRegistry.ENTITY_TYPE.a(new MinecraftKey(s), (Object) entitytypes);
++ IRegistry.ENTITY_TYPE.a(new MinecraftKey(s), entitytypes); // CraftBukkit - decompile error
+ return entitytypes;
+ }
+
+@@ -150,10 +150,16 @@
@Nullable
public T a(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, boolean flag, boolean flag1) {
@@ -19,7 +28,7 @@
}
@Nullable
-@@ -185,7 +191,7 @@
+@@ -187,7 +193,7 @@
}
a(world, entityhuman, entity, nbttagcompound);
@@ -28,12 +37,12 @@
}
}
-@@ -240,7 +246,7 @@
+@@ -250,7 +256,7 @@
@Nullable
public T a(World world) {
-- return (Entity) this.aU.apply(world);
-+ return this.aU.apply(world); // CraftBukkit - decompile error
+- return (Entity) this.aT.apply(world);
++ return this.aT.apply(world); // CraftBukkit - decompile error
}
@Nullable
diff --git a/nms-patches/EntityWither.patch b/nms-patches/EntityWither.patch
index e07a21fb..77708f47 100644
--- a/nms-patches/EntityWither.patch
+++ b/nms-patches/EntityWither.patch
@@ -14,8 +14,8 @@
private static final DataWatcherObject<Integer> a = DataWatcher.a(EntityWither.class, DataWatcherRegistry.b);
@@ -181,13 +187,38 @@
- if (this.dA() > 0) {
- i = this.dA() - 1;
+ if (this.dz() > 0) {
+ i = this.dz() - 1;
if (i <= 0) {
- this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, this.world.getGameRules().getBoolean("mobGriefing"));
- this.world.a(1023, new BlockPosition(this), 0);
@@ -48,7 +48,7 @@
+ // CraftBukkit end
}
- this.e(i);
+ this.d(i);
if (this.ticksLived % 10 == 0) {
- this.heal(10.0F);
+ this.heal(10.0F, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch
index 69dbfccd..25380ca7 100644
--- a/nms-patches/EntityZombie.patch
+++ b/nms-patches/EntityZombie.patch
@@ -30,7 +30,7 @@
}
}
-@@ -220,7 +234,7 @@
+@@ -221,7 +235,7 @@
entityzombie.setCustomNameVisible(this.getCustomNameVisible());
}
@@ -39,10 +39,10 @@
this.die();
}
}
-@@ -251,8 +265,8 @@
+@@ -252,8 +266,8 @@
if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).q() && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) {
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
- if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.b((Entity) entityzombie, entityzombie.getBoundingBox()) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()) && !this.world.containsLiquid(entityzombie.getBoundingBox())) {
+ if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.a_(entityzombie, entityzombie.getBoundingBox()) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()) && !this.world.containsLiquid(entityzombie.getBoundingBox())) {
- this.world.addEntity(entityzombie);
- entityzombie.setGoalTarget(entityliving);
+ this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
@@ -50,7 +50,7 @@
entityzombie.prepare(this.world.getDamageScaler(new BlockPosition(entityzombie)), (GroupDataEntity) null, (NBTTagCompound) null);
this.getAttributeInstance(EntityZombie.c).b(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
entityzombie.getAttributeInstance(EntityZombie.c).b(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
-@@ -275,7 +289,14 @@
+@@ -276,7 +290,14 @@
float f = this.world.getDamageScaler(new BlockPosition(this)).b();
if (this.getItemInMainHand().isEmpty() && this.isBurning() && this.random.nextFloat() < f * 0.3F) {
@@ -66,7 +66,7 @@
}
}
-@@ -371,7 +392,7 @@
+@@ -372,7 +393,7 @@
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
}
@@ -75,7 +75,7 @@
this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0);
}
-@@ -421,7 +442,7 @@
+@@ -422,7 +443,7 @@
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entitychicken1.s(true);
@@ -84,7 +84,7 @@
this.startRiding(entitychicken1);
}
}
-@@ -494,7 +515,7 @@
+@@ -495,7 +516,7 @@
}
public void die(DamageSource damagesource) {
@@ -93,7 +93,7 @@
if (damagesource.getEntity() instanceof EntityCreeper) {
EntityCreeper entitycreeper = (EntityCreeper) damagesource.getEntity();
-@@ -507,6 +528,7 @@
+@@ -508,6 +529,7 @@
}
}
}
diff --git a/nms-patches/EntityZombieVillager.patch b/nms-patches/EntityZombieVillager.patch
index 6d38c4b7..b04cbf5f 100644
--- a/nms-patches/EntityZombieVillager.patch
+++ b/nms-patches/EntityZombieVillager.patch
@@ -11,7 +11,7 @@
@@ -56,6 +57,11 @@
public void tick() {
if (!this.world.isClientSide && this.isConverting()) {
- int i = this.dL();
+ int i = this.dK();
+ // CraftBukkit start - Use wall time instead of ticks for villager conversion
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
+ this.lastTick = MinecraftServer.currentTick;
diff --git a/nms-patches/Explosion.patch b/nms-patches/Explosion.patch
index be06f65b..c9ededaa 100644
--- a/nms-patches/Explosion.patch
+++ b/nms-patches/Explosion.patch
@@ -40,7 +40,7 @@
HashSet hashset = Sets.newHashSet();
boolean flag = true;
-@@ -75,7 +88,7 @@
+@@ -76,7 +89,7 @@
f -= (f2 + 0.3F) * 0.3F;
}
@@ -49,7 +49,7 @@
hashset.add(blockposition);
}
-@@ -119,7 +132,16 @@
+@@ -120,7 +133,16 @@
double d12 = (double) this.world.a(vec3d, entity.getBoundingBox());
double d13 = (1.0D - d7) * d12;
@@ -67,7 +67,7 @@
double d14 = d13;
if (entity instanceof EntityLiving) {
-@@ -155,6 +177,50 @@
+@@ -156,6 +178,50 @@
BlockPosition blockposition;
if (this.b) {
@@ -118,7 +118,7 @@
iterator = this.blocks.iterator();
while (iterator.hasNext()) {
-@@ -186,7 +252,8 @@
+@@ -187,7 +253,8 @@
if (!iblockdata.isAir()) {
if (block.a(this)) {
@@ -128,7 +128,7 @@
}
this.world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
-@@ -201,7 +268,11 @@
+@@ -202,7 +269,11 @@
while (iterator.hasNext()) {
blockposition = (BlockPosition) iterator.next();
if (this.world.getType(blockposition).isAir() && this.world.getType(blockposition.down()).f(this.world, blockposition.down()) && this.c.nextInt(3) == 0) {
@@ -141,7 +141,7 @@
}
}
}
-@@ -222,7 +293,9 @@
+@@ -223,7 +294,9 @@
@Nullable
public EntityLiving getSource() {
diff --git a/nms-patches/FluidTypeFlowing.patch b/nms-patches/FluidTypeFlowing.patch
index 32ce4ece..13a30e10 100644
--- a/nms-patches/FluidTypeFlowing.patch
+++ b/nms-patches/FluidTypeFlowing.patch
@@ -1,9 +1,9 @@
--- a/net/minecraft/server/FluidTypeFlowing.java
+++ b/net/minecraft/server/FluidTypeFlowing.java
-@@ -5,6 +5,11 @@
- import java.util.Iterator;
- import java.util.Map;
- import java.util.Map.Entry;
+@@ -14,13 +14,18 @@
+ import java.util.function.IntFunction;
+ import java.util.function.IntPredicate;
+ import java.util.function.Supplier;
+// CraftBukkit start
+import org.bukkit.block.BlockFace;
+import org.bukkit.craftbukkit.block.CraftBlock;
@@ -12,7 +12,15 @@
public abstract class FluidTypeFlowing extends FluidType {
-@@ -128,6 +133,15 @@
+ public static final BlockStateBoolean FALLING = BlockProperties.h;
+ public static final BlockStateInteger LEVEL = BlockProperties.ag;
+ private static final ThreadLocal<Object2ByteLinkedOpenHashMap<Block.a>> e = ThreadLocal.withInitial(() -> {
+- Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) {
++ Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap<Block.a>(200) { // CraftBukkit - decompile error
+ protected void rehash(int i) {}
+ };
+
+@@ -145,6 +150,15 @@
Fluid fluid1 = this.a((IWorldReader) generatoraccess, blockposition1, iblockdata1);
if (this.a(generatoraccess, blockposition, iblockdata, EnumDirection.DOWN, blockposition1, iblockdata1, generatoraccess.b(blockposition1), fluid1.c())) {
@@ -28,7 +36,7 @@
this.a(generatoraccess, blockposition1, iblockdata1, EnumDirection.DOWN, fluid1);
if (this.a((IWorldReader) generatoraccess, blockposition) >= 3) {
this.a(generatoraccess, blockposition, fluid, iblockdata);
-@@ -158,6 +172,15 @@
+@@ -175,6 +189,15 @@
IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.b(blockposition1), fluid1.c())) {
@@ -44,3 +52,69 @@
this.a(generatoraccess, blockposition1, iblockdata1, enumdirection, fluid1);
}
}
+@@ -307,21 +330,25 @@
+ if (enumdirection1 != enumdirection) {
+ BlockPosition blockposition2 = blockposition.shift(enumdirection1);
+ short short0 = a(blockposition1, blockposition2);
+- Pair pair = (Pair) short2objectmap.computeIfAbsent(short0, (i) -> {
+- IBlockData iblockdata = iworldreader.getType(blockposition);
++ // CraftBukkit start - decompile errors
++ Pair pair = (Pair) short2objectmap.computeIfAbsent(short0, (ix) -> {
++ IBlockData iblockdatax = iworldreader.getType(blockposition2);
+
+- return Pair.of(iblockdata, iblockdata.s());
++ return Pair.of(iblockdatax, iblockdatax.s());
+ });
++ // CraftBukkit end
+ IBlockData iblockdata1 = (IBlockData) pair.getFirst();
+ Fluid fluid = (Fluid) pair.getSecond();
+
+ if (this.a(iworldreader, this.e(), blockposition, iblockdata, enumdirection1, blockposition2, iblockdata1, fluid)) {
+- boolean flag = short2booleanmap.computeIfAbsent(short0, (i) -> {
+- BlockPosition blockposition = blockposition1.down();
+- IBlockData iblockdata = iworldreader.getType(blockposition);
++ // CraftBukkit start - decompile errors
++ boolean flag = short2booleanmap.computeIfAbsent(short0, (ix) -> {
++ BlockPosition blockpositionx = blockposition2.down();
++ IBlockData iblockdatax = iworldreader.getType(blockpositionx);
+
+- return this.a((IBlockAccess) iworldreader, this.e(), blockposition1, iblockdata1, blockposition, iblockdata);
++ return this.a((IBlockAccess) iworldreader, this.e(), blockposition2, iblockdata1, blockpositionx, iblockdatax);
+ });
++ // CraftBukkit end
+
+ if (flag) {
+ return i;
+@@ -383,22 +410,26 @@
+ EnumDirection enumdirection = (EnumDirection) iterator.next();
+ BlockPosition blockposition1 = blockposition.shift(enumdirection);
+ short short0 = a(blockposition, blockposition1);
+- Pair pair = (Pair) short2objectopenhashmap.computeIfAbsent(short0, (i) -> {
+- IBlockData iblockdata = iworldreader.getType(blockposition);
++ // CraftBukkit start - decompile errors
++ Pair pair = (Pair) short2objectopenhashmap.computeIfAbsent(short0, (ix) -> {
++ IBlockData iblockdatax = iworldreader.getType(blockposition1);
+
+- return Pair.of(iblockdata, iblockdata.s());
++ return Pair.of(iblockdatax, iblockdatax.s());
+ });
++ // CraftBukkit end
+ IBlockData iblockdata1 = (IBlockData) pair.getFirst();
+ Fluid fluid = (Fluid) pair.getSecond();
+ Fluid fluid1 = this.a(iworldreader, blockposition1, iblockdata1);
+
+ if (this.a(iworldreader, fluid1.c(), blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, fluid)) {
+ BlockPosition blockposition2 = blockposition1.down();
+- boolean flag = short2booleanopenhashmap.computeIfAbsent(short0, (i) -> {
+- IBlockData iblockdata = iworldreader.getType(blockposition);
++ // CraftBukkit start - decompile errors
++ boolean flag = short2booleanopenhashmap.computeIfAbsent(short0, (ix) -> {
++ IBlockData iblockdatax = iworldreader.getType(blockposition2);
+
+- return this.a((IBlockAccess) iworldreader, this.e(), blockposition1, iblockdata1, blockposition, iblockdata);
++ return this.a((IBlockAccess) iworldreader, this.e(), blockposition1, iblockdata1, blockposition2, iblockdatax);
+ });
++ // CraftBukkit end
+ int j;
+
+ if (flag) {
diff --git a/nms-patches/FluidTypeLava.patch b/nms-patches/FluidTypeLava.patch
index ef36738d..32cbc489 100644
--- a/nms-patches/FluidTypeLava.patch
+++ b/nms-patches/FluidTypeLava.patch
@@ -31,7 +31,7 @@
}
@@ -139,7 +154,11 @@
- if (this.a(TagsFluid.b) && fluid1.a(TagsFluid.a)) {
+ if (this.a(TagsFluid.LAVA) && fluid1.a(TagsFluid.WATER)) {
if (iblockdata.getBlock() instanceof BlockFluids) {
- generatoraccess.setTypeAndData(blockposition, Blocks.STONE.getBlockData(), 3);
+ // CraftBukkit start
diff --git a/nms-patches/HandshakeListener.patch b/nms-patches/HandshakeListener.patch
index 6d93d0b9..83b69356 100644
--- a/nms-patches/HandshakeListener.patch
+++ b/nms-patches/HandshakeListener.patch
@@ -57,8 +57,8 @@
+ }
+ // CraftBukkit end
+
- if (packethandshakinginsetprotocol.c() > 393) {
- chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[] { "1.13"});
+ if (packethandshakinginsetprotocol.c() > 401) {
+ chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[] { "1.13.1"});
this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage));
@@ -26,6 +71,7 @@
this.b.close(chatmessage);
diff --git a/nms-patches/ItemArmor.patch b/nms-patches/ItemArmor.patch
index 082ce788..575de65b 100644
--- a/nms-patches/ItemArmor.patch
+++ b/nms-patches/ItemArmor.patch
@@ -11,7 +11,7 @@
+
public class ItemArmor extends Item {
- private static final UUID[] l = new UUID[] { UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")};
+ private static final UUID[] k = new UUID[] { UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")};
@@ -29,6 +34,32 @@
EntityLiving entityliving = (EntityLiving) list.get(0);
EnumItemSlot enumitemslot = EntityInsentient.e(itemstack);
diff --git a/nms-patches/ItemBow.patch b/nms-patches/ItemBow.patch
index c34128b3..b2da7810 100644
--- a/nms-patches/ItemBow.patch
+++ b/nms-patches/ItemBow.patch
@@ -60,4 +60,4 @@
+ // CraftBukkit end
}
- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.k.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
diff --git a/nms-patches/ItemBucket.patch b/nms-patches/ItemBucket.patch
index 10d01e46..3c055ca4 100644
--- a/nms-patches/ItemBucket.patch
+++ b/nms-patches/ItemBucket.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ItemBucket.java
+++ b/net/minecraft/server/ItemBucket.java
-@@ -1,10 +1,17 @@
+@@ -1,6 +1,13 @@
package net.minecraft.server;
import javax.annotation.Nullable;
@@ -14,13 +14,8 @@
public class ItemBucket extends Item {
-- private final FluidType a;
-+ public final FluidType a; // PAIL: private->public
-
- public ItemBucket(FluidType fluidtype, Item.Info item_info) {
- super(item_info);
-@@ -28,12 +35,20 @@
- if (this.a == FluidTypes.a) {
+@@ -26,12 +33,20 @@
+ if (this.fluidType == FluidTypes.a) {
iblockdata = world.getType(blockposition);
if (iblockdata.getBlock() instanceof IFluidSource) {
+ // CraftBukkit start
@@ -35,13 +30,13 @@
if (fluidtype != FluidTypes.a) {
entityhuman.b(StatisticList.ITEM_USED.b(this));
- entityhuman.a(fluidtype.a(TagsFluid.b) ? SoundEffects.ITEM_BUCKET_FILL_LAVA : SoundEffects.ITEM_BUCKET_FILL, 1.0F, 1.0F);
+ entityhuman.a(fluidtype.a(TagsFluid.LAVA) ? SoundEffects.ITEM_BUCKET_FILL_LAVA : SoundEffects.ITEM_BUCKET_FILL, 1.0F, 1.0F);
- ItemStack itemstack1 = this.a(itemstack, entityhuman, fluidtype.b());
+ ItemStack itemstack1 = this.a(itemstack, entityhuman, fluidtype.b(), event.getItemStack()); // CraftBukkit
if (!world.isClientSide) {
CriterionTriggers.j.a((EntityPlayer) entityhuman, new ItemStack(fluidtype.b()));
-@@ -48,7 +63,7 @@
+@@ -46,7 +61,7 @@
iblockdata = world.getType(blockposition);
BlockPosition blockposition1 = this.a(iblockdata, blockposition, movingobjectposition);
@@ -85,13 +80,13 @@
+
+ public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPosition movingobjectposition, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) {
+ // CraftBukkit end
- if (!(this.a instanceof FluidTypeFlowing)) {
+ if (!(this.fluidType instanceof FluidTypeFlowing)) {
return false;
} else {
@@ -103,8 +127,18 @@
boolean flag1 = material.isReplaceable();
- if (!world.isEmpty(blockposition) && !flag && !flag1 && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).a((IBlockAccess) world, blockposition, iblockdata, this.a))) {
+ if (!world.isEmpty(blockposition) && !flag && !flag1 && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) {
- return movingobjectposition == null ? false : this.a(entityhuman, world, movingobjectposition.a().shift(movingobjectposition.direction), (MovingObjectPosition) null);
+ return movingobjectposition == null ? false : this.a(entityhuman, world, movingobjectposition.a().shift(movingobjectposition.direction), (MovingObjectPosition) null, enumdirection, clicked, itemstack); // CraftBukkit
} else {
@@ -105,6 +100,6 @@
+ }
+ }
+ // CraftBukkit end
- if (world.worldProvider.isNether() && this.a.a(TagsFluid.a)) {
+ if (world.worldProvider.isNether() && this.fluidType.a(TagsFluid.WATER)) {
int i = blockposition.getX();
int j = blockposition.getY();
diff --git a/nms-patches/ItemChorusFruit.patch b/nms-patches/ItemChorusFruit.patch
index 70f0423c..f3167545 100644
--- a/nms-patches/ItemChorusFruit.patch
+++ b/nms-patches/ItemChorusFruit.patch
@@ -13,7 +13,7 @@
public ItemChorusFruit(int i, float f, Item.Info item_info) {
@@ -19,6 +25,20 @@
- double d4 = MathHelper.a(entityliving.locY + (double) (entityliving.getRandom().nextInt(16) - 8), 0.0D, (double) (world.aa() - 1));
+ double d4 = MathHelper.a(entityliving.locY + (double) (entityliving.getRandom().nextInt(16) - 8), 0.0D, (double) (world.ab() - 1));
double d5 = entityliving.locZ + (entityliving.getRandom().nextDouble() - 0.5D) * 16.0D;
+ // CraftBukkit start
diff --git a/nms-patches/ItemEnderPearl.patch b/nms-patches/ItemEnderPearl.patch
index baec115c..ab9eacf1 100644
--- a/nms-patches/ItemEnderPearl.patch
+++ b/nms-patches/ItemEnderPearl.patch
@@ -21,7 +21,7 @@
itemstack.subtract(1);
}
- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.k.nextFloat() * 0.4F + 0.8F));
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F));
entityhuman.getCooldownTracker().a(this, 20);
- if (!world.isClientSide) {
- EntityEnderPearl entityenderpearl = new EntityEnderPearl(world, entityhuman);
diff --git a/nms-patches/ItemFireball.patch b/nms-patches/ItemFireball.patch
index fdab04fa..b102662b 100644
--- a/nms-patches/ItemFireball.patch
+++ b/nms-patches/ItemFireball.patch
@@ -12,6 +12,6 @@
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
- world.a((EntityHuman) null, blockposition, SoundEffects.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, (ItemFireball.k.nextFloat() - ItemFireball.k.nextFloat()) * 0.2F + 1.0F);
+ world.a((EntityHuman) null, blockposition, SoundEffects.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, (ItemFireball.i.nextFloat() - ItemFireball.i.nextFloat()) * 0.2F + 1.0F);
world.setTypeUpdate(blockposition, ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition));
}
diff --git a/nms-patches/ItemFishingRod.patch b/nms-patches/ItemFishingRod.patch
index f9fd1bdc..f8d1d9d8 100644
--- a/nms-patches/ItemFishingRod.patch
+++ b/nms-patches/ItemFishingRod.patch
@@ -25,10 +25,10 @@
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
@@ -30,7 +36,7 @@
entityhuman.a(enumhand);
- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (ItemFishingRod.k.nextFloat() * 0.4F + 0.8F));
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F));
} else {
-- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.k.nextFloat() * 0.4F + 0.8F));
-+ // world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.k.nextFloat() * 0.4F + 0.8F));
+- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F));
++ // world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F));
if (!world.isClientSide) {
EntityFishingHook entityfishinghook = new EntityFishingHook(world, entityhuman);
int j = EnchantmentManager.c(itemstack);
@@ -44,7 +44,7 @@
+ entityhuman.hookedFish = null;
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
+ }
-+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.k.nextFloat() * 0.4F + 0.8F));
++ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F));
+ // CraftBukkit end
+
world.addEntity(entityfishinghook);
diff --git a/nms-patches/ItemFlintAndSteel.patch b/nms-patches/ItemFlintAndSteel.patch
index 81a7ef48..5c63e8fa 100644
--- a/nms-patches/ItemFlintAndSteel.patch
+++ b/nms-patches/ItemFlintAndSteel.patch
@@ -10,6 +10,6 @@
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
- world.a(entityhuman, blockposition, SoundEffects.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.k.nextFloat() * 0.4F + 0.8F);
+ world.a(entityhuman, blockposition, SoundEffects.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.i.nextFloat() * 0.4F + 0.8F);
IBlockData iblockdata = ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition);
diff --git a/nms-patches/ItemFood.patch b/nms-patches/ItemFood.patch
index 06317732..1cc8d578 100644
--- a/nms-patches/ItemFood.patch
+++ b/nms-patches/ItemFood.patch
@@ -3,9 +3,9 @@
@@ -36,7 +36,7 @@
protected void a(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (!world.isClientSide && this.l != null && world.random.nextFloat() < this.m) {
-- entityhuman.addEffect(new MobEffect(this.l));
-+ entityhuman.addEffect(new MobEffect(this.l), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
+ if (!world.isClientSide && this.k != null && world.random.nextFloat() < this.l) {
+- entityhuman.addEffect(new MobEffect(this.k));
++ entityhuman.addEffect(new MobEffect(this.k), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
}
}
diff --git a/nms-patches/ItemSnowball.patch b/nms-patches/ItemSnowball.patch
index 498fa712..6bb2a210 100644
--- a/nms-patches/ItemSnowball.patch
+++ b/nms-patches/ItemSnowball.patch
@@ -10,7 +10,7 @@
itemstack.subtract(1);
}
- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.k.nextFloat() * 0.4F + 0.8F));
+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F));
+ */
if (!world.isClientSide) {
EntitySnowball entitysnowball = new EntitySnowball(world, entityhuman);
@@ -22,7 +22,7 @@
+ itemstack.subtract(1);
+ }
+
-+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.k.nextFloat() * 0.4F + 0.8F));
++ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F));
+ } else if (entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch
index 7fd816b5..0e483da6 100644
--- a/nms-patches/ItemStack.patch
+++ b/nms-patches/ItemStack.patch
@@ -52,7 +52,7 @@
- private ItemStack(NBTTagCompound nbttagcompound) {
+ // CraftBukkit - break into own method
+ private void load(NBTTagCompound nbttagcompound) {
- Item item = (Item) Item.REGISTRY.get(new MinecraftKey(nbttagcompound.getString("id")));
+ Item item = (Item) IRegistry.ITEM.get(new MinecraftKey(nbttagcompound.getString("id")));
this.item = item == null ? Items.AIR : item;
this.count = nbttagcompound.getByte("Count");
@@ -86,7 +86,7 @@
BlockPosition blockposition = itemactioncontext.getClickPosition();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false);
@@ -106,12 +146,142 @@
- if (entityhuman != null && !entityhuman.abilities.mayBuild && !this.b(itemactioncontext.getWorld().E(), shapedetectorblock)) {
+ if (entityhuman != null && !entityhuman.abilities.mayBuild && !this.b(itemactioncontext.getWorld().F(), shapedetectorblock)) {
return EnumInteractionResult.PASS;
} else {
+ // CraftBukkit start - handle all block place event logic here
diff --git a/nms-patches/ItemWorldMap.patch b/nms-patches/ItemWorldMap.patch
index 237da62e..f7257b1d 100644
--- a/nms-patches/ItemWorldMap.patch
+++ b/nms-patches/ItemWorldMap.patch
@@ -16,7 +16,7 @@
public static ItemStack a(World world, int i, int j, byte b0, boolean flag, boolean flag1) {
ItemStack itemstack = new ItemStack(Items.FILLED_MAP);
-- a(itemstack, world, i, j, b0, flag, flag1, world.worldProvider.getDimensionManager().getDimensionID());
+- a(itemstack, world, i, j, b0, flag, flag1, world.worldProvider.getDimensionManager());
+ a(itemstack, world, i, j, b0, flag, flag1, ((WorldServer) world).dimension); // CraftBukkit - fixes Bukkit multiworld maps
return itemstack;
}
@@ -25,7 +25,7 @@
WorldMap worldmap = a((GeneratorAccess) world, "map_" + e(itemstack));
if (worldmap == null && !world.isClientSide) {
-- worldmap = a(itemstack, world, world.getWorldData().b(), world.getWorldData().d(), 3, false, false, world.worldProvider.getDimensionManager().getDimensionID());
+- worldmap = a(itemstack, world, world.getWorldData().b(), world.getWorldData().d(), 3, false, false, world.worldProvider.getDimensionManager());
+ worldmap = a(itemstack, world, world.getWorldData().b(), world.getWorldData().d(), 3, false, false, ((WorldServer) world).dimension); // CraftBukkit - fixes Bukkit multiworld maps
}
@@ -38,16 +38,16 @@
+ return nbttagcompound != null && nbttagcompound.hasKeyOfType("map", 99) ? nbttagcompound.getInt("map") : -1; // CraftBukkit - make new maps for no tag
}
- private static WorldMap a(ItemStack itemstack, World world, int i, int j, int k, boolean flag, boolean flag1, int l) {
-- int i1 = world.b("map");
-+ World worldMain = world.getServer().getServer().worlds.get(0); // CraftBukkit - store reference to primary world
-+ int i1 = worldMain.b("map"); // CraftBukkit - use primary world for maps
- WorldMap worldmap = new WorldMap("map_" + i1);
+ private static WorldMap a(ItemStack itemstack, World world, int i, int j, int k, boolean flag, boolean flag1, DimensionManager dimensionmanager) {
+- int l = world.a(DimensionManager.OVERWORLD, "map");
++ World worldMain = world.getServer().getServer().getWorldServer(DimensionManager.OVERWORLD); // CraftBukkit - store reference to primary world
++ int l = worldMain.a(DimensionManager.OVERWORLD, "map"); // CraftBukkit - use primary world for maps
+ WorldMap worldmap = new WorldMap("map_" + l);
- worldmap.a(i, j, k, flag, flag1, l);
-- world.a(worldmap.getId(), (PersistentBase) worldmap);
-+ worldMain.a(worldmap.getId(), (PersistentBase) worldmap); // CraftBukkit - use primary world for maps
- itemstack.getOrCreateTag().setInt("map", i1);
+ worldmap.a(i, j, k, flag, flag1, dimensionmanager);
+- world.a(DimensionManager.OVERWORLD, worldmap.getId(), (PersistentBase) worldmap);
++ worldMain.a(DimensionManager.OVERWORLD, worldmap.getId(), (PersistentBase) worldmap); // CraftBukkit - use primary world for maps
+ itemstack.getOrCreateTag().setInt("map", l);
+
+ // CraftBukkit start
+ MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
@@ -58,9 +58,9 @@
@Nullable
public static WorldMap a(GeneratorAccess generatoraccess, String s) {
-- return (WorldMap) generatoraccess.a(WorldMap::new, s);
+- return (WorldMap) generatoraccess.a(DimensionManager.OVERWORLD, WorldMap::new, s);
+ // CraftBukkit start - use primary world for maps and call event
-+ WorldMap worldmap = (WorldMap) MinecraftServer.getServer().worlds.get(0).a((id) -> {
++ WorldMap worldmap = (WorldMap) MinecraftServer.getServer().getWorldServer(DimensionManager.OVERWORLD).a(DimensionManager.OVERWORLD, (id) -> {
+ // We only get here when the data file exists, but is not a valid map
+ WorldMap newMap = new WorldMap(id);
+ MapInitializeEvent event = new MapInitializeEvent(newMap.mapView);
@@ -72,7 +72,7 @@
}
public void a(World world, Entity entity, WorldMap worldmap) {
-- if (world.worldProvider.getDimensionManager().getDimensionID() == worldmap.map && entity instanceof EntityHuman) {
+- if (world.worldProvider.getDimensionManager() == worldmap.map && entity instanceof EntityHuman) {
+ // CraftBukkit - world.worldProvider -> ((WorldServer) world)
+ if (((WorldServer) world).dimension == worldmap.map && entity instanceof EntityHuman) {
int i = 1 << worldmap.scale;
@@ -82,7 +82,7 @@
WorldMap worldmap = getSavedMap(itemstack, world);
if (worldmap != null) {
-- if (world.worldProvider.getDimensionManager().getDimensionID() == worldmap.map) {
+- if (world.worldProvider.getDimensionManager() == worldmap.map) {
+ // CraftBukkit - world.worldProvider -> ((WorldServer) world)
+ if (((WorldServer) world).dimension == worldmap.map) {
int i = 1 << worldmap.scale;
diff --git a/nms-patches/ItemWrittenBook.patch b/nms-patches/ItemWrittenBook.patch
deleted file mode 100644
index e43dd909..00000000
--- a/nms-patches/ItemWrittenBook.patch
+++ /dev/null
@@ -1,34 +0,0 @@
---- a/net/minecraft/server/ItemWrittenBook.java
-+++ b/net/minecraft/server/ItemWrittenBook.java
-@@ -62,6 +62,23 @@
-
- Object object;
-
-+ // CraftBukkit start
-+ // Some commands use the worldserver variable but we leave it full of null values,
-+ // so we must temporarily populate it with the world of the commandsender
-+ WorldServer[] prev = MinecraftServer.getServer().worldServer;
-+ MinecraftServer server = MinecraftServer.getServer();
-+ server.worldServer = new WorldServer[server.worlds.size()];
-+ server.worldServer[0] = (WorldServer) entityhuman.getWorld();
-+ int bpos = 0;
-+ for (int pos = 1; pos < server.worldServer.length; pos++) {
-+ WorldServer world = server.worlds.get(bpos++);
-+ if (server.worldServer[0] == world) {
-+ pos--;
-+ continue;
-+ }
-+ server.worldServer[pos] = world;
-+ }
-+ // CraftBukkit end
- try {
- IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.b(s);
-
-@@ -69,6 +86,7 @@
- } catch (Exception exception) {
- object = new ChatComponentText(s);
- }
-+ finally { MinecraftServer.getServer().worldServer = prev; } // CraftBukkit
-
- nbttaglist.set(i, (NBTBase) (new NBTTagString(IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) object))));
- }
diff --git a/nms-patches/LoginListener.patch b/nms-patches/LoginListener.patch
index f1671027..75e20b64 100644
--- a/nms-patches/LoginListener.patch
+++ b/nms-patches/LoginListener.patch
@@ -57,7 +57,7 @@
+ // CraftBukkit end
} else {
this.g = LoginListener.EnumProtocolState.ACCEPTED;
- if (this.server.ay() >= 0 && !this.networkManager.isLocal()) {
+ if (this.server.aw() >= 0 && !this.networkManager.isLocal()) {
@@ -94,9 +117,9 @@
if (entityplayer != null) {
@@ -72,7 +72,7 @@
@@ -141,6 +164,43 @@
- LoginListener.this.i = LoginListener.this.server.ar().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
+ LoginListener.this.i = LoginListener.this.server.ap().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
if (LoginListener.this.i != null) {
+ // CraftBukkit start - fire PlayerPreLoginEvent
+ if (!networkManager.isConnected()) {
@@ -113,7 +113,7 @@
+ // CraftBukkit end
LoginListener.c.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId());
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
- } else if (LoginListener.this.server.J()) {
+ } else if (LoginListener.this.server.H()) {
@@ -160,6 +220,11 @@
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0]));
LoginListener.c.error("Couldn\'t verify username because servers are unavailable");
diff --git a/nms-patches/LootTableInfo.patch b/nms-patches/LootTableInfo.patch
index 1c078179..44c1d298 100644
--- a/nms-patches/LootTableInfo.patch
+++ b/nms-patches/LootTableInfo.patch
@@ -53,15 +53,15 @@
}
+ // CraftBukkit start - add looting modifier
-+ public LootTableInfo.a lootingModifier(int modifier) {
++ public LootTableInfo.Builder lootingModifier(int modifier) {
+ this.lootingMod = modifier;
+ return this;
+ }
+ // CraftBukkit end
+
- public LootTableInfo a() {
-- return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().aP(), this.c, this.d, this.e, this.f);
-+ return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().aP(), this.c, this.d, this.e, this.f, this.lootingMod); // CraftBukkit add looting modifier
+ public LootTableInfo build() {
+- return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().getLootTableRegistry(), this.c, this.d, this.e, this.f);
++ return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().getLootTableRegistry(), this.c, this.d, this.e, this.f, this.lootingMod); // CraftBukkit add looting modifier
}
}
}
diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch
index 6016cba4..35218c2d 100644
--- a/nms-patches/MinecraftServer.patch
+++ b/nms-patches/MinecraftServer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
-@@ -55,6 +55,13 @@
+@@ -59,6 +59,13 @@
import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -14,13 +14,12 @@
public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable {
-@@ -125,7 +132,22 @@
+@@ -129,7 +136,21 @@
private boolean forceUpgrade;
private float ap;
- public MinecraftServer(@Nullable File file, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
+ // CraftBukkit start
-+ public List<WorldServer> worlds = new ArrayList<WorldServer>();
+ public org.bukkit.craftbukkit.CraftServer server;
+ public OptionSet options;
+ public org.bukkit.command.ConsoleCommandSender console;
@@ -38,10 +37,10 @@
this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA);
this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new);
this.ag = new CraftingManager();
-@@ -136,22 +158,51 @@
+@@ -140,22 +161,51 @@
this.al = new AdvancementDataWorld();
this.am = new CustomFunctionData(this);
- this.d = proxy;
+ this.c = proxy;
- this.commandDispatcher = commanddispatcher;
+ this.commandDispatcher = this.vanillaCommandDispatcher = commanddispatcher; // CraftBukkit
this.U = yggdrasilauthenticationservice;
@@ -49,10 +48,10 @@
this.W = gameprofilerepository;
this.X = usercache;
- this.universe = file;
-- this.m = file == null ? null : new ServerConnection(this);
+- this.l = file == null ? null : new ServerConnection(this);
- this.convertable = file == null ? null : new WorldLoaderServer(file.toPath(), file.toPath().resolve("../backups"), datafixer);
+ // this.universe = file; // CraftBukkit
-+ this.m = new ServerConnection(this); // CraftBukkit
++ this.l = new ServerConnection(this); // CraftBukkit
+ // this.convertable = file == null ? null : new WorldLoaderServer(file.toPath(), file.toPath().resolve("../backups"), datafixer); // CraftBukkit - moved to DedicatedServer.init
this.dataConverterManager = datafixer;
this.ac.a((IResourcePackListener) this.ah);
@@ -94,7 +93,7 @@
public abstract boolean init() throws IOException;
public void convertWorld(String s) {
-@@ -176,11 +227,11 @@
+@@ -180,11 +230,11 @@
}
if (this.forceUpgrade) {
@@ -109,50 +108,57 @@
IChatBaseComponent ichatbasecomponent = null;
while (!worldupgrader.b()) {
-@@ -219,9 +270,10 @@
+@@ -223,8 +273,9 @@
}
public void a(String s, String s1, long i, WorldType worldtype, JsonElement jsonelement) {
- this.convertWorld(s);
+ // this.convertWorld(s); // CraftBukkit - moved down
this.b((IChatBaseComponent) (new ChatMessage("menu.loadingLevel", new Object[0])));
- this.worldServer = new WorldServer[3];
+ /* CraftBukkit start - Remove ticktime arrays and worldsettings
- this.f = new long[this.worldServer.length][100];
- IDataManager idatamanager = this.convertable.a(s, this);
+ IDataManager idatamanager = this.getConvertable().a(s, this);
-@@ -247,40 +299,116 @@
+ this.a(this.getWorld(), idatamanager);
+@@ -249,54 +300,144 @@
}
this.a(idatamanager.getDirectory(), worlddata);
+- PersistentCollection persistentcollection = new PersistentCollection(idatamanager);
+ */
+ int worldCount = 3;
-- for (int j = 0; j < this.worldServer.length; ++j) {
-- byte b0 = 0;
+- this.a(idatamanager, persistentcollection, worlddata, worldsettings);
+- this.a(this.getDifficulty());
+- this.a(persistentcollection);
+- }
+ for (int j = 0; j < worldCount; ++j) {
+ WorldServer world;
+ WorldData worlddata;
+ byte dimension = 0;
-
- if (j == 1) {
-- b0 = -1;
++
++ if (j == 1) {
+ if (getAllowNether()) {
+ dimension = -1;
+ } else {
+ continue;
+ }
- }
++ }
- if (j == 2) {
-- b0 = 1;
+- protected void a(IDataManager idatamanager, PersistentCollection persistentcollection, WorldData worlddata, WorldSettings worldsettings) {
+- if (this.L()) {
+- this.worldServer.put(DimensionManager.OVERWORLD, (new DemoWorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler)).i_());
+- } else {
+- this.worldServer.put(DimensionManager.OVERWORLD, (new WorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler)).i_());
+- }
++ if (j == 2) {
+ if (server.getAllowEnd()) {
+ dimension = 1;
+ } else {
+ continue;
+ }
- }
++ }
+- WorldServer worldserver = this.getWorldServer(DimensionManager.OVERWORLD);
+ String worldType = org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase();
+ String name = (dimension == 0) ? s : s + "_" + worldType;
+ this.convertWorld(name); // Run conversion now
@@ -161,7 +167,7 @@
+ WorldSettings worldsettings = new WorldSettings(i, this.getGamemode(), this.getGenerateStructures(), this.isHardcore(), worldtype);
+ worldsettings.setGeneratorSettings(jsonelement);
+
- if (j == 0) {
++ if (j == 0) {
+ IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), s1, this, this.dataConverterManager);
+ worlddata = idatamanager.getWorldData();
+ if (worlddata == null) {
@@ -169,24 +175,34 @@
+ }
+ worlddata.checkName(s1); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
+ this.a(idatamanager.getDirectory(), worlddata);
- if (this.N()) {
-- this.worldServer[j] = (WorldServer) (new DemoWorldServer(this, idatamanager, worlddata, b0, this.methodProfiler)).b();
-+ world = (WorldServer) (new DemoWorldServer(this, idatamanager, worlddata, dimension, this.methodProfiler)).b();
- } else {
-- this.worldServer[j] = (WorldServer) (new WorldServer(this, idatamanager, worlddata, b0, this.methodProfiler)).b();
-+ world = (WorldServer) (new WorldServer(this, idatamanager, worlddata, dimension, this.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), gen)).b();
- }
++ PersistentCollection persistentcollection = new PersistentCollection(idatamanager);
-- this.worldServer[j].a(worldsettings);
+- worldserver.a(worldsettings);
+- worldserver.addIWorldAccess(new WorldManager(this, worldserver));
+- if (!this.H()) {
+- worldserver.getWorldData().setGameType(this.getGamemode());
+- }
++ if (this.L()) {
++ world = (WorldServer) (new DemoWorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler)).i_();
++ } else {
++ world = (WorldServer) (new WorldServer(this, idatamanager, persistentcollection, worlddata, DimensionManager.OVERWORLD, this.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), gen)).i_();
++ }
+
+- SecondaryWorldServer secondaryworldserver = (new SecondaryWorldServer(this, idatamanager, DimensionManager.NETHER, worldserver, this.methodProfiler)).b();
+ world.a(worldsettings);
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
- } else {
-- this.worldServer[j] = (WorldServer) (new SecondaryWorldServer(this, idatamanager, b0, this.worldServer[0], this.methodProfiler)).b();
++ } else {
+ String dim = "DIM" + dimension;
-+
+
+- this.worldServer.put(DimensionManager.NETHER, secondaryworldserver);
+- secondaryworldserver.addIWorldAccess(new WorldManager(this, secondaryworldserver));
+- if (!this.H()) {
+- secondaryworldserver.getWorldData().setGameType(this.getGamemode());
+- }
+ File newWorld = new File(new File(name), dim);
+ File oldWorld = new File(new File(s), dim);
-+
+
+- SecondaryWorldServer secondaryworldserver1 = (new SecondaryWorldServer(this, idatamanager, DimensionManager.THE_END, worldserver, this.methodProfiler)).b();
+ if ((!newWorld.isDirectory()) && (oldWorld.isDirectory())) {
+ MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder required ----");
+ MinecraftServer.LOGGER.info("Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly.");
@@ -216,7 +232,12 @@
+ MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder failed ----");
+ }
+ }
-+
+
+- this.worldServer.put(DimensionManager.THE_END, secondaryworldserver1);
+- secondaryworldserver1.addIWorldAccess(new WorldManager(this, secondaryworldserver1));
+- if (!this.H()) {
+- secondaryworldserver1.getWorldData().setGameType(this.getGamemode());
+- }
+ IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), name, this, this.dataConverterManager);
+ // world =, b0 to dimension, s1 to name, added Environment and gen
+ worlddata = idatamanager.getWorldData();
@@ -224,35 +245,32 @@
+ worlddata = new WorldData(worldsettings, name);
+ }
+ worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
-+ world = (WorldServer) new SecondaryWorldServer(this, idatamanager, dimension, this.worlds.get(0), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen).b();
- }
-
-- this.worldServer[j].addIWorldAccess(new WorldManager(this, this.worldServer[j]));
++ world = (WorldServer) new SecondaryWorldServer(this, idatamanager, DimensionManager.a(dimension), this.getWorldServer(DimensionManager.OVERWORLD), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen).b();
++ }
++
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld()));
+
+ world.addIWorldAccess(new WorldManager(this, world));
- if (!this.J()) {
-- this.worldServer[j].getWorldData().setGameType(this.getGamemode());
++ if (!this.H()) {
+ world.getWorldData().setGameType(this.getGamemode());
- }
-- }
++ }
++
++ this.worldServer.put(world.dimension, world);
++ this.getPlayerList().setPlayerFileData(world);
-- this.s.setPlayerFileData(this.worldServer);
+- this.getPlayerList().setPlayerFileData(worldserver);
- if (worlddata.P() != null) {
-- this.aR().a(worlddata.P());
-+ worlds.add(world);
-+ getPlayerList().setPlayerFileData(worlds.toArray(new WorldServer[worlds.size()]));
-+
+- this.aP().a(worlddata.P());
+ if (worlddata.P() != null) {
-+ this.aR().a(worlddata.P());
++ this.aP().a(worlddata.P());
+ }
}
-+ this.s.setPlayerFileData(this.worldServer);
++ this.a(this.getDifficulty());
++ this.a(this.getWorldServer(DimensionManager.OVERWORLD).worldMaps);
+ // CraftBukkit end
- this.a(this.getDifficulty());
- this.g_();
-@@ -289,6 +417,25 @@
+ }
+
protected void a(File file, WorldData worlddata) {
this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla()));
this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks"));
@@ -278,12 +296,13 @@
this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder);
this.resourcePackRepository.a();
ArrayList arraylist = Lists.newArrayList();
-@@ -319,41 +466,52 @@
+@@ -325,42 +466,52 @@
+ boolean flag4 = true;
+
this.b((IChatBaseComponent) (new ChatMessage("menu.generatingTerrain", new Object[0])));
- boolean flag5 = false;
+- WorldServer worldserver = this.getWorldServer(DimensionManager.OVERWORLD);
-- MinecraftServer.LOGGER.info("Preparing start region for level 0");
-- WorldServer worldserver = this.worldServer[0];
+- MinecraftServer.LOGGER.info("Preparing start region for dimension " + DimensionManager.a(worldserver.worldProvider.getDimensionManager()));
- BlockPosition blockposition = worldserver.getSpawn();
- ArrayList arraylist = Lists.newArrayList();
- Set set = Sets.newConcurrentHashSet();
@@ -293,9 +312,8 @@
- for (int i = -192; i <= 192 && this.isRunning(); i += 16) {
- for (int j = -192; j <= 192 && this.isRunning(); j += 16) {
- arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4));
-+ for (int m = 0; m < worlds.size(); m++) {
-+ WorldServer worldserver = this.worlds.get(m);
-+ MinecraftServer.LOGGER.info("Preparing start region for level " + m + " (Seed: " + worldserver.getSeed() + ")");
++ for (WorldServer worldserver : this.getWorlds()) {
++ MinecraftServer.LOGGER.info("Preparing start region for level " + worldserver.dimension + " (Seed: " + worldserver.getSeed() + ")");
+ if (!worldserver.getWorld().getKeepSpawnInMemory()) {
+ continue;
}
@@ -306,6 +324,11 @@
+ BlockPosition blockposition = worldserver.getSpawn();
+ ArrayList arraylist = Lists.newArrayList();
+ Set set = Sets.newConcurrentHashSet();
++
++ for (int i = -192; i <= 192 && this.isRunning(); i += 16) {
++ for (int j = -192; j <= 192 && this.isRunning(); j += 16) {
++ arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4));
++ }
- while (!completablefuture.isDone()) {
- try {
@@ -316,18 +339,10 @@
- if (executionexception.getCause() instanceof RuntimeException) {
- throw (RuntimeException) executionexception.getCause();
- }
-+ for (int i = -192; i <= 192 && this.isRunning(); i += 16) {
-+ for (int j = -192; j <= 192 && this.isRunning(); j += 16) {
-+ arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4));
-+ }
-+
+ CompletableFuture completablefuture = worldserver.getChunkProviderServer().a((Iterable) arraylist, (chunk) -> {
+ set.add(chunk.getPos());
+ });
-
-- throw new RuntimeException(executionexception.getCause());
-- } catch (TimeoutException timeoutexception) {
-- this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / 625);
++
+ while (!completablefuture.isDone()) {
+ try {
+ completablefuture.get(1L, TimeUnit.SECONDS);
@@ -337,7 +352,10 @@
+ if (executionexception.getCause() instanceof RuntimeException) {
+ throw (RuntimeException) executionexception.getCause();
+ }
-+
+
+- throw new RuntimeException(executionexception.getCause());
+- } catch (TimeoutException timeoutexception) {
+- this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / 625);
+ throw new RuntimeException(executionexception.getCause());
+ } catch (TimeoutException timeoutexception) {
+ this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / 625);
@@ -350,34 +368,22 @@
+ }
}
-+ for (WorldServer world : this.worlds) {
++ for (WorldServer world : this.getWorlds()) {
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(world.getWorld()));
+ }
+ // CraftBukkit end
- this.m();
MinecraftServer.LOGGER.info("Time elapsed: {} ms", Long.valueOf(stopwatch.elapsed(TimeUnit.MILLISECONDS)));
- }
-@@ -392,14 +550,17 @@
- protected void m() {
+ Iterator iterator = DimensionManager.b().iterator();
+
+@@ -419,6 +570,7 @@
+ protected void l() {
this.w = null;
this.x = 0;
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD); // CraftBukkit
}
protected void saveChunks(boolean flag) {
- WorldServer[] aworldserver = this.worldServer;
- int i = aworldserver.length;
-
-- for (int j = 0; j < i; ++j) {
-- WorldServer worldserver = aworldserver[j];
-+ // CraftBukkit start
-+ for (int j = 0; j < worlds.size(); ++j) {
-+ WorldServer worldserver = worlds.get(j);
-+ // CraftBukkit end
-
- if (worldserver != null) {
- if (!flag) {
-@@ -416,8 +577,24 @@
+@@ -442,8 +594,24 @@
}
@@ -403,41 +409,15 @@
if (this.getServerConnection() != null) {
this.getServerConnection().b();
}
-@@ -426,6 +603,7 @@
+@@ -452,6 +620,7 @@
MinecraftServer.LOGGER.info("Saving players");
this.s.savePlayers();
this.s.u();
+ try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
- if (this.worldServer != null) {
-@@ -436,8 +614,10 @@
- int j;
- WorldServer worldserver;
-
-- for (j = 0; j < i; ++j) {
-- worldserver = aworldserver[j];
-+ // CraftBukkit start
-+ for (j = 0; j < worlds.size(); ++j) {
-+ worldserver = worlds.get(j);
-+ // CraftBukkit end
- if (worldserver != null) {
- worldserver.savingDisabled = false;
- }
-@@ -447,8 +627,10 @@
- aworldserver = this.worldServer;
- i = aworldserver.length;
-
-- for (j = 0; j < i; ++j) {
-- worldserver = aworldserver[j];
-+ // CraftBukkit start
-+ for (j = 0; j < worlds.size(); ++j) {
-+ worldserver = worlds.get(j);
-+ // CraftBukkit end
- if (worldserver != null) {
- worldserver.close();
- }
-@@ -491,11 +673,13 @@
+ MinecraftServer.LOGGER.info("Saving worlds");
+@@ -516,11 +685,13 @@
if (i > 2000L && this.aa - this.Q >= 15000L) {
long j = i / 50L;
@@ -448,10 +428,10 @@
}
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
- this.v();
+ this.a(this::aT);
this.aa += 50L;
-@@ -534,6 +718,12 @@
+@@ -559,6 +730,12 @@
} catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally {
@@ -461,11 +441,11 @@
+ } catch (Exception ignored) {
+ }
+ // CraftBukkit end
- this.u();
+ this.t();
}
-@@ -602,7 +792,7 @@
- this.n.b().a(agameprofile);
+@@ -627,7 +804,7 @@
+ this.m.b().a(agameprofile);
}
- if (this.ticks % 900 == 0) {
@@ -473,18 +453,19 @@
this.methodProfiler.a("save");
this.s.savePlayers();
this.saveChunks(true);
-@@ -628,6 +818,7 @@
+@@ -653,6 +830,7 @@
}
- public void w() {
+ public void b(BooleanSupplier booleansupplier) {
+ this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit
this.methodProfiler.a("jobs");
FutureTask futuretask;
-@@ -640,22 +831,40 @@
+@@ -665,23 +843,40 @@
this.getFunctionData().Y_();
this.methodProfiler.c("levels");
+- WorldServer worldserver;
+ // CraftBukkit start
+ // Run tasks that are waiting on processing
+ while (!processQueue.isEmpty()) {
@@ -501,41 +482,34 @@
+ }
+ }
+
- int i;
-
-- for (i = 0; i < this.worldServer.length; ++i) {
-+ for (i = 0; i < this.worlds.size(); ++i) { // CraftBukkit
- long j = SystemUtils.c();
-
-- if (i == 0 || this.getAllowNether()) {
-- WorldServer worldserver = this.worldServer[i];
-+ if (true || i == 0 || this.getAllowNether()) { // CraftBukkit
-+ WorldServer worldserver = this.worlds.get(i);
-
++ // WorldServer worldserver; // CraftBukkit - dropped down
+ long i;
+
+- for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();((long[]) this.e.computeIfAbsent(worldserver.worldProvider.getDimensionManager(), (dimensionmanager) -> {
+- return new long[100];
+- }))[this.ticks % 100] = SystemUtils.c() - i) {
+- worldserver = (WorldServer) iterator.next();
++ // CraftBukkit - dropTickTime
++ for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();) {
++ WorldServer worldserver = (WorldServer) iterator.next();
+ i = SystemUtils.c();
+- if (worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) {
++ if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit
this.methodProfiler.a(() -> {
return worldserver.getWorldData().getName();
});
+ /* Drop global time updates
if (this.ticks % 20 == 0) {
this.methodProfiler.a("timeSync");
- this.s.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))), worldserver.worldProvider.getDimensionManager().getDimensionID());
+ this.s.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))), worldserver.worldProvider.getDimensionManager());
this.methodProfiler.e();
}
+ // CraftBukkit end */
this.methodProfiler.a("tick");
-@@ -684,7 +893,7 @@
- this.methodProfiler.e();
- }
-
-- this.f[i][this.ticks % 100] = SystemUtils.c() - j;
-+ // this.f[i][this.ticks % 100] = SystemUtils.c() - j; // CraftBukkit
- }
-
- this.methodProfiler.c("connection");
-@@ -708,10 +917,11 @@
- this.l.add(itickable);
+@@ -732,10 +927,11 @@
+ this.k.add(itickable);
}
- public static void main(String[] astring) {
@@ -547,7 +521,7 @@
boolean flag = true;
String s = null;
String s1 = ".";
-@@ -759,13 +969,16 @@
+@@ -783,13 +979,16 @@
++j;
}
}
@@ -565,7 +539,7 @@
if (s != null) {
dedicatedserver.h(s);
}
-@@ -803,6 +1016,29 @@
+@@ -827,6 +1026,29 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER));
Runtime.getRuntime().addShutdownHook(thread);
@@ -595,10 +569,10 @@
} catch (Exception exception) {
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
}
-@@ -814,11 +1050,13 @@
+@@ -838,11 +1060,13 @@
}
- public void y() {
+ public void v() {
+ /* CraftBukkit start - prevent abuse
this.serverThread = new Thread(this, "Server thread");
this.serverThread.setUncaughtExceptionHandler((thread, throwable) -> {
@@ -609,28 +583,7 @@
}
public File c(String s) {
-@@ -834,11 +1072,18 @@
- }
-
- public WorldServer getWorldServer(int i) {
-- return i == -1 ? this.worldServer[1] : (i == 1 ? this.worldServer[2] : this.worldServer[0]);
-+ // CraftBukkit start
-+ for (WorldServer world : worlds) {
-+ if (world.dimension == i) {
-+ return world;
-+ }
-+ }
-+ return worlds.get(0);
-+ // CraftBukkit end
- }
-
- public WorldServer a(DimensionManager dimensionmanager) {
-- return dimensionmanager == DimensionManager.NETHER ? this.worldServer[1] : (dimensionmanager == DimensionManager.THE_END ? this.worldServer[2] : this.worldServer[0]);
-+ return dimensionmanager == DimensionManager.NETHER ? this.worlds.get(1) : (dimensionmanager == DimensionManager.THE_END ? this.worlds.get(2) : this.worlds.get(0)); // CraftBukkit
- }
-
- public String getVersion() {
-@@ -858,7 +1103,7 @@
+@@ -882,7 +1106,7 @@
}
public boolean isDebugging() {
@@ -639,7 +592,7 @@
}
public void f(String s) {
-@@ -873,7 +1118,7 @@
+@@ -897,7 +1121,7 @@
}
public String getServerModName() {
@@ -648,52 +601,17 @@
}
public CrashReport b(CrashReport crashreport) {
-@@ -909,7 +1154,7 @@
+@@ -933,7 +1157,7 @@
}
- public boolean F() {
+ public boolean D() {
- return this.universe != null;
+ return true; // CraftBukkit
}
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
-@@ -953,11 +1198,13 @@
- }
-
- public void a(EnumDifficulty enumdifficulty) {
-- WorldServer[] aworldserver = this.worldServer;
-- int i = aworldserver.length;
-+ // CraftBukkit start
-+ // WorldServer[] aworldserver = this.worldServer;
-+ int i = this.worlds.size();
-
- for (int j = 0; j < i; ++j) {
-- WorldServer worldserver = aworldserver[j];
-+ WorldServer worldserver = this.worlds.get(j);
-+ // CraftBukkit end
-
- if (worldserver != null) {
- if (worldserver.getWorldData().isHardcore()) {
-@@ -1024,13 +1271,11 @@
- int i = 0;
-
- if (this.worldServer != null) {
-- WorldServer[] aworldserver = this.worldServer;
-- int j = aworldserver.length;
--
-- for (int k = 0; k < j; ++k) {
-- WorldServer worldserver = aworldserver[k];
--
-+ // CraftBukkit start
-+ for (int j = 0; j < this.worlds.size(); ++j) {
-+ WorldServer worldserver = this.worlds.get(j);
- if (worldserver != null) {
-+ // CraftBukkit end
- WorldData worlddata = worldserver.getWorldData();
-
- mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimensionManager().getDimensionID()));
-@@ -1056,7 +1301,7 @@
- public abstract boolean S();
+@@ -1073,7 +1297,7 @@
+ public abstract boolean Q();
public boolean getOnlineMode() {
- return this.onlineMode;
@@ -701,24 +619,7 @@
}
public void setOnlineMode(boolean flag) {
-@@ -1138,13 +1383,9 @@
- public abstract boolean af();
-
- public void setGamemode(EnumGamemode enumgamemode) {
-- WorldServer[] aworldserver = this.worldServer;
-- int i = aworldserver.length;
--
-- for (int j = 0; j < i; ++j) {
-- WorldServer worldserver = aworldserver[j];
--
-- worldserver.getWorldData().setGameType(enumgamemode);
-+ // CraftBukkit start
-+ for (int i = 0; i < this.worlds.size(); ++i) {
-+ worlds.get(i).getWorldData().setGameType(enumgamemode);
- }
-
- }
-@@ -1217,7 +1458,7 @@
+@@ -1233,7 +1457,7 @@
public <V> ListenableFuture<V> a(Callable<V> callable) {
Validate.notNull(callable);
@@ -726,17 +627,8 @@
+ if (!this.isMainThread()) { // CraftBukkit && !this.isStopped()) {
ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable);
- this.g.add(listenablefuturetask);
-@@ -1274,7 +1515,7 @@
- } else {
- this.getPlayerList().savePlayers();
- this.resourcePackRepository.a();
-- this.a(this.worldServer[0].getWorldData());
-+ this.a(this.worlds.get(0).getWorldData()); // CraftBukkit
- this.getPlayerList().reload();
- }
- }
-@@ -1288,8 +1529,8 @@
+ this.f.add(listenablefuturetask);
+@@ -1304,8 +1528,8 @@
if (!worlddata.N().contains(resourcepackloader.e()) && !arraylist.contains(resourcepackloader)) {
MinecraftServer.LOGGER.info("Found new data pack {}, loading it automatically", resourcepackloader.e());
@@ -747,7 +639,7 @@
}, false);
}
}
-@@ -1298,7 +1539,7 @@
+@@ -1314,7 +1538,7 @@
ArrayList arraylist1 = Lists.newArrayList();
this.resourcePackRepository.d().forEach((resourcepackloader) -> {
@@ -756,25 +648,7 @@
});
this.ac.a((List) arraylist1);
worlddata.O().clear();
-@@ -1348,7 +1589,7 @@
- }
-
- public CommandListenerWrapper getServerCommandListener() {
-- return new CommandListenerWrapper(this, this.worldServer[0] == null ? Vec3D.a : new Vec3D(this.worldServer[0].getSpawn()), Vec2F.a, this.worldServer[0], 4, "Server", new ChatComponentText("Server"), this, (Entity) null);
-+ return new CommandListenerWrapper(this, this.worlds.isEmpty() ? Vec3D.a : new Vec3D(this.worlds.get(0).getSpawn()), Vec2F.a, this.worlds.isEmpty() ? null : this.worlds.get(0), 4, "Server", new ChatComponentText("Server"), this, (Entity) null); // CraftBukkit
- }
-
- public boolean a() {
-@@ -1376,7 +1617,7 @@
- }
-
- public GameRules aQ() {
-- return this.worldServer[0].getGameRules();
-+ return this.worlds.get(0).getGameRules(); // CraftBukkit
- }
-
- public BossBattleCustomData aR() {
-@@ -1400,4 +1641,11 @@
+@@ -1416,4 +1640,11 @@
return 0;
}
}
diff --git a/nms-patches/MobEffectList.patch b/nms-patches/MobEffectList.patch
index 2d7984c9..ce7747c8 100644
--- a/nms-patches/MobEffectList.patch
+++ b/nms-patches/MobEffectList.patch
@@ -11,17 +11,17 @@
+
public class MobEffectList {
- public static final RegistryMaterials<MinecraftKey, MobEffectList> REGISTRY = new RegistryMaterials();
-@@ -26,7 +31,7 @@
+ private final Map<IAttribute, AttributeModifier> a = Maps.newHashMap();
+@@ -25,7 +30,7 @@
}
public static int getId(MobEffectList mobeffectlist) {
-- return MobEffectList.REGISTRY.a((Object) mobeffectlist);
-+ return MobEffectList.REGISTRY.a(mobeffectlist); // CraftBukkit - decompile error
+- return IRegistry.MOB_EFFECT.a((Object) mobeffectlist);
++ return IRegistry.MOB_EFFECT.a(mobeffectlist); // CraftBukkit - decompile error
}
protected MobEffectList(boolean flag, int i) {
-@@ -48,11 +53,11 @@
+@@ -47,11 +52,11 @@
public void tick(EntityLiving entityliving, int i) {
if (this == MobEffects.REGENERATION) {
if (entityliving.getHealth() < entityliving.getMaxHealth()) {
@@ -35,7 +35,7 @@
}
} else if (this == MobEffects.WITHER) {
entityliving.damageEntity(DamageSource.WITHER, 1.0F);
-@@ -60,14 +65,25 @@
+@@ -59,14 +64,25 @@
((EntityHuman) entityliving).applyExhaustion(0.005F * (float) (i + 1));
} else if (this == MobEffects.SATURATION && entityliving instanceof EntityHuman) {
if (!entityliving.world.isClientSide) {
@@ -63,7 +63,7 @@
}
}
-@@ -88,7 +104,7 @@
+@@ -87,7 +103,7 @@
}
} else {
j = (int) (d0 * (double) (4 << i) + 0.5D);
@@ -72,12 +72,12 @@
}
}
-@@ -217,6 +233,11 @@
+@@ -216,6 +232,11 @@
a(28, "slow_falling", (new MobEffectList(false, 16773073)).b(8, 0).l());
a(29, "conduit_power", (new MobEffectList(false, 1950417)).b(9, 0).l());
a(30, "dolphins_grace", (new MobEffectList(false, 8954814)).b(10, 0).l());
+ // CraftBukkit start
-+ for (Object effect : REGISTRY) {
++ for (Object effect : IRegistry.MOB_EFFECT) {
+ org.bukkit.potion.PotionEffectType.registerPotionEffectType(new org.bukkit.craftbukkit.potion.CraftPotionEffectType((MobEffectList) effect));
+ }
+ // CraftBukkit end
diff --git a/nms-patches/MobSpawnerAbstract.patch b/nms-patches/MobSpawnerAbstract.patch
index abcecdf9..e9c46ee5 100644
--- a/nms-patches/MobSpawnerAbstract.patch
+++ b/nms-patches/MobSpawnerAbstract.patch
@@ -3,7 +3,7 @@
@@ -41,6 +41,7 @@
public void setMobName(EntityTypes<?> entitytypes) {
- this.spawnData.b().setString("id", ((MinecraftKey) EntityTypes.REGISTRY.b(entitytypes)).toString());
+ this.spawnData.b().setString("id", IRegistry.ENTITY_TYPE.getKey(entitytypes).toString());
+ this.mobs.clear(); // CraftBukkit - SPIGOT-3496, MC-92282
}
diff --git a/nms-patches/PacketPlayOutPlayerListHeaderFooter.patch b/nms-patches/PacketPlayOutPlayerListHeaderFooter.patch
deleted file mode 100644
index f3857ef6..00000000
--- a/nms-patches/PacketPlayOutPlayerListHeaderFooter.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
-+++ b/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
-@@ -4,8 +4,8 @@
-
- public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListenerPlayOut> {
-
-- private IChatBaseComponent a;
-- private IChatBaseComponent b;
-+ public IChatBaseComponent a; // PAIL
-+ public IChatBaseComponent b; // PAIL
-
- public PacketPlayOutPlayerListHeaderFooter() {}
-
diff --git a/nms-patches/PathfinderGoalHorseTrap.patch b/nms-patches/PathfinderGoalHorseTrap.patch
index ae35ba73..47730fe0 100644
--- a/nms-patches/PathfinderGoalHorseTrap.patch
+++ b/nms-patches/PathfinderGoalHorseTrap.patch
@@ -18,7 +18,7 @@
}
@@ -42,7 +43,7 @@
- entityhorseskeleton.dj();
+ entityhorseskeleton.di();
entityhorseskeleton.setTamed(true);
entityhorseskeleton.setAgeRaw(0);
- entityhorseskeleton.world.addEntity(entityhorseskeleton);
diff --git a/nms-patches/PathfinderGoalVillagerFarm.patch b/nms-patches/PathfinderGoalVillagerFarm.patch
index 0a27e7e8..19116f1a 100644
--- a/nms-patches/PathfinderGoalVillagerFarm.patch
+++ b/nms-patches/PathfinderGoalVillagerFarm.patch
@@ -11,7 +11,7 @@
+ }
+ // CraftBukkit end
} else if (this.i == 1 && iblockdata.isAir()) {
- InventorySubcontainer inventorysubcontainer = this.f.dE();
+ InventorySubcontainer inventorysubcontainer = this.f.dD();
@@ -49,19 +53,28 @@
boolean flag = false;
diff --git a/nms-patches/PlayerChunk.patch b/nms-patches/PlayerChunk.patch
index e9e5e79c..14c17553 100644
--- a/nms-patches/PlayerChunk.patch
+++ b/nms-patches/PlayerChunk.patch
@@ -31,7 +31,7 @@
+ private Runnable loadedRunnable = new Runnable() {
+ public void run() {
+ loadInProgress = false;
-+ PlayerChunk.this.chunk = PlayerChunk.this.playerChunkMap.getWorld().getChunkProviderServer().getOrLoadChunkAt(location.x, location.z);
++ PlayerChunk.this.chunk = PlayerChunk.this.playerChunkMap.getWorld().getChunkProviderServer().getChunkAt(location.x, location.z, true, true);
+ }
+ };
+ // CraftBukkit end
diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch
index 42e0d82e..f2f7b896 100644
--- a/nms-patches/PlayerConnection.patch
+++ b/nms-patches/PlayerConnection.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/PlayerConnection.java
+++ b/net/minecraft/server/PlayerConnection.java
-@@ -15,6 +15,50 @@
+@@ -17,6 +17,50 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -51,7 +51,7 @@
public class PlayerConnection implements PacketListenerPlayIn, ITickable {
private static final Logger LOGGER = LogManager.getLogger();
-@@ -25,7 +69,10 @@
+@@ -27,7 +71,10 @@
private long f;
private boolean g;
private long h;
@@ -63,7 +63,7 @@
private int j;
private final IntHashMap<Short> k = new IntHashMap();
private double l;
-@@ -57,7 +104,33 @@
+@@ -59,7 +106,33 @@
networkmanager.setPacketListener(this);
this.player = entityplayer;
entityplayer.playerConnection = this;
@@ -97,7 +97,7 @@
public void Y_() {
this.syncPosition();
-@@ -103,7 +176,7 @@
+@@ -105,7 +178,7 @@
this.minecraftServer.methodProfiler.a("keepAlive");
long i = SystemUtils.b();
@@ -106,7 +106,7 @@
if (this.g) {
this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
} else {
-@@ -115,15 +188,21 @@
+@@ -117,15 +190,21 @@
}
this.minecraftServer.methodProfiler.e();
@@ -128,7 +128,7 @@
this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0]));
}
-@@ -142,16 +221,46 @@
+@@ -144,16 +223,46 @@
return this.networkManager;
}
@@ -176,11 +176,11 @@
}
public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) {
-@@ -190,7 +299,34 @@
+@@ -192,7 +301,34 @@
double d9 = entity.motX * entity.motX + entity.motY * entity.motY + entity.motZ * entity.motZ;
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
-- if (d10 - d9 > 100.0D && (!this.minecraftServer.J() || !this.minecraftServer.I().equals(entity.getDisplayName().getString()))) {
+- if (d10 - d9 > 100.0D && (!this.minecraftServer.H() || !this.minecraftServer.G().equals(entity.getDisplayName().getString()))) {
+
+ // CraftBukkit start - handle custom speeds and skipped ticks
+ this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
@@ -207,12 +207,12 @@
+ }
+ speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
+
-+ if (d10 - d9 > Math.max(100.0D, Math.pow((double) (10.0F * (float) i * speed), 2)) && (!this.minecraftServer.J() || !this.minecraftServer.I().equals(entity.getDisplayName().getString()))) {
++ if (d10 - d9 > Math.max(100.0D, Math.pow((double) (10.0F * (float) i * speed), 2)) && (!this.minecraftServer.H() || !this.minecraftServer.G().equals(entity.getDisplayName().getString()))) {
+ // CraftBukkit end
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8));
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
return;
-@@ -228,6 +364,62 @@
+@@ -230,6 +366,62 @@
return;
}
@@ -275,16 +275,16 @@
this.minecraftServer.getPlayerList().d(this.player);
this.player.checkMovement(this.player.locX - d0, this.player.locY - d1, this.player.locZ - d2);
this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && !worldserver.a(entity.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D));
-@@ -241,7 +433,7 @@
+@@ -243,7 +435,7 @@
public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) {
PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer());
- if (packetplayinteleportaccept.b() == this.teleportAwait) {
+ if (packetplayinteleportaccept.b() == this.teleportAwait && this.teleportPos != null) { // CraftBukkit
this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
- if (this.player.H()) {
- this.o = this.teleportPos.x;
-@@ -287,10 +479,17 @@
+ this.o = this.teleportPos.x;
+ this.p = this.teleportPos.y;
+@@ -289,6 +481,12 @@
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer());
@@ -294,7 +294,11 @@
+ return;
+ }
+ // CraftBukkit end
- ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(packetplayintabcomplete.c(), this.player.getCommandListener());
+ StringReader stringreader = new StringReader(packetplayintabcomplete.c());
+
+ if (stringreader.canRead() && stringreader.peek() == 47) {
+@@ -298,7 +496,8 @@
+ ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions));
@@ -303,7 +307,7 @@
});
}
-@@ -484,6 +683,14 @@
+@@ -492,6 +691,15 @@
}
public void a(PacketPlayInBEdit packetplayinbedit) {
@@ -314,23 +318,28 @@
+ return;
+ }
+ this.lastBookTick = MinecraftServer.currentTick;
++ EnumItemSlot enumitemslot = packetplayinbedit.d() == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND;
+ // CraftBukkit end
ItemStack itemstack = packetplayinbedit.b();
if (!itemstack.isEmpty()) {
-@@ -508,9 +715,10 @@
+@@ -516,11 +724,13 @@
}
itemstack2.a("pages", (NBTBase) nbttaglist);
-- this.player.setSlot(EnumItemSlot.MAINHAND, itemstack2);
-+ CraftEventFactory.handleEditBookEvent(player, itemstack2); // CraftBukkit
+- EnumItemSlot enumitemslot = packetplayinbedit.d() == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND;
++ // EnumItemSlot enumitemslot = packetplayinbedit.d() == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND; // CraftBukkit - Moved up
+
+- this.player.setSlot(enumitemslot, itemstack2);
++ this.player.setSlot(enumitemslot, CraftEventFactory.handleEditBookEvent(player, enumitemslot, itemstack1, itemstack2)); // CraftBukkit
} else {
++ ItemStack old = itemstack1.cloneItemStack(); // CraftBukkit
itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
-+ CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
++ CraftEventFactory.handleEditBookEvent(player, enumitemslot, old, itemstack1); // CraftBukkit
}
}
-@@ -550,7 +758,7 @@
+@@ -560,7 +770,7 @@
} else {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
@@ -339,7 +348,7 @@
if (this.e == 0) {
this.syncPosition();
}
-@@ -560,13 +768,21 @@
+@@ -570,13 +780,21 @@
this.A = this.e;
this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
}
@@ -362,7 +371,7 @@
double d0 = this.player.locX;
double d1 = this.player.locY;
double d2 = this.player.locZ;
-@@ -591,15 +807,33 @@
+@@ -601,15 +819,33 @@
++this.receivedMovePackets;
int i = this.receivedMovePackets - this.processedMovePackets;
@@ -392,13 +401,13 @@
if (!this.player.H() && (!this.player.getWorldServer().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.dc())) {
float f2 = this.player.dc() ? 300.0F : 100.0F;
-- if (d11 - d10 > (double) (f2 * (float) i) && (!this.minecraftServer.J() || !this.minecraftServer.I().equals(this.player.getProfile().getName()))) {
-+ if (d11 - d10 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && (!this.minecraftServer.J() || !this.minecraftServer.I().equals(this.player.getProfile().getName()))) {
+- if (d11 - d10 > (double) (f2 * (float) i) && (!this.minecraftServer.H() || !this.minecraftServer.G().equals(this.player.getProfile().getName()))) {
++ if (d11 - d10 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && (!this.minecraftServer.H() || !this.minecraftServer.G().equals(this.player.getProfile().getName()))) {
+ // CraftBukkit end
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9));
this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch);
return;
-@@ -645,6 +879,69 @@
+@@ -655,6 +891,69 @@
}
}
@@ -468,7 +477,7 @@
this.B = d12 >= -0.03125D;
this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly;
this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.dc() && !worldserver.a(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D));
-@@ -662,10 +959,76 @@
+@@ -672,10 +971,76 @@
}
public void a(double d0, double d1, double d2, float f, float f1) {
@@ -546,7 +555,7 @@
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX : 0.0D;
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY : 0.0D;
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ : 0.0D;
-@@ -677,6 +1040,14 @@
+@@ -687,6 +1052,14 @@
this.teleportAwait = 0;
}
@@ -561,7 +570,7 @@
this.A = this.e;
this.player.setLocation(d0, d1, d2, f, f1);
this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait));
-@@ -684,6 +1055,7 @@
+@@ -694,6 +1067,7 @@
public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer());
@@ -569,7 +578,7 @@
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
BlockPosition blockposition = packetplayinblockdig.b();
-@@ -693,14 +1065,46 @@
+@@ -703,14 +1077,46 @@
if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.b(EnumHand.OFF_HAND);
@@ -618,7 +627,7 @@
this.player.a(false);
}
-@@ -734,7 +1138,15 @@
+@@ -744,7 +1150,15 @@
if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
this.player.playerInteractManager.a(blockposition, packetplayinblockdig.c());
} else {
@@ -634,7 +643,7 @@
}
} else {
if (packetplayinblockdig.d() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) {
-@@ -754,10 +1166,12 @@
+@@ -764,10 +1178,12 @@
default:
throw new IllegalArgumentException("Invalid player action");
}
@@ -647,7 +656,7 @@
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
EnumHand enumhand = packetplayinuseitem.d();
ItemStack itemstack = this.player.b(enumhand);
-@@ -770,6 +1184,13 @@
+@@ -780,6 +1196,13 @@
this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, ChatMessageType.GAME_INFO));
} else if (this.teleportPos == null && this.player.d((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
@@ -661,7 +670,7 @@
this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.e(), packetplayinuseitem.f(), packetplayinuseitem.g());
}
-@@ -779,13 +1200,52 @@
+@@ -789,13 +1212,52 @@
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer());
@@ -715,18 +724,7 @@
}
}
-@@ -796,8 +1256,8 @@
- WorldServer[] aworldserver = this.minecraftServer.worldServer;
- int i = aworldserver.length;
-
-- for (int j = 0; j < i; ++j) {
-- WorldServer worldserver = aworldserver[j];
-+ // CraftBukkit - use the worlds array list
-+ for (WorldServer worldserver : minecraftServer.worlds) {
-
- if (worldserver != null) {
- entity = packetplayinspectate.a(worldserver);
-@@ -808,13 +1268,18 @@
+@@ -815,13 +1277,18 @@
}
if (entity != null) {
@@ -747,7 +745,7 @@
public void a(PacketPlayInBoatMove packetplayinboatmove) {
PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.getWorldServer());
-@@ -827,11 +1292,26 @@
+@@ -834,11 +1301,26 @@
}
public void a(IChatBaseComponent ichatbasecomponent) {
@@ -761,7 +759,7 @@
PlayerConnection.LOGGER.info("{} lost connection: {}", this.player.getDisplayName().getString(), ichatbasecomponent.getString());
+ // CraftBukkit start - Replace vanilla quit message handling with our own.
+ /*
- this.minecraftServer.av();
+ this.minecraftServer.at();
this.minecraftServer.getPlayerList().sendMessage((new ChatMessage("multiplayer.player.left", new Object[] { this.player.getScoreboardDisplayName()})).a(EnumChatFormat.YELLOW));
+ */
+
@@ -772,10 +770,10 @@
+ this.minecraftServer.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage));
+ }
+ // CraftBukkit end
- if (this.minecraftServer.J() && this.player.getDisplayName().getString().equals(this.minecraftServer.I())) {
+ if (this.minecraftServer.H() && this.player.getDisplayName().getString().equals(this.minecraftServer.G())) {
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
this.minecraftServer.safeShutdown();
-@@ -857,6 +1337,15 @@
+@@ -864,6 +1346,15 @@
}
}
@@ -791,7 +789,7 @@
try {
this.networkManager.sendPacket(packet, genericfuturelistener);
} catch (Throwable throwable) {
-@@ -872,17 +1361,37 @@
+@@ -879,17 +1370,37 @@
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
@@ -831,7 +829,7 @@
this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend", new Object[0])).a(EnumChatFormat.RED)));
} else {
this.player.resetIdleTimer();
-@@ -892,39 +1401,249 @@
+@@ -899,39 +1410,249 @@
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@@ -1088,7 +1086,7 @@
this.player.resetIdleTimer();
IJumpable ijumpable;
-@@ -996,6 +1715,7 @@
+@@ -1003,6 +1724,7 @@
public void a(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer());
@@ -1096,7 +1094,7 @@
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
Entity entity = packetplayinuseentity.a((World) worldserver);
-@@ -1011,20 +1731,73 @@
+@@ -1018,20 +1740,73 @@
if (this.player.h(entity) < d0) {
EnumHand enumhand;
@@ -1171,17 +1169,17 @@
}
}
}
-@@ -1040,7 +1813,8 @@
+@@ -1047,7 +1822,8 @@
case PERFORM_RESPAWN:
if (this.player.viewingCredits) {
this.player.viewingCredits = false;
-- this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, true);
-+ // this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, true);
-+ this.minecraftServer.getPlayerList().changeDimension(this.player, 0, PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management
+- this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, DimensionManager.OVERWORLD, true);
++ // this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, DimensionManager.OVERWORLD, true);
++ this.minecraftServer.getPlayerList().changeDimension(this.player, DimensionManager.OVERWORLD, PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management
CriterionTriggers.v.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD);
} else {
if (this.player.getHealth() > 0.0F) {
-@@ -1063,14 +1837,20 @@
+@@ -1070,14 +1846,20 @@
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
@@ -1204,7 +1202,7 @@
NonNullList nonnulllist = NonNullList.a();
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
-@@ -1079,8 +1859,274 @@
+@@ -1086,8 +1868,274 @@
this.player.a(this.player.activeContainer, nonnulllist);
} else {
@@ -1480,7 +1478,7 @@
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
this.player.f = true;
-@@ -1123,6 +2169,7 @@
+@@ -1130,6 +2178,7 @@
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
@@ -1488,7 +1486,7 @@
this.player.resetIdleTimer();
if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
this.player.activeContainer.a(this.player, packetplayinenchantitem.c());
-@@ -1154,6 +2201,43 @@
+@@ -1161,6 +2210,43 @@
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@@ -1532,7 +1530,7 @@
if (flag1 && flag2) {
if (itemstack.isEmpty()) {
-@@ -1177,6 +2261,7 @@
+@@ -1184,6 +2270,7 @@
public void a(PacketPlayInTransaction packetplayintransaction) {
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
@@ -1540,7 +1538,7 @@
Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
if (oshort != null && packetplayintransaction.c() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.b() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
-@@ -1187,6 +2272,7 @@
+@@ -1194,6 +2281,7 @@
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer());
@@ -1548,7 +1546,7 @@
this.player.resetIdleTimer();
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
BlockPosition blockposition = packetplayinupdatesign.b();
-@@ -1203,14 +2289,30 @@
+@@ -1210,14 +2298,30 @@
if (!tileentitysign.d() || tileentitysign.e() != this.player) {
this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign");
@@ -1566,7 +1564,7 @@
+ String[] lines = new String[4];
+
for (int i = 0; i < astring.length; ++i) {
-- tileentitysign.lines[i] = new ChatComponentText(EnumChatFormat.b(astring[i]));
+- tileentitysign.a(i, new ChatComponentText(EnumChatFormat.b(astring[i])));
+ lines[i] = EnumChatFormat.b(new ChatComponentText(EnumChatFormat.b(astring[i])).getString());
}
+ SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
@@ -1580,7 +1578,7 @@
tileentitysign.update();
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
-@@ -1219,6 +2321,7 @@
+@@ -1226,6 +2330,7 @@
}
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
@@ -1588,7 +1586,7 @@
if (this.g && packetplayinkeepalive.b() == this.h) {
int i = (int) (SystemUtils.b() - this.f);
-@@ -1232,7 +2335,17 @@
+@@ -1239,7 +2344,17 @@
public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
@@ -1607,7 +1605,7 @@
}
public void a(PacketPlayInSettings packetplayinsettings) {
-@@ -1240,5 +2353,47 @@
+@@ -1247,5 +2362,47 @@
this.player.a(packetplayinsettings);
}
diff --git a/nms-patches/PlayerInventory.patch b/nms-patches/PlayerInventory.patch
index 9058f988..8c192719 100644
--- a/nms-patches/PlayerInventory.patch
+++ b/nms-patches/PlayerInventory.patch
@@ -99,7 +99,7 @@
}
public boolean b(IBlockData iblockdata) {
-@@ -552,6 +621,11 @@
+@@ -554,6 +623,11 @@
}
public ItemStack getCarried() {
diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch
index 89e070cf..350105d2 100644
--- a/nms-patches/PlayerList.patch
+++ b/nms-patches/PlayerList.patch
@@ -102,7 +102,7 @@
@@ -82,6 +124,7 @@
PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, entityplayer);
- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getDimensionID(), worldserver.getDifficulty(), this.getMaxPlayers(), worlddata.getType(), worldserver.getGameRules().getBoolean("reducedDebugInfo")));
+ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager(), worldserver.getDifficulty(), this.getMaxPlayers(), worlddata.getType(), worldserver.getGameRules().getBoolean("reducedDebugInfo")));
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.b, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
@@ -132,10 +132,10 @@
@@ -186,26 +233,27 @@
}
- public void setPlayerFileData(WorldServer[] aworldserver) {
+ public void setPlayerFileData(WorldServer worldserver) {
+ if (playerFileData != null) return; // CraftBukkit
- this.playerFileData = aworldserver[0].getDataManager().getPlayerFileData();
- aworldserver[0].getWorldBorder().a(new IWorldBorderListener() {
+ this.playerFileData = worldserver.getDataManager().getPlayerFileData();
+ worldserver.getWorldBorder().a(new IWorldBorderListener() {
public void a(WorldBorder worldborder, double d0) {
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_SIZE));
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_SIZE), worldborder.world);
@@ -162,15 +162,6 @@
}
public void b(WorldBorder worldborder, double d0) {}
-@@ -238,7 +286,7 @@
-
- @Nullable
- public NBTTagCompound a(EntityPlayer entityplayer) {
-- NBTTagCompound nbttagcompound = this.server.worldServer[0].getWorldData().h();
-+ NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().h(); // CraftBukkit
- NBTTagCompound nbttagcompound1;
-
- if (entityplayer.getDisplayName().getString().equals(this.server.I()) && nbttagcompound != null) {
@@ -254,13 +302,13 @@
protected void savePlayerFile(EntityPlayer entityplayer) {
@@ -242,12 +233,12 @@
- worldserver.addEntity(entityplayer);
- this.a(entityplayer, (WorldServer) null);
-- this.server.aR().a(entityplayer);
+- this.server.aP().a(entityplayer);
+ // CraftBukkit start - Only add if the player wasn't moved in the event
+ if (entityplayer.world == worldserver && !worldserver.players.contains(entityplayer)) {
+ worldserver.addEntity(entityplayer);
+ this.a(entityplayer, (WorldServer) null);
-+ this.server.aR().a(entityplayer);
++ this.server.aP().a(entityplayer);
+ }
+ // CraftBukkit end
}
@@ -342,7 +333,7 @@
+ // depending on the outcome.
+ SocketAddress socketaddress = loginlistener.networkManager.getSocketAddress();
+
-+ EntityPlayer entity = new EntityPlayer(this.server, this.server.a(DimensionManager.OVERWORLD), gameprofile, new PlayerInteractManager(this.server.a(DimensionManager.OVERWORLD)));
++ EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(DimensionManager.OVERWORLD), gameprofile, new PlayerInteractManager(this.server.getWorldServer(DimensionManager.OVERWORLD)));
+ Player player = entity.getBukkitEntity();
+ PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress());
+
@@ -379,13 +370,13 @@
+ if (this.players.size() >= this.maxPlayers && !this.f(gameprofile)) {
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full");
+ }
-+ }
+ }
+
+ cserver.getPluginManager().callEvent(event);
+ if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
+ loginlistener.disconnect(event.getKickMessage());
+ return null;
- }
++ }
+ return entity;
}
@@ -398,18 +389,18 @@
@@ -392,17 +555,27 @@
}
- return new EntityPlayer(this.server, this.server.a(DimensionManager.OVERWORLD), gameprofile, (PlayerInteractManager) object);
+ return new EntityPlayer(this.server, this.server.getWorldServer(DimensionManager.OVERWORLD), gameprofile, (PlayerInteractManager) object);
+ */
+ return player;
+ // CraftBukkit end
}
+ // CraftBukkit start
- public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag) {
-+ return this.moveToWorld(entityplayer, i, flag, null, true);
+ public EntityPlayer moveToWorld(EntityPlayer entityplayer, DimensionManager dimensionmanager, boolean flag) {
++ return this.moveToWorld(entityplayer, dimensionmanager, flag, null, true);
+ }
+
-+ public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, Location location, boolean avoidSuffocation) {
++ public EntityPlayer moveToWorld(EntityPlayer entityplayer, DimensionManager dimensionmanager, boolean flag, Location location, boolean avoidSuffocation) {
+ entityplayer.stopRiding(); // CraftBukkit
entityplayer.getWorldServer().getTracker().untrackPlayer(entityplayer);
- entityplayer.getWorldServer().getTracker().untrackEntity(entityplayer);
@@ -421,7 +412,7 @@
boolean flag1 = entityplayer.isRespawnForced();
+ /* CraftBukkit start
- entityplayer.dimension = i;
+ entityplayer.dimension = dimensionmanager;
Object object;
@@ -413,6 +586,11 @@
@@ -436,7 +427,7 @@
entityplayer1.playerConnection = entityplayer.playerConnection;
entityplayer1.copyFrom(entityplayer, flag);
-@@ -426,43 +604,166 @@
+@@ -426,43 +604,160 @@
entityplayer1.addScoreboardTag(s);
}
@@ -467,13 +458,13 @@
+ entityplayer1.setRespawnPosition(null, true);
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(0, 0.0F));
+ }
-+ }
+ }
+
+ if (location == null) {
+ cworld = (CraftWorld) this.server.server.getWorlds().get(0);
+ blockposition = entityplayer1.getSpawnPoint(cworld.getHandle());
+ location = new Location(cworld, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F));
- }
++ }
+
+ Player respawnPlayer = cserver.getPlayer(entityplayer1);
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
@@ -482,27 +473,26 @@
+ location = respawnEvent.getRespawnLocation();
+ entityplayer.reset();
+ } else {
-+ location.setWorld(server.getWorldServer(i).getWorld());
++ location.setWorld(server.getWorldServer(dimensionmanager).getWorld());
}
+ WorldServer worldserver = ((CraftWorld) location.getWorld()).getHandle();
+ entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
+ // CraftBukkit end
- worldserver.getChunkProviderServer().getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
+ worldserver.getChunkProviderServer().getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4, true, true);
- while (!worldserver.getCubes(entityplayer1, entityplayer1.getBoundingBox()) && entityplayer1.locY < 256.0D) {
+ while (avoidSuffocation && !worldserver.getCubes(entityplayer1, entityplayer1.getBoundingBox()) && entityplayer1.locY < 256.0D) {
entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
}
+ // CraftBukkit start
-+ byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
+ // Force the client to refresh their chunk cache
+ if (fromWorld.getEnvironment() == worldserver.getWorld().getEnvironment()) {
-+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn((byte) (actualDimension >= 0 ? -1 : 0), worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode()));
++ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.worldProvider.getDimensionManager().getDimensionID() >= 0 ? DimensionManager.NETHER : DimensionManager.OVERWORLD, worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode()));
+ }
- entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(entityplayer1.dimension, entityplayer1.world.getDifficulty(), entityplayer1.world.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode()));
-+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(actualDimension, worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode()));
++ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.worldProvider.getDimensionManager(), worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode()));
+ entityplayer1.spawnIn(worldserver);
+ entityplayer1.dead = false;
+ entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
@@ -556,25 +546,20 @@
}
+ // CraftBukkit start - Replaced the standard handling of portals with a more customised method.
-+ public void changeDimension(EntityPlayer entityplayer, int i, TeleportCause cause) {
++ public void changeDimension(EntityPlayer entityplayer, DimensionManager dimensionManager, TeleportCause cause) {
+ WorldServer exitWorld = null;
-+ if (entityplayer.dimension < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // plugins must specify exit from custom Bukkit worlds
-+ // only target existing worlds (compensate for allow-nether/allow-end as false)
-+ for (WorldServer world : this.server.worlds) {
-+ if (world.dimension == i) {
-+ exitWorld = world;
-+ }
-+ }
++ if (entityplayer.dimension.getDimensionID() < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // plugins must specify exit from custom Bukkit worlds
++ exitWorld = server.getWorldServer(dimensionManager);
+ }
+
+ Location enter = entityplayer.getBukkitEntity().getLocation();
+ Location exit = null;
+ boolean useTravelAgent = false; // don't use agent for custom worlds or return from THE_END
+ if (exitWorld != null) {
-+ if ((cause == TeleportCause.END_PORTAL) && (i == 0)) {
++ if ((cause == TeleportCause.END_PORTAL) && (dimensionManager == DimensionManager.OVERWORLD)) {
+ // THE_END -> NORMAL; use bed if available, otherwise default spawn
+ exit = ((org.bukkit.craftbukkit.entity.CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation();
-+ if (exit == null || ((CraftWorld) exit.getWorld()).getHandle().dimension != 0) {
++ if (exit == null || ((CraftWorld) exit.getWorld()).getHandle().dimension != DimensionManager.OVERWORLD) {
+ BlockPosition randomSpawn = entityplayer.getSpawnPoint(exitWorld);
+ exit = new Location(exitWorld.getWorld(), randomSpawn.getX(), randomSpawn.getY(), randomSpawn.getZ());
+ } else {
@@ -620,10 +605,10 @@
public void f(EntityPlayer entityplayer) {
GameProfile gameprofile = entityplayer.getProfile();
int i = this.server.a(gameprofile);
-@@ -499,12 +800,111 @@
+@@ -499,42 +794,69 @@
}
- public void changeWorld(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) {
+ public void changeWorld(Entity entity, DimensionManager dimensionmanager, WorldServer worldserver, WorldServer worldserver1) {
+ // CraftBukkit start - Split into modular functions
+ Location exit = calculateTarget(entity.getBukkitEntity().getLocation(), worldserver1);
+ repositionEntity(entity, exit, true);
@@ -633,14 +618,14 @@
+ public Location calculateTarget(Location enter, World target) {
+ WorldServer worldserver = ((CraftWorld) enter.getWorld()).getHandle();
+ WorldServer worldserver1 = ((CraftWorld) target.getWorld()).getHandle();
-+ int i = worldserver.dimension;
++ DimensionManager dimensionmanager = worldserver.dimension;
+
+ double y = enter.getY();
+ float yaw = enter.getYaw();
+ float pitch = enter.getPitch();
+ double d0 = enter.getX();
+ double d1 = enter.getZ();
-+ double d2 = 8.0D;
++ double d2 = 8.0D;
+ /*
double d0 = entity.locX;
double d1 = entity.locZ;
@@ -649,61 +634,64 @@
+ */
worldserver.methodProfiler.a("moving");
-+ if (worldserver1.dimension == -1) {
-+ d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b()+ 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
-+ d1 = MathHelper.a(d1 / d2, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
+- if (entity.dimension == DimensionManager.NETHER) {
++ if (worldserver1.dimension == DimensionManager.NETHER) {
+ d0 = MathHelper.a(d0 / 8.0D, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
+ d1 = MathHelper.a(d1 / 8.0D, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
+ /*
-+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
-+ if (entity.isAlive()) {
-+ worldserver.entityJoinedWorld(entity, false);
-+ }
+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
+ if (entity.isAlive()) {
+ worldserver.entityJoinedWorld(entity, false);
+ }
+- } else if (entity.dimension == DimensionManager.OVERWORLD) {
+ */
-+ } else if (worldserver1.dimension == 0) {
-+ d0 = MathHelper.a(d0 * d2, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
-+ d1 = MathHelper.a(d1 * d2, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
++ } else if (worldserver1.dimension == DimensionManager.OVERWORLD) {
+ d0 = MathHelper.a(d0 * 8.0D, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
+ d1 = MathHelper.a(d1 * 8.0D, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
+ /*
-+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
-+ if (entity.isAlive()) {
-+ worldserver.entityJoinedWorld(entity, false);
-+ }
+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
+ if (entity.isAlive()) {
+ worldserver.entityJoinedWorld(entity, false);
+ }
+ */
-+ } else {
-+ BlockPosition blockposition;
-+
-+ if (i == 1) {
+ } else {
+ BlockPosition blockposition;
+
+ if (dimensionmanager == DimensionManager.THE_END) {
+ // use default NORMAL world spawn instead of target
-+ worldserver1 = this.server.worlds.get(0);
-+ blockposition = worldserver1.getSpawn();
-+ } else {
-+ blockposition = worldserver1.getDimensionSpawn();
-+ }
-+
-+ d0 = (double) blockposition.getX();
++ worldserver1 = this.server.getWorldServer(DimensionManager.OVERWORLD);
+ blockposition = worldserver1.getSpawn();
+ } else {
+ blockposition = worldserver1.getDimensionSpawn();
+ }
+
+ d0 = (double) blockposition.getX();
+- entity.locY = (double) blockposition.getY();
+ y = (double) blockposition.getY();
-+ d1 = (double) blockposition.getZ();
+ d1 = (double) blockposition.getZ();
+ /*
-+ entity.setPositionRotation(d0, entity.locY, d1, 90.0F, 0.0F);
-+ if (entity.isAlive()) {
-+ worldserver.entityJoinedWorld(entity, false);
-+ }
+ entity.setPositionRotation(d0, entity.locY, d1, 90.0F, 0.0F);
+ if (entity.isAlive()) {
+ worldserver.entityJoinedWorld(entity, false);
+ }
+ */
-+ }
-+
-+ worldserver.methodProfiler.b();
-+ if (i != 1) {
-+ worldserver.methodProfiler.a("placing");
-+ d0 = (double) MathHelper.clamp((int) d0, -29999872, 29999872);
-+ d1 = (double) MathHelper.clamp((int) d1, -29999872, 29999872);
+ }
+
+ worldserver.methodProfiler.e();
+@@ -542,22 +864,119 @@
+ worldserver.methodProfiler.a("placing");
+ d0 = (double) MathHelper.clamp((int) d0, -29999872, 29999872);
+ d1 = (double) MathHelper.clamp((int) d1, -29999872, 29999872);
+ /*
-+ if (entity.isAlive()) {
-+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
-+ worldserver1.getTravelAgent().a(entity, f);
-+ worldserver1.addEntity(entity);
-+ worldserver1.entityJoinedWorld(entity, false);
-+ }
+ if (entity.isAlive()) {
+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
+ worldserver1.getTravelAgent().a(entity, f);
+ worldserver1.addEntity(entity);
+ worldserver1.entityJoinedWorld(entity, false);
+ }
+ */
+
-+ worldserver.methodProfiler.b();
++ worldserver.methodProfiler.e();
+ }
+
+ // entity.spawnIn(worldserver1);
@@ -714,7 +702,7 @@
+ public void repositionEntity(Entity entity, Location exit, boolean portal) {
+ WorldServer worldserver = (WorldServer) entity.world;
+ WorldServer worldserver1 = ((CraftWorld) exit.getWorld()).getHandle();
-+ int i = worldserver.dimension;
++ DimensionManager dimensionmanager = worldserver.dimension;
+
+ /*
+ double d0 = entity.locX;
@@ -729,35 +717,49 @@
+ worldserver.entityJoinedWorld(entity, false);
+ }
+ /*
- if (entity.dimension == -1) {
- d0 = MathHelper.a(d0 / 8.0D, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
- d1 = MathHelper.a(d1 / 8.0D, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
-@@ -523,6 +923,8 @@
- BlockPosition blockposition;
-
- if (i == 1) {
++ if (entity.dimension == DimensionManager.NETHER) {
++ d0 = MathHelper.a(d0 / 8.0D, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
++ d1 = MathHelper.a(d1 / 8.0D, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
++ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
++ if (entity.isAlive()) {
++ worldserver.entityJoinedWorld(entity, false);
++ }
++ } else if (entity.dimension == DimensionManager.OVERWORLD) {
++ d0 = MathHelper.a(d0 * 8.0D, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
++ d1 = MathHelper.a(d1 * 8.0D, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
++ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
++ if (entity.isAlive()) {
++ worldserver.entityJoinedWorld(entity, false);
++ }
++ } else {
++ BlockPosition blockposition;
++
++ if (dimensionmanager == DimensionManager.THE_END) {
+ // use default NORMAL world spawn instead of target
+ worldserver1 = this.server.worlds.get(0);
- blockposition = worldserver1.getSpawn();
- } else {
- blockposition = worldserver1.getDimensionSpawn();
-@@ -536,16 +938,27 @@
- worldserver.entityJoinedWorld(entity, false);
- }
- }
++ blockposition = worldserver1.getSpawn();
++ } else {
++ blockposition = worldserver1.getDimensionSpawn();
++ }
++
++ d0 = (double) blockposition.getX();
++ entity.locY = (double) blockposition.getY();
++ d1 = (double) blockposition.getZ();
++ entity.setPositionRotation(d0, entity.locY, d1, 90.0F, 0.0F);
++ if (entity.isAlive()) {
++ worldserver.entityJoinedWorld(entity, false);
++ }
++ }
+ */
-
- worldserver.methodProfiler.e();
- if (i != 1) {
- worldserver.methodProfiler.a("placing");
++
++ worldserver.methodProfiler.e();
++ if (dimensionmanager != DimensionManager.THE_END) {
++ worldserver.methodProfiler.a("placing");
+ /*
- d0 = (double) MathHelper.clamp((int) d0, -29999872, 29999872);
- d1 = (double) MathHelper.clamp((int) d1, -29999872, 29999872);
++ d0 = (double) MathHelper.clamp((int) d0, -29999872, 29999872);
++ d1 = (double) MathHelper.clamp((int) d1, -29999872, 29999872);
+ */
- if (entity.isAlive()) {
-- entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
-- worldserver1.getTravelAgent().a(entity, f);
-- worldserver1.addEntity(entity);
++ if (entity.isAlive()) {
+ // entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
+ // worldserver1.getTravelAgent().a(entity, f);
+ if (portal) {
@@ -769,10 +771,10 @@
+ }
+ }
+ // worldserver1.addEntity(entity);
- worldserver1.entityJoinedWorld(entity, false);
- }
++ worldserver1.entityJoinedWorld(entity, false);
++ }
-@@ -553,11 +966,23 @@
+ worldserver.methodProfiler.e();
}
entity.spawnIn(worldserver1);
@@ -797,7 +799,7 @@
this.v = 0;
}
-@@ -570,6 +995,25 @@
+@@ -570,6 +989,25 @@
}
@@ -820,10 +822,10 @@
+ }
+ // CraftBukkit end
+
- public void a(Packet<?> packet, int i) {
- for (int j = 0; j < this.players.size(); ++j) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
-@@ -670,6 +1114,7 @@
+ public void a(Packet<?> packet, DimensionManager dimensionmanager) {
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
+@@ -670,6 +1108,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
}
@@ -831,18 +833,9 @@
this.server.getCommandDispatcher().a(entityplayer);
}
-@@ -678,7 +1123,7 @@
- }
-
- public boolean isOp(GameProfile gameprofile) {
-- return this.operators.d(gameprofile) || this.server.J() && this.server.worldServer[0].getWorldData().u() && this.server.I().equalsIgnoreCase(gameprofile.getName()) || this.u;
-+ return this.operators.d(gameprofile) || this.server.J() && this.server.worlds.get(0).getWorldData().u() && this.server.I().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit
- }
-
- @Nullable
-@@ -702,6 +1147,12 @@
- for (int j = 0; j < this.players.size(); ++j) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
+@@ -702,6 +1141,12 @@
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
+ // CraftBukkit start - Test if player receiving packet can see the source of the packet
+ if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) {
@@ -850,19 +843,19 @@
+ }
+ // CraftBukkit end
+
- if (entityplayer != entityhuman && entityplayer.dimension == i) {
+ if (entityplayer != entityhuman && entityplayer.dimension == dimensionmanager) {
double d4 = d0 - entityplayer.locX;
double d5 = d1 - entityplayer.locY;
-@@ -741,7 +1192,7 @@
+@@ -741,7 +1186,7 @@
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
-- WorldBorder worldborder = this.server.worldServer[0].getWorldBorder();
+- WorldBorder worldborder = this.server.getWorldServer(DimensionManager.OVERWORLD).getWorldBorder();
+ WorldBorder worldborder = entityplayer.world.getWorldBorder(); // CraftBukkit
entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE));
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
-@@ -749,16 +1200,21 @@
+@@ -749,16 +1194,21 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition));
if (worldserver.isRaining()) {
@@ -888,16 +881,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
}
-@@ -771,7 +1227,7 @@
- }
-
- public String[] getSeenPlayers() {
-- return this.server.worldServer[0].getDataManager().getPlayerFileData().getSeenPlayers();
-+ return this.server.worlds.get(0).getDataManager().getPlayerFileData().getSeenPlayers(); // CraftBukkit
- }
-
- public boolean getHasWhitelist() {
-@@ -820,26 +1276,39 @@
+@@ -820,26 +1270,39 @@
}
public void u() {
@@ -941,8 +925,8 @@
+ // CraftBukkit end
if (serverstatisticmanager == null) {
- File file = new File(this.server.a(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "stats");
-@@ -854,7 +1323,7 @@
+ File file = new File(this.server.getWorldServer(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "stats");
+@@ -854,7 +1317,7 @@
}
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
@@ -951,7 +935,7 @@
}
return serverstatisticmanager;
-@@ -862,14 +1331,14 @@
+@@ -862,14 +1325,14 @@
public AdvancementDataPlayer h(EntityPlayer entityplayer) {
UUID uuid = entityplayer.getUniqueID();
@@ -959,7 +943,7 @@
+ AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) entityplayer.getAdvancementData(); // CraftBukkit
if (advancementdataplayer == null) {
- File file = new File(this.server.a(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "advancements");
+ File file = new File(this.server.getWorldServer(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "advancements");
File file1 = new File(file, uuid + ".json");
advancementdataplayer = new AdvancementDataPlayer(this.server, file1, entityplayer);
@@ -968,20 +952,7 @@
}
advancementdataplayer.a(entityplayer);
-@@ -882,8 +1351,10 @@
- WorldServer[] aworldserver = this.server.worldServer;
- int j = aworldserver.length;
-
-- for (int k = 0; k < j; ++k) {
-- WorldServer worldserver = aworldserver[k];
-+ // CraftBukkit start
-+ for (int k = 0; k < server.worlds.size(); ++k) {
-+ WorldServer worldserver = server.worlds.get(0);
-+ // CraftBukkit end
-
- if (worldserver != null) {
- worldserver.getPlayerChunkMap().a(i);
-@@ -908,13 +1379,20 @@
+@@ -905,13 +1368,20 @@
}
public void reload() {
diff --git a/nms-patches/PortalTravelAgent.patch b/nms-patches/PortalTravelAgent.patch
index fd81d2dc..2ad05052 100644
--- a/nms-patches/PortalTravelAgent.patch
+++ b/nms-patches/PortalTravelAgent.patch
@@ -120,7 +120,7 @@
- for (int i1 = -128; i1 <= 128; ++i1) {
+ for (int i1 = -radius; i1 <= radius; ++i1) {
- for (BlockPosition blockposition2 = blockposition.a(l, this.world.aa() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) {
+ for (BlockPosition blockposition2 = blockposition.a(l, this.world.ab() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) {
blockposition1 = blockposition2.down();
if (this.world.getType(blockposition2).getBlock() == PortalTravelAgent.a) {
@@ -96,6 +159,29 @@
@@ -244,7 +244,7 @@
+ d2 = (double) j2 + 0.5D - z; // CraftBukkit
label257:
- for (k2 = this.world.aa() - 1; k2 >= 0; --k2) {
+ for (k2 = this.world.ab() - 1; k2 >= 0; --k2) {
@@ -217,7 +331,7 @@
}
}
@@ -266,7 +266,7 @@
+ d2 = (double) j2 + 0.5D - z; // CraftBukkit
label205:
- for (k2 = this.world.aa() - 1; k2 >= 0; --k2) {
+ for (k2 = this.world.ab() - 1; k2 >= 0; --k2) {
@@ -262,7 +376,7 @@
}
}
diff --git a/nms-patches/RegionFileCache.patch b/nms-patches/RegionFileCache.patch
index 8628214f..aef8ddb9 100644
--- a/nms-patches/RegionFileCache.patch
+++ b/nms-patches/RegionFileCache.patch
@@ -1,6 +1,36 @@
--- a/net/minecraft/server/RegionFileCache.java
+++ b/net/minecraft/server/RegionFileCache.java
-@@ -76,18 +76,28 @@
+@@ -36,6 +36,29 @@
+ }
+ }
+
++ // CraftBukkit start
++ public static synchronized RegionFile b(File file, int i, int j) {
++ File file1 = new File(file, "region");
++ File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca");
++ RegionFile regionfile = (RegionFile) RegionFileCache.a.get(file2);
++
++ if (regionfile != null) {
++ return regionfile;
++ } else if (file1.exists() && file2.exists()) {
++ if (RegionFileCache.a.size() >= 256) {
++ a();
++ }
++
++ RegionFile regionfile1 = new RegionFile(file2);
++
++ RegionFileCache.a.put(file2, regionfile1);
++ return regionfile1;
++ } else {
++ return null;
++ }
++ }
++ // CraftBukkit end
++
+ public static synchronized void a() {
+ Iterator iterator = RegionFileCache.a.values().iterator();
+
+@@ -55,16 +78,32 @@
}
@Nullable
@@ -28,8 +58,12 @@
+ DataOutputStream dataoutputstream = regionfile.c(i & 31, j & 31);
+ NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream);
+ dataoutputstream.close();
++ }
++
++ public static synchronized boolean chunkExists(File file, int i, int j) {
++ RegionFile regionfile = b(file, i, j);
++
++ return regionfile != null ? regionfile.d(i & 31, j & 31) : false;
}
+ // CraftBukkit end
-
- public static synchronized boolean chunkExists(File file, int i, int j) {
- RegionFile regionfile = b(file, i, j);
+ }
diff --git a/nms-patches/RegionLimitedWorldAccess.patch b/nms-patches/RegionLimitedWorldAccess.patch
index 7e68d926..d820df05 100644
--- a/nms-patches/RegionLimitedWorldAccess.patch
+++ b/nms-patches/RegionLimitedWorldAccess.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/RegionLimitedWorldAccess.java
+++ b/net/minecraft/server/RegionLimitedWorldAccess.java
-@@ -25,10 +25,10 @@
+@@ -22,10 +22,10 @@
private final Random k;
private final WorldProvider l;
private final GeneratorSettings m;
@@ -13,7 +13,7 @@
return this.y(blockposition).l();
});
-@@ -204,7 +204,14 @@
+@@ -201,7 +201,14 @@
this.y(blockposition).e(blockposition);
}
diff --git a/nms-patches/SecondaryWorldServer.patch b/nms-patches/SecondaryWorldServer.patch
index f92f9531..9a941819 100644
--- a/nms-patches/SecondaryWorldServer.patch
+++ b/nms-patches/SecondaryWorldServer.patch
@@ -1,21 +1,20 @@
--- a/net/minecraft/server/SecondaryWorldServer.java
+++ b/net/minecraft/server/SecondaryWorldServer.java
-@@ -6,9 +6,12 @@
+@@ -4,8 +4,11 @@
- private final WorldServer a;
+ public class SecondaryWorldServer extends WorldServer {
-- public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, int i, WorldServer worldserver, MethodProfiler methodprofiler) {
-- super(minecraftserver, idatamanager, new SecondaryWorldData(worldserver.getWorldData()), i, methodprofiler);
+- public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, DimensionManager dimensionmanager, WorldServer worldserver, MethodProfiler methodprofiler) {
+- super(minecraftserver, idatamanager, worldserver.h(), new SecondaryWorldData(worldserver.getWorldData()), dimensionmanager, methodprofiler);
+ // CraftBukkit start - Add WorldData, Environment and ChunkGenerator arguments
-+ public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, int i, WorldServer worldserver, MethodProfiler methodprofiler, WorldData worldData, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
-+ super(minecraftserver, idatamanager, worldData, i, methodprofiler, env, gen);
++ public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, DimensionManager dimensionmanager, WorldServer worldserver, MethodProfiler methodprofiler, WorldData worldData, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
++ super(minecraftserver, idatamanager, worldserver.h(), worldData, dimensionmanager, methodprofiler, env, gen);
+ // CraftBukkit end
- this.a = worldserver;
+ /* CraftBukkit start
worldserver.getWorldBorder().a(new IWorldBorderListener() {
public void a(WorldBorder worldborder, double d0) {
SecondaryWorldServer.this.getWorldBorder().setSize(d0);
-@@ -38,9 +41,10 @@
+@@ -35,9 +38,10 @@
SecondaryWorldServer.this.getWorldBorder().setDamageBuffer(d0);
}
});
@@ -25,14 +24,14 @@
- protected void a() {}
+ // protected void a() {} // CraftBukkit
- public GeneratorAccess b() {
- this.worldMaps = this.a.s_();
-@@ -55,7 +59,7 @@
+ public SecondaryWorldServer b() {
+ String s = PersistentVillage.a(this.worldProvider);
+@@ -51,7 +55,7 @@
this.villages.a((World) this);
}
- return this;
-+ return super.b(); // CraftBukkit
++ return (SecondaryWorldServer) super.i_(); // CraftBukkit
}
public void t_() {
diff --git a/nms-patches/ShapedRecipes.patch b/nms-patches/ShapedRecipes.patch
index d38a490e..e1367042 100644
--- a/nms-patches/ShapedRecipes.patch
+++ b/nms-patches/ShapedRecipes.patch
@@ -19,7 +19,7 @@
+ public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+ CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
-+ recipe.setGroup(this.f);
++ recipe.setGroup(this.group);
+
+ switch (this.height) {
+ case 1:
@@ -76,7 +76,7 @@
+ // CraftBukkit end
+
public MinecraftKey getKey() {
- return this.e;
+ return this.key;
}
@@ -302,11 +366,11 @@
packetdataserializer.a(shapedrecipes.result);
diff --git a/nms-patches/ShapelessRecipes.patch b/nms-patches/ShapelessRecipes.patch
index 1b5c2636..0723cdf1 100644
--- a/nms-patches/ShapelessRecipes.patch
+++ b/nms-patches/ShapelessRecipes.patch
@@ -20,7 +20,7 @@
+ public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe() {
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
-+ recipe.setGroup(this.b);
++ recipe.setGroup(this.group);
+
+ for (RecipeItemStack list : this.ingredients) {
+ list.buildChoices();
@@ -32,7 +32,7 @@
+ // CraftBukkit end
+
public MinecraftKey getKey() {
- return this.a;
+ return this.key;
}
@@ -127,11 +147,11 @@
packetdataserializer.a(shapelessrecipes.result);
diff --git a/nms-patches/SpawnerCreature.patch b/nms-patches/SpawnerCreature.patch
index 0bfac793..dca91ed0 100644
--- a/nms-patches/SpawnerCreature.patch
+++ b/nms-patches/SpawnerCreature.patch
@@ -38,7 +38,7 @@
}
}
}
-@@ -66,9 +75,31 @@
+@@ -66,8 +75,30 @@
for (int k1 = 0; k1 < j; ++k1) {
EnumCreatureType enumcreaturetype = aenumcreaturetype[k1];
@@ -65,12 +65,11 @@
+ // CraftBukkit end
+
if ((!enumcreaturetype.c() || flag1) && (enumcreaturetype.c() || flag) && (!enumcreaturetype.d() || flag2)) {
- k = worldserver.a(enumcreaturetype.a());
-- int l1 = enumcreaturetype.b() * i / SpawnerCreature.b;
-+ int l1 = limit * i / b; // CraftBukkit - use per-world limits
+- k = enumcreaturetype.b() * i / SpawnerCreature.b;
++ k = limit * i / SpawnerCreature.b; // CraftBukkit - use per-world limits
+ int l1 = worldserver.a(enumcreaturetype.a(), k);
- if (k <= l1) {
- BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
+ if (l1 <= k) {
@@ -76,8 +107,10 @@
label128:
@@ -85,7 +84,7 @@
int j2 = blockposition1.getY();
int k2 = blockposition1.getZ();
@@ -136,9 +169,12 @@
- if (entityinsentient.M() && entityinsentient.a((IWorldReader) worldserver)) {
+ if (entityinsentient.a((GeneratorAccess) worldserver, false) && entityinsentient.a((IWorldReader) worldserver)) {
groupdataentity = entityinsentient.prepare(worldserver.getDamageScaler(new BlockPosition(entityinsentient)), groupdataentity, (NBTTagCompound) null);
if (entityinsentient.a((IWorldReader) worldserver)) {
- ++l2;
@@ -101,8 +100,8 @@
entityinsentient.die();
}
@@ -255,7 +291,7 @@
- entityinsentient.setPositionRotation((double) f, (double) blockposition.getY(), (double) f1, random.nextFloat() * 360.0F, 0.0F);
- if (entityinsentient.a(generatoraccess) && entityinsentient.a((IWorldReader) generatoraccess)) {
+ entityinsentient.setPositionRotation(d0, (double) blockposition.getY(), d1, random.nextFloat() * 360.0F, 0.0F);
+ if (entityinsentient.a(generatoraccess, false) && entityinsentient.a((IWorldReader) generatoraccess)) {
groupdataentity = entityinsentient.prepare(generatoraccess.getDamageScaler(new BlockPosition(entityinsentient)), groupdataentity, (NBTTagCompound) null);
- generatoraccess.addEntity(entityinsentient);
+ generatoraccess.addEntity(entityinsentient, SpawnReason.CHUNK_GEN); // CraftBukkit
diff --git a/nms-patches/TagsServer.patch b/nms-patches/TagsServer.patch
index b5ed85d1..2d0c0861 100644
--- a/nms-patches/TagsServer.patch
+++ b/nms-patches/TagsServer.patch
@@ -3,11 +3,11 @@
@@ -11,6 +11,7 @@
public class TagsServer<T> extends Tags<T> {
- private final RegistryMaterials<MinecraftKey, T> a;
+ private final IRegistry<T> a;
+ public int version; // CraftBukkit
- public TagsServer(RegistryMaterials<MinecraftKey, T> registrymaterials, String s, String s1) {
- super(registrymaterials::d, registrymaterials::get, s, false, s1);
+ public TagsServer(IRegistry<T> iregistry, String s, String s1) {
+ super(iregistry::c, iregistry::get, s, false, s1);
@@ -31,7 +32,7 @@
while (iterator1.hasNext()) {
Object object = iterator1.next();
@@ -18,7 +18,7 @@
}
@@ -49,7 +50,7 @@
- arraylist.add(this.a.getId(packetdataserializer.g()));
+ arraylist.add(this.a.fromId(packetdataserializer.g()));
}
- this.c().put(minecraftkey, Tag.a.a().a((Collection) arraylist).b(minecraftkey));
diff --git a/nms-patches/TileEntityBeacon.patch b/nms-patches/TileEntityBeacon.patch
index e6a987ef..914439e0 100644
--- a/nms-patches/TileEntityBeacon.patch
+++ b/nms-patches/TileEntityBeacon.patch
@@ -52,7 +52,7 @@
+ // CraftBukkit end
public TileEntityBeacon() {
- super(TileEntityTypes.o);
+ super(TileEntityTypes.BEACON);
@@ -56,41 +95,79 @@
this.world.a((EntityHuman) null, this.position, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
diff --git a/nms-patches/TileEntityBrewingStand.patch b/nms-patches/TileEntityBrewingStand.patch
index bafd46ee..527d9d4b 100644
--- a/nms-patches/TileEntityBrewingStand.patch
+++ b/nms-patches/TileEntityBrewingStand.patch
@@ -48,7 +48,7 @@
+ // CraftBukkit end
public TileEntityBrewingStand() {
- super(TileEntityTypes.l);
+ super(TileEntityTypes.BREWING_STAND);
@@ -62,8 +97,19 @@
ItemStack itemstack = (ItemStack) this.items.get(4);
diff --git a/nms-patches/TileEntityConduit.patch b/nms-patches/TileEntityConduit.patch
index 23d9e0fa..0d8d1ba6 100644
--- a/nms-patches/TileEntityConduit.patch
+++ b/nms-patches/TileEntityConduit.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/TileEntityConduit.java
+++ b/net/minecraft/server/TileEntityConduit.java
-@@ -154,7 +154,7 @@
+@@ -152,7 +152,7 @@
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (this.position.m(new BlockPosition(entityhuman)) <= (double) j && entityhuman.ao()) {
@@ -9,7 +9,7 @@
}
}
-@@ -171,8 +171,8 @@
+@@ -169,8 +169,8 @@
this.j = this.l();
this.k = null;
} else if (this.j == null) {
@@ -20,7 +20,7 @@
});
if (!list.isEmpty()) {
-@@ -217,7 +217,7 @@
+@@ -215,7 +215,7 @@
@Nullable
private EntityLiving l() {
diff --git a/nms-patches/TileEntityFurnace.patch b/nms-patches/TileEntityFurnace.patch
index 0e20cc1c..691a1b4a 100644
--- a/nms-patches/TileEntityFurnace.patch
+++ b/nms-patches/TileEntityFurnace.patch
@@ -46,7 +46,7 @@
+ // CraftBukkit end
+
public TileEntityFurnace() {
- super(TileEntityTypes.b);
+ super(TileEntityTypes.FURNACE);
this.items = NonNullList.a(3, ItemStack.a);
@@ -220,7 +254,7 @@
}
@@ -58,7 +58,7 @@
if (this.isBurning()) {
@@ -238,9 +272,20 @@
- IRecipe irecipe = this.world.D().b(this, this.world);
+ IRecipe irecipe = this.world.E().b(this, this.world);
if (!this.isBurning() && this.canBurn(irecipe)) {
- this.burnTime = fuelTime(itemstack);
diff --git a/nms-patches/TileEntityHopper.patch b/nms-patches/TileEntityHopper.patch
index 6e4514bd..0dc8df6e 100644
--- a/nms-patches/TileEntityHopper.patch
+++ b/nms-patches/TileEntityHopper.patch
@@ -45,7 +45,7 @@
+ // CraftBukkit end
+
public TileEntityHopper() {
- super(TileEntityTypes.r);
+ super(TileEntityTypes.HOPPER);
this.items = NonNullList.a(5, ItemStack.a);
@@ -72,7 +106,7 @@
}
diff --git a/nms-patches/TileEntityShulkerBox.patch b/nms-patches/TileEntityShulkerBox.patch
index 1f77fc49..bb9e5db4 100644
--- a/nms-patches/TileEntityShulkerBox.patch
+++ b/nms-patches/TileEntityShulkerBox.patch
@@ -41,7 +41,7 @@
+ // CraftBukkit end
+
public TileEntityShulkerBox(@Nullable EnumColor enumcolor) {
- super(TileEntityTypes.x);
+ super(TileEntityTypes.SHULKER_BOX);
this.e = NonNullList.a(27, ItemStack.a);
@@ -148,7 +177,7 @@
}
diff --git a/nms-patches/TileEntitySign.patch b/nms-patches/TileEntitySign.patch
index 61758650..8cd01331 100644
--- a/nms-patches/TileEntitySign.patch
+++ b/nms-patches/TileEntitySign.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/TileEntitySign.java
+++ b/net/minecraft/server/TileEntitySign.java
-@@ -23,6 +23,12 @@
+@@ -24,6 +24,12 @@
nbttagcompound.setString("Text" + (i + 1), s);
}
@@ -13,7 +13,7 @@
return nbttagcompound;
}
-@@ -30,18 +36,38 @@
+@@ -31,18 +37,38 @@
this.isEditable = false;
super.load(nbttagcompound);
@@ -57,9 +57,9 @@
+ } catch (com.google.gson.JsonParseException jsonparseexception) {
+ this.lines[i] = new ChatComponentText(s);
}
- }
-@@ -94,6 +120,13 @@
+ this.h[i] = null;
+@@ -102,6 +128,13 @@
public void sendMessage(IChatBaseComponent ichatbasecomponent) {}
diff --git a/nms-patches/TileEntitySkull.patch b/nms-patches/TileEntitySkull.patch
index e7425b53..7b4bcc5c 100644
--- a/nms-patches/TileEntitySkull.patch
+++ b/nms-patches/TileEntitySkull.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/TileEntitySkull.java
+++ b/net/minecraft/server/TileEntitySkull.java
-@@ -119,13 +119,19 @@
+@@ -118,13 +118,19 @@
}
}
diff --git a/nms-patches/Village.patch b/nms-patches/Village.patch
index ea50abc5..930b4047 100644
--- a/nms-patches/Village.patch
+++ b/nms-patches/Village.patch
@@ -8,4 +8,4 @@
+ EntityIronGolem entityirongolem = (EntityIronGolem) EntityTypes.IRON_GOLEM.spawnCreature(this.a, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition1, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE); // CraftBukkit
if (entityirongolem != null) {
- if (entityirongolem.M() && entityirongolem.a((IWorldReader) this.a)) {
+ if (entityirongolem.a((GeneratorAccess) this.a, false) && entityirongolem.a((IWorldReader) this.a)) {
diff --git a/nms-patches/World.patch b/nms-patches/World.patch
index 5ccf8049..1e96e170 100644
--- a/nms-patches/World.patch
+++ b/nms-patches/World.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/World.java
+++ b/net/minecraft/server/World.java
-@@ -15,6 +15,23 @@
+@@ -21,6 +21,23 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -21,14 +21,14 @@
+import org.bukkit.generator.ChunkGenerator;
+// CraftBukkit end
+
- public abstract class World implements GeneratorAccess, IIBlockAccess, AutoCloseable {
+ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAccess, AutoCloseable {
protected static final Logger e = LogManager.getLogger();
-@@ -55,7 +72,52 @@
+@@ -62,7 +79,52 @@
private final WorldBorder K;
- int[] F;
+ int[] E;
-- protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag) {
+- protected World(IDataManager idatamanager, @Nullable PersistentCollection persistentcollection, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag) {
+ // CraftBukkit start Added the following
+ private final CraftWorld world;
+ public boolean pvpMode;
@@ -66,10 +66,10 @@
+ }
+
+ public Chunk getChunkIfLoaded(int x, int z) {
-+ return ((ChunkProviderServer) this.chunkProvider).getChunkIfLoaded(x, z);
++ return ((ChunkProviderServer) this.chunkProvider).getChunkAt(x, z, false, false);
+ }
+
-+ protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
++ protected World(IDataManager idatamanager, @Nullable PersistentCollection persistentcollection, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
+ this.generator = gen;
+ this.world = new CraftWorld((WorldServer) this, gen, env);
+ this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
@@ -78,7 +78,7 @@
this.v = Lists.newArrayList(new IWorldAccess[] { this.u});
this.allowMonsters = true;
this.allowAnimals = true;
-@@ -66,6 +128,36 @@
+@@ -74,6 +136,36 @@
this.worldProvider = worldprovider;
this.isClientSide = flag;
this.K = worldprovider.getWorldBorder();
@@ -114,8 +114,8 @@
+ // CraftBukkit end
}
- public GeneratorAccess b() {
-@@ -138,6 +230,26 @@
+ public BiomeBase getBiome(BlockPosition blockposition) {
+@@ -148,6 +240,26 @@
}
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
@@ -142,7 +142,7 @@
if (k(blockposition)) {
return false;
} else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
-@@ -145,9 +257,23 @@
+@@ -155,9 +267,23 @@
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
Block block = iblockdata.getBlock();
@@ -166,7 +166,7 @@
return false;
} else {
IBlockData iblockdata2 = this.getType(blockposition);
-@@ -158,6 +284,7 @@
+@@ -168,6 +294,7 @@
this.methodProfiler.e();
}
@@ -174,7 +174,7 @@
if (iblockdata2 == iblockdata) {
if (iblockdata1 != iblockdata2) {
this.a(blockposition, blockposition);
-@@ -182,12 +309,63 @@
+@@ -192,12 +319,63 @@
iblockdata.b(this, blockposition, j);
}
}
@@ -238,7 +238,7 @@
public boolean setAir(BlockPosition blockposition) {
Fluid fluid = this.b(blockposition);
-@@ -224,6 +402,11 @@
+@@ -234,6 +412,11 @@
public void update(BlockPosition blockposition, Block block) {
if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
@@ -250,7 +250,7 @@
this.applyPhysics(blockposition, block);
}
-@@ -299,6 +482,17 @@
+@@ -309,6 +492,17 @@
IBlockData iblockdata = this.getType(blockposition);
try {
@@ -268,16 +268,16 @@
iblockdata.doPhysics(this, blockposition, block, blockposition1);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
-@@ -307,7 +501,7 @@
+@@ -317,7 +511,7 @@
crashreportsystemdetails.a("Source block type", () -> {
try {
- return String.format("ID #%s (%s // %s)", new Object[] { Block.REGISTRY.b(block), block.m(), block.getClass().getCanonicalName()});
+ return String.format("ID #%s (%s // %s)", new Object[] { IRegistry.BLOCK.getKey(block), block.m(), block.getClass().getCanonicalName()});
- } catch (Throwable throwable) {
+ } catch (Throwable throwablex) { // CraftBukkit - decompile error
- return "ID #" + Block.REGISTRY.b(block);
+ return "ID #" + IRegistry.BLOCK.getKey(block);
}
});
-@@ -393,6 +587,17 @@
+@@ -403,6 +597,17 @@
}
public IBlockData getType(BlockPosition blockposition) {
@@ -295,7 +295,7 @@
if (k(blockposition)) {
return Blocks.VOID_AIR.getBlockData();
} else {
-@@ -639,6 +844,42 @@
+@@ -649,6 +854,42 @@
}
public boolean addEntity(Entity entity) {
@@ -338,7 +338,7 @@
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
boolean flag = entity.attachedToPlayer;
-@@ -669,6 +910,7 @@
+@@ -679,6 +920,7 @@
((IWorldAccess) this.v.get(i)).a(entity);
}
@@ -346,7 +346,7 @@
}
protected void c(Entity entity) {
-@@ -676,6 +918,7 @@
+@@ -686,6 +928,7 @@
((IWorldAccess) this.v.get(i)).b(entity);
}
@@ -354,7 +354,7 @@
}
public void kill(Entity entity) {
-@@ -711,7 +954,15 @@
+@@ -721,7 +964,15 @@
this.getChunkAt(i, j).b(entity);
}
@@ -371,7 +371,7 @@
this.c(entity);
}
-@@ -746,6 +997,11 @@
+@@ -756,6 +1007,11 @@
for (i = 0; i < this.k.size(); ++i) {
entity = (Entity) this.k.get(i);
@@ -383,7 +383,7 @@
try {
++entity.ticksLived;
-@@ -794,8 +1050,10 @@
+@@ -804,8 +1060,10 @@
CrashReportSystemDetails crashreportsystemdetails1;
CrashReport crashreport1;
@@ -396,7 +396,7 @@
Entity entity1 = entity.getVehicle();
if (entity1 != null) {
-@@ -828,7 +1086,7 @@
+@@ -838,7 +1096,7 @@
this.getChunkAt(j, l).b(entity);
}
@@ -405,7 +405,7 @@
this.c(entity);
}
-@@ -883,9 +1141,11 @@
+@@ -893,9 +1151,11 @@
TileEntity tileentity1 = (TileEntity) this.c.get(i1);
if (!tileentity1.x()) {
@@ -417,7 +417,7 @@
if (this.isLoaded(tileentity1.getPosition())) {
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
-@@ -893,6 +1153,12 @@
+@@ -903,6 +1163,12 @@
chunk.a(tileentity1.getPosition(), tileentity1);
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
@@ -430,7 +430,7 @@
}
}
}
-@@ -946,15 +1212,13 @@
+@@ -956,15 +1222,13 @@
int i;
int j;
@@ -452,15 +452,15 @@
entity.N = entity.locX;
entity.O = entity.locY;
-@@ -970,6 +1234,7 @@
- return ((MinecraftKey) EntityTypes.REGISTRY.b(entity.P())).toString();
+@@ -980,6 +1244,7 @@
+ return IRegistry.ENTITY_TYPE.getKey(entity.P()).toString();
});
entity.tick();
+ entity.postTick(); // CraftBukkit
this.methodProfiler.e();
}
}
-@@ -1300,11 +1565,18 @@
+@@ -1310,11 +1575,18 @@
}
}
@@ -479,7 +479,7 @@
TileEntity tileentity = null;
if (this.J) {
-@@ -1339,6 +1611,14 @@
+@@ -1349,6 +1621,14 @@
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
if (!k(blockposition)) {
if (tileentity != null && !tileentity.x()) {
@@ -494,7 +494,7 @@
if (this.J) {
tileentity.setPosition(blockposition);
Iterator iterator = this.c.iterator();
-@@ -1498,6 +1778,14 @@
+@@ -1509,6 +1789,14 @@
}
this.p = MathHelper.a(this.p, 0.0F, 1.0F);
@@ -509,7 +509,7 @@
}
}
}
-@@ -1583,7 +1871,10 @@
+@@ -1594,7 +1882,10 @@
}
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
@@ -521,7 +521,16 @@
return false;
} else {
int i = 0;
-@@ -1754,7 +2045,7 @@
+@@ -1737,7 +2028,7 @@
+ }
+
+ public Stream<VoxelShape> a(@Nullable Entity entity, VoxelShape voxelshape, VoxelShape voxelshape1, Set<Entity> set) {
+- Stream stream = super.a(entity, voxelshape, voxelshape1, set);
++ Stream stream = IIBlockAccess.super.a(entity, voxelshape, voxelshape1, set); // CraftBukkit - decompile error
+
+ return entity == null ? stream : Stream.concat(stream, this.a(entity, voxelshape, set));
+ }
+@@ -1767,7 +2058,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -530,7 +539,7 @@
arraylist.add(entity);
}
}
-@@ -1769,7 +2060,7 @@
+@@ -1782,7 +2073,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -539,7 +548,7 @@
arraylist.add(entity);
}
}
-@@ -1818,7 +2109,7 @@
+@@ -1831,7 +2122,7 @@
}
}
@@ -548,7 +557,7 @@
}
@Nullable
-@@ -1839,8 +2130,17 @@
+@@ -1852,8 +2143,16 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -560,34 +569,13 @@
+ }
+ }
-- if ((!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) && oclass.isAssignableFrom(entity.getClass())) {
-+ if (oclass.isAssignableFrom(entity.getClass())) {
-+ // if ((!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) && oclass.isAssignableFrom(entity.getClass())) {
+- if (!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) {
++ if (true || !(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) {
+ // CraftBukkit end
- ++i;
- }
- }
-@@ -1849,12 +2149,18 @@
- }
-
- public void a(Collection<Entity> collection) {
-- this.entityList.addAll(collection);
-+ // CraftBukkit start
-+ // this.entityList.addAll(collection);
- Iterator iterator = collection.iterator();
-
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
-
-+ if (entity == null) {
-+ continue;
-+ }
-+ this.entityList.add(entity);
-+ // CraftBukkit end
- this.b(entity);
- }
-
-@@ -1958,6 +2264,11 @@
+ if (oclass.isAssignableFrom(entity.getClass())) {
+ ++j;
+ }
+@@ -1972,6 +2271,11 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@@ -599,7 +587,7 @@
if (predicate.test(entityhuman1)) {
double d5 = entityhuman1.d(d0, d1, d2);
-@@ -2126,6 +2437,16 @@
+@@ -2164,6 +2468,16 @@
public void everyoneSleeping() {}
@@ -616,7 +604,7 @@
public float g(float f) {
return (this.q + (this.r - this.q) * f) * this.i(f);
}
-@@ -2300,7 +2621,7 @@
+@@ -2325,7 +2639,7 @@
int l = j * 16 + 8 - blockposition.getZ();
boolean flag = true;
@@ -624,4 +612,4 @@
+ return k >= -128 && k <= 128 && l >= -128 && l <= 128 && this.keepSpawnInMemory; // CraftBukkit - Added 'this.keepSpawnInMemory'
}
- public void a(Packet<?> packet) {
+ public LongSet ag() {
diff --git a/nms-patches/WorldBorder.patch b/nms-patches/WorldBorder.patch
index 8577053c..f28a690f 100644
--- a/nms-patches/WorldBorder.patch
+++ b/nms-patches/WorldBorder.patch
@@ -1,14 +1,14 @@
--- a/net/minecraft/server/WorldBorder.java
+++ b/net/minecraft/server/WorldBorder.java
-@@ -18,6 +18,7 @@
- private double j;
- private int k;
- private int l;
+@@ -15,6 +15,7 @@
+ private double g;
+ private int h = 29999984;
+ private WorldBorder.a i = new WorldBorder.c(6.0E7D);
+ public WorldServer world; // CraftBukkit
- public WorldBorder() {
- this.e = this.d;
-@@ -177,6 +178,7 @@
+ public WorldBorder() {}
+
+@@ -124,6 +125,7 @@
}
public void a(IWorldBorderListener iworldborderlistener) {
diff --git a/nms-patches/WorldData.patch b/nms-patches/WorldData.patch
index e8480760..f13eb7d8 100644
--- a/nms-patches/WorldData.patch
+++ b/nms-patches/WorldData.patch
@@ -23,8 +23,8 @@
@@ -304,6 +310,7 @@
nbttagcompound2.setBoolean("Snapshot", false);
nbttagcompound.set("Version", nbttagcompound2);
- nbttagcompound.setInt("DataVersion", 1519);
-+ if (org.bukkit.craftbukkit.util.CraftMagicNumbers.DATA_VERSION != 1519) throw new AssertionError(); // CraftBukkit - sentinel
+ nbttagcompound.setInt("DataVersion", 1628);
++ if (org.bukkit.craftbukkit.util.CraftMagicNumbers.DATA_VERSION != 1628) throw new AssertionError(); // CraftBukkit - sentinel
nbttagcompound.setLong("RandomSeed", this.e);
nbttagcompound.setString("generatorName", this.f.b());
nbttagcompound.setInt("generatorVersion", this.f.getVersion());
diff --git a/nms-patches/WorldGenVillagePieces.patch b/nms-patches/WorldGenVillagePieces.patch
index 8609a458..e55f15ce 100644
--- a/nms-patches/WorldGenVillagePieces.patch
+++ b/nms-patches/WorldGenVillagePieces.patch
@@ -3,7 +3,7 @@
@@ -1662,14 +1662,14 @@
entityzombievillager.prepare(generatoraccess.getDamageScaler(new BlockPosition(entityzombievillager)), (GroupDataEntity) null, (NBTTagCompound) null);
entityzombievillager.setProfession(this.c(i1, 0));
- entityzombievillager.dj();
+ entityzombievillager.di();
- generatoraccess.addEntity(entityzombievillager);
+ generatoraccess.addEntity(entityzombievillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
} else {
diff --git a/nms-patches/WorldGenWitchHut.patch b/nms-patches/WorldGenWitchHut.patch
index 8d43bbea..70c91680 100644
--- a/nms-patches/WorldGenWitchHut.patch
+++ b/nms-patches/WorldGenWitchHut.patch
@@ -1,7 +1,7 @@
--- a/net/minecraft/server/WorldGenWitchHut.java
+++ b/net/minecraft/server/WorldGenWitchHut.java
@@ -86,7 +86,7 @@
- entitywitch.dj();
+ entitywitch.di();
entitywitch.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, 0.0F, 0.0F);
entitywitch.prepare(generatoraccess.getDamageScaler(new BlockPosition(i, j, k)), (GroupDataEntity) null, (NBTTagCompound) null);
- generatoraccess.addEntity(entitywitch);
diff --git a/nms-patches/WorldManager.patch b/nms-patches/WorldManager.patch
index e1861fd8..5adb0d9b 100644
--- a/nms-patches/WorldManager.patch
+++ b/nms-patches/WorldManager.patch
@@ -4,7 +4,7 @@
}
public void a(@Nullable EntityHuman entityhuman, SoundEffect soundeffect, SoundCategory soundcategory, double d0, double d1, double d2, float f, float f1) {
-- this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.worldProvider.getDimensionManager().getDimensionID(), new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1));
+- this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.worldProvider.getDimensionManager(), new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1));
+ // CraftBukkit - this.world.dimension
+ this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1));
}
@@ -14,7 +14,7 @@
public void a(SoundEffect soundeffect, BlockPosition blockposition) {}
public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {
-- this.a.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.world.worldProvider.getDimensionManager().getDimensionID(), new PacketPlayOutWorldEvent(i, blockposition, j, false));
+- this.a.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.world.worldProvider.getDimensionManager(), new PacketPlayOutWorldEvent(i, blockposition, j, false));
+ // CraftBukkit - this.world.dimension
+ this.a.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.world.dimension, new PacketPlayOutWorldEvent(i, blockposition, j, false));
}
diff --git a/nms-patches/WorldMap.patch b/nms-patches/WorldMap.patch
index 89ff045e..755cb7c4 100644
--- a/nms-patches/WorldMap.patch
+++ b/nms-patches/WorldMap.patch
@@ -16,9 +16,9 @@
public class WorldMap extends PersistentBase {
public int centerX;
-@@ -21,8 +30,18 @@
- private final Map<String, MapIconBanner> k = Maps.newHashMap();
+@@ -22,8 +31,18 @@
public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
+ private final Map<String, WorldMapFrame> l = Maps.newHashMap();
+ // CraftBukkit start
+ public final CraftMapView mapView;
@@ -34,25 +34,16 @@
+ // CraftBukkit end
}
- public void a(int i, int j, int k, boolean flag, boolean flag1, int l) {
-@@ -31,7 +50,7 @@
- this.map = (byte) l;
- this.track = flag;
- this.unlimitedTracking = flag1;
-- this.d();
-+ this.c(); // CraftBukkit - typo
- }
-
- public void a(double d0, double d1, int i) {
-@@ -44,7 +63,30 @@
+ public void a(int i, int j, int k, boolean flag, boolean flag1, DimensionManager dimensionmanager) {
+@@ -45,7 +64,31 @@
}
public void a(NBTTagCompound nbttagcompound) {
-- this.map = nbttagcompound.getByte("dimension");
+- this.map = DimensionManager.a(nbttagcompound.getInt("dimension"));
+ // CraftBukkit start
-+ byte dimension = nbttagcompound.getByte("dimension");
++ int dimension = nbttagcompound.getInt("dimension");
+
-+ if (dimension >= 10) {
++ if (dimension >= CraftWorld.CUSTOM_DIMENSION_OFFSET) {
+ long least = nbttagcompound.getLong("UUIDLeast");
+ long most = nbttagcompound.getLong("UUIDMost");
+
@@ -64,24 +55,25 @@
+ if (world == null) {
+ /* All Maps which do not have their valid world loaded are set to a dimension which hopefully won't be reached.
+ This is to prevent them being corrupted with the wrong map data. */
-+ dimension = 127;
++ this.map = new DimensionManager(127, null, null, null);
+ } else {
-+ dimension = (byte) world.getHandle().dimension;
++ this.map = world.getHandle().dimension;
+ }
+ }
++ } else {
++ this.map = DimensionManager.a(dimension);
+ }
+
-+ this.map = dimension;
+ // CraftBukkit end
this.centerX = nbttagcompound.getInt("xCenter");
this.centerZ = nbttagcompound.getInt("zCenter");
this.scale = (byte) MathHelper.clamp(nbttagcompound.getByte("scale"), 0, 4);
-@@ -67,6 +109,25 @@
+@@ -77,6 +120,25 @@
}
public NBTTagCompound b(NBTTagCompound nbttagcompound) {
+ // CraftBukkit start
-+ if (this.map >= 10) {
++ if (this.map.getDimensionID() >= CraftWorld.CUSTOM_DIMENSION_OFFSET) {
+ if (this.uniqueId == null) {
+ for (org.bukkit.World world : server.getWorlds()) {
+ CraftWorld cWorld = (CraftWorld) world;
@@ -99,10 +91,10 @@
+ }
+ }
+ // CraftBukkit end
- nbttagcompound.setByte("dimension", this.map);
+ nbttagcompound.setInt("dimension", this.map.getDimensionID());
nbttagcompound.setInt("xCenter", this.centerX);
nbttagcompound.setInt("zCenter", this.centerZ);
-@@ -315,12 +376,25 @@
+@@ -357,12 +419,25 @@
@Nullable
public Packet<?> a(ItemStack itemstack) {
diff --git a/nms-patches/WorldNBTStorage.patch b/nms-patches/WorldNBTStorage.patch
index 675a06b5..6854bdc8 100644
--- a/nms-patches/WorldNBTStorage.patch
+++ b/nms-patches/WorldNBTStorage.patch
@@ -12,15 +12,15 @@
public class WorldNBTStorage implements IDataManager, IPlayerFileData {
private static final Logger b = LogManager.getLogger();
-@@ -24,6 +29,7 @@
- private final String g;
- private final DefinedStructureManager h;
+@@ -23,6 +28,7 @@
+ private final String f;
+ private final DefinedStructureManager g;
protected final DataFixer a;
+ private UUID uuid = null; // CraftBukkit
public WorldNBTStorage(File file, String s, @Nullable MinecraftServer minecraftserver, DataFixer datafixer) {
this.a = datafixer;
-@@ -170,6 +176,16 @@
+@@ -167,6 +173,16 @@
}
if (nbttagcompound != null) {
@@ -37,7 +37,7 @@
int i = nbttagcompound.hasKeyOfType("DataVersion", 3) ? nbttagcompound.getInt("DataVersion") : -1;
entityhuman.f(GameProfileSerializer.a(this.a, DataFixTypes.PLAYER, nbttagcompound, i));
-@@ -178,6 +194,22 @@
+@@ -175,6 +191,22 @@
return nbttagcompound;
}
diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch
index 9567884b..7411f7ae 100644
--- a/nms-patches/WorldServer.patch
+++ b/nms-patches/WorldServer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/WorldServer.java
+++ b/net/minecraft/server/WorldServer.java
-@@ -20,6 +20,18 @@
+@@ -21,6 +21,18 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -19,66 +19,66 @@
public class WorldServer extends World implements IAsyncTaskHandler {
private static final Logger a = LogManager.getLogger();
-@@ -38,28 +50,36 @@
+@@ -39,28 +51,36 @@
ObjectLinkedOpenHashSet<BlockActionData> d;
- private boolean Q;
+ private boolean P;
-- public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, WorldData worlddata, int i, MethodProfiler methodprofiler) {
-- super(idatamanager, worlddata, DimensionManager.a(i).d(), methodprofiler, false);
+- public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, PersistentCollection persistentcollection, WorldData worlddata, DimensionManager dimensionmanager, MethodProfiler methodprofiler) {
+- super(idatamanager, persistentcollection, worlddata, dimensionmanager.e(), methodprofiler, false);
- Predicate predicate = (block) -> {
+ // CraftBukkit start
-+ public final int dimension;
++ public final DimensionManager dimension;
+
+ // Add env and gen to constructor
-+ public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, WorldData worlddata, int i, MethodProfiler methodprofiler, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
-+ super(idatamanager, worlddata, DimensionManager.a(env.getId()).d(), methodprofiler, false, gen, env);
-+ this.dimension = i;
++ public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, PersistentCollection persistentcollection, WorldData worlddata, DimensionManager dimensionmanager, MethodProfiler methodprofiler, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
++ super(idatamanager, persistentcollection, worlddata, DimensionManager.a(env.getId()).e(), methodprofiler, false, gen, env);
++ this.dimension = dimensionmanager;
+ this.pvpMode = minecraftserver.getPVP();
+ worlddata.world = this;
+ // CraftBukkit end
+ Predicate<Block> predicate = (block) -> { // CraftBukkit - decompile error
return block == null || block.getBlockData().isAir();
};
- RegistryBlocks registryblocks = Block.REGISTRY;
+ IRegistry iregistry = IRegistry.BLOCK;
- Block.REGISTRY.getClass();
- Function function = registryblocks::b;
-- RegistryBlocks registryblocks1 = Block.REGISTRY;
-+ RegistryBlocks<MinecraftKey, Block> registryblocks1 = Block.REGISTRY; // CraftBukkit - decompile error
+ IRegistry.BLOCK.getClass();
+ Function function = iregistry::getKey;
+- IRegistry iregistry1 = IRegistry.BLOCK;
++ IRegistry<Block> iregistry1 = IRegistry.BLOCK; // CraftBukkit - decompile error
- Block.REGISTRY.getClass();
-- this.nextTickListBlock = new TickListServer(this, predicate, function, registryblocks1::get, this::b);
+ IRegistry.BLOCK.getClass();
+- this.nextTickListBlock = new TickListServer(this, predicate, function, iregistry1::getOrDefault, this::b);
- predicate = (fluidtype) -> {
-+ this.nextTickListBlock = new TickListServer<>(this, predicate, function, registryblocks1::get, this::b); // CraftBukkit - decompile error
-+ Predicate<FluidType> predicate2 = (fluidtype) -> {
++ this.nextTickListBlock = new TickListServer<>(this, predicate, function, iregistry1::getOrDefault, this::b); // CraftBukkit - decompile error
++ Predicate<FluidType> predicate2 = (fluidtype) -> { // CraftBukkit - decompile error
return fluidtype == null || fluidtype == FluidTypes.a;
};
- registryblocks = FluidType.c;
- FluidType.c.getClass();
- function = registryblocks::b;
-- registryblocks1 = FluidType.c;
-+ RegistryBlocks<MinecraftKey, FluidType> registryblocks2 = FluidType.c; // CraftBukkit - decompile error
- FluidType.c.getClass();
-- this.nextTickListFluid = new TickListServer(this, predicate, function, registryblocks1::get, this::a);
-+ this.nextTickListFluid = new TickListServer<>(this, predicate2, function, registryblocks2::get, this::a); // CraftBukkit - decompile error
+ iregistry = IRegistry.FLUID;
+ IRegistry.FLUID.getClass();
+ function = iregistry::getKey;
+- iregistry1 = IRegistry.FLUID;
++ IRegistry<FluidType> iregistry2 = IRegistry.FLUID; // CraftBukkit - decompile error
+ IRegistry.FLUID.getClass();
+- this.nextTickListFluid = new TickListServer(this, predicate, function, iregistry1::getOrDefault, this::a);
++ this.nextTickListFluid = new TickListServer<>(this, predicate2, function, iregistry2::getOrDefault, this::a); // CraftBukkit - decompile error
this.siegeManager = new VillageSiege(this);
this.d = new ObjectLinkedOpenHashSet();
this.server = minecraftserver;
-@@ -67,7 +87,7 @@
+@@ -68,7 +88,7 @@
this.manager = new PlayerChunkMap(this);
this.worldProvider.a((World) this);
- this.chunkProvider = this.q();
+ this.chunkProvider = this.r();
- this.portalTravelAgent = new PortalTravelAgent(this);
+ this.portalTravelAgent = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
- this.O();
this.P();
- this.getWorldBorder().a(minecraftserver.aw());
+ this.Q();
+ this.getWorldBorder().a(minecraftserver.au());
@@ -86,6 +106,7 @@
this.villages.a((World) this);
}
+ if (getServer().getScoreboardManager() == null) { // CraftBukkit
- PersistentScoreboard persistentscoreboard = (PersistentScoreboard) this.worldMaps.get(PersistentScoreboard::new, "scoreboard");
+ PersistentScoreboard persistentscoreboard = (PersistentScoreboard) this.a(DimensionManager.OVERWORLD, PersistentScoreboard::new, "scoreboard");
if (persistentscoreboard == null) {
@@ -95,6 +116,7 @@
@@ -217,9 +217,9 @@
+ }
+ // CraftBukkit end
+
- public void doTick() {
- this.Q = true;
- super.doTick();
+ public void doTick(BooleanSupplier booleansupplier) {
+ this.P = true;
+ super.doTick(booleansupplier);
@@ -128,9 +271,12 @@
}
@@ -238,8 +238,8 @@
this.methodProfiler.c("chunkSource");
@@ -160,6 +306,8 @@
this.methodProfiler.e();
- this.am();
- this.Q = false;
+ this.an();
+ this.P = false;
+
+ this.getWorld().processChunkGC(); // CraftBukkit
}
@@ -257,7 +257,7 @@
@@ -223,25 +371,46 @@
}
- private void ai() {
+ private void b() {
- this.worldData.setWeatherDuration(0);
+ // CraftBukkit start
this.worldData.setStorm(false);
@@ -279,7 +279,7 @@
}
public boolean everyoneDeeplySleeping() {
- if (this.K && !this.isClientSide) {
+ if (this.J && !this.isClientSide) {
Iterator iterator = this.players.iterator();
+ // CraftBukkit - This allows us to assume that some people are in bed but not really, allowing time to pass in spite of AFKers
@@ -305,15 +305,15 @@
return false;
} else {
-@@ -315,7 +484,7 @@
+@@ -316,7 +485,7 @@
entityhorseskeleton.s(true);
entityhorseskeleton.setAgeRaw(0);
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
- this.addEntity(entityhorseskeleton);
+ this.addEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
- this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), true));
- } else {
- this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), false));
+ }
+
+ this.strikeLightning(new EntityLightning(this, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, flag2));
@@ -332,11 +501,11 @@
BiomeBase biomebase = this.getBiome(blockposition);
@@ -363,7 +363,7 @@
private boolean getSpawnNPCs() {
return this.server.getSpawnNPCs();
@@ -513,7 +684,21 @@
- protected IChunkProvider q() {
+ protected IChunkProvider r() {
IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider);
- return new ChunkProviderServer(this, ichunkloader, this.worldProvider.getChunkGenerator(), this.server);
@@ -411,7 +411,7 @@
@@ -647,6 +848,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProviderServer();
- if (chunkproviderserver.e()) {
+ if (chunkproviderserver.d()) {
+ org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
if (iprogressupdate != null) {
iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0]));
@@ -422,11 +422,11 @@
chunkproviderserver.a(flag);
- ArrayList arraylist = Lists.newArrayList(chunkproviderserver.a());
+ // CraftBukkit - ArrayList -> Collection
-+ Collection arraylist = chunkproviderserver.a();
++ java.util.Collection arraylist = chunkproviderserver.a();
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
-@@ -692,6 +895,12 @@
+@@ -691,6 +894,12 @@
}
}
@@ -439,8 +439,8 @@
this.worldData.a(this.getWorldBorder().getSize());
this.worldData.d(this.getWorldBorder().getCenterX());
this.worldData.c(this.getWorldBorder().getCenterZ());
-@@ -706,9 +915,13 @@
- this.worldMaps.a();
+@@ -705,9 +914,13 @@
+ this.h().a();
}
- public boolean addEntity(Entity entity) {
@@ -453,9 +453,9 @@
}
+ // CraftBukkit end
- public void a(Collection<Entity> collection) {
- ArrayList arraylist = Lists.newArrayList(collection);
-@@ -727,7 +940,7 @@
+ public void a(Stream<Entity> stream) {
+ stream.forEach((entity) -> {
+@@ -721,7 +934,7 @@
private boolean j(Entity entity) {
if (entity.dead) {
@@ -464,7 +464,7 @@
return false;
} else {
UUID uuid = entity.getUniqueID();
-@@ -739,7 +952,7 @@
+@@ -733,7 +946,7 @@
this.g.remove(entity1);
} else {
if (!(entity instanceof EntityHuman)) {
@@ -473,7 +473,7 @@
return false;
}
-@@ -792,8 +1005,16 @@
+@@ -786,8 +999,16 @@
}
public boolean strikeLightning(Entity entity) {
@@ -486,12 +486,12 @@
+ }
+ // CraftBukkit end
if (super.strikeLightning(entity)) {
-- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, this.worldProvider.getDimensionManager().getDimensionID(), new PacketPlayOutSpawnEntityWeather(entity));
+- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entity));
+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, dimension, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit - Use dimension
return true;
} else {
return false;
-@@ -809,6 +1030,14 @@
+@@ -803,6 +1024,14 @@
}
public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
@@ -506,7 +506,7 @@
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, flag1);
if (damagesource != null) {
-@@ -817,6 +1046,8 @@
+@@ -811,6 +1040,8 @@
explosion.a();
explosion.a(false);
@@ -515,25 +515,25 @@
if (!flag1) {
explosion.clearBlocks();
}
-@@ -843,7 +1074,8 @@
+@@ -837,7 +1068,8 @@
BlockActionData blockactiondata = (BlockActionData) this.d.removeFirst();
if (this.a(blockactiondata)) {
-- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, this.worldProvider.getDimensionManager().getDimensionID(), new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.b(), blockactiondata.c(), blockactiondata.d()));
+- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.b(), blockactiondata.c(), blockactiondata.d()));
+ // CraftBukkit - this.worldProvider.dimension -> this.dimension
+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, dimension, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.b(), blockactiondata.c(), blockactiondata.d()));
}
}
-@@ -864,6 +1096,7 @@
+@@ -858,6 +1090,7 @@
boolean flag = this.isRaining();
- super.v();
+ super.w();
+ /* CraftBukkit start
if (this.o != this.p) {
- this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.p)), this.worldProvider.getDimensionManager().getDimensionID());
+ this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.p)), this.worldProvider.getDimensionManager());
}
-@@ -882,6 +1115,21 @@
+@@ -876,6 +1109,21 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.p));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.r));
}
@@ -555,7 +555,7 @@
}
-@@ -915,11 +1163,18 @@
+@@ -909,11 +1157,18 @@
}
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {