use of arekkuusu.solar.api.state.Direction in project Solar by ArekkuusuJerii.
the class BlockQelaion method getExtendedState.
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
Optional<TileQelaion> optional = getTile(TileQelaion.class, world, pos);
if (optional.isPresent()) {
List<EnumFacing> closed = optional.get().getInputs();
Direction direction = Direction.getDirectionFromFacings(closed.toArray(new EnumFacing[closed.size()]));
return ((IExtendedBlockState) state).withProperty(Direction.DIR_UNLISTED, direction);
}
return super.getExtendedState(state, world, pos);
}
use of arekkuusu.solar.api.state.Direction in project Solar by ArekkuusuJerii.
the class BakedQelaion method getQuads.
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, VertexFormat format) {
return cache.compute(state, quads -> {
boolean hasNode = state != null && state.getValue(BlockQelaion.HAS_NODE);
quads.addAll(BlockBaker.QELAION.getQuads());
quads.addAll(QuadBuilder.withFormat(format).setFrom(5, 5, 5).setTo(11, 11, 11).addAll(0, 9, 0, 9, hasNode ? on : off).setHasBrightness(true).bakeJava());
if (state instanceof IExtendedBlockState) {
Direction direction = ((IExtendedBlockState) state).getValue(Direction.DIR_UNLISTED);
if (direction != null && direction != Direction.NON) {
QuadBuilder builder = QuadBuilder.withFormat(format).setFrom(2, 2, 2).setTo(14, 14, 14);
for (EnumFacing facing : direction.getFacings()) builder = builder.addFace(facing, 2, 14, 2, 14, base);
quads.addAll(builder.bakeJava());
}
}
});
}
Aggregations