Jump to content

[1.7.10] I need help with enchantments


RedMindZ

Recommended Posts

Hello, I'm new to creating mods and I'm in the peoccses of making my first mod, and I need some help with it.

 

My mod currntly have 2 items: Flint Bow, and Gunpowder Arrow. I have a question about the Flint bow.

 

I want the flint bow to be able to accept enchantments, and she already knows what to do with them and how to proccess them(e.g. light the arrow in fire if she have the enchant "Flame", etc.) and it have been tested. I don't know how to make her accept enchants in the enchanting table, and right now she only accepts Unbreaking and I don't know why.

 

Thank you for helping.

Link to comment
Share on other sites

Did you extend ItemBow?

 

I extanded my items class but copied the bow's code so it will automatically have some methods that all of my items are using, is there any difrence? and btw, can I extanded both my items class and the bow class?

Link to comment
Share on other sites

I extanded my items class but copied the bow's code so it will automatically have some methods that all of my items are using, is there any difrence? and btw, can I extanded both my items class and the bow class?

 

Yes, there's difference, ItemBow is accepted by enchantment table and can be enchanted.

No, java doesn't support multiple base classes

Link to comment
Share on other sites

Yes, there's difference, ItemBow is accepted by enchantment table and can be enchanted.

No, java doesn't support multiple base classes

 

If I will extandened the ItemBow class, what will I do with my Item class? there are methods there that I want all of my items to use so should I copy the methods from there? What should I do with those 2 classes?

Link to comment
Share on other sites

If I will extandened the ItemBow class, what will I do with my Item class? there are methods there that I want all of my items to use so should I copy the methods from there? What should I do with those 2 classes?

 

ItemBow extends Item, if you don't know how that makes sense then learn java before modding

Link to comment
Share on other sites

Try extending Item in your ItemFB class and overriding getItemEnchantability in your bow class. Although I haven't tried that, but I think something more that 0 will let your item be enchantable.

 

This is what I already did and its only allowing me to get the "Unbreaking" enchant, can it be a problem with registering the item? Do I have to register it as a bow? If so, I'm not sure how to do it, so it will be helpful if you will tell me how.

 

I'm registering my items like this: GameRegistry.registerItem(flintBow, "flintBow");

 

And I saw vanila registering items like that: itemRegistry.addObject(261, "bow", (new ItemBow()).setUnlocalizedName("bow").setTextureName("bow"));

Link to comment
Share on other sites

have you tried different values of enchantability? Gold has 22 for example.

The problem is surely not relating to the way the item is registered.

 

Well, the vanila bow enchantability is set to 1 so this also was what my bow's enchantability was set to, I tried to set it to 22, no diffrence, still only unbreaking applys to it.

 

btw, the reason I asked about the registering of the item is that I remmeber RWTema (The author of Extra Utilites) talking once about the same problem: his sword wasn't enchantable, and when he fixed it he said that the problem was that the sword wasn't registered as a sword but as a item that heppend to do a lot of damage

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.