use of com.infinityraider.infinitylib.block.blockstate.SidedConnection in project AgriCraft by AgriCraft.
the class BlockWaterPad method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
SidedConnection connection = new SidedConnection();
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
IBlockState stateAt = world.getBlockState(pos.offset(facing));
connection.setConnected(facing, stateAt.getBlock() == state.getBlock());
}
return ((IExtendedBlockState) state).withProperty(AgriProperties.CONNECTIONS, connection);
}
use of com.infinityraider.infinitylib.block.blockstate.SidedConnection in project AgriCraft by AgriCraft.
the class RenderWaterPad method renderWorldBlockStatic.
@Override
public void renderWorldBlockStatic(ITessellator tessellator, IBlockState state, BlockWaterPad block, EnumFacing side) {
// Icon
final TextureAtlasSprite matIcon = BaseIcons.DIRT.getIcon();
final TextureAtlasSprite waterIcon = BaseIcons.WATER_STILL.getIcon();
// Check Full
SidedConnection connection = state instanceof IExtendedBlockState ? ((IExtendedBlockState) state).getValue(AgriProperties.CONNECTIONS) : DEFAULT;
// Draw Base
renderBase(tessellator, matIcon);
// Render Sides
for (EnumFacing dir : EnumFacing.HORIZONTALS) {
if (!connection.isConnected(dir)) {
renderSide(tessellator, dir, matIcon);
}
}
// Render Water
if (AgriProperties.POWERED.getValue(state)) {
renderWater(tessellator, waterIcon);
}
}
Aggregations