Jump to content

Recommended Posts

Posted

Hi everybody! (crowd: Hi doctor Nick!)

 

Well, I wanted to create some other material from which I could craft tools.

 

I don't want my new material to have the exact same properties as any of the other tool materials (wood, stone, iron, gold and diamond ). I'd like to customize things such as the combining the enchantability of gold with the max uses of diamond. Or even making it even more enchantable than gold. Basically, I'd like to have my own arbitrary values for my tool material properties.

 

Since I can't extend an Enum (and EnumToolMaterial is an Enum), I was thinking of extending each and every tool item (ItemSword, ItemSpade, ItemAxe, etc) with a version for my material (MyMaterialItemSword, MyMaterialItemSpade, etc) and then I would override any method that would make use of EnumToolMaterial. That's a very cumbersome approach, and some of those methods are really complicated, such as:

 

boolean ItemTool.getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)

 

That method is used in a most cryptic way by the unreadable method net.minecraft.inventory.ContainerRepair.updateRepairOutput()

 

So I have no idea of how to override ItemTool.getIsRepairable(...) just to mention one.

There must be a better way to simulate your own materials. Has anyone done that before? Any help is much appreciated.

 

Thanks in advance.

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Posted

MinecraftForge comes with the EnumHelper class which allows you to add new enum instances by using dirty reflection tricks.

You can create a new EnumToolMaterial with it.

 

That sounds just perfect! I'll look into that as soon as I have the time. Got to finish some homework and then get ready for school. Thank you diesieben07 and thank you Forge for what sounds like a neat feature.

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

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.