Jump to content

[1.10.2] diferent metadata of the same itemstacking together when must'n[SOLVED]


Recommended Posts

Posted

good nights

i'm retaken mi mod after long time without work on it

so wanna correct a little trouble from mi mod

 

this are the herbs from resident evil 

4 herbs and there are seed, plant, and plant in pot version of each one

 

at mixing them the item at output is only one item named "hierba" whit eleven meta versions

 

//############################################################################################3
public String getUnlocalizedName(ItemStack stack)
{
  	
int m= stack.getMetadata();
if (m == 0){return "hierbaAmarilla" ;}
if (m == 1){return "hierbaRoja" ;}
if (m == 2){return "hierbaAzul" ;}

if (m == 3){return "hierbaVerde" ;}
if (m == 4){return "hierba2Verdes" ;}
if (m == 5){return "hierba3Verdes" ;}
if (m == 6){return "hierbaVerdeyRoja" ;}
if (m == 7){return "hierba2VerdesyRoja" ;}

if (m == {return "hierba1Verde1Azul" ;}
if (m == 9){return "hierba1Verde1Roja1Azul" ;}

if (m == 10){return "hierba1Verde1Roja1Amarilla" ;}
if (m == 11){return "AidSpray" ;}
return name;

}
//############################################################################################3

 

video

 

soo i already have 2 mixed green + red herb metadata 6

now i just make the mashed red herb  metadata 1

and for some reason this red herb[1] end mixed whit the  two green + red herb [6] 

so i end whit 3  green + red herb[6] and that is wrong, the red herb must not mix in this way

 

then i mash some blue herb[2] but end stacked whit the mashed green herb[3] so now i have 3 green herbs

 

··········································

may im losing some flag at declaring the class hierba.java

can someone point me what im missing please

 

this is hierba.java

https://gist.github.com/anonymous/59409992c5b24d59a0d615e14cb278ff

 

this are the recipes

https://gist.github.com/anonymous/e9cec1c8f34699a2eb453f03e408d192

 

 

 

 

 

Posted
this.setHasSubtypes(false);

 

You're telling Minecraft that

hierba

doesn't have any subtypes, so it allows different metadata values to stack with each other. Change

false

to

true

and different metadata values won't be allowed to stack.

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.

Posted

As a matter of style, I would replace that sequence of if statements with a simple switch, or even a reference to a static array.

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.

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.