diff --git a/src/main/java/com/minelittlepony/client/pony/Pony.java b/src/main/java/com/minelittlepony/client/pony/Pony.java index 10f4f9c9..60070de6 100644 --- a/src/main/java/com/minelittlepony/client/pony/Pony.java +++ b/src/main/java/com/minelittlepony/client/pony/Pony.java @@ -47,6 +47,8 @@ public class Pony implements IPony { private final Identifier texture; private final IPonyData metadata; + private boolean initialized = false; + public Pony(Identifier resource) { texture = resource; metadata = checkSkin(texture); @@ -70,6 +72,14 @@ public class Pony implements IPony { return checkSkin(ponyTexture); } + @Override + public void updateForEntity(Entity entity) { + if (!initialized) { + initialized = true; + entity.calculateDimensions(); + } + } + @Nullable private IPonyData checkPonyMeta(Identifier resource) { try { @@ -219,8 +229,6 @@ public class Pony implements IPony { public Vec3d getAbsoluteRidingOffset(LivingEntity entity) { IPony ridingPony = getMountedPony(entity); - - if (ridingPony != null) { LivingEntity ridee = (LivingEntity)entity.getVehicle(); diff --git a/src/main/java/com/minelittlepony/client/pony/PonyManager.java b/src/main/java/com/minelittlepony/client/pony/PonyManager.java index 5b40c6cc..529be711 100644 --- a/src/main/java/com/minelittlepony/client/pony/PonyManager.java +++ b/src/main/java/com/minelittlepony/client/pony/PonyManager.java @@ -56,7 +56,7 @@ public class PonyManager implements IPonyManager, IdentifiableResourceReloadList private final PonyConfig config; - private final LoadingCache poniesCache = CacheBuilder.newBuilder() + private final LoadingCache poniesCache = CacheBuilder.newBuilder() .expireAfterAccess(30, TimeUnit.SECONDS) .build(CacheLoader.from(Pony::new)); diff --git a/src/main/java/com/minelittlepony/client/render/RenderPony.java b/src/main/java/com/minelittlepony/client/render/RenderPony.java index 3855e398..fefd0132 100644 --- a/src/main/java/com/minelittlepony/client/render/RenderPony.java +++ b/src/main/java/com/minelittlepony/client/render/RenderPony.java @@ -134,6 +134,7 @@ public class RenderPony & IPony public void updateModel(T entity) { pony = renderer.getEntityPony(entity); playerModel.apply(pony.getMetadata()); + pony.updateForEntity(entity); } public IPony getPony(T entity) { diff --git a/src/main/java/com/minelittlepony/pony/IPony.java b/src/main/java/com/minelittlepony/pony/IPony.java index af73bab8..8f2c0aee 100644 --- a/src/main/java/com/minelittlepony/pony/IPony.java +++ b/src/main/java/com/minelittlepony/pony/IPony.java @@ -1,5 +1,6 @@ package com.minelittlepony.pony; +import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Identifier; import net.minecraft.util.math.Box; @@ -18,6 +19,11 @@ public interface IPony { return MineLittlePony.getInstance().getManager().getPony(texture); } + /** + * Triggers state updates on the passed entity. + */ + void updateForEntity(Entity entity); + /** * Returns true if this pony has wings and the will to use them. */