use of net.minecraftforge.common.property.IExtendedBlockState in project Charset by CharsetMC.
the class BlockScaffold method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileScaffold scaffold = (TileScaffold) world.getTileEntity(pos);
IExtendedBlockState extendedBS = (IExtendedBlockState) super.getExtendedState(state, world, pos);
if (scaffold != null) {
return extendedBS.withProperty(TileScaffold.PROPERTY, ScaffoldCacheInfo.from(scaffold));
} else {
return extendedBS;
}
}
use of net.minecraftforge.common.property.IExtendedBlockState in project Charset by CharsetMC.
the class BlockShelf method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileShelf bookshelf = (TileShelf) world.getTileEntity(pos);
IExtendedBlockState extendedBS = (IExtendedBlockState) super.getExtendedState(state, world, pos);
if (bookshelf != null) {
return extendedBS.withProperty(TileShelf.PROPERTY, ShelfCacheInfo.from(extendedBS, bookshelf));
} else {
return extendedBS;
}
}
use of net.minecraftforge.common.property.IExtendedBlockState in project Charset by CharsetMC.
the class BlockBarrel method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileEntityDayBarrel barrel = (TileEntityDayBarrel) world.getTileEntity(pos);
IExtendedBlockState extendedBS = (IExtendedBlockState) super.getExtendedState(state, world, pos);
if (barrel != null) {
return extendedBS.withProperty(BARREL_INFO, BarrelCacheInfo.from(barrel));
} else {
return extendedBS;
}
}
use of net.minecraftforge.common.property.IExtendedBlockState in project Galacticraft by micdoodle8.
the class BlockFluidGC method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState oldState, IBlockAccess world, BlockPos pos) {
IExtendedBlockState state = (IExtendedBlockState) oldState;
state = state.withProperty(FLOW_DIRECTION, (float) getFlowDirection(world, pos));
IBlockState[][] upBlockState = new IBlockState[3][3];
float[][] height = new float[3][3];
float[][] corner = new float[2][2];
upBlockState[1][1] = world.getBlockState(pos.down(this.densityDir));
height[1][1] = this.getFluidHeightForRender(world, pos, upBlockState[1][1]);
if (height[1][1] == 1) {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
corner[i][j] = 1;
}
}
} else {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (i != 1 || j != 1) {
upBlockState[i][j] = world.getBlockState(pos.add(i - 1, 0, j - 1).down(this.densityDir));
height[i][j] = this.getFluidHeightForRender(world, pos.add(i - 1, 0, j - 1), upBlockState[i][j]);
}
}
}
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
corner[i][j] = this.getFluidHeightAverage(height[i][j], height[i][j + 1], height[i + 1][j], height[i + 1][j + 1]);
}
}
// check for downflow above corners
boolean n = this.isFluid(upBlockState[0][1]);
boolean s = this.isFluid(upBlockState[2][1]);
boolean w = this.isFluid(upBlockState[1][0]);
boolean e = this.isFluid(upBlockState[1][2]);
boolean nw = this.isFluid(upBlockState[0][0]);
boolean ne = this.isFluid(upBlockState[0][2]);
boolean sw = this.isFluid(upBlockState[2][0]);
boolean se = this.isFluid(upBlockState[2][2]);
if (nw || n || w) {
corner[0][0] = 1;
}
if (ne || n || e) {
corner[0][1] = 1;
}
if (sw || s || w) {
corner[1][0] = 1;
}
if (se || s || e) {
corner[1][1] = 1;
}
}
state = state.withProperty(LEVEL_CORNERS[0], corner[0][0]);
state = state.withProperty(LEVEL_CORNERS[1], corner[0][1]);
state = state.withProperty(LEVEL_CORNERS[2], corner[1][1]);
state = state.withProperty(LEVEL_CORNERS[3], corner[1][0]);
return state;
}
use of net.minecraftforge.common.property.IExtendedBlockState in project BuildCraft by BuildCraft.
the class BlockGenericPipe method getExtendedState.
// Client side extended state rendering
@Override
public IExtendedBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
IExtendedBlockState extended = (IExtendedBlockState) super.getActualState(state, world, pos);
TileEntity tile = world.getTileEntity(pos);
if (tile == null || !(tile instanceof TileGenericPipe)) {
return extended;
}
TileGenericPipe pipe = (TileGenericPipe) tile;
extended = extended.withProperty(PIPE_CORE_STATE.asUnlistedProperty(), pipe.coreState);
extended = extended.withProperty(PIPE_RENDER_STATE.asUnlistedProperty(), pipe.renderState);
extended = extended.withProperty(PIPE_PLUGGABLE_STATE.asUnlistedProperty(), pipe.pluggableState);
extended = extended.withProperty(PIPE_PIPE.asUnlistedProperty(), pipe.pipe);
return extended;
}
Aggregations