From 1c78b5e6299041ef19175108b34b68bb0e228488 Mon Sep 17 00:00:00 2001 From: Runemoro Date: Thu, 5 Apr 2018 00:40:07 -0400 Subject: [PATCH] Fix door right-click close to rift --- .../dimdoors/shared/items/ItemDimensionalDoor.java | 9 ++++++--- src/main/resources/assets/dimdoors/lang/en_US.lang | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/dimdev/dimdoors/shared/items/ItemDimensionalDoor.java b/src/main/java/org/dimdev/dimdoors/shared/items/ItemDimensionalDoor.java index f3730b85..3a2a5f22 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/items/ItemDimensionalDoor.java +++ b/src/main/java/org/dimdev/dimdoors/shared/items/ItemDimensionalDoor.java @@ -36,9 +36,12 @@ public abstract class ItemDimensionalDoor extends ItemDoor { // TODO: All wood t if (!world.getBlockState(pos).getBlock().isReplaceable(world, pos)) pos = pos.offset(facing); boolean placedOnRift = world.getBlockState(pos).getBlock().equals(ModBlocks.RIFT); - if (!placedOnRift && isRiftNear(world, pos)) { + if (!placedOnRift && !player.isSneaking() && isRiftNear(world, pos)) { + // Allowing on second right click would require cancelling client-side, which + // is impossible (see https://github.com/MinecraftForge/MinecraftForge/issues/3272) + // or sending fake packets. if (world.isRemote) { - DimDoors.chat(player, "rifts.entrances.rift_too_close"); // TODO: Linebreaks don't work in status message. + DimDoors.chat(player, "rifts.entrances.rift_too_close"); TileEntityFloatingRiftRenderer.showRiftCoreUntil = System.currentTimeMillis() + ModConfig.graphics.highlightRiftCoreFor; } return EnumActionResult.FAIL; @@ -92,7 +95,7 @@ public abstract class ItemDimensionalDoor extends ItemDoor { // TODO: All wood t BlockPos searchPos = new BlockPos(x, y, z); if (world.getBlockState(searchPos).getBlock() == ModBlocks.RIFT) { TileEntityFloatingRift rift = (TileEntityFloatingRift) world.getTileEntity(searchPos); - if (Math.sqrt(pos.distanceSq(searchPos)) < rift.size / 250) return true; + if (Math.sqrt(pos.distanceSq(searchPos)) < rift.size / 150) return true; } } } diff --git a/src/main/resources/assets/dimdoors/lang/en_US.lang b/src/main/resources/assets/dimdoors/lang/en_US.lang index c46404c9..deb50e7c 100644 --- a/src/main/resources/assets/dimdoors/lang/en_US.lang +++ b/src/main/resources/assets/dimdoors/lang/en_US.lang @@ -118,7 +118,7 @@ rifts.destinations.escape.did_not_use_rift=You didn't use a rift to enter the po rifts.destinations.escape.rift_has_closed=The rift you used to enter the pocket dimension has closed and you ended up in Limbo! rifts.destinations.private_pocket_exit.did_not_use_rift=You didn't use a rift to enter the pocket dimension and you ended up in Limbo! rifts.destinations.private_pocket_exit.rift_has_closed=The rift you used to enter the pocket dimension has closed and you ended up in Limbo! -rifts.entrances.rift_too_close=Placing a door this close to a tear in the world would be dangerous. Either place it on the rift's core (tesseract) or further away. Or use a rift signature to make a rift anyway, at your own risk! +rifts.entrances.rift_too_close=Placing a door this close to a tear in the world would be dangerous. Shift-right-click to place anyway, or place it on the rift's core (tesseract) to bind it to the rift. rifts.entrances.cannot_be_placed_on_rift=This type of door can't be placed on a rift. dimdoors.general=General Options