Jump to content

EscapeMC

Forge Modder
  • Posts

    337
  • Joined

  • Last visited

Everything posted by EscapeMC

  1. You can't read my mind...? I was thinking to use .getPosition thank you very much. What do I need to do then if that is not the right solution?
  2. Well, as much as I did want to figure out myself, thank you for supplying my with this! I was actually just thinking about putting playerIn.getPos().get_ and I'm glad I was thinking along the right path!
  3. Not too sure to be honest.. just playerIn.openGui asks for an x, y, and z.
  4. pos cannot be resolved If I add a BlockPos pos variable in the () for onItemRightClick, it tells me to remove @Override
  5. Ya sorry, that was confusing. Like this: @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { return onItemRightClick(playerIn.openGui(Main.instance, GuiHandler.TEST_BAG, worldIn, pos.getX(), pos.getY(), pos.getZ())); } How do I recreate this to open my gui on right click?
  6. Wait,if that was correct, then what do I put as the things that playerIn.openGui(Main.instance, GuiHandler.TEST_BAG, worldIn, pos.getX(), pos.getY(), pos.getZ()); goes in to?
  7. The parameters are given to you right there in the method. Regardless, you shouldn't be calling super at all, because you are overriding the method to do your own thing. Put your code to bring up the GUI back in the method now that it's overriding correctly. Then what do I call? I am so confused... EDIT: Do I just remove "super."?
  8. That means that your rightclick method does not match the one in the super class. You need to fix that. (Hint: yours doesn't have an ItemStack parameter!) Ok, so I went with what diesieben07 said and didn't write it, but rather let Eclipse to do work. I so far have @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { return super.onItemRightClick(Main.instance, GuiHandler.TEST_BAG, playerIn, hand); } But I get "The method onItemRightClick(ItemStack, World, EntityPlayer, EnumHand) in the type Item is not applicable for the arguments (Main, int, EntityPlayer, EnumHand)" What do I need to change to fix this? EDIT: I know I also need to change that Main.instance, and GuiHandler.TEST_BAG, but to what? What (and how) ItemStack do I use?
  9. I realize I didn't use @Override... When I add @Override I get an error. The method onItemRightClick(World, BlockPos, IBlockState, EntityPlayer, EnumHand, ItemStack, EnumFacing, float, float, float) of type test_bag must override or implement a supertype method My code for test_bag: package com.github.escapemc.thingsmod.items; import javax.annotation.Nullable; import com.github.escapemc.thingsmod.Main; import com.github.escapemc.thingsmod.Reference; import com.github.escapemc.thingsmod.handlers.GuiHandler; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; public class test_bag extends Item { public test_bag() { setUnlocalizedName(Reference.ModItems.TEST_BAG.getUnlocalizedName()); setRegistryName(Reference.ModItems.TEST_BAG.getRegistryName()); } @Override public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) { return new TestBagCapabilities(); } @Override public boolean onItemRightClick(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { playerIn.openGui(Main.instance, GuiHandler.TEST_BAG, worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; } } You can also go to my github https://github.com/EscapeMC/ThingsMod-1.10.2/tree/master/src/main/java/com/github/escapemc/thingsmod
  10. I load up the game, get my item. And right click it. *heart beats faster* Nothing happens. Also, do note nothing happens in the log either. In case you want it,
  11. If there is no TE, why do you have a TE here? https://github.com/EscapeMC/ThingsMod-1.10.2/blob/master/src/main/java/com/github/escapemc/thingsmod/client/gui/GuiTestBag.java#L17 Alright, I didn't notice I added that. Whoops (copy pasta look over... sry) So I got rid of all the TE stuff, but in my GuiHandler I still get an error asking me to add an argument for a tileentity. I removed all the tile entity stuff within this Gui, Container, and Item. Can you look through the stuff and tell me what I am missing? I get an error The method getCapability(Capability<T>, EnumFacing) in the type TestBagCapabilities is not applicable for the arguments (Capability<IItemHandler>) in my Container at line 17
  12. You do fucking nothing with it. The method call already exists. You do NOTHING to make that happen. When the player right clicks, then that method will run. You're done. That's it. Well you aren't using a TE in your gui, so don't get the TE from the world, don't pass the TE to the gui, do nothing with TEs. I figured out what I needed to do to open the Gui. And for the GuiHandler, do I just use return new ContainerTestBag(player.inventory, null); (null because there is no TE?) EDIT: That for the server portion, this return new GuiTestBag(new ContainerTestBag(player.inventory, null); for the client side?
  13. Ok, so in the GuiHandler, what do I need to put because it is not a TE?
  14. Alright so how would I use it to open my Gui? https://github.com/EscapeMC/ThingsMod-1.10.2/blob/master/src/main/java/com/github/escapemc/thingsmod/items/test_bag.java#L35 ? And then can you look at the capabilities and make sure I've got it right?
  15. I am trying to pull up a Gui (already set up, just once problem with the GuiHandler)
  16. OK, so thi: @Override public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) { return new TestBagCapabilities(); } Lastly: this.onItemRightClick(itemStackIn, worldIn, playerIn, hand) What do I need to put in each of the slots? (itemStackIn, worldIn, playerIn, hand) Please, don't just say itemStackIn, worldIn, playerIn, and hand. I am not sure what exactly these mean in this case
  17. Ok, so do NBTTagCompound NBTBase = ____ (what); in that serializeNBT. Wait so then what do I need to do? I know its not as simple as adding @Override...
  18. Alright, so I do that, but it says I then need to add unimplemented methods, and that method is the same thing. serialize nbt. I added @Override, but it then says remove it. I updated github: https://github.com/EscapeMC/ThingsMod-1.10.2 Remove the parameter in serializeNBT and create a local field of NBTBase and use that one and set it equal to a new NBTTagCompound. Ok, it took some figuring out, (and some sleep) but I think I've got the NBT part of this: https://github.com/EscapeMC/ThingsMod-1.10.2/blob/master/src/main/java/com/github/escapemc/thingsmod/items/TestBagCapabilities.java#L35 Then also, on that link, look up slightly. Would that be correct for both the hasCapability and getCapability? getCapability and hasCapability are indeed correct, but your serializeNBT is not you need a local field not a global field for your NBTBase. I click create local field and that is what it gives me. Ok, also, 1) What do I put in the initCapabilities of my test_bag? 2) What do I need to put in the GuiHandler for getServerGuiElement and getClientGuiElement? I have done this before with my chest, but it was a tileentity. 3) What (event?) do I need to do for onItemRightClick ( this.onItemRightClick(itemStackIn, worldIn, playerIn, hand)) to bring up the gui?
  19. Alright, so I do that, but it says I then need to add unimplemented methods, and that method is the same thing. serialize nbt. I added @Override, but it then says remove it. I updated github: https://github.com/EscapeMC/ThingsMod-1.10.2 Remove the parameter in serializeNBT and create a local field of NBTBase and use that one and set it equal to a new NBTTagCompound. Ok, it took some figuring out, (and some sleep) but I think I've got the NBT part of this: https://github.com/EscapeMC/ThingsMod-1.10.2/blob/master/src/main/java/com/github/escapemc/thingsmod/items/TestBagCapabilities.java#L35 Then also, on that link, look up slightly. Would that be correct for both the hasCapability and getCapability?
  20. Alright, so I do that, but it says I then need to add unimplemented methods, and that method is the same thing. serialize nbt. I added @Override, but it then says remove it. I updated github: https://github.com/EscapeMC/ThingsMod-1.10.2
  21. Says I need a return statement... What should it be? Null? public NBTBase serializeNBT(NBTBase nbt) { ((NBTTagCompound)nbt).setTag("inputSlot", inputSlot.serializeNBT()); } @Override public void deserializeNBT(NBTBase nbt) { inputSlot.deserializeNBT(((NBTTagCompound) nbt).getCompoundTag("inputSlot")); } That's the whole right now.
  22. No your serialize needs to write to the NBTBase not read from it. So just public void serializeNBT(NBTBase nbt) { inputSlot.serializeNBT(); } ?
  23. Ok, so I've updated my github once more. Did I get the read and write stuff correct?
  24. Alright, so I've done that. Should I also move inputSlot = new ItemStackHandler(18); to ItemBagCapabilities? And then, what do I do with the 4 methods in IBC? (ItemBagCapabilities)
  25. GitHub: https://github.com/EscapeMC/ThingsMod-1.10.2/tree/master/src/main sorry i totally forgot about code
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.