-
Recently Browsing
No registered users viewing this page.
-
Posts
-
By diesieben07 · Posted
If only the Slot constructor had a way to tell it which inventory to use... Oh, it does. It has an IInventory parameter. Use SlotItemHandler for the IItemHandler variant. Incorrect. The slot modifies whatever inventory you give it. Yes. If it's the horse inventory, then how is the slot supposed to know that it should look anywhere else? -
I do have an ItemStackHandler and it is attached It's actually attached in that same class (it was something I left out because it was irrelevant at the time). @SubscribeEvent public static void attachHorseCapabilities(AttachCapabilitiesEvent<Entity> event) { if (event.getObject() instanceof AbstractHorseEntity) { event.addCapability(new ResourceLocation(MOD_ID, "capability_mycustomslots"), new ThisIsntTheClassNameButYouGetTheIdea()); } } It's implemented correctly, supplies an additional slot index, serializes and deserializes to/from NBT, sure. Here's my confusion. How am I supposed to say "Hey, when you interact with this slot, you should be modifying this capability" because adding a slot reflectively to the horse container modifies what I assume is the horse inventory, correct? Should I be passing that capability somewhere so my slot knows to interact with that capability instead of the default, vanilla inventoryContents supplied by the inventory? I see only the IInventory passed to the Slot but as far as I'm concerned, that should be the horse inventory.
-
By diesieben07 · Posted
Since you said this, I assumed you had already done that... You need a capability attached to horses, which stores an IItemHandler for your additional inventory space. -
Correct, although that was my question to begin with. How am I meant to modify the inventory of an existing entity? I was under the impression that this would be addressed as well, though that mustn't be the case. The way you had described it in your initial reply had made it seem like the slots would have allowed the user to interact with them. Perhaps I misunderstood. I understand I am interacting with the 3rd slot (index 2) and I understand why I'm getting this exception, I'm just unsure how to address it. Overriding one of the existing slot indexes surely isn't an option. I want to maintain the vanilla functionality of a horse. So to rephrase the question in the OP, what would be the correct approach to add a slot to a horse inventory with which a player may interact and place/take items?
-
By diesieben07 · Posted
You can use the various sub-events of GuiScreenEvent to change existing GUIs.
-
-
Topics
-
Who's Online (See full list)