use of net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher in project Atum2 by TeamMetallurgy.
the class ItemStackRenderer method renderByItem.
@Override
public void renderByItem(@Nonnull ItemStack stack, @Nonnull ItemTransforms.TransformType transformType, @Nonnull PoseStack matrixStack, @Nonnull MultiBufferSource buffer, int combinedLight, int combinedOverlay) {
Item item = stack.getItem();
BlockEntityRenderDispatcher dispatcher = Minecraft.getInstance().getBlockEntityRenderDispatcher();
;
if (item instanceof BlockItem) {
Block block = ((BlockItem) item).getBlock();
if (block instanceof LimestoneChestBlock) {
dispatcher.renderItem(AtumTileEntities.LIMESTONE_CHEST.get().create(BlockPos.ZERO, AtumBlocks.LIMESTONE_CHEST.get().defaultBlockState()), matrixStack, buffer, combinedLight, combinedOverlay);
} else if (block instanceof SarcophagusBlock) {
dispatcher.renderItem(AtumTileEntities.SARCOPHAGUS.get().create(BlockPos.ZERO, AtumBlocks.SARCOPHAGUS.get().defaultBlockState()), matrixStack, buffer, combinedLight, combinedOverlay);
} else if (block == AtumBlocks.PALM_CURIO_DISPLAY.get()) {
dispatcher.renderItem(AtumTileEntities.PALM_CURIO_DISPLAY.get().create(BlockPos.ZERO, AtumBlocks.PALM_CURIO_DISPLAY.get().defaultBlockState()), matrixStack, buffer, combinedLight, combinedOverlay);
} else if (block == AtumBlocks.DEADWOOD_CURIO_DISPLAY.get()) {
dispatcher.renderItem(AtumTileEntities.DEADWOOD_CURIO_DISPLAY.get().create(BlockPos.ZERO, AtumBlocks.DEADWOOD_CURIO_DISPLAY.get().defaultBlockState()), matrixStack, buffer, combinedLight, combinedOverlay);
} else if (block == AtumBlocks.ACACIA_CURIO_DISPLAY.get()) {
dispatcher.renderItem(AtumTileEntities.ACACIA_CURIO_DISPLAY.get().create(BlockPos.ZERO, AtumBlocks.ACACIA_CURIO_DISPLAY.get().defaultBlockState()), matrixStack, buffer, combinedLight, combinedOverlay);
} else if (block == AtumBlocks.LIMESTONE_CURIO_DISPLAY.get()) {
dispatcher.renderItem(AtumTileEntities.LIMESTONE_CURIO_DISPLAY.get().create(BlockPos.ZERO, AtumBlocks.LIMESTONE_CURIO_DISPLAY.get().defaultBlockState()), matrixStack, buffer, combinedLight, combinedOverlay);
} else if (block == AtumBlocks.ALABASTER_CURIO_DISPLAY.get()) {
dispatcher.renderItem(AtumTileEntities.ALABASTER_CURIO_DISPLAY.get().create(BlockPos.ZERO, AtumBlocks.ALABASTER_CURIO_DISPLAY.get().defaultBlockState()), matrixStack, buffer, combinedLight, combinedOverlay);
} else if (block == AtumBlocks.PORPHYRY_CURIO_DISPLAY.get()) {
dispatcher.renderItem(AtumTileEntities.PORPHYRY_CURIO_DISPLAY.get().create(BlockPos.ZERO, AtumBlocks.PORPHYRY_CURIO_DISPLAY.get().defaultBlockState()), matrixStack, buffer, combinedLight, combinedOverlay);
} else if (block == AtumBlocks.NEBU_CURIO_DISPLAY.get()) {
dispatcher.renderItem(AtumTileEntities.NEBU_CURIO_DISPLAY.get().create(BlockPos.ZERO, AtumBlocks.NEBU_CURIO_DISPLAY.get().defaultBlockState()), matrixStack, buffer, combinedLight, combinedOverlay);
}
} else {
if (item == AtumItems.BRIGAND_SHIELD.get()) {
renderShield(stack, brigandShield, BRIGAND_SHIELD_MATERIAL, matrixStack, buffer, combinedLight, combinedOverlay);
} else if (item == AtumItems.STONEGUARD_SHIELD.get()) {
renderShield(stack, stoneguardShield, STONEGUARD_SHIELD_MATERIAL, matrixStack, buffer, combinedLight, combinedOverlay);
} else if (item == AtumItems.ATEMS_PROTECTION.get()) {
renderShield(stack, atemsProtection, ATEMS_PROTECTION_MATERIAL, matrixStack, buffer, combinedLight, combinedOverlay);
} else /*else if (item == AtumItems.NEPTHYS_CONSECRATION) {
renderShield(stack, NEPTHYS_CONSECRATION, NEPTHYS_CONSECRATION_MATERIAL, matrixStack, buffer, combinedLight, combinedOverlay);
} */
if (item == AtumItems.TEFNUTS_CALL.get()) {
matrixStack.pushPose();
matrixStack.scale(1.0F, -1.0F, -1.0F);
VertexConsumer vertexBuilder = ItemRenderer.getFoilBuffer(buffer, this.tefnutsCall.renderType(TefnutsCallRender.TEFNUTS_CALL_TEXTURE), false, stack.hasFoil());
this.tefnutsCall.renderToBuffer(matrixStack, vertexBuilder, combinedLight, combinedOverlay, 1.0F, 1.0F, 1.0F, 1.0F);
matrixStack.popPose();
}
}
}
use of net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher in project Atum2 by TeamMetallurgy.
the class RenderUtils method drawString.
public static void drawString(BlockEntity te, String str, double xOffset, double yOffset, double zOffset, float scaleModifier, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay) {
BlockEntityRenderDispatcher rendererDispatcher = Minecraft.getInstance().getBlockEntityRenderDispatcher();
Entity entity = rendererDispatcher.camera.getEntity();
BlockPos tePos = te.getBlockPos();
double distance = new Vec3(entity.getX(), entity.getY(), entity.getZ()).distanceToSqr(tePos.getX(), tePos.getY(), tePos.getZ());
if (distance <= (double) (14 * 14)) {
float yaw = rendererDispatcher.camera.getYRot();
float pitch = rendererDispatcher.camera.getXRot();
Font font = rendererDispatcher.font;
matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, zOffset);
matrixStack.mulPose(Vector3f.YP.rotationDegrees(-yaw));
matrixStack.mulPose(Vector3f.XP.rotationDegrees(pitch));
matrixStack.scale(-0.015F + scaleModifier, -0.015F + scaleModifier, 0.015F + scaleModifier);
font.drawInBatch(str, -font.width(str) / 2, 0, 1, false, matrixStack.last().pose(), buffer, false, 0, 0);
matrixStack.popPose();
}
}
Aggregations