use of com.infinityraider.agricraft.api.v1.util.AgriSideMetaMatrix in project AgriCraft by AgriCraft.
the class BlockWaterPad method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
AgriSideMetaMatrix connection = new AgriSideMetaMatrix();
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
final IBlockState stateAt = world.getBlockState(pos.offset(facing));
final byte value = (byte) (stateAt.getBlock() == state.getBlock() ? 1 : 0);
connection.set(facing, value);
}
return connection.writeToBlockState(state);
}
use of com.infinityraider.agricraft.api.v1.util.AgriSideMetaMatrix in project AgriCraft by AgriCraft.
the class RenderChannel method renderWoodChannel.
protected void renderWoodChannel(ITessellator tessellator, IBlockState state, TextureAtlasSprite icon) {
final AgriSideMetaMatrix connections = new AgriSideMetaMatrix();
connections.readFromBlockState(state);
this.renderBottom(tessellator, icon);
for (EnumFacing side : EnumFacing.HORIZONTALS) {
this.renderSide(tessellator, state, side, connections.get(side), icon);
}
}
use of com.infinityraider.agricraft.api.v1.util.AgriSideMetaMatrix in project AgriCraft by AgriCraft.
the class RenderChannel method drawWater.
protected void drawWater(ITessellator tessellator, T channel, TextureAtlasSprite icon) {
// Check if there is water to be rendered.
if (channel.getFluidHeight() <= channel.getMinFluidHeight()) {
// There exists no water to be rendered.
return;
}
// Calculate water brightness.
final int l = RenderUtilBase.getMixedBrightness(channel.getWorld(), channel.getPos(), Blocks.WATER);
tessellator.setBrightness(l);
tessellator.setAlpha(0.39f);
// Calculate y to avoid plane rendering conflicts
final float y = (channel.getFluidHeight() * 16 / 1_000f) - 0.001f;
// draw central water levels
tessellator.drawScaledFaceDouble(5, 5, 11, 11, EnumFacing.UP, icon, y);
// Fetch the connections.
final AgriSideMetaMatrix connections = channel.getConnections();
// connect to edges
if (connections.get(EnumFacing.NORTH) > 0) {
tessellator.drawScaledFaceDouble(5, 0, 11, 5, EnumFacing.UP, icon, y);
}
if (connections.get(EnumFacing.EAST) > 0) {
tessellator.drawScaledFaceDouble(11, 5, 16, 11, EnumFacing.UP, icon, y);
}
if (connections.get(EnumFacing.SOUTH) > 0) {
tessellator.drawScaledFaceDouble(5, 11, 11, 16, EnumFacing.UP, icon, y);
}
if (connections.get(EnumFacing.WEST) > 0) {
tessellator.drawScaledFaceDouble(0, 5, 5, 11, EnumFacing.UP, icon, y);
}
}
use of com.infinityraider.agricraft.api.v1.util.AgriSideMetaMatrix 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();
// Draw Base
renderBase(tessellator, matIcon);
// Get Connections.
final AgriSideMetaMatrix connections = new AgriSideMetaMatrix();
connections.readFromBlockState(state);
// Render Sides
for (EnumFacing dir : EnumFacing.HORIZONTALS) {
if (connections.get(dir) < 1) {
renderSide(tessellator, dir, matIcon);
}
}
// Render Water
if (AgriProperties.POWERED.getValue(state)) {
renderWater(tessellator, waterIcon);
}
}
use of com.infinityraider.agricraft.api.v1.util.AgriSideMetaMatrix in project AgriCraft by AgriCraft.
the class RenderTank method renderWorldBlockWoodStatic.
@Override
protected void renderWorldBlockWoodStatic(ITessellator tess, IExtendedBlockState state, BlockWaterTank block, EnumFacing face, TextureAtlasSprite sprite) {
final AgriSideMetaMatrix connections = new AgriSideMetaMatrix();
connections.readFromBlockState(state);
for (EnumFacing side : EnumFacing.HORIZONTALS) {
renderSide(tess, side, connections.get(side), sprite);
}
renderBottom(tess, connections.get(EnumFacing.DOWN), sprite);
}
Aggregations