From ed20842bcf87500619fff1af03341b1e74ec5a3e Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 25 Apr 2019 12:00:00 +1000 Subject: [PATCH] Update to Minecraft 1.14 --- nms-patches/AdvancementDataPlayer.patch | 4 +- nms-patches/Advancements.patch | 4 +- nms-patches/BlockBed.patch | 4 +- nms-patches/BlockCommand.patch | 2 +- nms-patches/Chunk.patch | 2 +- nms-patches/ChunkProviderServer.patch | 4 +- nms-patches/CommandDispatcher.patch | 10 +- nms-patches/ContainerAnvil.patch | 2 +- nms-patches/CraftingManager.patch | 10 +- nms-patches/Entity.patch | 62 ++++++------- nms-patches/EntityArrow.patch | 8 +- nms-patches/EntityEnderDragon.patch | 2 +- nms-patches/EntityHuman.patch | 6 +- nms-patches/EntityPlayer.patch | 8 +- nms-patches/EntityTrackerEntry.patch | 6 +- nms-patches/ItemStack.patch | 2 +- nms-patches/LegacyPingHandler.patch | 6 +- nms-patches/LoginListener.patch | 10 +- .../NameReferencingFileConverter.patch | 16 ++-- nms-patches/PlayerChunkMap.patch | 22 ++--- nms-patches/PlayerConnection.patch | 2 +- nms-patches/PlayerList.patch | 91 ++++++++++--------- nms-patches/PropertyManager.patch | 2 +- nms-patches/SpawnerCreature.patch | 2 +- nms-patches/TileEntity.patch | 2 +- nms-patches/TileEntityBeacon.patch | 4 +- nms-patches/TileEntityCampfire.patch | 2 +- nms-patches/TileEntityHopper.patch | 6 +- nms-patches/World.patch | 2 +- nms-patches/WorldNBTStorage.patch | 8 +- nms-patches/WorldServer.patch | 12 +-- pom.xml | 6 +- .../org/bukkit/craftbukkit/CraftServer.java | 2 +- .../craftbukkit/entity/CraftHumanEntity.java | 8 +- 34 files changed, 172 insertions(+), 167 deletions(-) diff --git a/nms-patches/AdvancementDataPlayer.patch b/nms-patches/AdvancementDataPlayer.patch index b14455b6e1..5dc3f34ea4 100644 --- a/nms-patches/AdvancementDataPlayer.patch +++ b/nms-patches/AdvancementDataPlayer.patch @@ -4,10 +4,10 @@ Advancement advancement = this.d.getAdvancementData().a((MinecraftKey) entry.getKey()); if (advancement == null) { -- AdvancementDataPlayer.a.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.e); +- AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.e); + // CraftBukkit start + if (((MinecraftKey) entry.getKey()).b().equals("minecraft")) { -+ AdvancementDataPlayer.a.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.e); ++ AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.e); + } + // CraftBukkit end } else { diff --git a/nms-patches/Advancements.patch b/nms-patches/Advancements.patch index 0312dbf8a5..ceb3497c6b 100644 --- a/nms-patches/Advancements.patch +++ b/nms-patches/Advancements.patch @@ -4,8 +4,8 @@ } } -- Advancements.a.info("Loaded {} advancements", this.advancements.size()); -+ // Advancements.a.info("Loaded {} advancements", this.advancements.size()); // CraftBukkit - moved to AdvancementDataWorld#reload +- Advancements.LOGGER.info("Loaded {} advancements", this.advancements.size()); ++ // Advancements.LOGGER.info("Loaded {} advancements", this.advancements.size()); // CraftBukkit - moved to AdvancementDataWorld#reload } public void a() { diff --git a/nms-patches/BlockBed.patch b/nms-patches/BlockBed.patch index 9a104607b7..4822b8d554 100644 --- a/nms-patches/BlockBed.patch +++ b/nms-patches/BlockBed.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/BlockBed.java +++ b/net/minecraft/server/BlockBed.java -@@ -41,20 +41,37 @@ +@@ -42,20 +42,37 @@ } } @@ -39,7 +39,7 @@ world.a(blockposition, false); BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite()); -@@ -64,8 +81,7 @@ +@@ -65,8 +82,7 @@ world.createExplosion((Entity) null, DamageSource.a(), (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.Effect.DESTROY); return true; diff --git a/nms-patches/BlockCommand.patch b/nms-patches/BlockCommand.patch index 75b5e602c8..cad4d41ec7 100644 --- a/nms-patches/BlockCommand.patch +++ b/nms-patches/BlockCommand.patch @@ -8,7 +8,7 @@ + public class BlockCommand extends BlockTileEntity { - private static final Logger c = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -32,6 +34,15 @@ TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity; boolean flag1 = world.isBlockIndirectlyPowered(blockposition); diff --git a/nms-patches/Chunk.patch b/nms-patches/Chunk.patch index 251c2a92e6..b3e573bbf6 100644 --- a/nms-patches/Chunk.patch +++ b/nms-patches/Chunk.patch @@ -13,7 +13,7 @@ + public class Chunk implements IChunkAccess { - private static final Logger b = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -91,8 +98,19 @@ } } diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch index 65a05a2ea8..4621159cb1 100644 --- a/nms-patches/ChunkProviderServer.patch +++ b/nms-patches/ChunkProviderServer.patch @@ -4,8 +4,8 @@ if (flag1) { completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag); -- this.serverThreadQueue.c(completablefuture::isDone); -+ this.serverThreadQueue.c((BooleanSupplier) completablefuture::isDone); // CraftBukkit - decompile error +- this.serverThreadQueue.awaitTasks(completablefuture::isDone); ++ this.serverThreadQueue.awaitTasks((BooleanSupplier) completablefuture::isDone); // CraftBukkit - decompile error } else { completablefuture = CompletableFuture.supplyAsync(() -> { return this.getChunkFutureMainThread(i, j, chunkstatus, flag); diff --git a/nms-patches/CommandDispatcher.patch b/nms-patches/CommandDispatcher.patch index 1454f31d76..de42bff4e7 100644 --- a/nms-patches/CommandDispatcher.patch +++ b/nms-patches/CommandDispatcher.patch @@ -14,7 +14,7 @@ + public class CommandDispatcher { - private static final Logger a = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); private final com.mojang.brigadier.CommandDispatcher b = new com.mojang.brigadier.CommandDispatcher(); - public CommandDispatcher(boolean flag) { @@ -27,8 +27,8 @@ } 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); -+ // CommandDispatcher.a.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection); // CraftBukkit +- CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection); ++ // CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection); // CraftBukkit }); + return this; + } @@ -149,10 +149,10 @@ - ChatComponentText chatcomponenttext1 = chatcomponenttext; + ChatMessage chatmessage1 = new ChatMessage("command.failed", new Object[0]); -- if (CommandDispatcher.a.isDebugEnabled()) { +- if (CommandDispatcher.LOGGER.isDebugEnabled()) { - StackTraceElement[] astacktraceelement = exception.getStackTrace(); + chatcomponenttext = new ChatComponentText(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage()); -+ if (CommandDispatcher.a.isDebugEnabled()) { ++ if (CommandDispatcher.LOGGER.isDebugEnabled()) { + StackTraceElement[] astacktraceelement = exception.getStackTrace(); - for(int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) { diff --git a/nms-patches/ContainerAnvil.patch b/nms-patches/ContainerAnvil.patch index e5cfa8f4fa..50df646671 100644 --- a/nms-patches/ContainerAnvil.patch +++ b/nms-patches/ContainerAnvil.patch @@ -10,7 +10,7 @@ + public class ContainerAnvil extends Container { - private static final Logger c = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -16,6 +20,12 @@ private int h; public String renameText; diff --git a/nms-patches/CraftingManager.patch b/nms-patches/CraftingManager.patch index d88fc01a50..31c83fdfe6 100644 --- a/nms-patches/CraftingManager.patch +++ b/nms-patches/CraftingManager.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/CraftingManager.java +++ b/net/minecraft/server/CraftingManager.java @@ -26,7 +26,7 @@ - private static final Logger c = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); public static final int a = "recipes/".length(); public static final int b = ".json".length(); -- public Map, Map>> recipes = (Map) SystemUtils.a((Object) Maps.newHashMap(), CraftingManager::a); -+ public Map, it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap>> recipes = SystemUtils.a(Maps.newHashMap(), CraftingManager::a); // CraftBukkit +- public Map, Map>> recipes = (Map) SystemUtils.a((Object) Maps.newHashMap(), CraftingManager::initializeRecipeMap); ++ public Map, it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap>> recipes = SystemUtils.a(Maps.newHashMap(), CraftingManager::initializeRecipeMap); // CraftBukkit private boolean e; public CraftingManager() {} @@ -58,8 +58,8 @@ })).a(minecraftkey, jsonobject); } -- private static void a(Map, Map>> map) { -+ public static void a(Map, it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap>> map) { // CraftBukkit +- public static void initializeRecipeMap(Map, Map>> map) { ++ public static void initializeRecipeMap(Map, it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap>> map) { // CraftBukkit map.clear(); Iterator iterator = IRegistry.RECIPE_TYPE.iterator(); diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch index 04de1973c5..7e5753c529 100644 --- a/nms-patches/Entity.patch +++ b/nms-patches/Entity.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Entity.java +++ b/net/minecraft/server/Entity.java -@@ -21,8 +21,54 @@ +@@ -20,8 +20,54 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -55,7 +55,7 @@ protected static final Logger LOGGER = LogManager.getLogger(); private static final AtomicInteger entityCount = new AtomicInteger(); private static final List c = Collections.emptyList(); -@@ -107,6 +153,16 @@ +@@ -106,6 +152,16 @@ private long aH; private EntitySize size; private float headHeight; @@ -72,7 +72,7 @@ public Entity(EntityTypes entitytypes, World world) { this.id = Entity.entityCount.incrementAndGet(); -@@ -213,6 +269,33 @@ +@@ -212,6 +268,33 @@ } protected void setYawPitch(float f, float f1) { @@ -106,7 +106,7 @@ this.yaw = f % 360.0F; this.pitch = f1 % 360.0F; } -@@ -225,6 +308,7 @@ +@@ -224,6 +307,7 @@ float f1 = this.size.height; this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); @@ -114,7 +114,7 @@ } public void tick() { -@@ -235,6 +319,15 @@ +@@ -234,6 +318,15 @@ this.entityBaseTick(); } @@ -130,7 +130,7 @@ public void entityBaseTick() { this.world.getMethodProfiler().enter("entityBaseTick"); if (this.isPassenger() && this.getVehicle().dead) { -@@ -251,7 +344,7 @@ +@@ -250,7 +343,7 @@ this.lastZ = this.locZ; this.lastPitch = this.pitch; this.lastYaw = this.yaw; @@ -139,7 +139,7 @@ this.az(); this.m(); if (this.world.isClientSide) { -@@ -301,12 +394,44 @@ +@@ -300,12 +393,44 @@ protected void burnFromLava() { if (!this.isFireProof()) { @@ -185,7 +185,7 @@ int j = i * 20; if (this instanceof EntityLiving) { -@@ -402,6 +527,28 @@ +@@ -401,6 +526,28 @@ block1.a((IBlockAccess) this.world, this); } @@ -214,7 +214,7 @@ if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) { double d0 = vec3d1.x; double d1 = vec3d1.y; -@@ -455,7 +602,14 @@ +@@ -454,7 +601,14 @@ if (!flag) { ++this.fireTicks; if (this.fireTicks == 0) { @@ -230,7 +230,7 @@ } } -@@ -566,7 +720,7 @@ +@@ -565,7 +719,7 @@ VoxelShape voxelshape = this.world.getWorldBorder().a(); Stream stream = VoxelShapes.c(voxelshape, VoxelShapes.a(axisalignedbb.shrink(1.0E-7D)), OperatorBoolean.AND) ? Stream.empty() : Stream.of(voxelshape); AxisAlignedBB axisalignedbb1 = axisalignedbb.a(vec3d).g(1.0E-7D); @@ -239,7 +239,7 @@ return !this.x(entity); }).flatMap((entity) -> { return Stream.of(entity.ap(), this.j(entity)); -@@ -650,6 +804,7 @@ +@@ -649,6 +803,7 @@ this.locX = (axisalignedbb.minX + axisalignedbb.maxX) / 2.0D; this.locY = axisalignedbb.minY; this.locZ = (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D; @@ -247,7 +247,7 @@ } protected SoundEffect getSoundSwim() { -@@ -821,7 +976,7 @@ +@@ -820,7 +975,7 @@ return null; } @@ -256,7 +256,7 @@ if (!this.isFireProof()) { this.damageEntity(DamageSource.FIRE, (float) i); } -@@ -1054,6 +1209,13 @@ +@@ -1053,6 +1208,13 @@ } public void spawnIn(World world) { @@ -270,7 +270,7 @@ this.world = world; } -@@ -1079,6 +1241,7 @@ +@@ -1078,6 +1240,7 @@ this.lastYaw -= 360.0F; } @@ -278,7 +278,7 @@ this.setPosition(this.locX, this.locY, this.locZ); this.setYawPitch(f, f1); } -@@ -1247,7 +1410,7 @@ +@@ -1246,7 +1409,7 @@ public boolean c(NBTTagCompound nbttagcompound) { String s = this.getSaveID(); @@ -287,7 +287,7 @@ nbttagcompound.setString("id", s); this.save(nbttagcompound); return true; -@@ -1266,6 +1429,18 @@ +@@ -1265,6 +1428,18 @@ Vec3D vec3d = this.getMot(); nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z)); @@ -306,7 +306,7 @@ nbttagcompound.set("Rotation", this.a(this.yaw, this.pitch)); nbttagcompound.setFloat("FallDistance", this.fallDistance); nbttagcompound.setShort("Fire", (short) this.fireTicks); -@@ -1275,6 +1450,12 @@ +@@ -1274,6 +1449,12 @@ nbttagcompound.setBoolean("Invulnerable", this.invulnerable); nbttagcompound.setInt("PortalCooldown", this.portalCooldown); nbttagcompound.a("UUID", this.getUniqueID()); @@ -319,7 +319,7 @@ IChatBaseComponent ichatbasecomponent = this.getCustomName(); if (ichatbasecomponent != null) { -@@ -1415,6 +1596,42 @@ +@@ -1414,6 +1595,42 @@ } else { throw new IllegalStateException("Entity has invalid position"); } @@ -362,7 +362,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -1490,9 +1707,22 @@ +@@ -1489,9 +1706,22 @@ } else if (this.world.isClientSide) { return null; } else { @@ -385,7 +385,7 @@ this.world.addEntity(entityitem); return entityitem; } -@@ -1596,7 +1826,7 @@ +@@ -1595,7 +1825,7 @@ } this.vehicle = entity; @@ -394,7 +394,7 @@ return true; } } -@@ -1621,15 +1851,36 @@ +@@ -1620,15 +1850,36 @@ Entity entity = this.vehicle; this.vehicle = null; @@ -433,7 +433,7 @@ if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) { this.passengers.add(0, entity); } else { -@@ -1637,15 +1888,33 @@ +@@ -1636,15 +1887,33 @@ } } @@ -468,7 +468,7 @@ } protected boolean q(Entity entity) { -@@ -1688,7 +1957,7 @@ +@@ -1687,7 +1956,7 @@ int i = this.ab(); if (this.ai) { @@ -477,7 +477,7 @@ this.world.getMethodProfiler().enter("portal"); this.aj = i; this.portalCooldown = this.aW(); -@@ -1772,6 +2041,13 @@ +@@ -1771,6 +2040,13 @@ } public void setSwimming(boolean flag) { @@ -491,7 +491,7 @@ this.setFlag(4, flag); } -@@ -1832,16 +2108,56 @@ +@@ -1831,16 +2107,56 @@ } public void setAirTicks(int i) { @@ -551,7 +551,7 @@ } public void j(boolean flag) { -@@ -1989,20 +2305,33 @@ +@@ -1988,20 +2304,33 @@ @Nullable public Entity a(DimensionManager dimensionmanager) { @@ -588,9 +588,9 @@ if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.OVERWORLD) { blockposition = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn()); } else if (dimensionmanager == DimensionManager.THE_END) { -@@ -2040,6 +2369,25 @@ - vec3d = (Vec3D) ((Pair) pair.getSecond()).getFirst(); - f = (float) (Integer) ((Pair) pair.getSecond()).getSecond(); +@@ -2039,6 +2368,25 @@ + vec3d = shapedetector_c.b; + f = (float) shapedetector_c.c; } + } // CraftBukkit + @@ -614,7 +614,7 @@ this.world.getMethodProfiler().exitEnter("reloading"); Entity entity = this.getEntityType().a((World) worldserver1); -@@ -2049,6 +2397,14 @@ +@@ -2048,6 +2396,14 @@ entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch); entity.setMot(vec3d); worldserver1.addEntityTeleport(entity); @@ -629,7 +629,7 @@ } this.dead = true; -@@ -2240,7 +2596,26 @@ +@@ -2239,7 +2595,26 @@ } public void a(AxisAlignedBB axisalignedbb) { diff --git a/nms-patches/EntityArrow.patch b/nms-patches/EntityArrow.patch index ee0bf8332c..b7daf7cdb7 100644 --- a/nms-patches/EntityArrow.patch +++ b/nms-patches/EntityArrow.patch @@ -13,7 +13,7 @@ public abstract class EntityArrow extends Entity implements IProjectile { private static final DataWatcherObject ar = DataWatcher.a(EntityArrow.class, DataWatcherRegistry.a); -@@ -251,6 +257,7 @@ +@@ -252,6 +258,7 @@ } protected void a(MovingObjectPosition movingobjectposition) { @@ -21,7 +21,7 @@ MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType(); if (movingobjectposition_enummovingobjecttype == MovingObjectPosition.EnumMovingObjectType.ENTITY) { -@@ -331,7 +338,13 @@ +@@ -332,7 +339,13 @@ } if (this.isBurning() && !(entity instanceof EntityEnderman)) { @@ -36,7 +36,7 @@ } if (entity.damageEntity(damagesource, (float) i)) { -@@ -467,6 +480,7 @@ +@@ -468,6 +481,7 @@ public void setShooter(@Nullable Entity entity) { this.shooter = entity == null ? null : entity.getUniqueID(); @@ -44,7 +44,7 @@ if (entity instanceof EntityHuman) { this.fromPlayer = ((EntityHuman) entity).abilities.canInstantlyBuild ? EntityArrow.PickupStatus.CREATIVE_ONLY : EntityArrow.PickupStatus.ALLOWED; } -@@ -481,9 +495,23 @@ +@@ -482,9 +496,23 @@ @Override public void pickup(EntityHuman entityhuman) { if (!this.world.isClientSide && (this.inGround || this.v()) && this.shake <= 0) { diff --git a/nms-patches/EntityEnderDragon.patch b/nms-patches/EntityEnderDragon.patch index ea567c81b7..903ab32170 100644 --- a/nms-patches/EntityEnderDragon.patch +++ b/nms-patches/EntityEnderDragon.patch @@ -13,7 +13,7 @@ +// PAIL: Fixme public class EntityEnderDragon extends EntityInsentient implements IMonster { - private static final Logger bN = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -35,6 +41,7 @@ private final PathPoint[] bT = new PathPoint[24]; private final int[] bU = new int[24]; diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch index 6885da8d53..5d3d943a13 100644 --- a/nms-patches/EntityHuman.patch +++ b/nms-patches/EntityHuman.patch @@ -388,7 +388,7 @@ this.sleepTicks = flag ? 0 : 100; if (flag2) { optional.ifPresent((blockposition) -> { -@@ -1188,9 +1364,11 @@ +@@ -1187,9 +1363,11 @@ if (blockposition != null) { this.f = blockposition; this.g = flag; @@ -400,7 +400,7 @@ } } -@@ -1262,7 +1440,11 @@ +@@ -1261,7 +1439,11 @@ this.setMot(vec3d2.x, d3 * 0.6D, vec3d2.z); this.aO = f; this.fallDistance = 0.0F; @@ -413,7 +413,7 @@ } else { super.e(vec3d); } -@@ -1581,24 +1763,29 @@ +@@ -1580,24 +1762,29 @@ } protected void releaseShoulderEntities() { diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch index 532bc84370..9bdcf2f0e2 100644 --- a/nms-patches/EntityPlayer.patch +++ b/nms-patches/EntityPlayer.patch @@ -146,20 +146,20 @@ + super.spawnIn(world); + if (world == null) { + this.dead = false; -+ BlockPosition position = null; ++ Vec3D position = null; + if (this.spawnWorld != null && !this.spawnWorld.equals("")) { + CraftWorld cworld = (CraftWorld) Bukkit.getServer().getWorld(this.spawnWorld); + if (cworld != null && this.getBed() != null) { + world = cworld.getHandle(); -+ position = EntityHuman.getBed(cworld.getHandle(), this.getBed(), false); ++ position = EntityHuman.getBed(cworld.getHandle(), this.getBed(), false).orElse(null); + } + } + if (world == null || position == null) { + world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle(); -+ position = world.getSpawn(); ++ position = new Vec3D(world.getSpawn()); + } + this.world = world; -+ this.setPosition(position.getX() + 0.5, position.getY(), position.getZ() + 0.5); ++ this.setPosition(position.getX(), position.getY(), position.getZ()); + } + this.dimension = ((WorldServer) this.world).dimension; + this.playerInteractManager.a((WorldServer) world); diff --git a/nms-patches/EntityTrackerEntry.patch b/nms-patches/EntityTrackerEntry.patch index dd945fddb3..c21ccd6eb9 100644 --- a/nms-patches/EntityTrackerEntry.patch +++ b/nms-patches/EntityTrackerEntry.patch @@ -11,7 +11,7 @@ + public class EntityTrackerEntry { - private static final Logger a = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -29,8 +34,12 @@ private List p; private boolean q; @@ -124,9 +124,9 @@ - public void a(Consumer> consumer) { + public void a(Consumer> consumer, EntityPlayer entityplayer) { // CraftBukkit - add player if (this.tracker.dead) { -- EntityTrackerEntry.a.warn("Fetching addPacket for removed entity"); +- EntityTrackerEntry.LOGGER.warn("Fetching addPacket for removed entity"); + // CraftBukkit start - Remove useless error spam, just return -+ // EntityTrackerEntry.a.warn("Fetching addPacket for removed entity") ++ // EntityTrackerEntry.LOGGER.warn("Fetching addPacket for removed entity") + return; + // CraftBukkit end } diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch index be4c497492..03a874cddc 100644 --- a/nms-patches/ItemStack.patch +++ b/nms-patches/ItemStack.patch @@ -24,7 +24,7 @@ + public final class ItemStack { - private static final Logger c = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -50,23 +68,42 @@ this.checkEmpty(); } diff --git a/nms-patches/LegacyPingHandler.patch b/nms-patches/LegacyPingHandler.patch index bd451453db..b368ae2d03 100644 --- a/nms-patches/LegacyPingHandler.patch +++ b/nms-patches/LegacyPingHandler.patch @@ -8,7 +8,7 @@ switch (i) { case 0: - LegacyPingHandler.a.debug("Ping: (<1.3.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); + LegacyPingHandler.LOGGER.debug("Ping: (<1.3.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); - s = String.format("%s\u00a7%d\u00a7%d", minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); + s = String.format("%s\u00a7%d\u00a7%d", event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()); // CraftBukkit this.a(channelhandlercontext, this.a(s)); @@ -17,7 +17,7 @@ @@ -47,7 +48,7 @@ } - LegacyPingHandler.a.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); + LegacyPingHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); - s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); + s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()); // CraftBukkit this.a(channelhandlercontext, this.a(s)); @@ -26,7 +26,7 @@ @@ -66,7 +67,7 @@ } - LegacyPingHandler.a.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); + LegacyPingHandler.LOGGER.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); - String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); + String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()); // CraftBukkit ByteBuf bytebuf1 = this.a(s1); diff --git a/nms-patches/LoginListener.patch b/nms-patches/LoginListener.patch index 403d39a6be..1d9293c5b9 100644 --- a/nms-patches/LoginListener.patch +++ b/nms-patches/LoginListener.patch @@ -30,18 +30,18 @@ + public void disconnect(String s) { + try { + IChatBaseComponent ichatbasecomponent = new ChatComponentText(s); -+ LoginListener.c.info("Disconnecting {}: {}", this.d(), s); ++ LoginListener.LOGGER.info("Disconnecting {}: {}", this.d(), s); + this.networkManager.sendPacket(new PacketLoginOutDisconnect(ichatbasecomponent)); + this.networkManager.close(ichatbasecomponent); + } catch (Exception exception) { -+ LoginListener.c.error("Error whilst disconnecting player", exception); ++ LoginListener.LOGGER.error("Error whilst disconnecting player", exception); + } + } + // CraftBukkit end + public void disconnect(IChatBaseComponent ichatbasecomponent) { try { - LoginListener.c.info("Disconnecting {}: {}", this.d(), ichatbasecomponent.getString()); + LoginListener.LOGGER.info("Disconnecting {}: {}", this.d(), ichatbasecomponent.getString()); @@ -76,10 +97,12 @@ this.i = this.a(this.i); } @@ -111,12 +111,12 @@ + } + } + // CraftBukkit end - LoginListener.c.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId()); + LoginListener.LOGGER.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.isEmbeddedServer()) { @@ -162,6 +222,11 @@ LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0])); - LoginListener.c.error("Couldn't verify username because servers are unavailable"); + LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable"); } + // CraftBukkit start - catch all exceptions + } catch (Exception exception) { diff --git a/nms-patches/NameReferencingFileConverter.patch b/nms-patches/NameReferencingFileConverter.patch index 3e39582fb2..72826c8b5b 100644 --- a/nms-patches/NameReferencingFileConverter.patch +++ b/nms-patches/NameReferencingFileConverter.patch @@ -5,10 +5,10 @@ try { gameprofilebanlist.load(); - } catch (FileNotFoundException filenotfoundexception) { -- NameReferencingFileConverter.e.warn("Could not load existing file {}", gameprofilebanlist.c().getName(), filenotfoundexception); +- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.c().getName(), filenotfoundexception); + // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace + } catch (IOException filenotfoundexception) { -+ NameReferencingFileConverter.e.warn("Could not load existing file {}", gameprofilebanlist.c().getName()); ++ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.c().getName()); } } @@ -17,10 +17,10 @@ try { ipbanlist.load(); - } catch (FileNotFoundException filenotfoundexception) { -- NameReferencingFileConverter.e.warn("Could not load existing file {}", ipbanlist.c().getName(), filenotfoundexception); +- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.c().getName(), filenotfoundexception); + // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace + } catch (IOException filenotfoundexception) { -+ NameReferencingFileConverter.e.warn("Could not load existing file {}", ipbanlist.c().getName()); ++ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.c().getName()); } } @@ -29,10 +29,10 @@ try { oplist.load(); - } catch (FileNotFoundException filenotfoundexception) { -- NameReferencingFileConverter.e.warn("Could not load existing file {}", oplist.c().getName(), filenotfoundexception); +- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", oplist.c().getName(), filenotfoundexception); + // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace + } catch (IOException filenotfoundexception) { -+ NameReferencingFileConverter.e.warn("Could not load existing file {}", oplist.c().getName()); ++ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", oplist.c().getName()); } } @@ -41,10 +41,10 @@ try { whitelist.load(); - } catch (FileNotFoundException filenotfoundexception) { -- NameReferencingFileConverter.e.warn("Could not load existing file {}", whitelist.c().getName(), filenotfoundexception); +- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", whitelist.c().getName(), filenotfoundexception); + // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace + } catch (IOException filenotfoundexception) { -+ NameReferencingFileConverter.e.warn("Could not load existing file {}", whitelist.c().getName()); ++ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", whitelist.c().getName()); } } diff --git a/nms-patches/PlayerChunkMap.patch b/nms-patches/PlayerChunkMap.patch index 9af0b90a53..49e3c5ced1 100644 --- a/nms-patches/PlayerChunkMap.patch +++ b/nms-patches/PlayerChunkMap.patch @@ -35,7 +35,7 @@ @@ -257,9 +270,9 @@ }).forEach((completablefuture) -> { if (flag) { - this.executor.c(completablefuture::isDone); + this.executor.awaitTasks(completablefuture::isDone); - ((Either) completablefuture.join()).ifLeft(this::saveChunk); + (completablefuture.join()).ifLeft(this::saveChunk); // CraftBukkit - decompile error } else { @@ -108,7 +108,7 @@ if (this.h.remove(i) && ichunkaccess instanceof Chunk) { Chunk chunk = (Chunk) ichunkaccess; -@@ -388,7 +428,7 @@ +@@ -394,7 +434,7 @@ return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); }, (runnable) -> { @@ -117,7 +117,7 @@ }); } } -@@ -448,7 +488,10 @@ +@@ -454,7 +494,10 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -129,7 +129,7 @@ if (list == null) { list = Lists.newArrayList(new Entity[] { entity}); } else { -@@ -470,7 +513,7 @@ +@@ -476,7 +519,7 @@ long i = playerchunk.h().pair(); playerchunk.getClass(); @@ -138,7 +138,7 @@ }); } -@@ -487,7 +530,7 @@ +@@ -493,7 +536,7 @@ return Either.left(chunk); }); }, (runnable) -> { @@ -147,7 +147,7 @@ }); completablefuture1.thenAcceptAsync((either) -> { -@@ -501,7 +544,7 @@ +@@ -507,7 +550,7 @@ return Either.left(chunk); }); }, (runnable) -> { @@ -156,7 +156,7 @@ }); return completablefuture1; } -@@ -511,8 +554,14 @@ +@@ -517,8 +560,14 @@ } public void saveChunk(IChunkAccess ichunkaccess) { @@ -172,7 +172,7 @@ try { this.world.checkSession(); } catch (ExceptionWorldConflict exceptionworldconflict) { -@@ -563,9 +612,10 @@ +@@ -569,9 +618,10 @@ ChunkCoordIntPair chunkcoordintpair = playerchunk.h(); Packet[] apacket = new Packet[2]; @@ -184,7 +184,7 @@ boolean flag1 = i1 <= this.A; this.sendChunk(entityplayer, chunkcoordintpair, apacket, flag, flag1); -@@ -620,7 +670,7 @@ +@@ -626,7 +676,7 @@ private NBTTagCompound f(ChunkCoordIntPair chunkcoordintpair) throws IOException { NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); @@ -193,7 +193,7 @@ } boolean d(ChunkCoordIntPair chunkcoordintpair) { -@@ -940,7 +990,7 @@ +@@ -946,7 +996,7 @@ public final Set trackedPlayers = Sets.newHashSet(); public EntityTracker(Entity entity, int i, int j, boolean flag) { @@ -202,7 +202,7 @@ this.tracker = entity; this.trackingDistance = i; this.e = SectionPosition.a(entity); -@@ -1009,6 +1059,17 @@ +@@ -1015,6 +1065,17 @@ } } diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 033c8a3a39..bf43d0b588 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -170,7 +170,7 @@ NetworkManager networkmanager = this.networkManager; this.networkManager.getClass(); -- minecraftserver.f(networkmanager::handleDisconnection); +- minecraftserver.executeSync(networkmanager::handleDisconnection); + // CraftBukkit - Don't wait + minecraftserver.postToMainThread(networkmanager::handleDisconnection); } diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index a51dcb021c..9794821f14 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/PlayerList.java +++ b/net/minecraft/server/PlayerList.java -@@ -18,6 +18,27 @@ +@@ -19,6 +19,27 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -28,8 +28,8 @@ public abstract class PlayerList { public static final File a = new File("banned-players.json"); -@@ -27,14 +48,16 @@ - private static final Logger f = LogManager.getLogger(); +@@ -28,14 +49,16 @@ + private static final Logger LOGGER = LogManager.getLogger(); private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); private final MinecraftServer server; - public final List players = Lists.newArrayList(); @@ -48,7 +48,7 @@ public IPlayerFileData playerFileData; private boolean hasWhitelist; protected final int maxPlayers; -@@ -43,13 +66,23 @@ +@@ -44,13 +67,23 @@ private boolean u; private int v; @@ -74,7 +74,7 @@ this.server = minecraftserver; this.maxPlayers = i; this.getProfileBans().a(true); -@@ -65,6 +98,12 @@ +@@ -66,6 +99,12 @@ usercache.a(gameprofile); NBTTagCompound nbttagcompound = this.a(entityplayer); WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); @@ -87,13 +87,13 @@ entityplayer.spawnIn(worldserver); entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); -@@ -74,13 +113,15 @@ +@@ -75,13 +114,15 @@ s1 = networkmanager.getSocketAddress().toString(); } -- PlayerList.f.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); +- PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); + // CraftBukkit - Moved message to after join -+ // PlayerList.f.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); ++ // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); WorldData worlddata = worldserver.getWorldData(); this.a(entityplayer, (EntityPlayer) null, worldserver); @@ -104,7 +104,7 @@ playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName()))); playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities)); -@@ -99,19 +140,61 @@ +@@ -100,19 +141,61 @@ } else { chatmessage = new ChatMessage("multiplayer.player.joined.renamed", new Object[] { entityplayer.getScoreboardDisplayName(), s}); } @@ -171,7 +171,7 @@ this.a(entityplayer, worldserver); if (!this.server.getResourcePack().isEmpty()) { entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash()); -@@ -127,8 +210,11 @@ +@@ -128,8 +211,11 @@ if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) { NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); @@ -185,16 +185,16 @@ }); if (entity != null) { -@@ -164,6 +250,8 @@ +@@ -165,6 +251,8 @@ } entityplayer.syncInventory(); + // CraftBukkit - Moved from above, added world -+ PlayerList.f.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); ++ PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); } public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { -@@ -196,31 +284,32 @@ +@@ -197,31 +285,32 @@ } public void setPlayerFileData(WorldServer worldserver) { @@ -232,7 +232,7 @@ } @Override -@@ -248,14 +337,15 @@ +@@ -249,14 +338,15 @@ } protected void savePlayerFile(EntityPlayer entityplayer) { @@ -250,7 +250,7 @@ if (advancementdataplayer != null) { advancementdataplayer.c(); -@@ -263,10 +353,21 @@ +@@ -264,10 +354,21 @@ } @@ -273,7 +273,7 @@ this.savePlayerFile(entityplayer); if (entityplayer.isPassenger()) { Entity entity = entityplayer.getRootVehicle(); -@@ -297,18 +398,66 @@ +@@ -298,18 +399,66 @@ if (entityplayer1 == entityplayer) { this.j.remove(uuid); @@ -346,7 +346,7 @@ GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile); chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[] { gameprofilebanentry.getReason()}); -@@ -316,10 +465,12 @@ +@@ -317,10 +466,12 @@ chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[] { PlayerList.g.format(gameprofilebanentry.getExpires())})); } @@ -362,7 +362,7 @@ IpBanEntry ipbanentry = this.l.get(socketaddress); chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[] { ipbanentry.getReason()}); -@@ -327,13 +478,25 @@ +@@ -328,13 +479,25 @@ chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[] { PlayerList.g.format(ipbanentry.getExpires())})); } @@ -391,7 +391,7 @@ UUID uuid = EntityHuman.a(gameprofile); List list = Lists.newArrayList(); -@@ -368,14 +531,24 @@ +@@ -369,14 +532,24 @@ } return new EntityPlayer(this.server, this.server.getWorldServer(DimensionManager.OVERWORLD), gameprofile, (PlayerInteractManager) object); @@ -416,7 +416,7 @@ entityplayer.dimension = dimensionmanager; Object object; -@@ -386,6 +559,11 @@ +@@ -387,6 +560,11 @@ } EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object); @@ -428,7 +428,7 @@ entityplayer1.playerConnection = entityplayer.playerConnection; entityplayer1.copyFrom(entityplayer, flag); -@@ -399,40 +577,97 @@ +@@ -400,42 +578,100 @@ entityplayer1.addScoreboardTag(s); } @@ -437,24 +437,27 @@ - this.a(entityplayer1, entityplayer, worldserver); - if (blockposition != null) { -- BlockPosition blockposition1 = EntityHuman.getBed(this.server.getWorldServer(entityplayer.dimension), blockposition, flag1); -- -- if (blockposition1 != null) { -- entityplayer1.setPositionRotation((double) ((float) blockposition1.getX() + 0.5F), (double) ((float) blockposition1.getY() + 0.1F), (double) ((float) blockposition1.getZ() + 0.5F), 0.0F, 0.0F); -- entityplayer1.setRespawnPosition(blockposition, flag1); -- } else { -- entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(0, 0.0F)); +- Optional optional = EntityHuman.getBed(this.server.getWorldServer(entityplayer.dimension), blockposition, flag1); + // this.a(entityplayer1, entityplayer, worldserver); // CraftBukkit - removed -+ + +- if (optional.isPresent()) { +- Vec3D vec3d = (Vec3D) optional.get(); + // CraftBukkit start - fire PlayerRespawnEvent + if (location == null) { + boolean isBedSpawn = false; + CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld); + if (cworld != null && blockposition != null) { -+ BlockPosition blockposition1 = EntityHuman.getBed(cworld.getHandle(), blockposition, flag1); -+ if (blockposition1 != null) { ++ Optional optional = EntityHuman.getBed(cworld.getHandle(), blockposition, flag1); + +- entityplayer1.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, 0.0F, 0.0F); +- entityplayer1.setRespawnPosition(blockposition, flag1); +- } else { +- entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(0, 0.0F)); ++ if (optional.isPresent()) { ++ Vec3D vec3d = (Vec3D) optional.get(); ++ + isBedSpawn = true; -+ location = new Location(cworld, (double) ((float) blockposition1.getX() + 0.5F), (double) ((float) blockposition1.getY() + 0.1F), (double) ((float) blockposition1.getZ() + 0.5F)); ++ location = new Location(cworld, vec3d.x, vec3d.y, vec3d.z); + } else { + entityplayer1.setRespawnPosition(null, true); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(0, 0.0F)); @@ -499,11 +502,11 @@ + entityplayer1.dead = false; + entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch)); + entityplayer1.setSneaking(false); - BlockPosition blockposition2 = worldserver.getSpawn(); + BlockPosition blockposition1 = worldserver.getSpawn(); - entityplayer1.playerConnection.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); + // entityplayer1.playerConnection.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); - entityplayer1.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition2)); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition1)); entityplayer1.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); entityplayer1.playerConnection.sendPacket(new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel)); this.a(entityplayer1, worldserver); @@ -544,7 +547,7 @@ return entityplayer1; } -@@ -445,7 +680,18 @@ +@@ -448,7 +684,18 @@ public void tick() { if (++this.v > 600) { @@ -564,7 +567,7 @@ this.v = 0; } -@@ -458,6 +704,25 @@ +@@ -461,6 +708,25 @@ } @@ -590,7 +593,7 @@ public void a(Packet packet, DimensionManager dimensionmanager) { for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); -@@ -558,6 +823,7 @@ +@@ -561,6 +827,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0)); } @@ -598,7 +601,7 @@ this.server.getCommandDispatcher().a(entityplayer); } -@@ -590,6 +856,12 @@ +@@ -593,6 +860,12 @@ for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); @@ -611,7 +614,7 @@ if (entityplayer != entityhuman && entityplayer.dimension == dimensionmanager) { double d4 = d0 - entityplayer.locX; double d5 = d1 - entityplayer.locY; -@@ -629,7 +901,7 @@ +@@ -632,7 +905,7 @@ public void reloadWhitelist() {} public void a(EntityPlayer entityplayer, WorldServer worldserver) { @@ -620,7 +623,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE)); entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))); -@@ -637,17 +909,26 @@ +@@ -640,17 +913,26 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition)); if (worldserver.isRaining()) { @@ -651,7 +654,7 @@ } public int getPlayerCount() { -@@ -704,26 +985,39 @@ +@@ -707,26 +989,39 @@ } public void shutdown() { @@ -696,7 +699,7 @@ if (serverstatisticmanager == null) { File file = new File(this.server.getWorldServer(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "stats"); -@@ -738,7 +1032,7 @@ +@@ -741,7 +1036,7 @@ } serverstatisticmanager = new ServerStatisticManager(this.server, file1); @@ -705,7 +708,7 @@ } return serverstatisticmanager; -@@ -746,14 +1040,14 @@ +@@ -749,14 +1044,14 @@ public AdvancementDataPlayer f(EntityPlayer entityplayer) { UUID uuid = entityplayer.getUniqueID(); @@ -722,7 +725,7 @@ } advancementdataplayer.a(entityplayer); -@@ -789,13 +1083,20 @@ +@@ -792,13 +1087,20 @@ } public void reload() { diff --git a/nms-patches/PropertyManager.patch b/nms-patches/PropertyManager.patch index 066695224b..475f28b41b 100644 --- a/nms-patches/PropertyManager.patch +++ b/nms-patches/PropertyManager.patch @@ -8,7 +8,7 @@ + public abstract class PropertyManager> { - private static final Logger a = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); public final Properties properties; + // CraftBukkit start + private OptionSet options = null; diff --git a/nms-patches/SpawnerCreature.patch b/nms-patches/SpawnerCreature.patch index 8cd236f1dc..5039c22695 100644 --- a/nms-patches/SpawnerCreature.patch +++ b/nms-patches/SpawnerCreature.patch @@ -10,7 +10,7 @@ + public final class SpawnerCreature { - private static final Logger a = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -85,9 +89,12 @@ entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, world.random.nextFloat() * 360.0F, 0.0F); if ((entityhuman.e((double) f, (double) k, (double) f1) <= 16384.0D || !entityinsentient.isTypeNotPersistent(entityhuman.e((double) f, (double) k, (double) f1))) && entityinsentient.a((GeneratorAccess) world, EnumMobSpawn.NATURAL) && entityinsentient.a((IWorldReader) world)) { diff --git a/nms-patches/TileEntity.patch b/nms-patches/TileEntity.patch index cf8676b007..0fc1669413 100644 --- a/nms-patches/TileEntity.patch +++ b/nms-patches/TileEntity.patch @@ -8,7 +8,7 @@ + public abstract class TileEntity { - private static final Logger a = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -55,8 +57,15 @@ } } diff --git a/nms-patches/TileEntityBeacon.patch b/nms-patches/TileEntityBeacon.patch index dcc2caf992..5742910ca3 100644 --- a/nms-patches/TileEntityBeacon.patch +++ b/nms-patches/TileEntityBeacon.patch @@ -30,7 +30,7 @@ public TileEntityBeacon() { super(TileEntityTypes.BEACON); -@@ -185,39 +201,78 @@ +@@ -187,39 +203,78 @@ } @@ -119,7 +119,7 @@ public void a(SoundEffect soundeffect) { this.world.a((EntityHuman) null, this.position, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F); } -@@ -247,8 +302,10 @@ +@@ -249,8 +304,10 @@ @Override public void load(NBTTagCompound nbttagcompound) { super.load(nbttagcompound); diff --git a/nms-patches/TileEntityCampfire.patch b/nms-patches/TileEntityCampfire.patch index 4667a3ef2e..7b9660279f 100644 --- a/nms-patches/TileEntityCampfire.patch +++ b/nms-patches/TileEntityCampfire.patch @@ -12,7 +12,7 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickable { -@@ -55,6 +60,20 @@ +@@ -59,6 +64,20 @@ }).orElse(itemstack); BlockPosition blockposition = this.getPosition(); diff --git a/nms-patches/TileEntityHopper.patch b/nms-patches/TileEntityHopper.patch index 43e629004c..f36c49dbe2 100644 --- a/nms-patches/TileEntityHopper.patch +++ b/nms-patches/TileEntityHopper.patch @@ -52,7 +52,7 @@ public TileEntityHopper() { super(TileEntityTypes.HOPPER); this.items = NonNullList.a(5, ItemStack.a); -@@ -159,7 +198,28 @@ +@@ -161,7 +200,28 @@ for (int i = 0; i < this.getSize(); ++i) { if (!this.getItem(i).isEmpty()) { ItemStack itemstack = this.getItem(i).cloneItemStack(); @@ -82,7 +82,7 @@ if (itemstack1.isEmpty()) { iinventory.update(); -@@ -224,7 +284,34 @@ +@@ -226,7 +286,34 @@ if (!itemstack.isEmpty() && b(iinventory, itemstack, i, enumdirection)) { ItemStack itemstack1 = itemstack.cloneItemStack(); @@ -118,7 +118,7 @@ if (itemstack2.isEmpty()) { iinventory.update(); -@@ -239,6 +326,13 @@ +@@ -241,6 +328,13 @@ public static boolean a(IInventory iinventory, EntityItem entityitem) { boolean flag = false; diff --git a/nms-patches/World.patch b/nms-patches/World.patch index 077b81b991..fe43a75119 100644 --- a/nms-patches/World.patch +++ b/nms-patches/World.patch @@ -22,7 +22,7 @@ + public abstract class World implements IIBlockAccess, GeneratorAccess, AutoCloseable { - protected static final Logger e = LogManager.getLogger(); + protected static final Logger LOGGER = LogManager.getLogger(); @@ -41,14 +57,87 @@ protected boolean tickingTileEntities; private final WorldBorder worldBorder; diff --git a/nms-patches/WorldNBTStorage.patch b/nms-patches/WorldNBTStorage.patch index 79dfb00c97..dcfc3bf9e2 100644 --- a/nms-patches/WorldNBTStorage.patch +++ b/nms-patches/WorldNBTStorage.patch @@ -11,7 +11,7 @@ + public class WorldNBTStorage implements IPlayerFileData { - private static final Logger b = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -22,6 +27,7 @@ private final String f; private final DefinedStructureManager g; @@ -50,7 +50,7 @@ + return NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1))); + } + } catch (Exception exception) { -+ b.warn("Failed to load player data for " + s); ++ LOGGER.warn("Failed to load player data for " + s); + } + + return null; @@ -75,7 +75,7 @@ + dis = new DataInputStream(new FileInputStream(file1)); + return uuid = new UUID(dis.readLong(), dis.readLong()); + } catch (IOException ex) { -+ b.warn("Failed to read " + file1 + ", generating new random UUID", ex); ++ LOGGER.warn("Failed to read " + file1 + ", generating new random UUID", ex); + } finally { + if (dis != null) { + try { @@ -93,7 +93,7 @@ + dos.writeLong(uuid.getMostSignificantBits()); + dos.writeLong(uuid.getLeastSignificantBits()); + } catch (IOException ex) { -+ b.warn("Failed to write " + file1, ex); ++ LOGGER.warn("Failed to write " + file1, ex); + } finally { + if (dos != null) { + try { diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index e30744f1b2..224256e5b6 100644 --- a/nms-patches/WorldServer.patch +++ b/nms-patches/WorldServer.patch @@ -21,7 +21,7 @@ + public class WorldServer extends World { - private static final Logger v = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); @@ -56,12 +71,31 @@ @Nullable private final MobSpawnerTrader mobSpawnerTrader; @@ -245,7 +245,7 @@ + // CraftBukkit end + if (blockposition == null) { - WorldServer.v.warn("Unable to find spawn biome"); + WorldServer.LOGGER.warn("Unable to find spawn biome"); } @@ -638,6 +731,7 @@ ChunkProviderServer chunkproviderserver = this.getChunkProvider(); @@ -308,8 +308,8 @@ + // CraftBukkit start + private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { if (entity.dead) { -- WorldServer.v.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); -+ // WorldServer.v.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit +- WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); ++ // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit return false; } else if (this.isUUIDTaken(entity)) { return false; @@ -325,8 +325,8 @@ if (entity1 == null) { return false; } else { -- WorldServer.v.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.getEntityType()), entity.getUniqueID().toString()); -+ // WorldServer.v.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.getEntityType()), entity.getUniqueID().toString()); // CraftBukkit +- WorldServer.LOGGER.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.getEntityType()), entity.getUniqueID().toString()); ++ // WorldServer.LOGGER.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.getEntityType()), entity.getUniqueID().toString()); // CraftBukkit return true; } } diff --git a/pom.xml b/pom.xml index 7da4913bee..2d444b6a1c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,15 +4,15 @@ org.bukkit craftbukkit jar - 1.14-pre5-SNAPSHOT + 1.14-R0.1-SNAPSHOT CraftBukkit - http://www.bukkit.org + https://www.spigotmc.org/ true UTF-8 unknown - 1.14-pre5 + 1.14 1_14_R1 git-Bukkit- diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 55a874f95f..459bf23cc4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1097,7 +1097,7 @@ public final class CraftServer implements Server { @Override public void clearRecipes() { - CraftingManager.a(console.getCraftingManager().recipes); + CraftingManager.initializeRecipeMap(console.getCraftingManager().recipes); } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index fa4fe5bcf0..a7b495c7ad 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -43,6 +43,7 @@ import net.minecraft.server.TileEntityHopper; import net.minecraft.server.TileEntityLectern; import net.minecraft.server.TileEntityShulkerBox; import net.minecraft.server.TileEntitySmoker; +import net.minecraft.server.Vec3D; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; @@ -140,9 +141,10 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { BlockPosition bed = getHandle().getBed(); if (world != null && bed != null) { - bed = EntityHuman.getBed(((CraftWorld) world).getHandle(), bed, getHandle().isRespawnForced()); - if (bed != null) { - return new Location(world, bed.getX(), bed.getY(), bed.getZ()); + Optional spawnLoc = EntityHuman.getBed(((CraftWorld) world).getHandle(), bed, getHandle().isRespawnForced()); + if (spawnLoc.isPresent()) { + Vec3D vec = spawnLoc.get(); + return new Location(world, vec.x, vec.y, vec.z); } } return null;