diff options
| author | nea <nea@nea.moe> | 2023-04-26 00:53:12 +0200 |
|---|---|---|
| committer | nea <nea@nea.moe> | 2023-04-26 00:53:12 +0200 |
| commit | fc745da88b19064f3015f918b4f090f2c4666524 (patch) | |
| tree | 501091c82d82cc47e1947d8f03609c4a2b1118a4 /src/main/java/io | |
| parent | b12f18fdbc60f141657ecfbd18590724666b593d (diff) | |
| download | NotEnoughUpdates-fc745da88b19064f3015f918b4f090f2c4666524.tar.gz NotEnoughUpdates-fc745da88b19064f3015f918b4f090f2c4666524.tar.bz2 NotEnoughUpdates-fc745da88b19064f3015f918b4f090f2c4666524.zip | |
Make ruler not work cross plot
Diffstat (limited to 'src/main/java/io')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java index c8c7a3da..242fce4e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -24,6 +24,7 @@ import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.SpecialColour; import io.github.moulberry.notenoughupdates.util.Utils; +import lombok.var; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -53,6 +54,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.util.Vec3i; @@ -1585,10 +1587,21 @@ public class CustomItemEffects { Facing facing = Facing.forDirection(yaw); int xOff = facing == Facing.WEST ? -1 : facing == Facing.EAST ? 1 : 0; int zOff = facing == Facing.NORTH ? -1 : facing == Facing.SOUTH ? 1 : 0; + BlockPos posNew = candidate.add(xOff, 0, zOff); + if ( + "garden".equals(SBInfo.getInstance().getLocation()) + ) { + var plotX = MathHelper.floor_float((candidate.getX() + 48) / 96F); + var plotXNew = MathHelper.floor_float((posNew.getX() + 48) / 96F); + var plotZ = MathHelper.floor_float((candidate.getZ() + 48) / 96F); + var plotZNew = MathHelper.floor_float((posNew.getZ() + 48) / 96F); + if (plotX != plotXNew || plotZ != plotZNew) { + continue; + } + } if (!sneaking) { if (Minecraft.getMinecraft().theWorld.getBlockState(candidate.add(xOff, 1, zOff)).getBlock() == Blocks.air) { - BlockPos posNew = candidate.add(xOff, 0, zOff); if (!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) { IBlockState blockNew = Minecraft.getMinecraft().theWorld.getBlockState(posNew.add(0, 1, 0)); if (blockNew.getBlock() == Blocks.air) { @@ -1601,7 +1614,6 @@ public class CustomItemEffects { } else { if (Minecraft.getMinecraft().theWorld.getBlockState(candidate.add(xOff, 0, zOff)).getBlock() == Minecraft.getMinecraft().theWorld.getBlockState(target.getBlockPos()).getBlock()) { - BlockPos posNew = candidate.add(xOff, 0, zOff); if (!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) { IBlockState blockNew = Minecraft.getMinecraft().theWorld.getBlockState(posNew.add(0, 0, 0)); if (blockNew.getBlock() == |
