witches no longer drink potions or join raids if swept
This commit is contained in:
parent
eb2490b12a
commit
bfb3463529
3 changed files with 37 additions and 1 deletions
17
src/main/java/at/petrak/hexcasting/mixin/MixinRaider.java
Normal file
17
src/main/java/at/petrak/hexcasting/mixin/MixinRaider.java
Normal 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);
|
||||
}
|
||||
}
|
17
src/main/java/at/petrak/hexcasting/mixin/MixinWitch.java
Normal file
17
src/main/java/at/petrak/hexcasting/mixin/MixinWitch.java
Normal 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);
|
||||
}
|
||||
}
|
|
@ -6,6 +6,8 @@
|
|||
"package": "at.petrak.hexcasting.mixin",
|
||||
"mixins": [
|
||||
"MixinMob",
|
||||
"MixinVillager"
|
||||
"MixinRaider",
|
||||
"MixinVillager",
|
||||
"MixinWitch"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue