Sq3xd Posted October 19, 2022 Share Posted October 19, 2022 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(); } Quote Link to comment Share on other sites More sharing options...
warjort Posted October 19, 2022 Share Posted October 19, 2022 https://forums.minecraftforge.net/topic/115679-1182-block-entity-renderer-disappears-after-leaving-the-world/#comment-511734 Quote 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. Link to comment Share on other sites More sharing options...
Sq3xd Posted October 19, 2022 Author Share Posted October 19, 2022 Thank you so much, it's now working! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.