Skip to content

Commit

Permalink
Fix Wall Tester Signs clipping players in ceiling
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
ellieisjelly committed Oct 17, 2024
1 parent 3a6208d commit 5a1640f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
import net.minecraft.world.World;

public class BaseTesterSign {
public static void onUse(World world, PlayerEntity player, BlockHitResult hit) {
public static void onUse(World world, PlayerEntity player, BlockPos pos) {
if (!world.isClient()) {
ServerPlayerEntity plr = (ServerPlayerEntity) player;

for (SabotageActive game : Sabotage.activeGames) {
if (game.getWorld().equals(world)) {
if (!game.testEntity(plr, hit.getBlockPos().toCenterPos())) {
if (!game.testEntity(plr, pos.toCenterPos())) {
plr.sendMessage(Text.translatable("sabotage.tester.fail").formatted(Formatting.YELLOW));
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable Livi

@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
BaseTesterSign.onUse(world, player, hit);
BaseTesterSign.onUse(world, player, pos);
return ActionResult.FAIL;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;

Expand All @@ -42,7 +43,8 @@ public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable Livi

@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
BaseTesterSign.onUse(world, player, hit);

BaseTesterSign.onUse(world, player, pos.subtract(new Vec3i(0, 1, 0)));
return ActionResult.FAIL;
}

Expand Down

0 comments on commit 5a1640f

Please sign in to comment.