Jump to content

[1.6.4] How to make "meta items" based on NBT Tags.


SackCastellon

Recommended Posts

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

I need a better idea of what the goal you have in mind is, first.

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

I need a better idea of what the goal you have in mind is, first.

 

OK, i want to create items like the ones which have your mod, not artfacts or something like it, items that can have different damages (like tools, every tool have a different max damage) and also items that are "normal" items (with lore, multiple render passes, etc.)

 

I hope you can help me  :)

Link to comment
Share on other sites

Ok, so to start off, all you're talking about is making new items that behave in different ways, each one will have its own class.  Different maximum damage is simply just a property of that class instance.  You haven't even gotten to the point where you need NBT data yet.

 

My artifacts are unique in that they all use the same class, and the effects ("throws fireballs" "heals the player" "causes lightning") are handled separately with key-value data stored in the NBT.

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

Feom that what i read you could create a interface that handle every case and you can store the maxDamage in every class.

And the Item call the interface and call the functions you implemented. Like BC Pipes.

Its a little bit advanced Programming but with that you have a modular Item.

 

 

Link to comment
Share on other sites

Override methods in Item which have ItemStack as argument.

Add different behaviour according to that ItemStack NBTTagCompound.

 

Example:

@Override
public int getMaxDamage(ItemStack stack)
    {
if(stack.hasTagCompound() && stack.stackTagCompound.hasKey("SubType")){
return new ItemBehavior(stack.getKey("SubType")).getMaxDamage();
}
        else 
return super.getMaxDamage(stack);
    }

Link to comment
Share on other sites

Ok, so to start off, all you're talking about is making new items that behave in different ways, each one will have its own class.  Different maximum damage is simply just a property of that class instance.  You haven't even gotten to the point where you need NBT data yet.

 

My artifacts are unique in that they all use the same class, and the effects ("throws fireballs" "heals the player" "causes lightning") are handled separately with key-value data stored in the NBT.

 

Yes, i know it can be make without NBT, but using various IDs, but i want to make this items using only one ID, and the cause that i don't use metadata is that the tool are already using it to store damage.

 

P.D.: I think i should have said  if before  ;D

Link to comment
Share on other sites

So use an NBT tag to store your "metadata" and just use that value everywhere the Item class calls a function and passes an ItemStack.

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

So start coding o..o

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

So look at Artifacts.  You're going to be using almost the entire code base.  "Components" you'll be replacing to be the effects YOU want, and the FactoryArtifacts is going to need to be changed as well (as its based on the assumption that things are random).

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.



×
×
  • Create New...

Important Information

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