From 08309619eb94742aa82eb56bf9f4d0ecccbd5531 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sat, 19 Feb 2022 16:55:08 +0100 Subject: [PATCH 01/42] undo #74 --- .../src/main/java/net/minecraft/server/ChunkRegionLoader.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java index 2955830d4..e1099f4ad 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -296,10 +296,6 @@ private void a(Chunk chunk, World world, NBTTagCompound nbttagcompound) { nbttagcompound1 = new NBTTagCompound(); tileentity.b(nbttagcompound1); nbttaglist2.add(nbttagcompound1); - - if(tileentity instanceof TileEntityHopper) { - Arrays.fill(((TileEntityHopper) tileentity).items, null); - } } nbttagcompound.set("TileEntities", nbttaglist2); From 65351cb5929795ab66badbde018fd1a3dd6bafaa Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sat, 19 Feb 2022 17:04:41 +0100 Subject: [PATCH 02/42] add SportPaper #207 Block#toLegacyData optimisation --- .../src/main/java/net/minecraft/server/Block.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/Block.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/Block.java index eba818bbe..a2fd28036 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/Block.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/Block.java @@ -161,11 +161,7 @@ public IBlockData fromLegacyData(int i) { } public int toLegacyData(IBlockData iblockdata) { - if (iblockdata != null && !iblockdata.a().isEmpty()) { - throw new IllegalArgumentException("Don\'t know how to convert " + iblockdata + " back into data..."); - } else { - return 0; - } + return 0; // Sportpaper - optimize toLegacyData removing unneeded sanity checks } public IBlockData updateState(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { From d9a821621e08124159339764743f3b71dba36c9e Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sat, 19 Feb 2022 17:08:16 +0100 Subject: [PATCH 03/42] add SportPaper #206 Remove the world before nullifying chunkLoader & chunkProvider --- .../src/main/java/org/bukkit/craftbukkit/CraftServer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 3c62fe5cd..a6550e18d 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1038,7 +1038,10 @@ public boolean unloadWorld(World world, boolean save) { if (e.isCancelled()) { return false; } - + + worlds.remove(world.getName().toLowerCase()); + console.worlds.remove(handle); + if (save) { try { handle.save(true, null); @@ -1064,9 +1067,6 @@ public boolean unloadWorld(World world, boolean save) { chunkProviderServer.chunks.clear(); } - worlds.remove(world.getName().toLowerCase()); - console.worlds.remove(handle); - // KigPaper start - fix memory leak CraftingManager craftingManager = CraftingManager.getInstance(); CraftInventoryView lastView = (CraftInventoryView) craftingManager.lastCraftView; From af7c34ec3371610abab65911dbe3823f5f5cf701 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sat, 19 Feb 2022 17:12:01 +0100 Subject: [PATCH 04/42] add SportPaper #204 dont divide d14 by 0 --- .../src/main/java/net/minecraft/server/Explosion.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/Explosion.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/Explosion.java index 6b7ff0235..a9ab808eb 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/Explosion.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/Explosion.java @@ -150,7 +150,11 @@ public void affectEntities(List list, Vec3D vec3d, float f3) { // PaperSpigot end if (entity instanceof EntityHuman && !((EntityHuman) entity).abilities.isInvulnerable && !world.paperSpigotConfig.disableExplosionKnockback) { // PaperSpigot - this.k.put((EntityHuman) entity, new Vec3D(finalD * d13, finalD1 * d13, finalD11 * d13)); + this.k.put((EntityHuman) entity, new Vec3D(x / d14 * d13, y / d14 * d13, z / d14 * d13)); // SportPaper + double vecX = d14 == 0 ? x : x / d14; + double vecY = d14 == 0 ? y : y / d14; + double vecZ = d14 == 0 ? z : z / d14; + this.k.put((EntityHuman) entity, new Vec3D(vecX * d13, vecY * d13, vecZ * d13)); // SportPaper } })); } From 906515fb9ab23e39ac491d80d3216b89214e0d40 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sat, 19 Feb 2022 18:45:04 +0100 Subject: [PATCH 05/42] add SportPaper #220 Use EnumMap in CraftPlayer#playEffect() --- .../java/net/minecraft/server/Explosion.java | 6 +--- .../org/bukkit/craftbukkit/CraftWorld.java | 30 +++++++------------ .../craftbukkit/entity/CraftPlayer.java | 21 +++++-------- 3 files changed, 20 insertions(+), 37 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/Explosion.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/Explosion.java index a9ab808eb..6b7ff0235 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/Explosion.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/Explosion.java @@ -150,11 +150,7 @@ public void affectEntities(List list, Vec3D vec3d, float f3) { // PaperSpigot end if (entity instanceof EntityHuman && !((EntityHuman) entity).abilities.isInvulnerable && !world.paperSpigotConfig.disableExplosionKnockback) { // PaperSpigot - this.k.put((EntityHuman) entity, new Vec3D(x / d14 * d13, y / d14 * d13, z / d14 * d13)); // SportPaper - double vecX = d14 == 0 ? x : x / d14; - double vecY = d14 == 0 ? y : y / d14; - double vecZ = d14 == 0 ? z : z / d14; - this.k.put((EntityHuman) entity, new Vec3D(vecX * d13, vecY * d13, vecZ * d13)); // SportPaper + this.k.put((EntityHuman) entity, new Vec3D(finalD * d13, finalD1 * d13, finalD11 * d13)); } })); } diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 05c103c1b..db6a2a48a 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -13,6 +13,7 @@ import java.util.UUID; import dev.cobblesword.nachospigot.commons.Constants; +import dev.cobblesword.nachospigot.commons.Dictionary; import me.elier.nachospigot.config.NachoConfig; import net.minecraft.server.*; @@ -60,7 +61,6 @@ import org.bukkit.util.Vector; import net.jafama.FastMath; -import me.elier.nachospigot.config.NachoConfig; public class CraftWorld implements World { public static final int CUSTOM_DIMENSION_OFFSET = 10; @@ -1465,25 +1465,17 @@ public void playEffect( Location location, Effect effect, int id, int data, floa } else { net.minecraft.server.EnumParticle particle = null; - int[] extra = null; - for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() ) - { - if ( effect.getName().startsWith( p.b().replace("_", "") ) ) - { - particle = p; - if ( effect.getData() != null ) - { - if ( effect.getData().equals( org.bukkit.Material.class ) ) - { - extra = new int[]{ id }; - } else - { - extra = new int[]{ (data << 12) | (id & 0xFFF) }; - } - } - break; - } + int[] extra = null; + if ((particle = Dictionary.EFFECT_TO_PARTICLE.get(effect)) != null) { + if ( effect.getData() != null ) { + if ( effect.getData().equals( org.bukkit.Material.class ) ) { + extra = new int[]{ id }; + } else { + extra = new int[]{ (data << 12) | (id & 0xFFF) }; + } + } } + if ( extra == null ) { extra = Constants.EMPTY_ARRAY; diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index b5299b210..19eec5f4f 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -18,6 +18,7 @@ import me.elier.nachospigot.config.NachoConfig; import net.md_5.bungee.api.chat.BaseComponent; +import dev.cobblesword.nachospigot.commons.Dictionary; import net.minecraft.server.*; import net.minecraft.server.PacketPlayOutTitle.EnumTitleAction; @@ -1532,22 +1533,16 @@ public void playEffect( Location location, Effect effect, int id, int data, floa { net.minecraft.server.EnumParticle particle = null; int[] extra = null; - for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() ) - { - if ( effect.getName().startsWith( p.b().replace("_", "") ) ) + if ((particle = Dictionary.EFFECT_TO_PARTICLE.get(effect)) != null) { + if ( effect.getData() != null ) { - particle = p; - if ( effect.getData() != null ) + if ( effect.getData().equals( Material.class ) ) + { + extra = new int[]{ id }; + } else { - if ( effect.getData().equals( org.bukkit.Material.class ) ) - { - extra = new int[]{ id }; - } else - { - extra = new int[]{ (data << 12) | (id & 0xFFF) }; - } + extra = new int[]{ (data << 12) | (id & 0xFFF) }; } - break; } } if ( extra == null ) From 67ba4c185e45b583185929c70367e12d75dc433a Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sat, 19 Feb 2022 18:47:13 +0100 Subject: [PATCH 06/42] add SportPaper #218 Update entity head yaw on teleport --- .../src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index dd2fd62a3..4e29aab0b 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -252,6 +252,7 @@ public boolean teleport(Location location, TeleportCause cause) { // entity.world = ((CraftWorld) location.getWorld()).getHandle(); // Spigot end entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + entity.f(location.getYaw()); // KigPaper - update head yaw to keep consistency with /tp entity.world.entityJoinedWorld(entity, false); // PaperSpigot - Fix issues with entities not being switched to their new chunk // entity.setLocation() throws no event, and so cannot be cancelled return true; From 1ee07be4dcf66346eae341603ba2dc4d3c85665a Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sat, 19 Feb 2022 19:10:39 +0100 Subject: [PATCH 07/42] add SportPaper #130 fix CraftLivingEntity#damage not calling EntityDamageEvent --- .../java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index b6984df9d..757fd441f 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -533,7 +533,8 @@ private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSo } else if (source == DamageSource.FALL) { cause = DamageCause.FALL; } else if (source == DamageSource.GENERIC) { - return new EntityDamageEvent(entity.getBukkitEntity(), null, modifiers, modifierFunctions); + //return new EntityDamageEvent(entity.getBukkitEntity(), null, modifiers, modifierFunctions); + cause = DamageCause.CUSTOM; // KigPaper } if (cause != null) { From fb586561b5d535101ae19b63673aa40ba1194a1a Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sat, 19 Feb 2022 19:25:30 +0100 Subject: [PATCH 08/42] add Migot #036 Check for lava only once per tick --- .../main/java/net/minecraft/server/Entity.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java index 25e3a54f6..b9078c155 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java @@ -166,7 +166,12 @@ public synchronized void setSeed(long seed) { public boolean fromMobSpawner; public void inactiveTick() { } // Spigot end - + + // Migot start + private boolean isInLava; + private int lastLavaCheck = Integer.MIN_VALUE; + // Migot end + public int getId() { return this.id; } @@ -1070,7 +1075,15 @@ public boolean a(Material material) { } public boolean ab() { - return this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); + // Migot start Check for lava only once per tick + // return this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); + int currentTick = MinecraftServer.currentTick; + if (this.lastLavaCheck != currentTick) { + this.lastLavaCheck = currentTick; + this.isInLava = this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); + } + return this.isInLava; + // Migot end } public void a(float f, float f1, float f2) { From 8530f715bd6cccca05e6ab4dcc745ef7990a5a9c Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sat, 19 Feb 2022 19:58:40 +0100 Subject: [PATCH 09/42] add optimize region cache - paper 1.13 backport --- NachoSpigot-Server/pom.xml | 2 +- .../src/main/java/net/minecraft/server/RegionFileCache.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NachoSpigot-Server/pom.xml b/NachoSpigot-Server/pom.xml index 4e5161035..b6bb3b030 100644 --- a/NachoSpigot-Server/pom.xml +++ b/NachoSpigot-Server/pom.xml @@ -35,7 +35,7 @@ io.netty netty-all - 4.1.68.Final + 4.1.74.Final diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java index 5b000c47c..2a2965120 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java @@ -13,10 +13,10 @@ public class RegionFileCache { public static final Map a = Maps.newHashMap(); // Spigot - private -> public // PaperSpigot start - public static synchronized RegionFile a(File file, int i, int j) { + public static /*synchronized*/ RegionFile a(File file, int i, int j) {// Paper 1.13 Backport - remove synchronization return a(file, i, j, true); } - public static synchronized RegionFile a(File file, int i, int j, boolean create) { + public static /*synchronized*/ RegionFile a(File file, int i, int j, boolean create) {// Paper 1.13 Backport - remove synchronization // PaperSpigot end File file1 = new File(file, "region"); File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); @@ -41,7 +41,7 @@ public static synchronized RegionFile a(File file, int i, int j, boolean create) } } - public static synchronized void a() { + public static /*synchronized*/ void a() {// Paper 1.13 Backport - remove synchronization Iterator iterator = RegionFileCache.a.values().iterator(); while (iterator.hasNext()) { From fa62bafb770d94cb95e8e099a1af7c76841e0648 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sat, 19 Feb 2022 20:18:47 +0100 Subject: [PATCH 10/42] update readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 7ba409f5d..9657deeb7 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ See: [Contributors Page](https://github.com/CobbleSword/NachoSpigot/graphs/contr [Paper-0249] Improve BlockPosition inlining by Techcable [Paper-0254] Don't blindly send unlit chunks when lighting updates are allowed by Shane Freeder [Paper-0266] [MC-99321] Dont check for blocked double chest for hoppers +[Paper-0301] Optimize Region File Cache [Paper-0302] Don't load chunks for villager door checks by Aikar [Paper-0313] Optimize World Time Updates by Aikar [Paper-0321] Server Tick Events @@ -168,18 +169,22 @@ See: [Contributors Page](https://github.com/CobbleSword/NachoSpigot/graphs/contr [SportPaper-0162] Fix PlayerInteractEvent not cancelling properly [SportPaper-0197] Optimize head rotation patch [SportPaper-0201] Cache block break animation packet +[SportPaper-0204] Optimize toLegacyData removing unneeded sanity checks [SportPaper-0203] Fix Teleport Invisibility +[SportPaper-0206] Remove the world before nullifying chunkLoader & chunkProvider [PaperBin-????] WorldServer#everyoneDeeplySleeping optimization [KigPaper-0039] Fix Entity and Command Block memory leaks [KigPaper-0128] Fix Entity and Command Block memory leaks [KigPaper-0129] Fix more EnchantmentManager leaks +[KigPaper-0130] Fix CraftLivingEntity#damage not calling EntityDamageEvent [KigPaper-0138] Fix some more memory leaks [KigPaper-0161] Fix CraftingManager memory leak [KigPaper-0167] Add setType without lighting update API [KigPaper-0172] NBT no-op for block place packet [KigPaper-0191] Don't calculate initial light if not requested +[KigPaper-0220] Entity: Use EnumMap in CraftPlayer#playEffect() [FlamePaper-0102] Fixed chunk memory leak [FlamePaper-0103] Limit CraftChatMessage iterations @@ -196,6 +201,7 @@ See: [Contributors Page](https://github.com/CobbleSword/NachoSpigot/graphs/contr [MineTick-0017] Fix Insane Nether Portal Lag [Migot-0009] Prevent Creature Spawning in Unloaded Chunks +[Migot-0036] Check for lava only once per tick [Sugarcane-0022] Add YAML comments ``` From b3885977cec9434b345446fcbf263b0f3e1d11ab Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sun, 20 Feb 2022 15:17:53 +0100 Subject: [PATCH 11/42] backport parts of light queue changes from 1.13 --- .../destroystokyo/paper/PaperWorldConfig.java | 1 + .../main/java/net/minecraft/server/Chunk.java | 31 ++++++++----------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/NachoSpigot-Server/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java index 54aa02afb..21c619128 100644 --- a/NachoSpigot-Server/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/NachoSpigot-Server/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -396,4 +396,5 @@ private void portalSearchRadius() { portalSearchRadius = getInt("portal-search-radius", 128); } + public boolean queueLightUpdates = true; } diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java index 080cb839c..74092b33c 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java @@ -285,6 +285,8 @@ private void d(int i, int j) { this.g[i + j * 16] = true; this.k = true; } + + private void recheckGaps(boolean flag) { h(flag); } // Paper private void h(boolean flag) { this.world.methodProfiler.a("recheckGaps"); @@ -1280,10 +1282,20 @@ public BlockPosition h(BlockPosition blockposition) { return new BlockPosition(blockposition.getX(), this.f[k], blockposition.getZ()); } + + // Paper start + private boolean shouldRecheckGaps = false; + public void doGapCheck() { + if (shouldRecheckGaps) { + this.recheckGaps(false); + shouldRecheckGaps = false; + } + } + // Paper end public void b(boolean flag) { if (this.k && !this.world.worldProvider.o() && !flag) { - this.recheckGaps(this.world.isClientSide); // PaperSpigot - Asynchronous lighting updates + shouldRecheckGaps = true; // Paper } this.p = true; @@ -1304,23 +1316,6 @@ public void b(boolean flag) { } - /** - * PaperSpigot - Recheck gaps asynchronously. - */ - public void recheckGaps(final boolean isClientSide) { - if (!world.paperSpigotConfig.useAsyncLighting) { - this.h(isClientSide); - return; - } - - world.lightingExecutor.submit(new Runnable() { - @Override - public void run() { - Chunk.this.h(isClientSide); - } - }); - } - public boolean isReady() { // Spigot Start /* From 0a001e0c978ae755a32c1c7ca61de0d8d98f8279 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sun, 20 Feb 2022 15:55:57 +0100 Subject: [PATCH 12/42] Paper #0178 Disable Vanilla Chunk GC in favor of Bukkits --- .../src/main/java/net/minecraft/server/WorldServer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java index 250482d55..69a58ed4b 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java @@ -962,13 +962,15 @@ public void save(boolean flag, IProgressUpdate iprogressupdate) throws Exception this.chunkProvider.saveChunks(flag, iprogressupdate); // CraftBukkit - ArrayList -> Collection - Collection arraylist = this.chunkProviderServer.a(); + /* //Paper start Collection arraylist = this.chunkProviderServer.a(); for (Chunk value : arraylist) { if (value != null && !this.manager.a(value.locX, value.locZ)) { this.chunkProviderServer.queueUnload(value.locX, value.locZ); } } + */ + // Paper end } } From 6e842aaf0c521450416537c0dee27fe2b9fb05c9 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sun, 20 Feb 2022 16:00:04 +0100 Subject: [PATCH 13/42] Paper #0176 Auto fix bad Y levels on player login --- .../src/main/java/net/minecraft/server/EntityPlayer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/EntityPlayer.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/EntityPlayer.java index 6c0657339..fc8410862 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/EntityPlayer.java @@ -130,7 +130,8 @@ public void a(NBTTagCompound nbttagcompound) { this.playerInteractManager.setGameMode(WorldSettings.EnumGamemode.getById(nbttagcompound.getInt("playerGameType"))); } } - + + if (this.locY > 300) this.locY = 200; this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit } From ead58d0e7716bb6a930ad71faecdf64ea042bbc6 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sun, 20 Feb 2022 16:06:17 +0100 Subject: [PATCH 14/42] Paper #0172 Incremental Auto Saving --- .../src/main/java/net/minecraft/server/MinecraftServer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java index e25f90631..856692c07 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java @@ -736,10 +736,11 @@ protected void A() throws ExceptionWorldConflict { // CraftBukkit - added throws this.r.b().a(agameprofile); } - if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit + if (autosavePeriod > 0 /*&& this.ticks % autosavePeriod == 0*/) { // CraftBukkit // Paper - Incremental Auto Saving SpigotTimings.worldSaveTimer.startTiming(); // Spigot this.methodProfiler.a("save"); - this.playerList.savePlayers(); // Nacho - deobfuscate playerList + //this.playerList.savePlayers(); // Nacho - deobfuscate playerList + if (this.ticks % autosavePeriod == 0) this.playerList.savePlayers(); // Paper - Incremental Auto Saving // Spigot Start // We replace this with saving each individual world as this.saveChunks(...) is broken, // and causes the main thread to sleep for random amounts of time depending on chunk activity From 0d70a5a12bc748a1095f35e5c34705219b0f302a Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sun, 20 Feb 2022 16:12:18 +0100 Subject: [PATCH 15/42] Paper Chunk registration fixes & Fix infinite loop when saving chunks --- .../src/main/java/net/minecraft/server/ChunkRegionLoader.java | 1 + .../src/main/java/net/minecraft/server/World.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java index e1099f4ad..f2576ec69 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -195,6 +195,7 @@ public void b() { if (this.c()) { continue; } + break; // Paper - fix infinite loop when saving chunks } } finally { this.e = false; diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/World.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/World.java index bd0c694ba..b7d90454e 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/World.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/World.java @@ -1910,7 +1910,8 @@ public void entityJoinedWorld(Entity entity, boolean flag) { } int k = MathHelper.floor(entity.locX / 16.0D); - int l = MathHelper.floor(entity.locY / 16.0D); + //int l = MathHelper.floor(entity.locY / 16.0D); + int l = Math.min(15, Math.max(0, MathHelper.floor(entity.locY / 16.0D))); // Paper - stay consistent with chunk add/remove behavior int i1 = MathHelper.floor(entity.locZ / 16.0D); // Nacho start - deobfuscate chunkX, chunkY, chunkZ removeEntity From ea26cc59d5c47fc6124e08be14a3b1df71d73df6 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sun, 20 Feb 2022 16:14:30 +0100 Subject: [PATCH 16/42] Paper #0163 MC-80966 - Always send chunk sections --- .../src/main/java/net/minecraft/server/ChunkSection.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkSection.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkSection.java index 907c57b8c..152e49751 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkSection.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkSection.java @@ -72,7 +72,10 @@ public int c(int i, int j, int k) { } public boolean a() { - return this.nonEmptyBlockCount == 0; + //return this.nonEmptyBlockCount == 0; + // Paper - MC-80966 + // Even if there are no blocks, there may be other information associated with the chunk, always send it. + return false; } public boolean shouldTick() { From 25c8d150bdc9e7070570790c6f748fa363808c92 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sun, 20 Feb 2022 17:10:30 +0100 Subject: [PATCH 17/42] Paper Fix hopper suck in patch bug --- .../src/main/java/net/minecraft/server/Chunk.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java index 74092b33c..6c1a73410 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java @@ -1160,7 +1160,7 @@ public void a(Class oclass, AxisAlignedBB axisal // PaperSpigot start int[] counts; - if (ItemStack.class.isAssignableFrom(oclass)) { + if (EntityItem.class.isAssignableFrom(oclass)) { counts = itemCounts; } else if (IInventory.class.isAssignableFrom(oclass)) { counts = inventoryEntityCounts; From f639d787b5e18db8b3de2d7a728f3b966fa3f301 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sun, 20 Feb 2022 18:53:45 +0100 Subject: [PATCH 18/42] Update NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../main/java/org/bukkit/craftbukkit/entity/CraftEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 4e29aab0b..8a88008f4 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -252,7 +252,7 @@ public boolean teleport(Location location, TeleportCause cause) { // entity.world = ((CraftWorld) location.getWorld()).getHandle(); // Spigot end entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - entity.f(location.getYaw()); // KigPaper - update head yaw to keep consistency with /tp + entity.f(location.getYaw()); // KigPaper - update head yaw to keep consistency with /tp entity.world.entityJoinedWorld(entity, false); // PaperSpigot - Fix issues with entities not being switched to their new chunk // entity.setLocation() throws no event, and so cannot be cancelled return true; From 400bd6992f77dc8666ba700fbaaf9f5eb7fa9b52 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Sun, 20 Feb 2022 18:54:05 +0100 Subject: [PATCH 19/42] Update NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/org/bukkit/craftbukkit/CraftServer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index a6550e18d..01bb6bf6c 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1039,7 +1039,7 @@ public boolean unloadWorld(World world, boolean save) { return false; } - worlds.remove(world.getName().toLowerCase()); + worlds.remove(world.getName().toLowerCase()); console.worlds.remove(handle); if (save) { From 8b9192351cf07228fc84a7fa2422fac0215d829c Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Thu, 24 Feb 2022 20:52:03 +0100 Subject: [PATCH 20/42] third time to add dictionary.java... --- Dictionary.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Dictionary.java diff --git a/Dictionary.java b/Dictionary.java new file mode 100644 index 000000000..12fa60750 --- /dev/null +++ b/Dictionary.java @@ -0,0 +1,24 @@ +package dev.cobblesword.nachospigot.commons; + +import net.minecraft.server.EnumParticle; +import org.bukkit.Effect; + +import java.util.EnumMap; + +public class Dictionary { + public static final EnumMap EFFECT_TO_PARTICLE = new EnumMap<>(Effect.class); + + static { + String tmp; + for (EnumParticle p : EnumParticle.values()) { + tmp = p.b().replace("_", ""); + for (Effect e : Effect.values()) { + // This is pretty much the original code, but we only call it once / effect & matching particle + if (e.getName() != null && e.getName().startsWith(tmp)) { + EFFECT_TO_PARTICLE.put(e, p); + break; + } + } + } + } +} \ No newline at end of file From 8a12b676c288e6a3b380ebde804e5e209109bcb3 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Thu, 24 Feb 2022 20:59:50 +0100 Subject: [PATCH 21/42] im very dump --- Dictionary.java | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 Dictionary.java diff --git a/Dictionary.java b/Dictionary.java deleted file mode 100644 index 12fa60750..000000000 --- a/Dictionary.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.cobblesword.nachospigot.commons; - -import net.minecraft.server.EnumParticle; -import org.bukkit.Effect; - -import java.util.EnumMap; - -public class Dictionary { - public static final EnumMap EFFECT_TO_PARTICLE = new EnumMap<>(Effect.class); - - static { - String tmp; - for (EnumParticle p : EnumParticle.values()) { - tmp = p.b().replace("_", ""); - for (Effect e : Effect.values()) { - // This is pretty much the original code, but we only call it once / effect & matching particle - if (e.getName() != null && e.getName().startsWith(tmp)) { - EFFECT_TO_PARTICLE.put(e, p); - break; - } - } - } - } -} \ No newline at end of file From 4b5d317ea166d872c7f9943e69611f5d4fa0ed66 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Thu, 24 Feb 2022 21:00:22 +0100 Subject: [PATCH 22/42] forth time to fix that... shall have more sleep --- .../nachospigot/commons/Dictionary.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 NachoSpigot-Server/src/main/java/dev/cobblesword/nachospigot/commons/Dictionary.java diff --git a/NachoSpigot-Server/src/main/java/dev/cobblesword/nachospigot/commons/Dictionary.java b/NachoSpigot-Server/src/main/java/dev/cobblesword/nachospigot/commons/Dictionary.java new file mode 100644 index 000000000..12fa60750 --- /dev/null +++ b/NachoSpigot-Server/src/main/java/dev/cobblesword/nachospigot/commons/Dictionary.java @@ -0,0 +1,24 @@ +package dev.cobblesword.nachospigot.commons; + +import net.minecraft.server.EnumParticle; +import org.bukkit.Effect; + +import java.util.EnumMap; + +public class Dictionary { + public static final EnumMap EFFECT_TO_PARTICLE = new EnumMap<>(Effect.class); + + static { + String tmp; + for (EnumParticle p : EnumParticle.values()) { + tmp = p.b().replace("_", ""); + for (Effect e : Effect.values()) { + // This is pretty much the original code, but we only call it once / effect & matching particle + if (e.getName() != null && e.getName().startsWith(tmp)) { + EFFECT_TO_PARTICLE.put(e, p); + break; + } + } + } + } +} \ No newline at end of file From 78d7d8d26bbf70d698d643b56b1048968dcb64ac Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Thu, 24 Feb 2022 21:01:27 +0100 Subject: [PATCH 23/42] Update NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/Entity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java index b9078c155..31eca9c5d 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java @@ -166,8 +166,8 @@ public synchronized void setSeed(long seed) { public boolean fromMobSpawner; public void inactiveTick() { } // Spigot end - - // Migot start + + // Migot start private boolean isInLava; private int lastLavaCheck = Integer.MIN_VALUE; // Migot end From 97b0d13ce994d47bacfe66ec7e26c9084005917a Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Thu, 24 Feb 2022 21:01:39 +0100 Subject: [PATCH 24/42] Update NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/Entity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java index 31eca9c5d..cd4b0311c 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/Entity.java @@ -1075,15 +1075,15 @@ public boolean a(Material material) { } public boolean ab() { - // Migot start Check for lava only once per tick - // return this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); - int currentTick = MinecraftServer.currentTick; + // Migot start - Check for lava only once per tick + // return this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); + int currentTick = MinecraftServer.currentTick; if (this.lastLavaCheck != currentTick) { this.lastLavaCheck = currentTick; this.isInLava = this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); } return this.isInLava; - // Migot end + // Migot end } public void a(float f, float f1, float f2) { From e95bf40b1c46e340974ed0adcb50e86410dc0351 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Thu, 24 Feb 2022 21:01:56 +0100 Subject: [PATCH 25/42] Update NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/RegionFileCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java index 2a2965120..68d022c23 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java @@ -41,7 +41,7 @@ public class RegionFileCache { } } - public static /*synchronized*/ void a() {// Paper 1.13 Backport - remove synchronization + public static /*synchronized*/ void a() { // Paper - remove synchronization Iterator iterator = RegionFileCache.a.values().iterator(); while (iterator.hasNext()) { From 4740db6f3a28f97ba1df6657ab3b56dee074fe13 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Thu, 24 Feb 2022 21:07:35 +0100 Subject: [PATCH 26/42] revert kigpaper optimize damage source --- .../java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 757fd441f..b6984df9d 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -533,8 +533,7 @@ private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSo } else if (source == DamageSource.FALL) { cause = DamageCause.FALL; } else if (source == DamageSource.GENERIC) { - //return new EntityDamageEvent(entity.getBukkitEntity(), null, modifiers, modifierFunctions); - cause = DamageCause.CUSTOM; // KigPaper + return new EntityDamageEvent(entity.getBukkitEntity(), null, modifiers, modifierFunctions); } if (cause != null) { From 8cf13c97e278d5a9da5eb95db17b7a24f1fd9be8 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Thu, 24 Feb 2022 21:08:18 +0100 Subject: [PATCH 27/42] get away because of revert --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 9657deeb7..710da0087 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,6 @@ See: [Contributors Page](https://github.com/CobbleSword/NachoSpigot/graphs/contr [KigPaper-0039] Fix Entity and Command Block memory leaks [KigPaper-0128] Fix Entity and Command Block memory leaks [KigPaper-0129] Fix more EnchantmentManager leaks -[KigPaper-0130] Fix CraftLivingEntity#damage not calling EntityDamageEvent [KigPaper-0138] Fix some more memory leaks [KigPaper-0161] Fix CraftingManager memory leak [KigPaper-0167] Add setType without lighting update API From a8a3c67eb063fd6cbc9db319c25c8c63a82bf09a Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:52:12 +0100 Subject: [PATCH 28/42] Update NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkSection.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/ChunkSection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkSection.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkSection.java index 152e49751..7f699b97d 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkSection.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkSection.java @@ -73,7 +73,7 @@ public int c(int i, int j, int k) { public boolean a() { //return this.nonEmptyBlockCount == 0; - // Paper - MC-80966 + // Paper - MC-80966 // Even if there are no blocks, there may be other information associated with the chunk, always send it. return false; } From 3023a790990ed87f6b8a3df4417631ad6a303d99 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:52:35 +0100 Subject: [PATCH 29/42] Fix spaces Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/ChunkRegionLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java index f2576ec69..29a6e65df 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -195,7 +195,7 @@ public void b() { if (this.c()) { continue; } - break; // Paper - fix infinite loop when saving chunks + break; // Paper - fix infinite loop when saving chunks } } finally { this.e = false; From 0d4f95dfb417caf56a1dd6a33e0359f4818d8a5b Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:52:55 +0100 Subject: [PATCH 30/42] Fix spaces Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/Chunk.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java index 6c1a73410..6628a5d95 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java @@ -286,7 +286,7 @@ private void d(int i, int j) { this.k = true; } - private void recheckGaps(boolean flag) { h(flag); } // Paper + private void recheckGaps(boolean flag) { h(flag); } // Paper private void h(boolean flag) { this.world.methodProfiler.a("recheckGaps"); From 72ba7b8f7c6f89e981116bb112e55d78a5ffe3b5 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:53:08 +0100 Subject: [PATCH 31/42] Fix spaces Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/Chunk.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java index 6628a5d95..208e2d3dd 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/Chunk.java @@ -1283,7 +1283,7 @@ public BlockPosition h(BlockPosition blockposition) { return new BlockPosition(blockposition.getX(), this.f[k], blockposition.getZ()); } - // Paper start + // Paper start private boolean shouldRecheckGaps = false; public void doGapCheck() { if (shouldRecheckGaps) { From d49d5b72afe566b2338025527cc757c2da5657af Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:53:30 +0100 Subject: [PATCH 32/42] Update NachoSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/WorldServer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java index 69a58ed4b..f7bfadc60 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java @@ -962,15 +962,13 @@ public void save(boolean flag, IProgressUpdate iprogressupdate) throws Exception this.chunkProvider.saveChunks(flag, iprogressupdate); // CraftBukkit - ArrayList -> Collection - /* //Paper start Collection arraylist = this.chunkProviderServer.a(); - + /*Collection arraylist = this.chunkProviderServer.a(); // Paper start for (Chunk value : arraylist) { if (value != null && !this.manager.a(value.locX, value.locZ)) { this.chunkProviderServer.queueUnload(value.locX, value.locZ); } } - */ - // Paper end + */ // Paper end } } From 26b3c92bcd4ed90427e61694d33ac19f102dec0c Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:53:38 +0100 Subject: [PATCH 33/42] Update NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../java/org/bukkit/craftbukkit/CraftWorld.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index db6a2a48a..08c3a57f8 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1465,15 +1465,15 @@ public void playEffect( Location location, Effect effect, int id, int data, floa } else { net.minecraft.server.EnumParticle particle = null; - int[] extra = null; + int[] extra = null; if ((particle = Dictionary.EFFECT_TO_PARTICLE.get(effect)) != null) { - if ( effect.getData() != null ) { - if ( effect.getData().equals( org.bukkit.Material.class ) ) { - extra = new int[]{ id }; - } else { - extra = new int[]{ (data << 12) | (id & 0xFFF) }; - } - } + if (effect.getData() != null) { + if (effect.getData().equals( org.bukkit.Material.class)) { + extra = new int[]{id}; + } else { + extra = new int[]{(data << 12) | (id & 0xFFF)}; + } + } } if ( extra == null ) From 5fe023190ed15fbe803f7c0918441cbb93013615 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:53:51 +0100 Subject: [PATCH 34/42] Update NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 19eec5f4f..8d569fed8 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1541,7 +1541,7 @@ public void playEffect( Location location, Effect effect, int id, int data, floa extra = new int[]{ id }; } else { - extra = new int[]{ (data << 12) | (id & 0xFFF) }; + extra = new int[]{(data << 12) | (id & 0xFFF)}; } } } From ed39593ab15eff62daca3b75f42dc752b6595c76 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:54:01 +0100 Subject: [PATCH 35/42] Update NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 8d569fed8..24cdcca91 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1534,7 +1534,7 @@ public void playEffect( Location location, Effect effect, int id, int data, floa net.minecraft.server.EnumParticle particle = null; int[] extra = null; if ((particle = Dictionary.EFFECT_TO_PARTICLE.get(effect)) != null) { - if ( effect.getData() != null ) + if (effect.getData() != null) { if ( effect.getData().equals( Material.class ) ) { From 853dbc163f2fa9720cd7ba98fbeb21c65aefa946 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:54:12 +0100 Subject: [PATCH 36/42] Update NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 24cdcca91..b4c3f44d0 100644 --- a/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1536,9 +1536,9 @@ public void playEffect( Location location, Effect effect, int id, int data, floa if ((particle = Dictionary.EFFECT_TO_PARTICLE.get(effect)) != null) { if (effect.getData() != null) { - if ( effect.getData().equals( Material.class ) ) + if (effect.getData().equals(Material.class)) { - extra = new int[]{ id }; + extra = new int[]{id}; } else { extra = new int[]{(data << 12) | (id & 0xFFF)}; From a64aef004a9f68fb451acfd227ecbfef47fcbcc3 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:54:23 +0100 Subject: [PATCH 37/42] Update NachoSpigot-Server/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/com/destroystokyo/paper/PaperWorldConfig.java | 1 - 1 file changed, 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/NachoSpigot-Server/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java index 21c619128..54aa02afb 100644 --- a/NachoSpigot-Server/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/NachoSpigot-Server/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -396,5 +396,4 @@ private void portalSearchRadius() { portalSearchRadius = getInt("portal-search-radius", 128); } - public boolean queueLightUpdates = true; } From 09bfcc061c289df20f5b6a8ba5a90bece89baded Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:55:04 +0100 Subject: [PATCH 38/42] Update NachoSpigot-Server/src/main/java/net/minecraft/server/EntityPlayer.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/EntityPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/EntityPlayer.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/EntityPlayer.java index fc8410862..177076419 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/EntityPlayer.java @@ -131,7 +131,7 @@ public void a(NBTTagCompound nbttagcompound) { } } - if (this.locY > 300) this.locY = 200; + if (this.locY > 300) this.locY = 200; this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit } From 60daec54d72e3f385662b7d60d4908ee72a3d1fa Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:55:26 +0100 Subject: [PATCH 39/42] Update NachoSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/MinecraftServer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java index 856692c07..d83d94023 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java @@ -739,8 +739,8 @@ protected void A() throws ExceptionWorldConflict { // CraftBukkit - added throws if (autosavePeriod > 0 /*&& this.ticks % autosavePeriod == 0*/) { // CraftBukkit // Paper - Incremental Auto Saving SpigotTimings.worldSaveTimer.startTiming(); // Spigot this.methodProfiler.a("save"); - //this.playerList.savePlayers(); // Nacho - deobfuscate playerList - if (this.ticks % autosavePeriod == 0) this.playerList.savePlayers(); // Paper - Incremental Auto Saving + //this.playerList.savePlayers(); + if (this.ticks % autosavePeriod == 0) this.playerList.savePlayers(); // Paper - Incremental Auto Saving // Spigot Start // We replace this with saving each individual world as this.saveChunks(...) is broken, // and causes the main thread to sleep for random amounts of time depending on chunk activity From 82562a19b8a841475a6e40c4d3424389c2e062d1 Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:55:38 +0100 Subject: [PATCH 40/42] Update NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/RegionFileCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java index 68d022c23..a0c4cd967 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java @@ -13,7 +13,7 @@ public class RegionFileCache { public static final Map a = Maps.newHashMap(); // Spigot - private -> public // PaperSpigot start - public static /*synchronized*/ RegionFile a(File file, int i, int j) {// Paper 1.13 Backport - remove synchronization + public static /*synchronized*/ RegionFile a(File file, int i, int j) { // Paper - remove synchronization return a(file, i, j, true); } public static /*synchronized*/ RegionFile a(File file, int i, int j, boolean create) {// Paper 1.13 Backport - remove synchronization From 57ed16f766d4c555dc8514a5345e1afb76e7740b Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:55:46 +0100 Subject: [PATCH 41/42] Update NachoSpigot-Server/src/main/java/net/minecraft/server/World.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/World.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/World.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/World.java index b7d90454e..9b1b4b318 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/World.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/World.java @@ -1911,7 +1911,7 @@ public void entityJoinedWorld(Entity entity, boolean flag) { int k = MathHelper.floor(entity.locX / 16.0D); //int l = MathHelper.floor(entity.locY / 16.0D); - int l = Math.min(15, Math.max(0, MathHelper.floor(entity.locY / 16.0D))); // Paper - stay consistent with chunk add/remove behavior + int l = Math.min(15, Math.max(0, MathHelper.floor(entity.locY / 16.0D))); // Paper - stay consistent with chunk add/remove behavior int i1 = MathHelper.floor(entity.locZ / 16.0D); // Nacho start - deobfuscate chunkX, chunkY, chunkZ removeEntity From fc32a46f63f6bdb1c6794396a7bef7ce9206cdff Mon Sep 17 00:00:00 2001 From: crafter23456 <64259198+crafter23456@users.noreply.github.com> Date: Fri, 25 Feb 2022 09:44:12 +0100 Subject: [PATCH 42/42] Update NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java Co-authored-by: Elier <71361901+Elierrr@users.noreply.github.com> --- .../src/main/java/net/minecraft/server/RegionFileCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java b/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java index a0c4cd967..5fc15638b 100644 --- a/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/NachoSpigot-Server/src/main/java/net/minecraft/server/RegionFileCache.java @@ -16,7 +16,7 @@ public class RegionFileCache { public static /*synchronized*/ RegionFile a(File file, int i, int j) { // Paper - remove synchronization return a(file, i, j, true); } - public static /*synchronized*/ RegionFile a(File file, int i, int j, boolean create) {// Paper 1.13 Backport - remove synchronization + public static /*synchronized*/ RegionFile a(File file, int i, int j, boolean create) { // Paper - remove synchronization // PaperSpigot end File file1 = new File(file, "region"); File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca");