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

[Request] Decouple Freezing Totem logic from mixin class or add an event #302

Open
TheDeathlyCow opened this issue Dec 29, 2024 · 1 comment

Comments

@TheDeathlyCow
Copy link

TheDeathlyCow commented Dec 29, 2024

Hello,

I am the developer of the Frostiful and Scorchful temperature mods and I am looking to integrate Friends and Foes better with my mod through Thermoo Patches. Specifically, for the integration I'd like to have the Totem of Freezing actually apply a freezing effect to the targeted entities. To do this, I need to mixin to your mod here:

private void friendsandfoes_freezeEntities() {
List<LivingEntity> nearbyEntities = this.getWorld().getEntitiesByClass(LivingEntity.class, this.getBoundingBox().expand(9.0), (livingEntity) -> {
return FREEZE_TARGET_PREDICATE.test(this, livingEntity);
});
nearbyEntities.forEach(nearbyEntity -> {
nearbyEntity.setFrozenTicks(NEGATIVE_EFFECT_TICKS);
nearbyEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, NEGATIVE_EFFECT_TICKS, 1));
});
}

However, this logic is entirely contained within a mixin class, which creates an issue for me. Normally, you cannot mixin to other mixin classes. I am aware that MixinSquared exists, but I'd rather not use something like that as it's pretty hacky and not very stable (they even discourage its use for maintained projects such as this). Instead, it would be best if this logic could be decoupled from the mixin class into a regular class that I can mixin to.

Alternatively, you could create an event here that I could simply listen and respond to, and avoid the trouble of mixins all together. This would probably also be more stable than a mixin.

I am targeting Fabric 1.21.1.

@TheDeathlyCow TheDeathlyCow changed the title [Request] Decouple Freezing Totem logic from mixin class or add an event to the API package [Request] Decouple Freezing Totem logic from mixin class or add an event Dec 29, 2024
@Faboslav
Copy link
Owner

Faboslav commented Jan 8, 2025

Hello there, i can separate the method to a non-mixin class in the next update.

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

No branches or pull requests

2 participants