From db302bf5e3e04970aa3b0f83597ad8e990780463 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 10 Jun 2021 18:19:44 -0400 Subject: [PATCH] Updated Upstream and Sidestream(s) (Tuinity) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: 901ac35 Optimise BlockSoil nearby water lookup --- PATCHES.md | 1 + ...timise-BlockSoil-nearby-water-lookup.patch | 64 +++++++++++++++++++ upstream/Tuinity | 2 +- upstreamCommits/Tuinity | 2 +- 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 patches/Tuinity/patches/server/0082-Optimise-BlockSoil-nearby-water-lookup.patch diff --git a/PATCHES.md b/PATCHES.md index e163fa87..7a151e33 100644 --- a/PATCHES.md +++ b/PATCHES.md @@ -113,6 +113,7 @@ # Patches | server | Nuke streams off BlockPosition | Ivan Pekov | | | server | Nuke streams off SectionPosition | Ivan Pekov | | | server | Oprimise map impl for tracked players | Spottedleaf | | +| server | Optimise BlockSoil nearby water lookup | Spottedleaf | | | server | Optimise WorldServer#notify | Spottedleaf | | | server | Optimise chunk tick iteration | Spottedleaf | | | server | Optimise closest entity lookup | Spottedleaf | | diff --git a/patches/Tuinity/patches/server/0082-Optimise-BlockSoil-nearby-water-lookup.patch b/patches/Tuinity/patches/server/0082-Optimise-BlockSoil-nearby-water-lookup.patch new file mode 100644 index 00000000..af3dec0d --- /dev/null +++ b/patches/Tuinity/patches/server/0082-Optimise-BlockSoil-nearby-water-lookup.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Thu, 10 Jun 2021 14:36:00 -0700 +Subject: [PATCH] Optimise BlockSoil nearby water lookup + +Apparently the abstract block iteration was taking about +75% of the method call. + +diff --git a/src/main/java/net/minecraft/world/level/block/BlockSoil.java b/src/main/java/net/minecraft/world/level/block/BlockSoil.java +index 3bedb1c6a0f221c7b40ee0a50f676e8b05bd37a7..ac830ea21e639652908fe82a253853b26b412e4d 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockSoil.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockSoil.java +@@ -139,19 +139,28 @@ public class BlockSoil extends Block { + } + + private static boolean a(IWorldReader iworldreader, BlockPosition blockposition) { +- Iterator iterator = BlockPosition.a(blockposition.b(-4, 0, -4), blockposition.b(4, 1, 4)).iterator(); +- +- BlockPosition blockposition1; +- +- do { +- if (!iterator.hasNext()) { +- return false; ++ // Tuinity start - remove abstract block iteration ++ int xOff = blockposition.getX(); ++ int yOff = blockposition.getY(); ++ int zOff = blockposition.getZ(); ++ ++ for (int dz = -4; dz <= 4; ++dz) { ++ int z = dz + zOff; ++ for (int dx = -4; dx <= 4; ++dx) { ++ int x = xOff + dx; ++ for (int dy = 0; dy <= 1; ++dy) { ++ int y = dy + yOff; ++ net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk)iworldreader.getChunkAt(x >> 4, z >> 4); ++ net.minecraft.world.level.material.Fluid fluid = chunk.getBlockData(x, y, z).getFluid(); ++ if (fluid.isTagged(TagsFluid.WATER)) { ++ return true; ++ } ++ } + } ++ } + +- blockposition1 = (BlockPosition) iterator.next(); +- } while (!iworldreader.getFluid(blockposition1).a((Tag) TagsFluid.WATER)); +- +- return true; ++ return false; ++ // Tuinity end - remove abstract block iteration + } + + @Override +diff --git a/src/main/java/net/minecraft/world/level/material/Fluid.java b/src/main/java/net/minecraft/world/level/material/Fluid.java +index 147e628bd562da4cf6f07218724a9d6c79d26e38..1a6120dff8236e83575ed07017844d1bf98b6fda 100644 +--- a/src/main/java/net/minecraft/world/level/material/Fluid.java ++++ b/src/main/java/net/minecraft/world/level/material/Fluid.java +@@ -72,6 +72,7 @@ public final class Fluid extends IBlockDataHolder { + return this.getType().b(this); + } + ++ public final boolean isTagged(Tag tag) { return this.a(tag); } // Tuinity - OBFHELPER + public boolean a(Tag tag) { + return this.getType().a(tag); + } diff --git a/upstream/Tuinity b/upstream/Tuinity index f32fe9aa..901ac352 160000 --- a/upstream/Tuinity +++ b/upstream/Tuinity @@ -1 +1 @@ -Subproject commit f32fe9aaaad11839df3d0e893aae251658940481 +Subproject commit 901ac352564a09a53791330e00ab034df8f5cfe5 diff --git a/upstreamCommits/Tuinity b/upstreamCommits/Tuinity index fcedd7f5..01c55c3c 100644 --- a/upstreamCommits/Tuinity +++ b/upstreamCommits/Tuinity @@ -1 +1 @@ -f32fe9aaaad11839df3d0e893aae251658940481 \ No newline at end of file +901ac352564a09a53791330e00ab034df8f5cfe5 \ No newline at end of file