mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +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 com.minelittlepony.api.pony.PonyPosture;
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
|
||||
import com.minelittlepony.unicopia.EquinePredicates;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
@Mixin(PonyPosture.class)
|
||||
abstract class MixinPonyPosture {
|
||||
@Inject(method = "isPartiallySubmerged", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
"MixinFallingBlock",
|
||||
"MixinFallingBlockEntity",
|
||||
"MixinFlowableFluid",
|
||||
"MixinGuardianTargetPredicate",
|
||||
"MixinItem",
|
||||
"MixinItemEntity",
|
||||
"MixinLivingEntity",
|
||||
|
|
Loading…
Reference in a new issue