mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Fixed eye position not being updated when joining a world, or when skins load
This commit is contained in:
parent
9641bbfe5c
commit
3f1744d98a
4 changed files with 18 additions and 3 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class PonyManager implements IPonyManager, IdentifiableResourceReloadList
|
|||
|
||||
private final PonyConfig config;
|
||||
|
||||
private final LoadingCache<Identifier, Pony> poniesCache = CacheBuilder.newBuilder()
|
||||
private final LoadingCache<Identifier, IPony> poniesCache = CacheBuilder.newBuilder()
|
||||
.expireAfterAccess(30, TimeUnit.SECONDS)
|
||||
.build(CacheLoader.from(Pony::new));
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
|
|||
public void updateModel(T entity) {
|
||||
pony = renderer.getEntityPony(entity);
|
||||
playerModel.apply(pony.getMetadata());
|
||||
pony.updateForEntity(entity);
|
||||
}
|
||||
|
||||
public IPony getPony(T entity) {
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue