use of com.simibubi.create.foundation.render.SuperByteBuffer in project Create by Creators-of-Create.
the class CopperBacktankArmorLayer method render.
@Override
public void render(PoseStack ms, MultiBufferSource buffer, int light, LivingEntity entity, float yaw, float pitch, float pt, float p_225628_8_, float p_225628_9_, float p_225628_10_) {
if (entity.getPose() == Pose.SLEEPING)
return;
if (!AllItems.COPPER_BACKTANK.get().isWornBy(entity))
return;
M entityModel = getParentModel();
if (!(entityModel instanceof HumanoidModel))
return;
HumanoidModel<?> model = (HumanoidModel<?>) entityModel;
RenderType renderType = Sheets.cutoutBlockSheet();
BlockState renderedState = AllBlocks.COPPER_BACKTANK.getDefaultState().setValue(CopperBacktankBlock.HORIZONTAL_FACING, Direction.SOUTH);
SuperByteBuffer backtank = CachedBufferer.block(renderedState);
SuperByteBuffer cogs = CachedBufferer.partial(AllBlockPartials.COPPER_BACKTANK_COGS, renderedState);
ms.pushPose();
model.body.translateAndRotate(ms);
ms.translate(-1 / 2f, 10 / 16f, 1f);
ms.scale(1, -1, -1);
backtank.forEntityRender().light(light).renderInto(ms, buffer.getBuffer(renderType));
cogs.centre().rotateY(180).unCentre().translate(0, 6.5f / 16, 11f / 16).rotate(Direction.EAST, AngleHelper.rad(2 * AnimationTickHolder.getRenderTime(entity.level) % 360)).translate(0, -6.5f / 16, -11f / 16);
cogs.forEntityRender().light(light).renderInto(ms, buffer.getBuffer(renderType));
ms.popPose();
}
use of com.simibubi.create.foundation.render.SuperByteBuffer in project Create by Creators-of-Create.
the class BellRenderer method renderSafe.
@Override
protected void renderSafe(TE te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
BlockState state = te.getBlockState();
Direction facing = state.getValue(BellBlock.FACING);
BellAttachType attachment = state.getValue(BellBlock.ATTACHMENT);
SuperByteBuffer bell = CachedBufferer.partial(te.getBellModel(), state);
if (te.isRinging)
bell.rotateCentered(te.ringDirection.getCounterClockWise(), getSwingAngle(te.ringingTicks + partialTicks));
float rY = AngleHelper.horizontalAngle(facing);
if (attachment == BellAttachType.SINGLE_WALL || attachment == BellAttachType.DOUBLE_WALL)
rY += 90;
bell.rotateCentered(Direction.UP, AngleHelper.rad(rY));
bell.light(light).renderInto(ms, buffer.getBuffer(RenderType.cutout()));
}
use of com.simibubi.create.foundation.render.SuperByteBuffer in project Create by Creators-of-Create.
the class WorldSectionElement method renderLayer.
@Override
protected void renderLayer(PonderWorld world, MultiBufferSource buffer, RenderType type, PoseStack ms, float fade, float pt) {
SuperByteBufferCache bufferCache = CreateClient.BUFFER_CACHE;
int code = hashCode() ^ world.hashCode();
Pair<Integer, Integer> key = Pair.of(code, RenderType.chunkBufferLayers().indexOf(type));
if (redraw)
bufferCache.invalidate(DOC_WORLD_SECTION, key);
SuperByteBuffer contraptionBuffer = bufferCache.get(DOC_WORLD_SECTION, key, () -> buildStructureBuffer(world, type));
if (contraptionBuffer.isEmpty())
return;
transformMS(contraptionBuffer.getTransforms(), pt);
int light = lightCoordsFromFade(fade);
contraptionBuffer.light(light).renderInto(ms, buffer.getBuffer(type));
}
use of com.simibubi.create.foundation.render.SuperByteBuffer in project Create by Creators-of-Create.
the class ColoredOverlayTileEntityRenderer method renderSafe.
@Override
protected void renderSafe(T te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
if (Backend.canUseInstancing(te.getLevel()))
return;
SuperByteBuffer render = render(getOverlayBuffer(te), getColor(te, partialTicks), light);
render.renderInto(ms, buffer.getBuffer(RenderType.solid()));
}
use of com.simibubi.create.foundation.render.SuperByteBuffer in project Create by Creators-of-Create.
the class BracketedKineticTileRenderer method renderSafe.
@Override
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
if (Backend.canUseInstancing(te.getLevel()))
return;
if (!AllBlocks.LARGE_COGWHEEL.has(te.getBlockState())) {
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
return;
}
// Large cogs sometimes have to offset their teeth by 11.25 degrees in order to
// mesh properly
Axis axis = getRotationAxisOf(te);
BlockPos pos = te.getBlockPos();
Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE);
renderRotatingBuffer(te, CachedBufferer.partialFacingVertical(AllBlockPartials.SHAFTLESS_LARGE_COGWHEEL, te.getBlockState(), facing), ms, buffer.getBuffer(RenderType.solid()), light);
float offset = getShaftAngleOffset(axis, pos);
float time = AnimationTickHolder.getRenderTime(te.getLevel());
float angle = ((time * te.getSpeed() * 3f / 10 + offset) % 360) / 180 * (float) Math.PI;
SuperByteBuffer shaft = CachedBufferer.partialFacingVertical(AllBlockPartials.COGWHEEL_SHAFT, te.getBlockState(), facing);
kineticRotationTransform(shaft, te, axis, angle, light);
shaft.renderInto(ms, buffer.getBuffer(RenderType.solid()));
}
Aggregations