Posted March 20, 20223 yr I'm making a wallpaper mod and I want to change the side of a block by rendering needed block with a little offset. To do this, I save the blockstate of the wanted blocks for each side and in the render() function I read blockstate from nbt and try to render these blockstates for the each side. Blocks are not rendered. Obviously I'm missing something but I can't figure out what. @Override public void render(TileEntity tileEntity, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) { CompoundNBT compoundNBT = tileEntity.getTileData(); BlockState camoStateUp = NBTUtil.readBlockState(compoundNBT.getCompound("camo_state_up")); BlockState camoStateDown = NBTUtil.readBlockState(compoundNBT.getCompound("camo_state_down")); BlockState camoStateNorth = NBTUtil.readBlockState(compoundNBT.getCompound("camo_state_north")); BlockState camoStateSouth = NBTUtil.readBlockState(compoundNBT.getCompound("camo_state_south")); BlockState camoStateEast = NBTUtil.readBlockState(compoundNBT.getCompound("camo_state_east")); BlockState camoStateWest = NBTUtil.readBlockState(compoundNBT.getCompound("camo_state_west")); matrixStack.pushPose(); if (camoStateUp != Blocks.AIR.defaultBlockState()) { matrixStack.translate(0, 0.1, 0); mc().getBlockRenderer().renderBlock(camoStateUp, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay, EmptyModelData.INSTANCE); } if (camoStateDown != Blocks.AIR.defaultBlockState()) { matrixStack.translate(0, -0.2, 0); mc().getBlockRenderer().renderBlock(camoStateDown, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay, EmptyModelData.INSTANCE); matrixStack.translate(0, 0.2, 0); } if (camoStateNorth != Blocks.AIR.defaultBlockState()) { matrixStack.translate(0, 0, -0.1); mc().getBlockRenderer().renderBlock(camoStateNorth, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay, EmptyModelData.INSTANCE); } if (camoStateSouth != Blocks.AIR.defaultBlockState()) { matrixStack.translate(0, 0, 0.2); mc().getBlockRenderer().renderBlock(camoStateSouth, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay, EmptyModelData.INSTANCE); matrixStack.translate(0, -0.1, -0.2); } if (camoStateEast != Blocks.AIR.defaultBlockState()) { matrixStack.translate(0.1, 0, 0); mc().getBlockRenderer().renderBlock(camoStateEast, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay, EmptyModelData.INSTANCE); } if (camoStateWest != Blocks.AIR.defaultBlockState()) { matrixStack.translate(-0.2, 0, 0); mc().getBlockRenderer().renderBlock(camoStateWest, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay, EmptyModelData.INSTANCE); } matrixStack.popPose(); }
March 20, 20223 yr Author 3 hours ago, diesieben07 said: Do not use getTileData for your own tile entities. Simply store the data in your TileEntity normally. Note also that you will need to sync the block states to the client for them to be available there. Thanks, it worked. Now I would like to know how can I disable rendering of specific sides for these blockstates.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.