Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit support for BuildCraft, CoFH wrenches #396

Merged
merged 2 commits into from
Oct 10, 2023
Merged

Conversation

firenoo
Copy link

@firenoo firenoo commented Sep 28, 2023

Uses AE2's integration system to add support for Thermal Expansion wrenches

  • Refactor ToolQuartzWrench and ToolNetworkTool, move BC optional interface IToolWrench to IAEWrench
  • Adds IToolHammer to IAEWrench

Fixes #395

@github-actions
Copy link

Warning: 2 uncommitted changes
#397

@miozune
Copy link
Member

miozune commented Sep 30, 2023

I don't understand the issue, ThermalExpansion Crescent Hammer doesn't let me pick up the cable without BC, even before my patch #385

@firenoo
Copy link
Author

firenoo commented Sep 30, 2023

Since your code most recently touched wrench code, I assumed it had to do with the issue. Apologies if I offended you.
But even so, it's a bug with the way it is implemented, and id like to fix that. If BC is not loaded, then it will definitely not work since AE only knows about the crescent hammer's wrenching ability from IToolWrench, if cofh's source is trustable.

@miozune
Copy link
Member

miozune commented Sep 30, 2023

We can use IToolHammer from CoFH Core

And no, I don't feel offended. Everyone makes mistakes 😉

@firenoo
Copy link
Author

firenoo commented Sep 30, 2023

I wanted to avoid having to make multiple optional deps.
but I see now that the wrenchers map will fill up with random item entries so that'll need a rewrite anyways.
Sadly we can't put the onus on cofh to provide compat :( so maybe using IToolHammer is right (if the hammer actually extends it)

@Alastors
Copy link

Alastors commented Sep 30, 2023

Optional dependency > hard dependency when applicable

Just a little more work, but it's usually worth in my opinion, def energy draining tho

@firenoo
Copy link
Author

firenoo commented Sep 30, 2023

we are already talking about optional deps here, just how to implement it 😉

@miozune
Copy link
Member

miozune commented Sep 30, 2023

It's not hard, cofhloaded && item instanceof IToolHammer, just like I did with IToolWrench
You can check code for crescent hammer here

@firenoo
Copy link
Author

firenoo commented Sep 30, 2023

Don't worry, I am no stranger to optional dep implementation. I meant that I don't necessarily agree with the previous implementation (both yours and mine) now that I've looked closer at how AE2 does integration. To maintain consistency with the rest of the mod - at least until we refactor that part (if we ever want to) - its probabaly better to use these annotations: https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial/blob/master/src/main/java/appeng/transformer/annotations/Integration.java and create a new IntegrationType for CoFHCore/ThermalExpansion (or rather, re-add it since it was removed at some point)

@miozune
Copy link
Member

miozune commented Sep 30, 2023

Isn't @Integration basically the same as @Optional? But IIntegrationModule implementation sounds good

@glowredman
Copy link
Member

The problem with checking the modid to decide whether to enable/disable the compat is, that the APIs can (and often are) shaded in other mods. "CoolWrenchMod" might shade both the BC API and the CoFH API and expect the Interaction with AE to work, even though neither BuildCraft or CoFHCore are present. IIRC FML provides a method to check if an API is loaded, so maybe it is possible to use that.

@glowredman
Copy link
Member

Just checked, it is ModAPIManager.hasAPI(String)

@miozune
Copy link
Member

miozune commented Sep 30, 2023

AE2 IIntegrationModule already checks that, see IntegrationNode

@firenoo
Copy link
Author

firenoo commented Oct 8, 2023

@miozune implemented. lmk if it looks better

Copy link
Member

@miozune miozune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PartP2PTunnelStatic still references raw IToolWrench

dependencies.gradle Outdated Show resolved Hide resolved
src/main/java/appeng/integration/IntegrationType.java Outdated Show resolved Hide resolved
@firenoo firenoo changed the title appeng/util: Platform.java: Revert BC harddep fix, use reflection instead Add explicit support for BuildCraft, CoFH wrenches Oct 9, 2023
dependencies.gradle Outdated Show resolved Hide resolved
dependencies.gradle Outdated Show resolved Hide resolved
@firenoo firenoo merged commit 2c2613d into master Oct 10, 2023
1 check passed
@firenoo firenoo deleted the fix/bc_wrench branch October 10, 2023 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thermal Expansion Crescent Hammer no longer removes cables/machines
4 participants