witches no longer drink potions or join raids if swept

This commit is contained in:
yrsegal@gmail.com 2022-05-02 12:02:26 -04:00
parent eb2490b12a
commit bfb3463529
3 changed files with 37 additions and 1 deletions

View file

@ -0,0 +1,17 @@
package at.petrak.hexcasting.mixin;
import at.petrak.hexcasting.common.misc.Brainsweeping;
import net.minecraft.world.entity.raid.Raider;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
// Prevents the witch from joining a raid
@Mixin(Raider.class)
public class MixinRaider {
@Redirect(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/raid/Raider;isAlive()Z"))
private boolean isAliveForAiPurposes(Raider instance) {
var self = (Raider) (Object) this;
return self.isAlive() && !Brainsweeping.isBrainswept(self);
}
}

View file

@ -0,0 +1,17 @@
package at.petrak.hexcasting.mixin;
import at.petrak.hexcasting.common.misc.Brainsweeping;
import net.minecraft.world.entity.monster.Witch;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
// Prevents the witch from drinking potions
@Mixin(Witch.class)
public class MixinWitch {
@Redirect(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/monster/Witch;isAlive()Z"))
private boolean isAliveForAiPurposes(Witch instance) {
var self = (Witch) (Object) this;
return self.isAlive() && !Brainsweeping.isBrainswept(self);
}
}

View file

@ -6,6 +6,8 @@
"package": "at.petrak.hexcasting.mixin",
"mixins": [
"MixinMob",
"MixinVillager"
"MixinRaider",
"MixinVillager",
"MixinWitch"
]
}