Posted August 14, 20223 yr Hey, My entity extends TamableAnimal that finally extends Mob and I am using handItems and armorItems (both are a List of ItemStacks). Everything is working, I can put and remove items from these 'inventories', I can render items above entity head at client side, very well. But now, I don't know how to create a custom gui screen to interact with these inventories. Gui normally requires containers, but I don't have a container here, just list of itemstacks. Can someone help me a little here? Tks †GnR† Slash †GnR† Slash can one man truly make a difference?
August 14, 20223 yr 4 hours ago, GnRSlashSP said: Gui normally requires containers, but I don't have a container here, just list of itemstacks. You can use EntityEquipmentInvWrapper to get an item handler wrapping handItems and armorItems, which you can then use to create the slots in a ContainerMenu.
August 20, 20223 yr Author On 8/14/2022 at 3:49 AM, vemerion said: You can use EntityEquipmentInvWrapper to get an item handler wrapping handItems and armorItems, which you can then use to create the slots in a ContainerMenu. Thank you for this tip. I think I did it right because it is working on single and multiplayer! This is what I did with inventory: I put this inside entity constructor: handsInvWrapper = new EntityHandsInvWrapper(this); So, I created this inside the Container: antItemHandler = antEntity.handsInvWrapper; antItemHandler is a IItemHandler class. thank you again! Edited August 21, 20223 yr by GnRSlashSP I did it! it is working! †GnR† Slash can one man truly make a difference?
August 25, 20223 yr Author Another question: I have these public functions in my custom entity: 1. void setDropItem(boolean value); 2. void setHomePos(); I am implementing this using network messages, but I want to know if messages is the best way or there is another forge functions do deal with these. From gui: a. player can use a checkbox to write on item 1 b. player can use a button to activate item 2 I'll send send a message from gui to the server -> my entity, every time player clicks the button or changes the checkbox. Am I doing it correctly with messages? Thanks †GnR† Slash can one man truly make a difference?
August 25, 20223 yr 1 hour ago, GnRSlashSP said: Am I doing it correctly with messages? Yes, I would say a custom network message is the best way to do this (at least to my knowledge)
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.