Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

frankiecav

Members
  • Content Count

    37
  • Joined

  • Last visited

Community Reputation

3 Neutral

About frankiecav

  • Rank
    Tree Puncher

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi forum, I wanted to share something that I think is pretty neat and that you may be wondering how to do. Adjusting the size of items while being held in hand, while not the most important aspect of a mod can be a fun thing to play with, which isn't very complicated, either. Custom size, versus default below: Changing the size is pretty easy. It only has to do with editing the item json file. Below is the json file for the orange sword seen above. Finding the size you want requires testing. By changing the scale, you'll probably
  2. I realize that, but you know what: That constructor is only used for registering the container. The ItemStackHandler doesn't do anything except fill out the super because of the second constructor, the one which I use. That's how I understand it, anyway. Thanks for your help, and everyone on the thread. One more thing, before you leave: If I wanted to make this item switch textures depending on what was in it, any advice? I should be able to tackle this one on my own, but since I have you on the thread...
  3. except... it did. the sheath was able to hold an item and worked as expected.
  4. This works: public ContainerSheath(final int windowID, PlayerInventory player) { this(windowID, player, new ItemStackHandler()); } public ContainerSheath(final int windowID, PlayerInventory player, IItemHandler cap) { super(EssentialContainers.SHEATH, windowID); for(int y = 0; y < 3; ++y) for(int x = 0; x < 9; ++x) this.addSlot(new Slot(player, 9 + x + y * 9, 8 + x * 18, 84 + y * 18)); for(int x = 0; x < 9; ++x) this.addSlot(new Slot(player, x, 8 + x * 18, 142)); this.addSlot(new SlotItemHandler(cap, 0, 50, 50)); } Is there a downside to
  5. But how do I invoke IItemHandler here: public ContainerSheath(final int windowID, PlayerInventory player) { this(windowID, player); } public ContainerSheath(final int windowID, PlayerInventory player, IItemHandler cap) { super(EssentialContainers.SHEATH, windowID); for(int y = 0; y < 3; ++y) for(int x = 0; x < 9; ++x) this.addSlot(new Slot(player, 9 + x + y * 9, 8 + x * 18, 84 + y * 18)); for(int x = 0; x < 9; ++x) this.addSlot(new Slot(player, x, 8 + x * 18, 142)); this.addSlot(new SlotItemHandler(cap, 0, 50, 50)); } in the top constru
  6. Ok loordgek I'll try it. So you're saying that if the itemstack doesn't have the capability it will return null. I set the capability. This makes sense!
  7. Ok. I thought that since in initCapabilities I returned SheathCapability, stack would contain SheathCapability.
  8. I don't see how that helps, I'm trying to pass in an ICapabilityProvider not an IItemHandler. I have ItemStackHandler in the Capability class. Unless I'm totally missing something (definitely possible). I really appreciate everyone's patience. Wait... can I just say: ICapabilityProvider icap = stack; if (icap instanceof SheathCapability) { NetworkHooks.openGui((ServerPlayerEntity) player, new InterfaceSheath((SheathCapability) icap)); } ?? Apparently not, because it didn't work!
  9. Yes, but then how do I get it to return ICapabilityProvider or SheathCapability? public class ItemSheath extends Item { public ItemSheath() { super(new Properties().group(SurvivalEssentials.ESSENTIAL_TAB).maxStackSize(1)); setRegistryName("sheath"); } @Override public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) { PlayerEntity player = context.getPlayer(); if(!context.getWorld().isRemote && player instanceof ServerPlayerEntity) { ICapabilityProvider icap = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null
  10. Ok. Start a new thread, post build.gradle and cmd/ps logs, and the specific problem you’re having ( mine was that the MCP wasn’t installing)
  11. You set it to the file location of your JDK?
  12. Actually forget that... here's what I think has to be fixed: @Override public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) { PlayerEntity player = context.getPlayer(); if(!context.getWorld().isRemote && player instanceof ServerPlayerEntity) { SheathCapability icap = new SheathCapability(); NetworkHooks.openGui((ServerPlayerEntity) player, new InterfaceSheath(icap)); } return ActionResultType.SUCCESS; } The Capability needs to be passed into InterfaceSheath, and I make a new instance of it every time onItemUse is called. Is there
  13. Does anyone know if there's a markDirty method for items? That's what I would put in onSlotChanged if this was a tileentity. public ContainerSheath(final int windowID, PlayerInventory player) { this(windowID, player, new SheathCapability()); } public ContainerSheath(final int windowID, PlayerInventory player, SheathCapability cap) { super(EssentialContainers.SHEATH, windowID); ItemStackHandler inv = cap.getInventory(); for(int y = 0; y < 3; ++y) for(int x = 0; x < 9; ++x) this.addSlot(new Slot(player, 9 + x + y * 9, 8 + x * 18, 84 + y * 18)); for(int x = 0;
  14. CAS thanks for the example; I fixed the NBT crash. Still trying to go with the capability which Draco and Ben have helped me with... by the way, Frost, I have been trying... and it's not all solutions I'm being thrown (except casual), but hints so that I figure it out on my own which I respect. If I wanted to just copy someone's code completely, there are enough githubs online to do so. Anyway, I'm really close. Just need to get a reference to my capability class without creating an instance of it, as Draco pointed out...
  15. Ok I didn't make an instance of it and I made the ItemStackHandler field in the capability class public. this.addSlot(new SlotItemHandler(cap.inventory, 0, 50, 50)); I'm lazy. It crashes the game when I click on it and try to put it in my inventory. ---- Minecraft Crash Report ---- // Don't do that. Time: 8/6/20 1:21 PM Description: mouseClicked event handler java.lang.IllegalArgumentException: Invalid null NBT value with key Parent at net.minecraft.nbt.CompoundNBT.put(CompoundNBT.java:107) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading} at
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.