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

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

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.

  • Author

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

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.