|
@@ -1,7 +1,7 @@
|
|
|
package me.km.entities;
|
|
|
|
|
|
import me.km.Server;
|
|
|
-import me.km.overrides.ModEntityPlayerMP;
|
|
|
+import me.km.utils.ReflectionUtils;
|
|
|
import net.minecraft.entity.Entity;
|
|
|
import net.minecraft.entity.CreatureEntity;
|
|
|
import net.minecraft.entity.EntitySize;
|
|
@@ -30,6 +30,7 @@ public class EntityHuman extends CreatureEntity {
|
|
|
private static final DataParameter<String> SKIN_NAME = EntityDataManager.createKey(EntityHuman.class, DataSerializers.STRING);
|
|
|
private static final DataParameter<Float> SCALE = EntityDataManager.createKey(EntityHuman.class, DataSerializers.FLOAT);
|
|
|
private static final DataParameter<Boolean> SLIM = EntityDataManager.createKey(EntityHuman.class, DataSerializers.BOOLEAN);
|
|
|
+ private static final DataParameter<Boolean> STATUE = EntityDataManager.createKey(EntityHuman.class, DataSerializers.BOOLEAN);
|
|
|
|
|
|
private final float originalWidth;
|
|
|
private final float originalHeight;
|
|
@@ -48,11 +49,22 @@ public class EntityHuman extends CreatureEntity {
|
|
|
this.getDataManager().register(SKIN_NAME, "Steve");
|
|
|
this.getDataManager().register(SCALE, 1.0f);
|
|
|
this.getDataManager().register(SLIM, false);
|
|
|
+ this.getDataManager().register(STATUE, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isStatue() {
|
|
|
+ return this.getDataManager().get(STATUE);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setStatue(boolean statue) {
|
|
|
+ this.getDataManager().set(STATUE, statue);
|
|
|
+ if(!world.isRemote) {
|
|
|
+ ReflectionUtils.getGoals(goalSelector).clear();
|
|
|
+ ReflectionUtils.getGoals(targetSelector).clear();
|
|
|
+ registerGoals();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // size modifier
|
|
|
- // -------------------------------------------------------------------------
|
|
|
public boolean isSlim() {
|
|
|
return this.getDataManager().get(SLIM);
|
|
|
}
|
|
@@ -82,11 +94,11 @@ public class EntityHuman extends CreatureEntity {
|
|
|
return this.getDataManager().get(SKIN_NAME);
|
|
|
}
|
|
|
|
|
|
- // -------------------------------------------------------------------------
|
|
|
- // texture stuff
|
|
|
- // -------------------------------------------------------------------------
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
|
public ResourceLocation getTexture() {
|
|
|
+ if(isStatue()) {
|
|
|
+ return HumanSkinLoader.GREY_INSTANCE.getTexture(getSkinName());
|
|
|
+ }
|
|
|
return HumanSkinLoader.INSTANCE.getTexture(getSkinName());
|
|
|
}
|
|
|
|
|
@@ -102,6 +114,9 @@ public class EntityHuman extends CreatureEntity {
|
|
|
if(com.contains("Slim")) {
|
|
|
setSlim(com.getBoolean("Slim"));
|
|
|
}
|
|
|
+ if(com.contains("Statue")) {
|
|
|
+ setStatue(com.getBoolean("Statue"));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -110,6 +125,7 @@ public class EntityHuman extends CreatureEntity {
|
|
|
com.putString("HumanName", getSkinName());
|
|
|
com.putFloat("Scale", getScale());
|
|
|
com.putBoolean("Slim", isSlim());
|
|
|
+ com.putBoolean("Statue", isStatue());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -138,6 +154,9 @@ public class EntityHuman extends CreatureEntity {
|
|
|
|
|
|
@Override
|
|
|
protected void registerGoals() {
|
|
|
+ if(isStatue()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.goalSelector.addGoal(0, new SwimGoal(this));
|
|
|
this.goalSelector.addGoal(1, new LookAtGoal(this, PlayerEntity.class, 6.0F));
|
|
|
this.goalSelector.addGoal(2, new LookRandomlyGoal(this));
|