-
Posts
884 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Jay Avery
-
Seeking a tutorial on rendering entities for 1.9+
Jay Avery replied to Jay Avery's topic in Modder Support
Ah thanks, I should have mentioned that I'm really not good with videos so I have a strong preference for a written tutorial - but I will give that one a try. -
I'm trying to create a custom throwable entity, but all the guides I can find are for 1.7 or 1.8 - and a lot of stuff seems to have changed. Can anyone recommend a 1.9 or 1.10 tutorial on making/rendering/registering entities?
-
[SOLVED] TileEntity inventory lost on world save/load
Jay Avery replied to Jay Avery's topic in Modder Support
Oh my goodness, that is such an embarrassing mistake to make and not notice. Thank you for pointing it out. The inventory is now correctly saving and loading with the world. (The getUpdateTag(...) was just an experiment from another post I found about a similar problem so I added it without fully understanding, but luckily it turns out it's not needed at all anyway). -
[SOLVED] TileEntity inventory lost on world save/load
Jay Avery replied to Jay Avery's topic in Modder Support
Hmm maybe you missed the thingymabober in the whoseitwhatsit that caused the dohicky to become flabbergasted. How are we supposed to know if you don't show what you have? Like I said, I am happy to post my code but there are lots of files and I wondered if there might be a common or obvious solution without the hassle of reading through everything. At this point I'm going to have to post 5+ classes worth of code because I have no ideas about what is causing the problem. My custom furnace is one of several types subclassed from an abstract class so that's where a lot of the action happens. The abstract class: The subclass: The same for the blocks, abstract class: Subclass: The Containers if you need to see those - abstract class: Subclass: I also have the TileEntities registered in init in my common proxy, the blocks registered in preinit, and a GUI handler to set up the containers. I can post all of that if you really want but I'll stop here for now. -
I'm creating a TileEntity which functions like a furnace. It now works in the game, and the inventory and cook time stay and keep working when the GUI is opened and closed. But when I save and exit the game while something is in the inventory, it's lost when the world is reloaded. From using printlns it looks like the inventory is being written to NBT correctly, but when the game is loaded a new TileEntity is created instead of loading it from NBT like it should. How can I make sure the game loads the existing TileEntity instead of creating a new one each time the world is loaded? I can post my code if needed but there's a lot of it so I thought I'd ask for general suggestions first and see if there's anything obvious I might have missed. Edit: Solved. I made a really silly error, I had just mixed up the names of my NBT tags so they weren't the same in the read and write methods.
-
[SOLVED] Change which blocks can be harvested with bare hands
Jay Avery replied to Jay Avery's topic in Modder Support
Thanks, yeah that's what I went with in the end and I've got it working successfully now. -
[SOLVED] Change which blocks can be harvested with bare hands
Jay Avery replied to Jay Avery's topic in Modder Support
I tried this but it doesn't work. When I searched for it, I found this old thread which points out that HarvestCheck is not fired when trying to harvest something that can normally be harvested with bare hands. -
I did some searching and all I found was this thread which is 3 years old. I want to edit the set of blocks which can be harvested without holding a tool. For example, I want the player to be unable to harvest dirt blocks without a shovel. Is this possible to do? If so, does the method in the thread I linked to still work or is there a different way to do it? Is it possible to make a block breakable but not harvestable (like breaking stone with bare hands in vanilla) - or is it only possible to make a block unbreakable by hand? Edit: Solved by using PlayerEvent.BreakSpeed to change how long it takes to break the block and HarvestDropsEvent to remove the drops for blocks which I want to be un-harvestable.
-
SlotCrafting::onPickupFromSlot Ahhh, I found the source of the problem inside this method! It refers to the vanilla CraftingManager when checking the recipe. So I made a custom SlotCrafting which overrides that method and uses whichever custom CraftingManager applies for the container, and that's solved it. Thank you for the help, even though you just pointed me to the right place! I've been stuck for days.
-
I'm trying to make a mod where there are lots of different crafting blocks (different types of crafting table), which each have their own set of recipes. So I made a custom ModCraftingManager class which is a pretty much direct copy of the vanilla CraftingManager (since I can't create multiple instances of that). That allowed me to add different sets of recipes to the different crafting blocks and it almost works... except that, when I click on the output slot to pick up the crafted item, the stacks in the crafting grid don't decrease in size by 1 - instead they double in size. I have combed through the vanilla code and I just can't seem to find the actual place that tells the crafting grid item stacks to decrease by 1 when the output slot is clicked - I thought finding it might help me figure out the problem. But anyway, I don't understand how my custom crafting managers can be bugged even when I literally copy the methods from the vanilla class. Can anyone advise me on: Where in the vanilla code is the instruction for the crafting grid slots to decrease in size when the output is picked up? How can an almost exact copy of the vanilla code function differently to the vanilla version itself? How can I create working custom crafting managers? Or even, is there a better way to give a specific set of recipes to specific crafting blocks other than using individual crafting managers for each? Edit: Solved! In SlotCrafting.onPickupFromSlot , it refers to the vanilla CraftingManager to check the recipe to reduce the input stack sizes. So I created a subclass of SlotCrafting and overrode that method to make it refer to whichever custom CraftingManager applies to the container it's in, and now custom crafting is working correctly.
-
[SOLVED] Multiblock structure and neighborChanged
Jay Avery replied to Jay Avery's topic in Modder Support
Ahh, thank you! I was thinking that I needed every block in the structure to check every other block, but I see now that I can just have them trigger each others' checks in a chain. This means that I actually don't need to set the third parameter in the setBlockState method, right? -
I'm making a multiblock structure - an item which, when placed, places a set of three blocks in a particular layout. When any one of those blocks is broken, all of the others are removed too. I've made the neighborChanged method so that it checks the expected positions of the other blocks in the structure, and then removes the block if they aren't there. I've also made the onItemUse method to place all three blocks when the item is clicked. But when I actually use the item in the game, the structure doesn't get placed. Because on each setBlockState call, the game checks for neighborChanged and finds the the other blocks aren't there yet. I've looked through the code for vanilla beds and I can't figure out how this problem is suppressed there. I could add a whole other block property to keep track of whether the structure is 'being built' or not, and only update it if it's false - but that seems excessive. Is there any other way to tell the game not to check neighborChanged until all the blocks of the structure have been placed via onItemUse? Edit: I think I've solved it! Needed to add the third parameter to the setBlockState method, the flags which define whether the block updates the neighbours. I don't understand bitwise flags very well, but with some trial and error it seems that '2' is making it work as expected. Solved with Choonster's advice in post #2.
-
Override crafting manager for player inventory
Jay Avery replied to Jay Avery's topic in Modder Support
I'm not sure why I didn't realise that was exactly what I needed. Thank you! -
I want to make a mod that drastically changes the recipes available, as well as restricting certain recipes to certain custom crafting blocks. I've figured out how to use a custom crafting manager for my new crafting blocks, but I don't know how to do this for the player inventory, because I can't edit the ContainerPlayer class directly. Is there a way for me to override the usual call to CraftingManager in the player inventory, and instead call my own custom crafting manager class? Do I need to override the whole player inventory class and edit the part I need? Or is there no way to do it except to manually add/remove recipes from the CraftingManager itself?
-
That page doesn't have any mention of a folder with the modid name, which is what I've been using. Am I missing something? This is a screenshot of my folder structure: https://s31.postimg.org/j88x0156z/Screenshot_000113.png[/img] The Forge folder is where gradlew.bat is, where I ran the setupDecompWorkspace command to set up forge. The eclipse folder is where my eclipse workspace is. "jj" is my author name and "test2" is my modid. Should the lang, models, and textures folders be directly inside the resources folder - instead of inside the modid folder? Surely that would allow interference between mods?
-
I made the foolish mistake of rearranging some folders, and somehow killed my forge workspace, so I ended up reinstalling forge to sort it out. I backed up all my mod files and the install went fine except that I installed a more recent version than I had before. When I moved my mod files back to their previous location and test ran the mod, it worked fine except the items didn't have their models or localised names. Instead they're all purple-black cubes called "item.[itemname].name". I replaced the model files, textures, and language file when I moved all my mod files back, and I've checked and double-checked that they're all there are don't have any errors. I'm wondering if I've got my folder structure slightly wrong, or if there's maybe some kind of unlocalised name reference that's changed in the latest forge update. Can anyone tell me (specifically for the latest version of forge - I installed it today): - the exact folder structure I need to put my language, model and texture files in? - if anything in the way unlocalised names are referred to has changed? - some other mistake that could explain the fact that the items are present but without models or names?
-
Execution failed for ':decompileMc' - GC overhead limit exceeded
Jay Avery replied to Jay Avery's topic in Modder Support
Ugh, that really annoying thing has happened where I've managed to get it to work but I still don't really understand how or what the problem was. The only difference was that this time I added the -Dorg.gradle.jvmargs=-Xmx4096M into the command as I entered it, rather than making a gradle.properties file. Maybe I was doing something wrong in making the properties file?? Oh well. Thanks everyone for your patience and advice! -
Execution failed for ':decompileMc' - GC overhead limit exceeded
Jay Avery replied to Jay Avery's topic in Modder Support
Is there anything else I can try now? I've done all the 'usual' fixes repeatedly but I'm still getting either Java heap space or GC overhead limit error every time. -
Execution failed for ':decompileMc' - GC overhead limit exceeded
Jay Avery replied to Jay Avery's topic in Modder Support
Oh, gotcha. I don't have a JAVA_OPTS environment variable, but I have a JAVA_HOME variable (added following the instructions at the github link in my OP) if that's relevant. -
Execution failed for ':decompileMc' - GC overhead limit exceeded
Jay Avery replied to Jay Avery's topic in Modder Support
Where do I find out whether I have that or not? (I will remind you of my extreme noob alert) -
Execution failed for ':decompileMc' - GC overhead limit exceeded
Jay Avery replied to Jay Avery's topic in Modder Support
Okay, so I deleted the Forge files and then downloaded again and followed the tutorial to the letter. Created a gradle.properties file in the ~\.gradle folder and wrote the line org.gradle.jvmargs=-Xmx4G. Then when I did gradlew setupDecompWorkspace it still failed, but this time with the slightly different error: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':decompileMc'. > Java heap space Then I tried again with the special command from here, and got the same Java heap space error. What do I try next? -
Execution failed for ':decompileMc' - GC overhead limit exceeded
Jay Avery replied to Jay Avery's topic in Modder Support
I guess that makes sense! I will try starting from scratch and update on whether it works... -
Execution failed for ':decompileMc' - GC overhead limit exceeded
Jay Avery replied to Jay Avery's topic in Modder Support
I tried that too! But I followed a Forge tutorial that told me to copy-paste the files from the downloaded zip into a folder in my documents that I could easily access - rather than using an installer that made folders itself. Should I try deleting the files that I copy-pasted from the downloaded zip, and instead download a version that uses an installer?