Jump to content

Custom Block (Oven)


Sawii00

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Yes... You're right, this mod conflicts with very many other mods causing this error.
    • Hi, the microphone mod is not working on my Mac. It says “launcher does not support MacOS microphone permissions” Thank you in advance for answering.
    • Make sure you have Optifine installed as a mod. Go into Options > Video Settings > Shaders > and then click the shader you want Make sure the shader.zip files are in the shaderpacks folder inside the minecraft folder
    • It sounds like you're probably registering the item in the wrong place, try looking at this tutorial for how to register items:  Forge Modding Tutorial - Minecraft 1.20: Custom Items & Creative Mode Tab | #2 This (free) tutorial series is excellent, by the way, and I'd highly recommend watching through some or all of the videos. There may also be an error in the code I showed above since I was in a hurry, but it should be enough for the general idea. I can't be more specific since I don't know exactly what you plan to do.
    • Realizing I was a victim of a scam was a devastating blow. My initial investment of $89,000, driven by dreams of financial success and the buzz surrounding a new cryptocurrency project, turned into a nightmare. The project promised high returns and rapid gains, attracting many eager investors like myself. However, as time passed and inconsistencies began to surface, it became evident that I had made a grave mistake by not thoroughly vetting the brokerage company handling the investment. Feeling anxious and betrayed, I desperately searched for a way to recover my funds. It was during this frantic search that I stumbled upon the Lee Ultimate Hacker tool through a Facebook post. With little left to lose, I decided to reach out to their team for help. To my relief, they were quick to respond and immediately started recovering my compromised email and regaining access to my cryptocurrency wallets. The team at Lee Ultimate Hacker was incredibly professional and transparent throughout the process. They meticulously traced the digital footprints left by the scammers, employing advanced technological methods to unravel the complex network that had ensnared my funds. Their expertise in cybersecurity and recovery strategies gradually began to turn the tide in my favor. Although the scammers had already siphoned off $30,000 worth of Bitcoin, Lee Ultimate Hacker was relentless in their pursuit. They managed to expose the fraudulent activities of the scam operators, revealing their identities and the mechanisms they used to lure investors. This exposure was crucial not only for my case but also as a warning to the wider community about the perils of unverified investment schemes. As we progressed, it became a race against time to retrieve the remaining $59,000 before the scammers could vanish completely. Each step forward was met with new challenges, as these criminals constantly shifted tactics and moved their digital assets to evade capture. Nonetheless, the determination and skill of the recovery team kept us hopeful. Throughout this ordeal, I learned the hard value of caution and due diligence in investment, especially within the volatile world of cryptocurrency. The experience has been incredibly taxing, both emotionally and financially, but the support and results provided by Lee Ultimate Hacker have been indispensable. The recovery process is ongoing, and while the final outcome remains uncertain, the progress made so far gives me hope. The battle to recover the full amount of my investment continues, and with the expertise of Lee Ultimate Hacker, I remain optimistic about the eventual recovery of my funds. Their commitment to their clients and proficiency in handling such complex cases truly sets them apart in the field of cyber recovery. LEEULTIMATEHACKER@ AOL. COM   Support @ leeultimatehacker . com.  telegram:LEEULTIMATE   wh@tsapp +1  (715) 314  -  9248     
  • Topics

×
×
  • Create New...

Important Information

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