diff --git a/src/main/java/jp/ngt/rtm/item/ItemWrench.java b/src/main/java/jp/ngt/rtm/item/ItemWrench.java index 1a9bd9da..f48afe3a 100644 --- a/src/main/java/jp/ngt/rtm/item/ItemWrench.java +++ b/src/main/java/jp/ngt/rtm/item/ItemWrench.java @@ -77,11 +77,17 @@ public void onRightClickMarker(ItemStack itemStack, World world, EntityPlayer pl case 9: this.changeMarkerAnchor(world, player, marker); break; + case 10: + marker.fitNeighbor ^= true; + if (world.isRemote) { + NGTLog.sendChatMessage(player, "Set fit neighbor rail: " + marker.fitNeighbor); + } + break; } } private void changeMode(World world, ItemStack itemStack, EntityPlayer player) { - int i = (itemStack.getItemDamage() + 1) % 10; + int i = (itemStack.getItemDamage() + 1) % 11; if (i >= 2 && i <= 5) { i = 6; } diff --git a/src/main/java/jp/ngt/rtm/rail/BlockMarker.java b/src/main/java/jp/ngt/rtm/rail/BlockMarker.java index c331eea5..c3a2b9be 100644 --- a/src/main/java/jp/ngt/rtm/rail/BlockMarker.java +++ b/src/main/java/jp/ngt/rtm/rail/BlockMarker.java @@ -186,7 +186,6 @@ public boolean onMarkerActivated(World world, int x, int y, int z, EntityPlayer .sorted(Comparator.comparingInt(o -> Math.abs(o.yCoord - y))) .map(TileEntityMarker::getMarkerRP) .collect(Collectors.toList()); - list.forEach(rp -> rp.addHeight(prop.blockHeight - 0.0625F)); } if (list.size() == 2 && list.stream().allMatch(rp -> rp.switchType == 1)) { diff --git a/src/main/java/jp/ngt/rtm/rail/RenderMarkerBlock1122.java b/src/main/java/jp/ngt/rtm/rail/RenderMarkerBlock1122.java index dbf25d18..ddb7019f 100644 --- a/src/main/java/jp/ngt/rtm/rail/RenderMarkerBlock1122.java +++ b/src/main/java/jp/ngt/rtm/rail/RenderMarkerBlock1122.java @@ -313,7 +313,7 @@ private boolean changeAnchor(TileEntityMarker marker) { float cantLimit = 80.0F; float cant = (pitchDif < -cantLimit) ? -cantLimit : (Math.min(pitchDif, cantLimit)); RailPosition neighborRP = getNeighborRail(marker); - if (neighborRP != null) { + if (neighborRP != null && marker.fitNeighbor) { cant = -neighborRP.cantEdge; } rp.cantEdge = cant; @@ -389,14 +389,14 @@ private boolean changeAnchor(TileEntityMarker marker) { float length = (float) (dx / MathHelper.sin(dirRad)); float yaw = NGTMath.toDegrees(dirRad); if (curElm == MarkerElement.HORIZONTIAL) { - if (neighborRP != null) { + if (neighborRP != null && marker.fitNeighbor) { yaw = MathHelper.wrapAngleTo180_float(neighborRP.anchorYaw + 180.0F); } rp.anchorYaw = yaw; rp.anchorLengthHorizontal = length; } else if (curElm == MarkerElement.VERTICAL) { float pitch = MathHelper.wrapAngleTo180_float(yaw - rp.anchorYaw); - if (neighborRP != null) { + if (neighborRP != null && marker.fitNeighbor) { pitch = -neighborRP.anchorPitch; } else if (fitOpposite) { double dy = targetVec.yCoord - rp.posY; diff --git a/src/main/java/jp/ngt/rtm/rail/RenderMarkerBlock1710.java b/src/main/java/jp/ngt/rtm/rail/RenderMarkerBlock1710.java index 99566486..1a455495 100644 --- a/src/main/java/jp/ngt/rtm/rail/RenderMarkerBlock1710.java +++ b/src/main/java/jp/ngt/rtm/rail/RenderMarkerBlock1710.java @@ -169,14 +169,14 @@ private void changeAnchor(TileEntityMarker tileEntity)//Minecraft.1518-this.obje float yaw = NGTMath.toDegrees(dirRad); if (curElm == MarkerElement.HORIZONTIAL) { - if (neighborRP != null) { + if (neighborRP != null && tileEntity.fitNeighbor) { yaw = MathHelper.wrapAngleTo180_float(neighborRP.anchorYaw + 180.0F); } rp.anchorYaw = yaw; rp.anchorLengthHorizontal = length; } else if (curElm == MarkerElement.VERTICAL) { float pitch = MathHelper.wrapAngleTo180_float(yaw - rp.anchorYaw); - if (neighborRP != null) { + if (neighborRP != null && tileEntity.fitNeighbor) { pitch = -neighborRP.anchorPitch; } else if (fitOpposite) { double dy = vec3.yCoord - rp.posY; @@ -186,7 +186,7 @@ private void changeAnchor(TileEntityMarker tileEntity)//Minecraft.1518-this.obje rp.anchorLengthVertical = length; } else if (curElm == MarkerElement.CANT) { float cant = MathHelper.wrapAngleTo180_float(yaw - rp.anchorYaw); - if (neighborRP != null) { + if (neighborRP != null && tileEntity.fitNeighbor) { cant = -neighborRP.cantEdge; } rp.cantEdge = cant; diff --git a/src/main/java/jp/ngt/rtm/rail/TileEntityMarker.java b/src/main/java/jp/ngt/rtm/rail/TileEntityMarker.java index c0774364..a21b2efa 100644 --- a/src/main/java/jp/ngt/rtm/rail/TileEntityMarker.java +++ b/src/main/java/jp/ngt/rtm/rail/TileEntityMarker.java @@ -63,6 +63,8 @@ public class TileEntityMarker extends TileEntity { private int count; + public boolean fitNeighbor = true; + public TileEntityMarker() { this.markerState = MarkerState.DISTANCE.set(this.markerState, true); this.markerState = MarkerState.GRID.set(this.markerState, false);