[SPIGOT-82]  InventoryType.WORKBENCH doesn't create correct inventory screen Created: 01/Dec/14  Updated: 03/Dec/14  Resolved: 03/Dec/14

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: cindy_k Assignee: Thinkofname
Resolution: Fixed Votes: 1
Labels: Craftbukkit, bug
Environment:

Craftbukkit 1.8



 Description   

i = getServer().createInventory(new UsesHolder(), InventoryType.WORKBENCH);
doesn't work.

http://paste.md-5.net/juxituxejo.java



 Comments   
Comment by Fabian Faßbender [ 01/Dec/14 ]

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/18/overview fixes the showing of all Inventory Types.

One thing to say:
Crafting inventories don't work (they don't craft [you can't take out the result]). The attempt to fix that in the createInventory():

@Override
    public Inventory createInventory(InventoryHolder owner, InventoryType type) {
        switch ( type ) {
            case WORKBENCH:
                CraftInventory craftInventory = null;
                Player player = null;
                if ( owner instanceof Player ) {
                    player = (Player) owner;
                    craftInventory = (CraftInventoryPlayer) player.getInventory();
                }

                if ( craftInventory != null && craftInventory.getInventory() instanceof PlayerInventory ) {
                    ContainerWorkbench workbench = new ContainerWorkbench( (PlayerInventory) craftInventory.getInventory(), ((CraftWorld) player.getWorld()).getHandle(), new BlockPosition( player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ() ) );
                    workbench.checkReachable = false;

                    InventoryCraftResult inventoryCraftResult = new InventoryCraftResult();
                    InventoryCrafting inventoryCrafting = new InventoryCrafting(workbench,3,3,((CraftPlayer)player).getHandle());
                    return new CraftInventoryCrafting(inventoryCrafting, inventoryCraftResult);
                }
        }

        // TODO: Create the appropriate type, rather than Custom?
        return new CraftInventoryCustom(owner, type);
    }

failed. It opens the Inventory and takes items but does not update the Inventory itself.

Generated at Mon Apr 07 21:27:09 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.