Jump to content

Problem with using bone meal as a "fuel" for my machine


RaphiiWarren

Recommended Posts

Hello people,

 

I'm new into minecraft modding but I have some experience with programming in Java.

 

So I started creating a mod, got slowed by some problems(could figure them out by myself) and getting close to finishing this mod.

 

But one problem, I can't defeat by myself. I tried different ideas but none of those was working, so I hope someone can help me here :)

 

Basically i "copied" the furnace from minecraft and use the different functions for my machine, but I want to use bonemeal as "fuel" (in my case ingredient) and as we all know bone meal is not an item, it is a subitem of dye and i can't figure out how to get it into my fule slot without allowing the player to put every kind of dye in it. Any ideas?

 

if (item == Items.DYE.getByNameOrId("dye 15")) return 1600;

This is the closest I got to fix the problem.

 

Btw if anyone is already answering and has some knowledge with machines, do I have to create a ne block if I want to show other textures while the machine is running or is there an easier way? Gonna try to figure that out by myself, but i thought I'm gonna ask it right now, so I don't have to create another topic

 

Thanks in advance,

 

RaphiiWarren

 

P.S.: Sorry for bad english, I'm not native :)

 

Link to comment
Share on other sites

Don't use only the item.

Compare the itemstack's meta data, as well as making sure the item == dye.

 

I'm guessing you have an ItemStack and that "item" is the ItemStack.getItem()?

if so:

pseudo-code

if(stack.getItem() == Items.dye && stack.getMeta == 15) //If item is a dye, and if the meta corresponds to "white"

 

You can change the models depending on the blockstate.

If you just want to change the texture on a side, you can use the resource-pack method of doing so (using .mcmeta files). If you want to -animate- it, you can either use TESR's for tiles (quite bad on performance) or make the block actually place an entity in the world, and edit it that way (cant seem to be able to find the GitHub pages that shows how to do this though)

 

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

You have to check if

ItemStack#getItem()

is equal to

Items.DYE

IIRC, and check if

ItemStack#getMetadata()

is equal to the metadata of bonemeal, which is 15 as you already know.

 

I don't have access to my IDE atm, so the method names might not be the exact names.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Rather than using a hardcoded metadata value, you should call

EnumDyeColor#getDyeDamage

on

EnumDyeColor.WHITE

to get the white dye (bone meal) metadata.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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



×
×
  • Create New...

Important Information

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