diff options
author | Tamion <[email protected]> | 2023-11-04 21:20:13 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2023-11-04 13:20:13 -0700 |
commit | bffb08c2f99a5527b7357d005cb10ba21cf048d9 (patch) | |
tree | c25ad5490b0ede8ce30bc0f23b5e0255eecc0dbc /patches/server/0688-Optimise-BlockSoil-nearby-water-lookup.patch | |
parent | 6592fed511ee2ea17de9e05463579bd1923cf8aa (diff) | |
download | Paper-bffb08c2f99a5527b7357d005cb10ba21cf048d9.tar.gz Paper-bffb08c2f99a5527b7357d005cb10ba21cf048d9.zip |
Deprecate Player#boostElytra (#9899)
The Paper method was chosen for deprecation because it was more
restrictive in that it has an isGliding check.
Diffstat (limited to 'patches/server/0688-Optimise-BlockSoil-nearby-water-lookup.patch')
-rw-r--r-- | patches/server/0688-Optimise-BlockSoil-nearby-water-lookup.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/patches/server/0688-Optimise-BlockSoil-nearby-water-lookup.patch b/patches/server/0688-Optimise-BlockSoil-nearby-water-lookup.patch new file mode 100644 index 0000000000..08ef0f3bc8 --- /dev/null +++ b/patches/server/0688-Optimise-BlockSoil-nearby-water-lookup.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf <[email protected]> +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/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java +index 3b4d8a47e7fe08284b79fab2d147629e902db026..5946f06f63b5694034bd027984a4925b0831d439 100644 +--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java +@@ -142,19 +142,27 @@ public class FarmBlock extends Block { + } + + private static boolean isNearWater(LevelReader world, BlockPos pos) { +- Iterator iterator = BlockPos.betweenClosed(pos.offset(-4, 0, -4), pos.offset(4, 1, 4)).iterator(); +- +- BlockPos blockposition1; +- +- do { +- if (!iterator.hasNext()) { +- return false; ++ // Paper start - remove abstract block iteration ++ int xOff = pos.getX(); ++ int yOff = pos.getY(); ++ int zOff = pos.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.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)world.getChunk(x >> 4, z >> 4); ++ net.minecraft.world.level.material.FluidState fluid = chunk.getBlockStateFinal(x, y, z).getFluidState(); ++ if (fluid.is(FluidTags.WATER)) { ++ return true; ++ } ++ } + } ++ } + +- blockposition1 = (BlockPos) iterator.next(); +- } while (!world.getFluidState(blockposition1).is(FluidTags.WATER)); +- +- return true; ++ return false; + } + + @Override |