User Tools

Site Tools


tutorial:inventory

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tutorial:inventory [2021/07/31 21:06] – Changed toTag() and fromTag to writeNbt() and readNbt() jrprogrammertutorial:inventory [2022/01/30 03:38] – Corrected Error in Example Code outercloudstudio
Line 224: Line 224:
             if (!blockEntity.getStack(1).isEmpty()) {             if (!blockEntity.getStack(1).isEmpty()) {
                 // Give the player the stack in the inventory                 // Give the player the stack in the inventory
-                player.inventory.offerOrDrop(world, blockEntity.getStack(1));+                player.getInventory().offerOrDrop(blockEntity.getStack(1));
                 // Remove the stack from the inventory                 // Remove the stack from the inventory
                 blockEntity.removeStack(1);                 blockEntity.removeStack(1);
             } else if (!blockEntity.getStack(0).isEmpty()) {             } else if (!blockEntity.getStack(0).isEmpty()) {
-                player.inventory.offerOrDrop(world, blockEntity.getStack(0));+                player.getInventory().offerOrDrop(blockEntity.getStack(0));
                 blockEntity.removeStack(0);                 blockEntity.removeStack(0);
             }             }
tutorial/inventory.txt · Last modified: 2023/11/06 23:28 by binaris00