use of net.minecraftforge.common.property.IExtendedBlockState in project XNet by McJty.
the class FacadeBakedModel method getQuads.
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
FacadeBlockId facadeId = extendedBlockState.getValue(GenericCableBlock.FACADEID);
if (facadeId == null) {
return Collections.emptyList();
}
IBlockState facadeState = facadeId.getBlockState();
if (!facadeState.getBlock().canRenderInLayer(facadeState, MinecraftForgeClient.getRenderLayer())) {
return Collections.emptyList();
}
IBakedModel model = getModel(facadeState);
try {
return model.getQuads(state, side, rand);
} catch (Exception e) {
return Collections.emptyList();
}
}
use of net.minecraftforge.common.property.IExtendedBlockState in project Random-Things by lumien231.
the class BlockFluidDisplay method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileEntityFluidDisplay te = (TileEntityFluidDisplay) worldIn.getTileEntity(pos);
IExtendedBlockState actualState = (IExtendedBlockState) state;
if (te == null) {
return actualState.withProperty(FLUID, null).withProperty(FLOWING, false);
}
return actualState.withProperty(FLUID, te.getFluidStack()).withProperty(FLOWING, te.flowing()).withProperty(ROTATION, te.getRotation());
}
use of net.minecraftforge.common.property.IExtendedBlockState in project Random-Things by lumien231.
the class BlockCustomWorkbench method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileEntityCustomWorkbench te = (TileEntityCustomWorkbench) worldIn.getTileEntity(pos);
IExtendedBlockState actualState = (IExtendedBlockState) state;
if (te != null && te.getWoodState() != null) {
return actualState.withProperty(WOOD_STATE, te.getWoodState());
} else {
return actualState.withProperty(WOOD_STATE, Blocks.PLANKS.getDefaultState());
}
}
use of net.minecraftforge.common.property.IExtendedBlockState in project Random-Things by lumien231.
the class BlockRuneBase method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileEntityRuneBase te = (TileEntityRuneBase) worldIn.getTileEntity(pos);
IExtendedBlockState actualState = (IExtendedBlockState) state;
if (te != null) {
boolean[] connectionData = new boolean[16];
int[][] runeData = te.getRuneData();
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
BlockPos mod = pos.offset(facing);
TileEntity otherTE = worldIn.getTileEntity(mod);
if (otherTE instanceof TileEntityRuneBase) {
TileEntityRuneBase otherRune = (TileEntityRuneBase) otherTE;
int[][] otherRuneData = otherRune.getRuneData();
for (int i = 0; i < 4; i++) {
if (facing == EnumFacing.NORTH) {
connectionData[i] = runeData[i][0] == otherRuneData[i][3];
} else if (facing == EnumFacing.EAST) {
connectionData[i + 4] = runeData[3][i] == otherRuneData[0][i];
} else if (facing == EnumFacing.SOUTH) {
connectionData[i + 8] = runeData[i][3] == otherRuneData[i][0];
} else if (facing == EnumFacing.WEST) {
connectionData[i + 12] = runeData[0][i] == otherRuneData[3][i];
}
}
}
}
return actualState.withProperty(RUNE_DATA, runeData).withProperty(CONNECTION_DATA, connectionData);
} else {
return actualState.withProperty(RUNE_DATA, new int[4][4]);
}
}
use of net.minecraftforge.common.property.IExtendedBlockState in project Random-Things by lumien231.
the class BlockInventoryRerouter method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileEntity te = worldIn.getTileEntity(pos);
IExtendedBlockState extendedState = (IExtendedBlockState) state;
if (te instanceof TileEntityInventoryRerouter) {
TileEntityInventoryRerouter rerouter = (TileEntityInventoryRerouter) te;
Map<EnumFacing, EnumFacing> facingMap = rerouter.getFacingMap();
return extendedState.withProperty(OVERRIDE_DATA, new HashMap<>(facingMap));
}
return super.getActualState(state, worldIn, pos);
}
Aggregations