blob: c2de0d5529f1b7d0eb92d5c1bb4c09e61fbcb605 (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
|
package com.keuin.ohmyvanillamc.mixin;
import com.keuin.ohmyvanillamc.OhMyVanillaMinecraft;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.goal.FollowGroupLeaderGoal;
import net.minecraft.entity.passive.FishEntity;
import net.minecraft.entity.passive.SchoolingFishEntity;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(SchoolingFishEntity.class)
public abstract class DisableFishSchooling extends FishEntity {
public DisableFishSchooling(EntityType<? extends FishEntity> type, World world) {
super(type, world);
}
@Shadow public abstract boolean hasLeader();
@Shadow private SchoolingFishEntity leader;
/**
* @reason To disable SchoolingFish schooling.
* @author trueKeuin
*/
@Overwrite
public void moveTowardLeader() {
if (!OhMyVanillaMinecraft.getConfiguration().isDisableFishSchooling()) {
if (this.hasLeader()) {
this.getNavigation().startMovingTo(this.leader, 1.0D);
}
}
}
/**
* @reason To disable SchoolingFish schooling.
* @author trueKeuin
*/
@Overwrite
public void initGoals() {
super.initGoals();
if (!OhMyVanillaMinecraft.getConfiguration().isDisableFishSchooling()) {
this.goalSelector.add(5, new FollowGroupLeaderGoal((SchoolingFishEntity) (Object) this));
}
}
}
|