Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

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.

  • Author

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

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.

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.

 

 

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);
    }

  • Author

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

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.

  • Author

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.

 

Yes, basically i want it :)

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.

  • Author

So start coding o..o

 

Ohh, no. I don't know what i were thinking about, I want to create items which will have a common class, like your artifacts.  :-\

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.