Jump to content

Recommended Posts

Posted

I'm writing a weapon mod called Polearms, and I'm trying to implement compatibility with common modded materials, such as copper.

The trouble with that is that my Spear class extends ItemSword, and so requires a ToolMaterial. I don't want to hook into other mods to get that, because doing so could cause my mod to break when those mods update, and I want Polearms to be able to work on those materials regardless of what mods add them. I had made a couple of little addon mods that bolted on to Polearms and hooked into Thermal Foundation and Mekanism to provide compatibility with those mods, but that meant that they only worked with those particular mods. Because my mod calls for a sword in the crafting recipe, it wouldn't work with IC2 copper swords, for example.

I'm thinking that I should go about this by detecting the presence of a sword made of a modded material(like copper or tin), and then adding a spear based on that tool material, with a recipe using the appropriate OreDict entry for a sword of that material.

I'm having trouble figuring out how to go about implementing this. Does anyone have any pointers/hints/help?

 

Here's the current code in case it's necessary. (It seems to be in most cases): https://github.com/TheTrueForce/Polearms

Posted (edited)

If your recipe used ingots instead of swords, then you'd start with the ore (+ gems, dust & ingots) library. If you look into it, maybe you can see a way to add a raft of swords to it.

 

As for tool materials, you could try analyzing the enum during postInit to see what mod materials were injected by other mods. Your polearms will probably need their own material definitions, but checking for other mods might tell you which will be in use.

Edited by jeffryfisher

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

OK...

So, if I'm reading your post right, I need to add my own ToolMaterials anyway, even if I don't actually use them, or implement recipes for the spears in question. I can do that. It doesn't seem ideal, but it's probably what I have to do if I want to do it the way I've outlined.

Given that the recipes are notionally tying swords to the ends of poles right now, I could probably make the recipe use refined materials and a pole instead, making the whole thing rather easier to implement, while still keeping it sensible. If I change the recipes, the player's character could be making the spear properly(well, more properly), rather than hacking/kludging/jury-rigging it together like they are now.

 

Thank you for pushing me in this direction(even if it was indirect, it's still helpful).

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.