Jump to content

Recommended Posts

Posted
1 hour ago, 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)

Looks like you neglected to provide an "inventory" variant.

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.

Posted
3 hours ago, Sawii00 said:

If you jsut use blockstates and place the textures in there, I can see the block, although it places always facing north

What does your blockstates file look like in this case?

Posted
2 hours ago, 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")

Ok, I see it's looking for my model in the Item folder, but I do not understand why. I did not set anything...

Posted
13 minutes ago, 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...

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.

Posted
4 minutes ago, 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.

mhh, makes sense i guess. I understand the itemBlock, but should't the block render at least? or is it all linked?

Posted

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?

Posted
1 minute ago, 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?

I wasn't using any model, I'll replicate and post it in a minute

Posted
On 2017-5-2 at 11: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.

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).

Posted
Just now, 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).

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.

Posted

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.

Posted

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)). 

Posted
1 hour ago, Sawii00 said:

what method can I use to check if it is in that fridge ( it is basically a simple chest (for now)). 

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.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted
12 hours ago, 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.

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

Posted
3 minutes ago, Sawii00 said:

I mean, if I can find a way to check the container the item is in

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.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted
25 minutes ago, 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.

I guess you are right! Did not think of that.... I'm so pissed off right now. I had cool ideas.

Posted

You're not the first person to have this idea.

 

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.

Posted (edited)
2 hours ago, 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.

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 by T.S.White
  • Like 1
Posted

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.

Posted

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.

Posted
9 minutes ago, 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.

Wow! I'll study that! I have not studied capabilities yet, but I'll try to understand it quickly. Thanks

Posted (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 by Abastro

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

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.

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.

Posted

World#totalWorldTime is always accurate (it only increases, it never decreases), except for the /time command.

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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