Posted October 29, 20196 yr I am trying to make an item that has an inventory, but I need help with opening the GUI. I already have the inventory handler and right-click action in place, but just don't know how the send the right open GUI message. My mods: http://www.curse.com/mc-mods/minecraft/225548-greenscreen http://mods.curse.com/mc-mods/minecraft/238981-cash-craft
October 29, 20196 yr Author How do you use DeferredWorkQueue? I have not encountered that before. I already know how to use openGui in blocks/tile entities, but don't how to use INamedContainerProvider in an item. My mods: http://www.curse.com/mc-mods/minecraft/225548-greenscreen http://mods.curse.com/mc-mods/minecraft/238981-cash-craft
October 30, 20196 yr Author 31 minutes ago, diesieben07 said: 9 hours ago, TehStoneMan said: How do you use DeferredWorkQueue? I have not encountered that before. It has javadocs. Did you read them? You give it a Runnable or Supplier and it will run it on the main game thread and provide you with a CompletableFuture for when it's done. If I understood the javadocs, I wouldn't be asking for help. 32 minutes ago, diesieben07 said: 9 hours ago, TehStoneMan said: I already know how to use openGui in blocks/tile entities, but don't how to use INamedContainerProvider in an item. It's an interface. You implement it. If I knew how to implement it with an item, I wouldn't be asking for help. My mods: http://www.curse.com/mc-mods/minecraft/225548-greenscreen http://mods.curse.com/mc-mods/minecraft/238981-cash-craft
October 30, 20196 yr Author OK, I think I managed to figure out DefferedWorkQueue. Minecraft even seemed to launch faster. Am I correct with this? DeferredWorkQueue.runLater( () -> { ScreenManager.registerFactory( BetterStorageContainerTypes.LOCKER, GuiBetterStorage::new ); ScreenManager.registerFactory( BetterStorageContainerTypes.CRATE, GuiCrate::new ); ScreenManager.registerFactory( BetterStorageContainerTypes.REINFORCED_CHEST, GuiReinforcedChest::new ); ScreenManager.registerFactory( BetterStorageContainerTypes.REINFORCED_LOCKER, GuiReinforcedLocker::new ); ScreenManager.registerFactory( BetterStorageContainerTypes.KEYRING, GuiKeyring::new ); } ); What other startup calls would this be recommended to use this with? As for the item, this is my current guess based on how my tile entities are implemented: public class ItemKeyring extends ItemBetterStorage implements IKey, INamedContainerProvider // <-- Is this the right place? { public ItemKeyring() { super( "keyring", new Item.Properties().group( BetterStorage.ITEM_GROUP ) ); addPropertyOverride( new ResourceLocation( "full" ), ( itemStack, world, entityPlayer ) -> { return 0.0F; } ); } @Override public ActionResult< ItemStack > onItemRightClick( World world, PlayerEntity player, Hand hand ) { final ItemStack stack = player.getHeldItem( hand ); if( !player.isSneaking() ) return new ActionResult( ActionResultType.PASS, stack ); if( !world.isRemote) { NetworkHooks.openGui( (ServerPlayerEntity)player, BetterStorageItems.KEYRING ); // <-- Don't know what to put here } return new ActionResult( ActionResultType.SUCCESS, stack ); } .... } My mods: http://www.curse.com/mc-mods/minecraft/225548-greenscreen http://mods.curse.com/mc-mods/minecraft/238981-cash-craft
October 30, 20196 yr Author That's a static like to the object holder, probably not what is supposed to be there, but not sure what I should be using for this item. My mods: http://www.curse.com/mc-mods/minecraft/225548-greenscreen http://mods.curse.com/mc-mods/minecraft/238981-cash-craft
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.