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

[1.21.x] Fix and simplify Apoli/Origins compatibility implementation #367

Open
wants to merge 1 commit into
base: 1.21.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions common/src/main/java/artifacts/item/UmbrellaItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ArmorItem;
Expand Down Expand Up @@ -81,4 +82,10 @@ public static boolean isHoldingUmbrellaUpright(LivingEntity entity, InteractionH
public static boolean isHoldingUmbrellaUpright(LivingEntity entity) {
return isHoldingUmbrellaUpright(entity, InteractionHand.MAIN_HAND) || isHoldingUmbrellaUpright(entity, InteractionHand.OFF_HAND);
}

public static boolean isHoldingUmbrellaUpright(Entity entity) {
return entity instanceof LivingEntity livingEntity
&& isHoldingUmbrellaUpright(livingEntity);
}

}
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies {
modImplementation include("be.florens:expandability-fabric:${rootProject.expandability_version}")

// Compat & integration
modCompileOnly("io.github.apace100:apoli:2.12.0-alpha.11+mc.1.21.x")
modCompileOnly("io.github.apace100:apoli:2.12.0-alpha.15+mc.1.21.1")
}

processResources {
Expand Down
45 changes: 0 additions & 45 deletions fabric/src/main/java/artifacts/fabric/integration/ApoliCompat.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package artifacts.fabric.mixin.compat.apoli.condition.type.entity;

import artifacts.item.UmbrellaItem;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.sugar.Local;
import io.github.apace100.apoli.condition.type.entity.ExposedToSunEntityConditionType;
import net.minecraft.world.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(ExposedToSunEntityConditionType.class)
public abstract class ExposedToSunEntityConditionTypeMixin {

@ModifyReturnValue(method = "test(Lio/github/apace100/apoli/condition/context/EntityConditionContext;)Z", at = @At("RETURN"), remap = false)
private boolean accountForUprightUmbrella(boolean original, @Local Entity entity) {
return original
&& !UmbrellaItem.isHoldingUmbrellaUpright(entity);
}

}
5 changes: 1 addition & 4 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
"client": [
"artifacts.fabric.ArtifactsFabricClient"
],
"artifacts:compat_handlers": [
"artifacts.fabric.integration.ApoliCompat"
],
"modmenu": [
"artifacts.fabric.integration.ModMenuIntegration"
],
Expand Down Expand Up @@ -53,4 +50,4 @@
"artifacts:ability_toggles"
]
}
}
}
4 changes: 2 additions & 2 deletions fabric/src/main/resources/mixins.artifacts.fabric.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"attribute.entityexperience.LivingEntityMixin",
"attribute.slipresistance.LivingEntityMixin",
"attribute.swimspeed.LivingEntityMixin",
"compat.apoli.ConditionTypeFactoryAccessor",
"compat.apoli.condition.type.entity.ExposedToSunEntityConditionTypeMixin",
"item.WearableArtifactItemMixin"
],
"client": [
Expand All @@ -28,4 +28,4 @@
"injectors": {
"defaultRequire": 1
}
}
}