Fix rendering connection issue with cables.
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
				
			|||||||
package com.raoulvdberge.refinedstorage.block;
 | 
					package com.raoulvdberge.refinedstorage.block;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
 | 
					import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
 | 
				
			||||||
 | 
					import com.raoulvdberge.refinedstorage.tile.TileBase;
 | 
				
			||||||
import com.raoulvdberge.refinedstorage.tile.TileCable;
 | 
					import com.raoulvdberge.refinedstorage.tile.TileCable;
 | 
				
			||||||
import com.raoulvdberge.refinedstorage.tile.TileNode;
 | 
					import com.raoulvdberge.refinedstorage.tile.TileNode;
 | 
				
			||||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
 | 
					import com.raoulvdberge.refinedstorage.util.RenderUtils;
 | 
				
			||||||
@@ -86,30 +87,17 @@ public class BlockCable extends BlockNode {
 | 
				
			|||||||
        return state;
 | 
					        return state;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // This is used for rendering the box outlines in the client proxy.
 | 
					    private static boolean hasConnectionWith(IBlockAccess world, BlockPos pos, BlockBase block, TileEntity tile, EnumFacing direction) {
 | 
				
			||||||
    // We use this because MCMP wraps the block in a MCMP wrapper block, creating issues where
 | 
					 | 
				
			||||||
    // it cannot assign properties to the MCMP blockstate. Here, we make sure that it uses our block state.
 | 
					 | 
				
			||||||
    private IBlockState stateForRendering;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public IBlockState getActualStateForRendering(IBlockAccess world, BlockPos pos) {
 | 
					 | 
				
			||||||
        if (stateForRendering == null) {
 | 
					 | 
				
			||||||
            stateForRendering = createBlockState().getBaseState();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return getActualState(stateForRendering, world, pos);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // TODO: investigate connection issue
 | 
					 | 
				
			||||||
    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 = world.getTileEntity(pos.offset(direction));
 | 
				
			||||||
        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, direction.getOpposite())) {
 | 
				
			||||||
            if (block.getDirection() != null && ((TileNode) tile).getNode().getFacingTile() == otherTile) {
 | 
					            // Prevent the block adding connections in itself
 | 
				
			||||||
 | 
					            // For example: importer cable connection on the importer face
 | 
				
			||||||
 | 
					            if (block.getDirection() != null && ((TileBase) tile).getDirection() == direction) {
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -336,7 +336,7 @@ public class ProxyClient extends ProxyCommon {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        BlockCable cable = (BlockCable) block;
 | 
					        BlockCable cable = (BlockCable) block;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        IBlockState state = cable.getActualStateForRendering(player.getEntityWorld(), pos);
 | 
					        IBlockState state = cable.getActualState(cable.getDefaultState(), player.getEntityWorld(), pos);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (cable.collisionRayTrace(state, player.getEntityWorld(), pos, RenderUtils.getStart(player), RenderUtils.getEnd(player)) == null) {
 | 
					        if (cable.collisionRayTrace(state, player.getEntityWorld(), pos, RenderUtils.getStart(player), RenderUtils.getEnd(player)) == null) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user