Guest User

TileEntityRenderer

a guest
Aug 14th, 2020
37
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @OnlyIn(Dist.CLIENT)
  2. public class PurpleCampfireTileEntityRenderer  extends TileEntityRenderer<PurpleCampfireTileEntity> {
  3.     public PurpleCampfireTileEntityRenderer(TileEntityRendererDispatcher p_i226007_1_) {
  4.         super(p_i226007_1_);
  5.     }
  6.  
  7.     public void render(PurpleCampfireTileEntity tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
  8.         Direction direction = tileEntityIn.getBlockState().get(PurpleCampfire.FACING);
  9.         NonNullList<ItemStack> nonnulllist = tileEntityIn.getInventory();
  10.  
  11.         for(int i = 0; i < nonnulllist.size(); ++i) {
  12.             ItemStack itemstack = nonnulllist.get(i);
  13.             if (itemstack != ItemStack.EMPTY) {
  14.                 matrixStackIn.push();
  15.                 matrixStackIn.translate(0.5D, 0.44921875D, 0.5D);
  16.                 Direction direction1 = Direction.byHorizontalIndex((i + direction.getHorizontalIndex()) % 4);
  17.                 float f = -direction1.getHorizontalAngle();
  18.                 matrixStackIn.rotate(Vector3f.YP.rotationDegrees(f));
  19.                 matrixStackIn.rotate(Vector3f.XP.rotationDegrees(90.0F));
  20.                 matrixStackIn.translate(-0.3125D, -0.3125D, 0.0D);
  21.                 matrixStackIn.scale(0.375F, 0.375F, 0.375F);
  22.                 Minecraft.getInstance().getItemRenderer().renderItem(itemstack, ItemCameraTransforms.TransformType.FIXED, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn);
  23.                 matrixStackIn.pop();
  24.             }
  25.         }
  26.     }
  27. }
RAW Paste Data