Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/main/java/mcjty/xnet/blocks/cables/ConnectorBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
Expand Down Expand Up @@ -369,6 +370,22 @@ public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAc
}
}

@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
IBlockState mimicBlock = getMimicBlock(worldIn, pos);
if (mimicBlock != null) {
return mimicBlock.getBlockFaceShape(worldIn, pos, face);
}

ConnectorType connectorType = getConnectorType(state.getValue(COLOR), worldIn, pos, face);
if (connectorType == ConnectorType.CABLE) {
return BlockFaceShape.CENTER_SMALL;
} else if (connectorType == ConnectorType.BLOCK) {
return BlockFaceShape.CENTER_BIG;
}
return BlockFaceShape.UNDEFINED;
}

@Override
@SideOnly(Side.CLIENT)
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/mcjty/xnet/blocks/cables/NetCableBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import mcjty.xnet.blocks.generic.GenericCableBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
Expand Down Expand Up @@ -80,4 +81,11 @@ protected ConnectorType getConnectorType(@Nonnull CableColor color, IBlockAccess
}
}

@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
if (getConnectorType(state.getValue(COLOR), worldIn, pos, face) == ConnectorType.CABLE) {
return BlockFaceShape.CENTER_SMALL;
}
return BlockFaceShape.UNDEFINED;
}
}
9 changes: 9 additions & 0 deletions src/main/java/mcjty/xnet/blocks/facade/FacadeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import mcjty.xnet.init.ModBlocks;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
Expand Down Expand Up @@ -150,6 +151,14 @@ public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAc
}

@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
IBlockState mimicBlock = getMimicBlock(worldIn, pos);
if (mimicBlock != null) {
return mimicBlock.getBlockFaceShape(worldIn, pos, face);
}
return super.getBlockFaceShape(worldIn, state, pos, face);
}

@SideOnly(Side.CLIENT)
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
return true; // delegated to FacadeBakedModel#getQuads
Expand Down