Jump to content

[1.7.10]Generic Item Creation while in-game


UberAffe

Recommended Posts

I am working on a mod that allows users to design weapons armor and possibly machines while in game and use them in the world. Does forge support registering new items while in game and if so what library/class would I make use of to do so?

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Link to comment
Share on other sites

It doesn't (directly).

Registration must always happen in init phases. System simply won't allow you do that nicely.

 

What you can do:

Base everything about item on its NBT.

You can make NBTItem that would pull its model, colors, properties, damage, attributes directly from NBT.

For armour (vanilla) you would only have to make 4 pieces. For rest - one class.

Lemme tell you - good design allows damn lot wiht NBT :D (that's what I do).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

I appreciate the fast response http://minecraftforge.net/forum/Smileys/default/grin.gif

 

I don't want to set a limit on the number of items created and it sounds like this will allow that so that's good.

 

I'm not terribly familiar with NBT, do you know of a resource I could look at to learn a bit about how it works/syntax of it?

 

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Link to comment
Share on other sites

http://www.minecraftforge.net/wiki/Creating_NBT_for_items

 

Basically - Item is description of what an item is.

Then there is ItemStack that holds data.

It has Item, meta, stackSize and NBT.

When stack is saved it saves all those fields (note that NBT can be null).

 

You can use NBT to store any kind of additional data.

If you look into Item.class you will notice that many methods have 2 version - one is not argumented, one ships ItemStack - that allows you to read properties from stack.nbtTag (there is getter).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

The main thing you should know is that you will limit the amount of items that ur users create anyway, because you are setting restrictions. Your machine will have 10 different features? That will make 2^10 different types of machines.

Your item can be any type of tool and 5 different miningspeeds? That will make 4*5 items.

Link to comment
Share on other sites

@Failender

Technically yes, but the nature of the material they will use to create these items will be giving them an absurd number of possibilities.

I explain the mod pretty well in this post:

http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/requests-ideas-for-mods/2471206-mod-based-on-the-lightbringer-series-by-brent

 

@Enio

Thanks for the link and the explanation, I'll see how far that can get me :)

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Link to comment
Share on other sites

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

@Draco18s

I may be misunderstanding the code but it seems like it is almost like a factory class, it randomly chooses from a set of registered items and acts as the interface for that item.

 

Which will be useful for handling the interactions once the item is created, but I still need to read through information Ernio gave me for the in-game item creation part.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Link to comment
Share on other sites

@Draco18s

I may be misunderstanding the code but it seems like it is almost like a factory class, it randomly chooses from a set of registered items and acts as the interface for that item.

 

My factory is random, but it doesn't have to be. The important part is the Item class translating from NBT to effect.

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



×
×
  • Create New...

Important Information

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