use of net.minecraft.block.entity.BannerBlockEntity in project Carrier by GabrielOlvH.
the class CarriableBanner method render.
@Override
@Environment(EnvType.CLIENT)
public void render(@NotNull PlayerEntity player, @NotNull CarrierComponent carrier, @NotNull MatrixStack matrices, @NotNull VertexConsumerProvider vcp, float tickDelta, int light) {
BlockState blockState = getParent().getDefaultState();
BannerBlockEntity banner = getEntity();
banner.readNbt(carrier.getCarryingData().getBlockEntityTag());
((AccessorBannerBlockEntity) banner).setBaseColor(((AbstractBannerBlock) blockState.getBlock()).getColor());
matrices.push();
matrices.scale(0.6f, 0.6f, 0.6f);
float yaw = MathHelper.lerpAngleDegrees(tickDelta, player.prevBodyYaw, player.bodyYaw);
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-yaw));
matrices.translate(-0.5, 0.4, -0.05);
MinecraftClient.getInstance().getBlockRenderManager().renderBlockAsEntity(blockState, matrices, vcp, light, OverlayTexture.DEFAULT_UV);
if (MinecraftClient.isFancyGraphicsOrBetter())
getEntityRenderer().render(banner, tickDelta, matrices, vcp, light, OverlayTexture.DEFAULT_UV);
matrices.pop();
}
Aggregations