Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Siqhter

  1. Have you taken a look at the code in your editor for other gen structures? Specifically in net.minecraft.village. This line caught my eye, not sure if it's really what your looking for. Have a look through that class, there should be some loot-generation code along the lines of what you're looking for.
  2. Yes, and this what is called "cargo cult programming". It works for one person, so then other people start copying it without thinking. (And yes, this happens to pretty much every beginner, myself included. It's how you learn. )
  3. You also have a FileNotFound for ruby.json. Are you sure you're directing it to the right path?
  4. This is the slot code used in my custom container class: If I remove the for loop and just make it a single row of 9 slots (like a hotbar) it works fine, I put the items in the hopper, they transfer to the chest, works great. When I create this for loop for another row above the first one, the items transfer from the hopper into the chest, but don't actually appear in the chest. The funny thing is, when I break the container, they do drop the items into the world just fine. I am pretty sure this is not a capabilities issue, because the for loop is the direct result of the mysterious disappearing of said hopper-transfer-items. Thanks.
  5. So then how would I tell the "SlotCrafting" class, (or whichever class responsible) to look for the json?
  6. There's LivingHurtEvent and LivingAttackEvent. This sounds like what you're looking for.
  7. Ok, I was wondering about customization, and hardcoding it didn't seem quite right. Thanks.
  8. In the breakBlock method, loop through the inventory's slots. Create a new EntityItem in the for loop and then call spawnAsEntity. I think InventoryHelper#dropInventoryItems wants an IInventory, which probably won't work in your case. This is somewhat how I did it, and I use ItemStackHandler.
  9. Ok thanks. I have just been told to use an itemstackhandler and not use the vanilla "IInventory". I'll look through the git some more.
  10. Thanks for the response, just to clarify it looks like you're using IInventory? Would it look much different to use IItemStackHandler? I just noticed this in your TileEntity as well as your container. 2nd question is, when you're adding a recipe, are you actually hardcoding that in the recipes java class, or do you then define it in json format?
  11. Basically I'm trying to create a crafting system, where instead of creating a shape and getting a result in the 3x3 table, you open up the custom interface, put the two items in their respective slots and get the output. (e.g., instead of surrounding an apple with gold, put the gold in the first slot, apple in the second, and the result is a golden apple.) I've taken a look at ContainerWorkbench, but what really is the proper way to create a "crafting" slot that looks specifically for two items and provides you with a result? I already have the interface working, gui, tileentity (which I might not need...) etc. Just wondering specifically about the crafting mechanic. Thanks.
  12. instead of item/generated in your item json.
  13. Ok, it didn't change anything. The error I'm getting seems to be directing to readFromNBT, so could it be something different?
  14. Thank you, it is saving now, but I'm a bit confused about this null error: The error in the console does not cause the game to crash. It directs me to the readFromNBT method, so here they are. Could it be that the tileentity is trying to save empty inventory space? "inventory" is my ItemStackHandler.
  15. Ah, that's why. I wasn't sure if I knew why it was working. I didn't realize what overriding these two methods did altogether, now that works as intended. I'm still not able to save the items to the inventory, however.
  16. Yes, I've been looking at capabilities ever since I was told not to use IInventory. However, I'm unclear as to what they really do. I removed the two methods (getCapability and hasCapability) and the gui interface still works. I do use an ItemStackHandler instead of the NonNullList, which is what I think you're talking about?
  17. I wouldn't be even half way where I am (which is obviously still learning a lot of the basics) if it wasn't for being able to view the source code.
  18. Thanks a lot for the detailed response. I'm just going to go through the TileEntityChest class for now and make sure I know what's going on.
  19. So I have an inventory for another TileEntity that extends TileEntityChest, and I also just used the GuiChest and ContainerChest, like you suggested, which is fine. But if I don't want it to act exactly like a chest, I should not extend TileEntityChest right? The !this.checkLootAndWrite method for example, is only accessible from TileEntityLockableLoot, which is what TileEntityChest extends. Is there another way to do it by just extending TileEntity?
  20. Well, I have it working partially. The GUI and Container work fine. (It opens a menu when the block is activated, and I can store items in it.) But it won't save the items when I quit the world, because I really don't understand what should go in read and writeToNBT. The only reason I brought up TileEntityLockableLoot was because I thought that might have something to do with saving the data. I can't seem to find any examples either. Thanks.
  21. I haven't been able to find an answer to this question. I have a custom gui inventory that can store items, but should I be extending TileEntityLockableLoot or TileEntity? How does this necessarily affect using ItemStackHandler. Seen a few examples, and a lot of them vary. Still kind of confused on this. Thanks.
  22. Ok, I didn't think of that. There's also a method called getDisplayName that works in the tileentity. Last question, I don't understand what's going on in your read and write to NBT methods. Mine aren't saving any items after quitting, but that's obvious because there's nothing in them. Not sure if I use set integer?
  • Create New...

Important Information

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