-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathFoxMixin.java
More file actions
34 lines (26 loc) · 1.22 KB
/
FoxMixin.java
File metadata and controls
34 lines (26 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.github.alexthe666.alexsmobs.mixins;
import com.github.alexthe666.alexsmobs.config.AMConfig;
import com.github.alexthe666.alexsmobs.entity.EntityJerboa;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.TamableAnimal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.animal.Cat;
import net.minecraft.world.entity.animal.Fox;
import net.minecraft.world.level.Level;
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.CallbackInfo;
@Mixin(Fox.class)
public abstract class FoxMixin extends Animal {
protected FoxMixin(EntityType<? extends TamableAnimal> p_21803_, Level p_21804_) {
super(p_21803_, p_21804_);
}
@Inject(method = "registerGoals", at = @At("TAIL"), remap = false)
protected void registerGoals(CallbackInfo ci) {
if (AMConfig.catsAndFoxesAttackJerboas) {
this.targetSelector.addGoal(6, new NearestAttackableTargetGoal<>(this, EntityJerboa.class, 45, true, true, null));
}
}
}