-
Notifications
You must be signed in to change notification settings - Fork 208
Expand file tree
/
Copy pathSpiderMixin.java
More file actions
36 lines (28 loc) · 1.35 KB
/
SpiderMixin.java
File metadata and controls
36 lines (28 loc) · 1.35 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
35
36
package com.github.alexthe666.alexsmobs.mixins;
import com.github.alexthe666.alexsmobs.config.AMConfig;
import com.github.alexthe666.alexsmobs.entity.EntityFly;
import com.github.alexthe666.alexsmobs.entity.EntitySnowLeopard;
import com.github.alexthe666.alexsmobs.entity.EntityTiger;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.ai.goal.AvoidEntityGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.monster.Creeper;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.monster.Spider;
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(Spider.class)
public abstract class SpiderMixin extends Monster {
protected SpiderMixin(EntityType<? extends Monster> p_33002_, Level p_33003_) {
super(p_33002_, p_33003_);
}
@Inject(method = "registerGoals", at = @At("TAIL"), remap = false)
protected void registerGoals(CallbackInfo ci) {
if (AMConfig.spidersAttackFlies) {
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, EntityFly.class, 1, true, false, null));
}
}
}