Jump to content

Jdb100

Members
  • Posts

    223
  • Joined

  • Last visited

Everything posted by Jdb100

  1. http://lmgtfy.com/?q=minecraft+forge+events
  2. Haven't tried this but shouldn't it be == instead of != in your if statement.
  3. MinecraftForge.EVENT_BUS.register(new YourEventHandler()); Put in your post init method.
  4. It doesn't pause the game because it is in a new thread. But it isn't a good way to do it either.
  5. Recently when using a custom timer I made. Whenever I look at it I feel it is way too resource heavy so I was wondering how you guys made your timers? Currently I make a class called timer and an abstract class called TimerEvent which makes an new thread then sleeps for the time set then does the code then removes the thread. However making a new thread every time is very resource heavy.
  6. working code: Block: public boolean placeBook(EntityPlayer entityPlayer, TileEntityDesk tileEntityDesk) { ItemStack book = entityPlayer.getHeldItem(); if(book != null) { Item bookTest = book.getItem(); if(bookTest instanceof ItemBook) { int bookReturn = tileEntityDesk.addBook(book); if(bookReturn == 0) { entityPlayer.inventory.mainInventory[entityPlayer.inventory.currentItem] = null; } if(bookReturn > 0) { book.stackSize = bookReturn; entityPlayer.inventory.mainInventory[entityPlayer.inventory.currentItem] = book; return true; } } } TileEntity: public int addBook(ItemStack book) { if(book != null) { ItemStack deskBook = getStackInSlot(0); if(deskBook == null && book.stackSize == getInventoryStackLimit()) { setInventorySlotContents(0, book); return 0; } if(deskBook == null && book.stackSize > getInventoryStackLimit()) { int bookSize = book.stackSize; book.stackSize -= getInventoryStackLimit(); setInventorySlotContents(0,book); book.stackSize = bookSize; return book.stackSize - getInventoryStackLimit(); } } else { setInventorySlotContents(0, book); return 0; } return -1; }
  7. Your log says that ClientBrandRetreiver was critically damaged. Did you do a base edit to this class? If you didn't, reinstall forge but backup your code in case something happens.
  8. Ok I think that if what you had doesn't work I may have discovered that on my add book method when I check if there are any books currently in the inventory it says no and then sets a book inside aswell as returning 0 so then my place book see that it is returning 0 so it removes the stack. I had it like this because it used to be able to hold 64 books but changed it to hold 1 because I felt 64 unnecessary. However when it was 64 and it had no books inside it, it knew it could hold as many where in the players hand so it didn't need to check how many where in his hand and just simply would always return 0 since the player couldn't hold more than 64.
  9. I'll try this as soon as I can that makes sense even though I thought that ItemStacks always stored there stacksize so I assume you could go book.stackSize--; instead of making a new variable for the stackSize. Anyways thanks for the help i'll see if this works.
  10. 1. Ok 2. It does that already the problem is that if I say have 33 or whatever books in my hand then click the block well it is empty it removes all 33 instead of just 1 and then when I reclick it to remove them it only ejects 1 so it is not returning the excess books to the player.
  11. So recently i have been working on a block in my mod that when clicked with a book will insert that book inside and you can then remove the book with another click. i have been able to add and remove the book as well as add a renderer for it. The problem is though that when i click the block with more then the max number for the inventory it takes all of them but doesn't give back the extra like it is supposed to. Block Code: TileEntity Code: P.S. I know i shouldn't use Language Registry it is just i haven't got around to making a .lang file which has mostly been me being lazy. BaseMod Code(Trimmed):
  12. You need to return your world generator.
  13. Your missing the glyph sizes bin file. Just backup your code then reinstall forge and you should be good.
  14. okay i think i remember hearing that somewhere a while ago so thanks for the help.
  15. i was able to change the id to 4756 by putting the id to 4500 in config so i am assuming i need my items to be over 4096?
  16. i know but the config always sets the id of it to 31743 even if i change it.
  17. Hi guys so i recently got back into modding so i set up a basic mod and started working on my mod. I was able to add a desk with a TESR but when i was trying to make the item to use with the desk i got a problem. So the problem is that what ever i set the id to it always becomes id 31999 when loading the game. I tried changing it in the config class and where you set it for the original config in the code however neither of those would change it. I did nothing different then my desk and it doesn't mention anything in the log. Here is the code for my ids and my config. @EventHandler public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); //Ids deskId = config.getBlock("Desk", 675).getInt(); journalId = config.getItem("Journal",875).getInt(); config.save(); desk = new BlockDesk(deskId); journal = new ItemJournal(journalId); } # Configuration file #################### # block #################### block { I:Desk=675 } #################### # item #################### item { I:Journal=31743 }
  18. There is a tutorial on the wiki here for guiInGame which is what you need.
  19. Here you go it is 1.4.7 but it still works with a few name changes but best one out there. http://www.minecraftforum.net/topic/1412300-147forgeblaueseichoerns-gui-tutorial/
  20. Your chloriside ingot has the same Id as your enriched somonium ingot.
  21. It worked before you had the registers because you never ended up calling that code so it just sat there doing nothing.
  22. Ok so I see multiple problems here first don't extend blockcompoundores in your block file just instead extend block and in your block compound ore don't extend anything. As your not trying to make blockcompoundore a block I assume just a subsection for all your ores. Then you don't need all the blocks you register in the blockcompoundores to be public static blockcompoundores instead do public static block and it should work.
  23. And you saying you couldn't find this on google?
  24. If you google wuppy29 he has quite a few 1.7 tutorials. Also don't worry about bytecode manipulation yet as it will confuse you and you won't need it for a while if you are still working on the basics. Lots of mods don't even use bytecode manipulation at all.
  25. Never modify base classes as it makes your mod incompatible with other mods and 95% of what you need to do can be done without base edits. However on the off chance you actually need to change a base class you should use Asm byte code manipulation which you can find tutorials for just by a google search.
×
×
  • Create New...

Important Information

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