use of com.simibubi.create.foundation.render.SuperByteBuffer in project Create by Creators-of-Create.
the class MechanicalPressRenderer method renderSafe.
@Override
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
if (Backend.canUseInstancing(te.getLevel()))
return;
BlockState blockState = te.getBlockState();
float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks);
SuperByteBuffer headRender = CachedBufferer.partialFacing(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState, blockState.getValue(HORIZONTAL_FACING));
headRender.translate(0, -renderedHeadOffset, 0).light(light).renderInto(ms, buffer.getBuffer(RenderType.solid()));
}
use of com.simibubi.create.foundation.render.SuperByteBuffer in project Create by Creators-of-Create.
the class FlywheelRenderer method renderFlywheel.
private void renderFlywheel(KineticTileEntity te, PoseStack ms, int light, BlockState blockState, float angle, VertexConsumer vb) {
BlockState referenceState = blockState.rotate(Rotation.CLOCKWISE_90);
Direction facing = referenceState.getValue(BlockStateProperties.HORIZONTAL_FACING);
SuperByteBuffer wheel = CachedBufferer.partialFacing(AllBlockPartials.FLYWHEEL, referenceState, facing);
kineticRotationTransform(wheel, te, blockState.getValue(HORIZONTAL_FACING).getAxis(), AngleHelper.rad(angle), light);
wheel.renderInto(ms, vb);
}
use of com.simibubi.create.foundation.render.SuperByteBuffer in project Create by Creators-of-Create.
the class BlazeBurnerRenderer method renderSafe.
@Override
protected void renderSafe(BlazeBurnerTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
HeatLevel heatLevel = te.getHeatLevelFromBlock();
if (heatLevel == HeatLevel.NONE)
return;
float renderTick = AnimationTickHolder.getRenderTime(te.getLevel()) + (te.hashCode() % 13) * 16f;
float offset = (Mth.sin((float) ((renderTick / 16f) % (2 * Math.PI))) + .5f) / 16f;
PartialModel blazeModel = AllBlockPartials.BLAZES.get(heatLevel);
SuperByteBuffer blazeBuffer = CachedBufferer.partial(blazeModel, te.getBlockState());
blazeBuffer.rotateCentered(Direction.UP, AngleHelper.rad(te.headAngle.getValue(partialTicks)));
blazeBuffer.translate(0, offset, 0);
blazeBuffer.light(LightTexture.FULL_BRIGHT).renderInto(ms, buffer.getBuffer(RenderType.solid()));
}
use of com.simibubi.create.foundation.render.SuperByteBuffer in project Create by Creators-of-Create.
the class SpeedControllerRenderer method renderSafe.
@Override
protected void renderSafe(SpeedControllerTileEntity tileEntityIn, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay);
VertexConsumer builder = buffer.getBuffer(RenderType.solid());
if (!Backend.canUseInstancing(tileEntityIn.getLevel())) {
KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms, builder, light);
}
if (!tileEntityIn.hasBracket)
return;
BlockPos pos = tileEntityIn.getBlockPos();
Level world = tileEntityIn.getLevel();
BlockState blockState = tileEntityIn.getBlockState();
boolean alongX = blockState.getValue(SpeedControllerBlock.HORIZONTAL_AXIS) == Axis.X;
SuperByteBuffer bracket = CachedBufferer.partial(AllBlockPartials.SPEED_CONTROLLER_BRACKET, blockState);
bracket.translate(0, 1, 0);
bracket.rotateCentered(Direction.UP, (float) (alongX ? Math.PI : Math.PI / 2));
bracket.light(LevelRenderer.getLightColor(world, pos.above()));
bracket.renderInto(ms, builder);
}
use of com.simibubi.create.foundation.render.SuperByteBuffer in project Create by Creators-of-Create.
the class AnalogLeverRenderer method renderSafe.
@Override
protected void renderSafe(AnalogLeverTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
if (Backend.canUseInstancing(te.getLevel()))
return;
BlockState leverState = te.getBlockState();
float state = te.clientState.get(partialTicks);
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
// Handle
SuperByteBuffer handle = CachedBufferer.partial(AllBlockPartials.ANALOG_LEVER_HANDLE, leverState);
float angle = (float) ((state / 15) * 90 / 180 * Math.PI);
transform(handle, leverState).translate(1 / 2f, 1 / 16f, 1 / 2f).rotate(Direction.EAST, angle).translate(-1 / 2f, -1 / 16f, -1 / 2f);
handle.light(light).renderInto(ms, vb);
// Indicator
int color = Color.mixColors(0x2C0300, 0xCD0000, state / 15f);
SuperByteBuffer indicator = transform(CachedBufferer.partial(AllBlockPartials.ANALOG_LEVER_INDICATOR, leverState), leverState);
indicator.light(light).color(color).renderInto(ms, vb);
}
Aggregations