Fix door right-click close to rift

This commit is contained in:
Runemoro 2018-04-05 00:40:07 -04:00
parent d0cfbe08ac
commit 1c78b5e629
2 changed files with 7 additions and 4 deletions

View file

@ -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;
}
}
}

View file

@ -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