|
1 | 1 | package org.polaris_bear.wild_wind.common.entity;
|
2 | 2 |
|
| 3 | +import com.google.common.base.Function; |
3 | 4 | import net.minecraft.core.BlockPos;
|
4 | 5 | import net.minecraft.nbt.CompoundTag;
|
5 | 6 | import net.minecraft.network.syncher.EntityDataAccessor;
|
|
9 | 10 | import net.minecraft.world.InteractionHand;
|
10 | 11 | import net.minecraft.world.InteractionResult;
|
11 | 12 | import net.minecraft.world.damagesource.DamageSource;
|
12 |
| -import net.minecraft.world.entity.EntityType; |
13 |
| -import net.minecraft.world.entity.MobSpawnType; |
14 |
| -import net.minecraft.world.entity.PathfinderMob; |
15 |
| -import net.minecraft.world.entity.SpawnGroupData; |
| 13 | +import net.minecraft.world.entity.*; |
16 | 14 | import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
17 | 15 | import net.minecraft.world.entity.ai.attributes.Attributes;
|
18 | 16 | import net.minecraft.world.entity.ai.control.FlyingMoveControl;
|
| 17 | +import net.minecraft.world.entity.ai.goal.Goal; |
19 | 18 | import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation;
|
20 | 19 | import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
21 | 20 | import net.minecraft.world.entity.ambient.AmbientCreature;
|
|
31 | 30 | import software.bernie.geckolib.animatable.GeoEntity;
|
32 | 31 | import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
33 | 32 | import software.bernie.geckolib.animation.*;
|
| 33 | +import software.bernie.geckolib.animation.AnimationState; |
34 | 34 | import software.bernie.geckolib.util.GeckoLibUtil;
|
35 | 35 |
|
| 36 | +import java.util.List; |
| 37 | + |
36 | 38 | public class Firefly extends PathfinderMob implements FlyingAnimal, GeoEntity {
|
37 | 39 | private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
38 | 40 |
|
@@ -135,13 +137,17 @@ public boolean causeFallDamage(float fallDistance, float multiplier, DamageSourc
|
135 | 137 | protected void checkFallDamage(double y, boolean onGround, BlockState state, BlockPos pos) {
|
136 | 138 |
|
137 | 139 | }
|
138 |
| - |
| 140 | + public static final List<Function<Firefly, Goal>> FACTORY = List |
| 141 | + .of( |
| 142 | + FireflyBaseGoal::new, |
| 143 | + FireflyFlyGoal::new, |
| 144 | + FireflyRoostGoal::new |
| 145 | + ); |
139 | 146 | @Override
|
140 | 147 | protected void registerGoals() {
|
141 |
| - this.goalSelector.addGoal(0, new FireflyBaseGoal(this)); |
142 |
| - this.goalSelector.addGoal(1, new FireflyRoostGoal(this)); |
143 |
| - this.goalSelector.addGoal(2, new FireflyFlyGoal(this)); |
144 |
| - |
| 148 | + for (int i = 0; i < FACTORY.size(); i++) { |
| 149 | + this.goalSelector.addGoal(i, FACTORY.get(i).apply(this)); |
| 150 | + } |
145 | 151 | }
|
146 | 152 |
|
147 | 153 | @Override
|
|
0 commit comments