Friends&Foes (Quilt)

Friends&Foes (Quilt)

2.8k Downloads

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

TheDeathlyCow opened this issue ยท 1 comments

commented

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.