Posted October 19, 20222 yr I have a block that's had an itemStackHandler, it contains 1 item that player inserts and rendering it on block. I have done saving block load nbt data. But when i exiting and loading the world it only stores item on server side but not client. So i need to get data from Server side inventory to Client side invenory, how can i do that? My save/load code -> @Override protected void saveAdditional(CompoundTag nbt) { nbt.put("inventory", itemStackHandler.serializeNBT()); super.saveAdditional(nbt); } @Override public void load(CompoundTag nbt) { // TODO FIX MODEL RENDERING FOR CLIENT SIDE super.load(nbt); itemStackHandler.deserializeNBT(nbt.getCompound("inventory")); } Render code -> @Override public void render(SpecialCauldronBlockEntity entity, float pticks, PoseStack stack, MultiBufferSource buffer, int coverlay, int plight) { final BlockRenderDispatcher block_renderer = this.context.getBlockRenderDispatcher(); // TODO make block save items and render it //ItemStack item = Minecraft.getInstance().player.getMainHandItem(); final ItemRenderer item_renderer = this.context.getItemRenderer(); // Render Item inside if (state.getValue(HorizontalDirectionalBlock.FACING).equals(Direction.EAST) || state.getValue(HorizontalDirectionalBlock.FACING).equals(Direction.WEST)){ stack.pushPose(); stack.translate(0.5d, 0.55d, 0.5d); stack.scale(0.75f, 0.75f, 0.75f); stack.mulPose(Vector3f.YN.rotationDegrees(90)); item_renderer.renderStatic(Minecraft.getInstance().player, entity.itemStackHandler.getStackInSlot(0), ItemTransforms.TransformType.FIXED, false, stack, buffer, Minecraft.getInstance().level, coverlay, plight, plight); stack.popPose(); } else { stack.pushPose(); stack.translate(0.5d, 0.55d, 0.5d); stack.scale(0.75f, 0.75f, 0.75f); item_renderer.renderStatic(Minecraft.getInstance().player, entity.itemStackHandler.getStackInSlot(0), ItemTransforms.TransformType.FIXED, false, stack, buffer, Minecraft.getInstance().level, coverlay, plight, plight); stack.popPose(); }
October 19, 20222 yr https://forums.minecraftforge.net/topic/115679-1182-block-entity-renderer-disappears-after-leaving-the-world/#comment-511734 Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
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.