jeffryfisher Posted May 4, 2017 Posted May 4, 2017 On 5/4/2017 at 6:27 PM, Sawii00 said: Exception loading model for variant food:stove#inventory for item "food:stove" <snip> Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) Expand Looks like you neglected to provide an "inventory" variant. Quote The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
Jay Avery Posted May 4, 2017 Posted May 4, 2017 On 5/4/2017 at 5:23 PM, Sawii00 said: If you jsut use blockstates and place the textures in there, I can see the block, although it places always facing north Expand What does your blockstates file look like in this case? Quote
Sawii00 Posted May 4, 2017 Author Posted May 4, 2017 On 5/4/2017 at 7:35 PM, Draco18s said: 1) use spoiler and code tags, not images and a copy paste dump 2) your item model is missing or improperly registered (READ the error, particularly the not where it says "File Not Found") Expand Ok, I see it's looking for my model in the Item folder, but I do not understand why. I did not set anything... Quote
Jay Avery Posted May 4, 2017 Posted May 4, 2017 On 5/4/2017 at 10:25 PM, Sawii00 said: Ok, I see it's looking for my model in the Item folder, but I do not understand why. I did not set anything... Expand By default an ItemBlock (that's the item that places the block, the thing you have in your inventory) looks for either an "inventory" variant in the blockstates file, or a model file in the item folder. Quote
Sawii00 Posted May 4, 2017 Author Posted May 4, 2017 On 5/4/2017 at 10:38 PM, Jay Avery said: By default an ItemBlock (that's the item that places the block, the thing you have in your inventory) looks for either an "inventory" variant in the blockstates file, or a model file in the item folder. Expand mhh, makes sense i guess. I understand the itemBlock, but should't the block render at least? or is it all linked? Quote
Jay Avery Posted May 4, 2017 Posted May 4, 2017 No, the block and item rendering is separate, so the ItemBlock problem shouldn't interfere with the placed block. What did your blockstates file look like when you used only textures and said it worked? Quote
Sawii00 Posted May 4, 2017 Author Posted May 4, 2017 On 5/4/2017 at 10:45 PM, Jay Avery said: No, the block and item rendering is separate, so the ItemBlock problem shouldn't interfere with the placed block. What did your blockstates file look like when you used only textures and said it worked? Expand I wasn't using any model, I'll replicate and post it in a minute Quote
Alpvax Posted May 4, 2017 Posted May 4, 2017 On 5/2/2017 at 10:53 PM, Sawii00 said: perfect, I'll try that too. For now this method works because I have just one Item I want to check, but Is there a way to add the pan (or any other item that goes in that single slot) inside a recipe? I that case I would not have to check for the content of the slot but I would just check the whole recipe. I will have probably to change the addRecipe method so that I can consider that extra slot. Expand One option would be to add that slot to your recipe implementation. An alternative would be to add a wrapper around your recipe that checks the item in the slot, then passes off the matching to the wrapped recipe. That way you can take full advantage of any normal crafting recipe (shaped, shapeless, oredictionary, custom). Quote
Sawii00 Posted May 4, 2017 Author Posted May 4, 2017 On 5/4/2017 at 11:56 PM, Alpvax said: One option would be to add that slot to your recipe implementation. An alternative would be to add a wrapper around your recipe that checks the item in the slot, then passes off the matching to the wrapped recipe. That way you can take full advantage of any normal crafting recipe (shaped, shapeless, oredictionary, custom). Expand Mh... I think i'll have to study a little more before doing that. I have no idea how to do what you suggested yet. Quote
Sawii00 Posted May 5, 2017 Author Posted May 5, 2017 Ok, I fixed my problems. I just followed a couple of tutorials and changed the layout of my blockstate. I also worked on the rendering and it is working pretty well. Quote
Sawii00 Posted May 12, 2017 Author Posted May 12, 2017 Hi, I am proceeding with some more advanced and cool stuff. I am now working on a system where food decays if it is kept in fresh air, and to prevent that you need to place if in a fridge (custom block I made). When the food is rotten, its gonna give almost no food and it poisons the player. My question is: what method can I use to check if it is in that fridge ( it is basically a simple chest (for now)). Quote
Abastro Posted May 13, 2017 Posted May 13, 2017 On 5/12/2017 at 11:47 PM, Sawii00 said: what method can I use to check if it is in that fridge ( it is basically a simple chest (for now)). Expand It's impossible to get the container the item is contained within the Item class. It should be implemented in the container. It'll be hard to implement rotting in other containers, as you'd better not access all of them every tick. Also there is an issue with items in unloaded TileEntity. So you need to invent your own solution with that. Quote I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
Sawii00 Posted May 13, 2017 Author Posted May 13, 2017 On 5/13/2017 at 1:52 AM, Abastro said: It's impossible to get the container the item is contained within the Item class. It should be implemented in the container. It'll be hard to implement rotting in other containers, as you'd better not access all of them every tick. Also there is an issue with items in unloaded TileEntity. So you need to invent your own solution with that. Expand I mean, if I can find a way to check the container the item is in, I can just say (if it is not in the fridge) --> rots. This rotten thing is just a variable slowly decreasing its value Quote
Abastro Posted May 13, 2017 Posted May 13, 2017 On 5/13/2017 at 1:57 PM, Sawii00 said: I mean, if I can find a way to check the container the item is in Expand It's impossible unless you check for every containers every tick. Also there are unloaded chests and tiles, mod-added bags, and such. You can't just rot those items continuously. Quote I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
Sawii00 Posted May 13, 2017 Author Posted May 13, 2017 On 5/13/2017 at 2:02 PM, Abastro said: It's impossible unless you check for every containers every tick. Also there are unloaded chests and tiles, mod-added bags, and such. You can't just rot those items continuously. Expand I guess you are right! Did not think of that.... I'm so pissed off right now. I had cool ideas. Quote
Draco18s Posted May 13, 2017 Posted May 13, 2017 You're not the first person to have this idea. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
T.S.White Posted May 13, 2017 Posted May 13, 2017 (edited) On 5/13/2017 at 2:02 PM, Abastro said: It's impossible unless you check for every containers every tick. Also there are unloaded chests and tiles, mod-added bags, and such. You can't just rot those items continuously. Expand I'm a n00b, and these might be really stupid suggestions. Tell me so, please, because I'd like to learn why these wouldn't work. (Also, Java is not my native programming language, so forgive my logo-ish pseudo-code.) 1.a. You wouldn't have to check every inventory at every tick. You only need to check when you open that inventory. You'd need to keep track of what tick the inventory was last opened at and subtract it from the current tick to figure out how likely the food inside is to be rotten. You could also choose whether or not to run the more specific "is it rotten?" check at all, based on how long it's been. 1.b. Even more specifically (and may be overkill/over complication), you don't have to add an inventory to the list of "needs food-rot-checking" if you don't put any food in a particular chest. When you add food to a chest, add the chest to the list; when you open a chest, check it against that list. When you close the chest, check if it should still be on that list (which should return false if there is no fresh food). 2. Each food item doesn't need to keep track of its own ticks. Just give it a probability to run for each tick (or bunch of ticks) since the last time it was checked. ie: set (days_variable) ((time since last check) / 24000) if days_variable >= 1 ( repeat * (days_variable) ( if random 100 < 33 (set food_freshness (rotten)) )) 3. Whittling down the things you need to check even more, you only need to check if food has gone rotten if its last known state was fresh. You probably don't need to go so far as making this it's own sub-list, but maybe you do. (Thanks, Schrodinger.) Edited May 13, 2017 by T.S.White 1 Quote
Sawii00 Posted May 13, 2017 Author Posted May 13, 2017 Actually there must be a way. I just remebered that the MInechem does have something similar for radioactive elements. They decay when outside and "freeze" in the lead chest. Sadly it is not up to date with 1.11 so I cannot find how they did it.. I'll keep looking. Quote
Jay Avery Posted May 13, 2017 Posted May 13, 2017 I created an item decay system. It uses a capability which stores the world time that the item was created, then any time the decay status needs to be checked the age is calculated using the current time. I haven't (yet) done anything with special containers that affect the rate of decay though, it would probably need a bit of an overhaul to my current system. The code is on github if anyone wants to see anyway. Quote
Sawii00 Posted May 13, 2017 Author Posted May 13, 2017 On 5/13/2017 at 4:39 PM, Jay Avery said: I created an item decay system. It uses a capability which stores the world time that the item was created, then any time the decay status needs to be checked the age is calculated using the current time. I haven't (yet) done anything with special containers that affect the rate of decay though, it would probably need a bit of an overhaul to my current system. The code is on github if anyone wants to see anyway. Expand Wow! I'll study that! I have not studied capabilities yet, but I'll try to understand it quickly. Thanks Quote
Abastro Posted May 14, 2017 Posted May 14, 2017 (edited) @T.S.White, yes that works. That's what I mean by 'your own solution'. It means you need to design some system for that. EDIT: You need to be careful, as it could be easily messed up and many issues can arise. Edited May 14, 2017 by Abastro Quote I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
jeffryfisher Posted May 14, 2017 Posted May 14, 2017 Other considerations: If any players use creative mode, then they might set time to zero as a way to move the sun to sunrise. That'll foul your time-keeping. Also: Time can roll over. Its design only needs to cover a cycle of moon phases; I don't know how much larger its range might be. Before relying on the tick-counter for long-term aging, you should look at its range and decide what to do if time ever appears to have gone backward. Quote The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
Draco18s Posted May 14, 2017 Posted May 14, 2017 World#totalWorldTime is always accurate (it only increases, it never decreases), except for the /time command. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.