diff --git a/CHANGELOG.md b/CHANGELOG.md index a5b60a0c5..9e3d57c22 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### 1.5.29 - Update Forge to 2577 (minimum Forge version required is now 2555 for MC 1.12.2) +- Fixed bug where MCMP multiparts were blocking RS network connections (raoulvdberge) ### 1.5.28 - Fixed Writers not pushing energy (raoulvdberge) diff --git a/build.gradle b/build.gradle index b6bd91660..c3742e556 100755 --- a/build.gradle +++ b/build.gradle @@ -56,7 +56,7 @@ repositories { dependencies { deobfCompile "mezz.jei:jei_1.12.2:4.8.5.136:api" runtime "mezz.jei:jei_1.12.2:4.8.5.136" - deobfCompile "MCMultiPart2:MCMultiPart:2.4.0" + deobfCompile "MCMultiPart2:MCMultiPart:2.4.1" deobfCompile "li.cil.oc:OpenComputers:MC1.12.1-1.7.1.43:api" deobfCompile "com.jaquadro.minecraft.storagedrawers:StorageDrawers:1.12.1-5.3.3:api" compile "inventory-tweaks:InventoryTweaks:1.63:api" diff --git a/src/main/java/com/raoulvdberge/refinedstorage/RS.java b/src/main/java/com/raoulvdberge/refinedstorage/RS.java index eebf61173..1d9a30877 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/RS.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/RS.java @@ -24,7 +24,7 @@ public final class RS { public static final String ID = "refinedstorage"; public static final String VERSION = "1.5.29"; - public static final String DEPENDENCIES = "required-after:forge@[14.23.1.2555,);after:mcmultipart@[2.4.0,);after:storagedrawers@[1.12-5.2.2,);"; + public static final String DEPENDENCIES = "required-after:forge@[14.23.1.2555,);after:mcmultipart@[2.4.1,);after:storagedrawers@[1.12-5.2.2,);"; public static final String GUI_FACTORY = "com.raoulvdberge.refinedstorage.gui.config.ModGuiFactory"; public static final String UPDATE_JSON = "https://refinedstorage.raoulvdberge.com/update"; public static final String FINGERPRINT = "57893d5b90a7336e8c63fe1c1e1ce472c3d59578"; diff --git a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/NetworkNodeCable.java b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/NetworkNodeCable.java index 1aebbb2b3..c5a12eef4 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/NetworkNodeCable.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/NetworkNodeCable.java @@ -1,6 +1,7 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node; import com.raoulvdberge.refinedstorage.RS; +import com.raoulvdberge.refinedstorage.RSBlocks; import com.raoulvdberge.refinedstorage.block.BlockCable; import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP; import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon; @@ -9,7 +10,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import javax.annotation.Nullable; -import java.util.Collections; public class NetworkNodeCable extends NetworkNode { public static final String ID = "cable"; @@ -31,8 +31,7 @@ public class NetworkNodeCable extends NetworkNode { @Override public boolean canConduct(@Nullable EnumFacing direction) { if (IntegrationMCMP.isLoaded() && direction != null) { - return RSMCMPAddon.hasConnectionWith(world.getTileEntity(pos), Collections.singletonList(BlockCable.getCableExtensionAABB(direction))) - && RSMCMPAddon.hasConnectionWith(world.getTileEntity(pos.offset(direction)), Collections.singletonList(BlockCable.getCableExtensionAABB(direction.getOpposite()))); + return BlockCable.hasConnectionWith(world, pos, RSBlocks.CABLE, IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos), direction); } return true; diff --git a/src/main/java/com/raoulvdberge/refinedstorage/block/BlockCable.java b/src/main/java/com/raoulvdberge/refinedstorage/block/BlockCable.java index 25bb7be7f..46cce3aa4 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/block/BlockCable.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/block/BlockCable.java @@ -78,12 +78,12 @@ public class BlockCable extends BlockNode { TileEntity tile = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos); state = super.getActualState(state, world, pos) - .withProperty(NORTH, hasConnectionWith(world, pos, tile, EnumFacing.NORTH)) - .withProperty(EAST, hasConnectionWith(world, pos, tile, EnumFacing.EAST)) - .withProperty(SOUTH, hasConnectionWith(world, pos, tile, EnumFacing.SOUTH)) - .withProperty(WEST, hasConnectionWith(world, pos, tile, EnumFacing.WEST)) - .withProperty(UP, hasConnectionWith(world, pos, tile, EnumFacing.UP)) - .withProperty(DOWN, hasConnectionWith(world, pos, tile, EnumFacing.DOWN)); + .withProperty(NORTH, hasConnectionWith(world, pos, this, tile, EnumFacing.NORTH)) + .withProperty(EAST, hasConnectionWith(world, pos, this, tile, EnumFacing.EAST)) + .withProperty(SOUTH, hasConnectionWith(world, pos, this, tile, EnumFacing.SOUTH)) + .withProperty(WEST, hasConnectionWith(world, pos, this, tile, EnumFacing.WEST)) + .withProperty(UP, hasConnectionWith(world, pos, this, tile, EnumFacing.UP)) + .withProperty(DOWN, hasConnectionWith(world, pos, this, tile, EnumFacing.DOWN)); return state; } @@ -101,22 +101,22 @@ public class BlockCable extends BlockNode { return getActualState(stateForRendering, world, pos); } - private boolean hasConnectionWith(IBlockAccess world, BlockPos pos, TileEntity tile, EnumFacing direction) { + public static boolean hasConnectionWith(IBlockAccess world, BlockPos pos, BlockBase block, TileEntity tile, EnumFacing direction) { if (!(tile instanceof TileNode)) { return false; } - TileEntity otherTile = world.getTileEntity(pos.offset(direction)); + TileEntity otherTile = RSMCMPAddon.unwrapTile(world, pos.offset(direction)); EnumFacing otherTileSide = direction.getOpposite(); if (otherTile != null && otherTile.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, otherTileSide)) { - if (getDirection() != null && ((TileNode) tile).getNode().getFacingTile() == otherTile) { + if (block.getDirection() != null && ((TileNode) tile).getNode().getFacingTile() == otherTile) { return false; } if (IntegrationMCMP.isLoaded()) { - return RSMCMPAddon.hasConnectionWith(tile, Collections.singletonList(BlockCable.getCableExtensionAABB(direction))) - && RSMCMPAddon.hasConnectionWith(otherTile, Collections.singletonList(BlockCable.getCableExtensionAABB(direction.getOpposite()))); + return !RSMCMPAddon.hasObstructingMultipart(tile, Collections.singletonList(BlockCable.getCableExtensionAABB(direction))) + && !RSMCMPAddon.hasObstructingMultipart(otherTile, Collections.singletonList(BlockCable.getCableExtensionAABB(direction.getOpposite()))); } return true; diff --git a/src/main/java/com/raoulvdberge/refinedstorage/integration/mcmp/RSMCMPAddon.java b/src/main/java/com/raoulvdberge/refinedstorage/integration/mcmp/RSMCMPAddon.java index e74e9d132..fee952205 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/integration/mcmp/RSMCMPAddon.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/integration/mcmp/RSMCMPAddon.java @@ -103,7 +103,7 @@ public class RSMCMPAddon implements IMCMPAddon { }); } - public static boolean hasConnectionWith(TileEntity tile, List boxes) { + public static boolean hasObstructingMultipart(TileEntity tile, List testBoxes) { if (tile != null && tile.hasCapability(MCMPCapabilities.MULTIPART_TILE, null)) { IMultipartTile multipartTile = tile.getCapability(MCMPCapabilities.MULTIPART_TILE, null); @@ -111,14 +111,14 @@ public class RSMCMPAddon implements IMCMPAddon { for (IPartInfo info : ((PartCableTile) multipartTile).getInfo().getContainer().getParts().values()) { IMultipart multipart = info.getPart(); - if (MultipartOcclusionHelper.testBoxIntersection(boxes, multipart.getOcclusionBoxes(info))) { - return false; + if (!(multipart instanceof PartCable) && MultipartOcclusionHelper.testBoxIntersection(testBoxes, multipart.getOcclusionBoxes(info))) { + return true; } } } } - return true; + return false; } @Nullable