Fixed bug where MCMP multiparts were blocking RS network connections

This commit is contained in:
raoulvdberge
2017-12-20 12:37:30 +01:00
parent 99e2171cf5
commit a365ec515d
6 changed files with 20 additions and 20 deletions

View File

@@ -2,6 +2,7 @@
### 1.5.29 ### 1.5.29
- Update Forge to 2577 (minimum Forge version required is now 2555 for MC 1.12.2) - 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 ### 1.5.28
- Fixed Writers not pushing energy (raoulvdberge) - Fixed Writers not pushing energy (raoulvdberge)

View File

@@ -56,7 +56,7 @@ repositories {
dependencies { dependencies {
deobfCompile "mezz.jei:jei_1.12.2:4.8.5.136:api" deobfCompile "mezz.jei:jei_1.12.2:4.8.5.136:api"
runtime "mezz.jei:jei_1.12.2:4.8.5.136" 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 "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" deobfCompile "com.jaquadro.minecraft.storagedrawers:StorageDrawers:1.12.1-5.3.3:api"
compile "inventory-tweaks:InventoryTweaks:1.63:api" compile "inventory-tweaks:InventoryTweaks:1.63:api"

View File

@@ -24,7 +24,7 @@ public final class RS {
public static final String ID = "refinedstorage"; public static final String ID = "refinedstorage";
public static final String VERSION = "1.5.29"; 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 GUI_FACTORY = "com.raoulvdberge.refinedstorage.gui.config.ModGuiFactory";
public static final String UPDATE_JSON = "https://refinedstorage.raoulvdberge.com/update"; public static final String UPDATE_JSON = "https://refinedstorage.raoulvdberge.com/update";
public static final String FINGERPRINT = "57893d5b90a7336e8c63fe1c1e1ce472c3d59578"; public static final String FINGERPRINT = "57893d5b90a7336e8c63fe1c1e1ce472c3d59578";

View File

@@ -1,6 +1,7 @@
package com.raoulvdberge.refinedstorage.apiimpl.network.node; package com.raoulvdberge.refinedstorage.apiimpl.network.node;
import com.raoulvdberge.refinedstorage.RS; import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSBlocks;
import com.raoulvdberge.refinedstorage.block.BlockCable; import com.raoulvdberge.refinedstorage.block.BlockCable;
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP; import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon; import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
@@ -9,7 +10,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Collections;
public class NetworkNodeCable extends NetworkNode { public class NetworkNodeCable extends NetworkNode {
public static final String ID = "cable"; public static final String ID = "cable";
@@ -31,8 +31,7 @@ public class NetworkNodeCable extends NetworkNode {
@Override @Override
public boolean canConduct(@Nullable EnumFacing direction) { public boolean canConduct(@Nullable EnumFacing direction) {
if (IntegrationMCMP.isLoaded() && direction != null) { if (IntegrationMCMP.isLoaded() && direction != null) {
return RSMCMPAddon.hasConnectionWith(world.getTileEntity(pos), Collections.singletonList(BlockCable.getCableExtensionAABB(direction))) return BlockCable.hasConnectionWith(world, pos, RSBlocks.CABLE, IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos), direction);
&& RSMCMPAddon.hasConnectionWith(world.getTileEntity(pos.offset(direction)), Collections.singletonList(BlockCable.getCableExtensionAABB(direction.getOpposite())));
} }
return true; return true;

View File

@@ -78,12 +78,12 @@ public class BlockCable extends BlockNode {
TileEntity tile = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos); TileEntity tile = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos);
state = super.getActualState(state, world, pos) state = super.getActualState(state, world, pos)
.withProperty(NORTH, hasConnectionWith(world, pos, tile, EnumFacing.NORTH)) .withProperty(NORTH, hasConnectionWith(world, pos, this, tile, EnumFacing.NORTH))
.withProperty(EAST, hasConnectionWith(world, pos, tile, EnumFacing.EAST)) .withProperty(EAST, hasConnectionWith(world, pos, this, tile, EnumFacing.EAST))
.withProperty(SOUTH, hasConnectionWith(world, pos, tile, EnumFacing.SOUTH)) .withProperty(SOUTH, hasConnectionWith(world, pos, this, tile, EnumFacing.SOUTH))
.withProperty(WEST, hasConnectionWith(world, pos, tile, EnumFacing.WEST)) .withProperty(WEST, hasConnectionWith(world, pos, this, tile, EnumFacing.WEST))
.withProperty(UP, hasConnectionWith(world, pos, tile, EnumFacing.UP)) .withProperty(UP, hasConnectionWith(world, pos, this, tile, EnumFacing.UP))
.withProperty(DOWN, hasConnectionWith(world, pos, tile, EnumFacing.DOWN)); .withProperty(DOWN, hasConnectionWith(world, pos, this, tile, EnumFacing.DOWN));
return state; return state;
} }
@@ -101,22 +101,22 @@ public class BlockCable extends BlockNode {
return getActualState(stateForRendering, world, pos); 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)) { if (!(tile instanceof TileNode)) {
return false; return false;
} }
TileEntity otherTile = world.getTileEntity(pos.offset(direction)); TileEntity otherTile = RSMCMPAddon.unwrapTile(world, pos.offset(direction));
EnumFacing otherTileSide = direction.getOpposite(); EnumFacing otherTileSide = direction.getOpposite();
if (otherTile != null && otherTile.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, otherTileSide)) { 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; return false;
} }
if (IntegrationMCMP.isLoaded()) { if (IntegrationMCMP.isLoaded()) {
return RSMCMPAddon.hasConnectionWith(tile, Collections.singletonList(BlockCable.getCableExtensionAABB(direction))) return !RSMCMPAddon.hasObstructingMultipart(tile, Collections.singletonList(BlockCable.getCableExtensionAABB(direction)))
&& RSMCMPAddon.hasConnectionWith(otherTile, Collections.singletonList(BlockCable.getCableExtensionAABB(direction.getOpposite()))); && !RSMCMPAddon.hasObstructingMultipart(otherTile, Collections.singletonList(BlockCable.getCableExtensionAABB(direction.getOpposite())));
} }
return true; return true;

View File

@@ -103,7 +103,7 @@ public class RSMCMPAddon implements IMCMPAddon {
}); });
} }
public static boolean hasConnectionWith(TileEntity tile, List<AxisAlignedBB> boxes) { public static boolean hasObstructingMultipart(TileEntity tile, List<AxisAlignedBB> testBoxes) {
if (tile != null && tile.hasCapability(MCMPCapabilities.MULTIPART_TILE, null)) { if (tile != null && tile.hasCapability(MCMPCapabilities.MULTIPART_TILE, null)) {
IMultipartTile multipartTile = tile.getCapability(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()) { for (IPartInfo info : ((PartCableTile) multipartTile).getInfo().getContainer().getParts().values()) {
IMultipart multipart = info.getPart(); IMultipart multipart = info.getPart();
if (MultipartOcclusionHelper.testBoxIntersection(boxes, multipart.getOcclusionBoxes(info))) { if (!(multipart instanceof PartCable) && MultipartOcclusionHelper.testBoxIntersection(testBoxes, multipart.getOcclusionBoxes(info))) {
return false; return true;
} }
} }
} }
} }
return true; return false;
} }
@Nullable @Nullable