mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 23:27:59 +01:00
Guardians no longer attack seaponies
This commit is contained in:
parent
ea78257ffd
commit
fb7a85c5d8
3 changed files with 24 additions and 4 deletions
|
@ -0,0 +1,21 @@
|
||||||
|
package com.minelittlepony.unicopia.mixin;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.EquinePredicates;
|
||||||
|
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
|
||||||
|
@Mixin(targets = "net.minecraft.entity.mob.GuardianEntity$GuardianTargetPredicate")
|
||||||
|
abstract class MixinGuardianTargetPredicate {
|
||||||
|
@Inject(method = "test", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void test(@Nullable LivingEntity livingEntity, CallbackInfoReturnable<Boolean> info) {
|
||||||
|
if (EquinePredicates.PLAYER_SEAPONY.test(livingEntity)) {
|
||||||
|
info.setReturnValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,16 +6,14 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.minelittlepony.api.pony.PonyPosture;
|
import com.minelittlepony.api.pony.PonyPosture;
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.EquinePredicates;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
|
||||||
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
|
||||||
@Mixin(PonyPosture.class)
|
@Mixin(PonyPosture.class)
|
||||||
abstract class MixinPonyPosture {
|
abstract class MixinPonyPosture {
|
||||||
@Inject(method = "isPartiallySubmerged", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "isPartiallySubmerged", at = @At("HEAD"), cancellable = true)
|
||||||
private static void isPartiallySubmerged(LivingEntity entity, CallbackInfoReturnable<Boolean> info) {
|
private static void isPartiallySubmerged(LivingEntity entity, CallbackInfoReturnable<Boolean> info) {
|
||||||
if (Pony.of(entity).filter(pony -> pony.getCompositeRace().includes(Race.SEAPONY)).isPresent()) {
|
if (EquinePredicates.PLAYER_SEAPONY.test(entity)) {
|
||||||
info.setReturnValue(true);
|
info.setReturnValue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
"MixinFallingBlock",
|
"MixinFallingBlock",
|
||||||
"MixinFallingBlockEntity",
|
"MixinFallingBlockEntity",
|
||||||
"MixinFlowableFluid",
|
"MixinFlowableFluid",
|
||||||
|
"MixinGuardianTargetPredicate",
|
||||||
"MixinItem",
|
"MixinItem",
|
||||||
"MixinItemEntity",
|
"MixinItemEntity",
|
||||||
"MixinLivingEntity",
|
"MixinLivingEntity",
|
||||||
|
|
Loading…
Reference in a new issue