mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-29 07:27: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 Identifier texture;
|
||||||
private final IPonyData metadata;
|
private final IPonyData metadata;
|
||||||
|
|
||||||
|
private boolean initialized = false;
|
||||||
|
|
||||||
public Pony(Identifier resource) {
|
public Pony(Identifier resource) {
|
||||||
texture = resource;
|
texture = resource;
|
||||||
metadata = checkSkin(texture);
|
metadata = checkSkin(texture);
|
||||||
|
@ -70,6 +72,14 @@ public class Pony implements IPony {
|
||||||
return checkSkin(ponyTexture);
|
return checkSkin(ponyTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateForEntity(Entity entity) {
|
||||||
|
if (!initialized) {
|
||||||
|
initialized = true;
|
||||||
|
entity.calculateDimensions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private IPonyData checkPonyMeta(Identifier resource) {
|
private IPonyData checkPonyMeta(Identifier resource) {
|
||||||
try {
|
try {
|
||||||
|
@ -219,8 +229,6 @@ public class Pony implements IPony {
|
||||||
public Vec3d getAbsoluteRidingOffset(LivingEntity entity) {
|
public Vec3d getAbsoluteRidingOffset(LivingEntity entity) {
|
||||||
IPony ridingPony = getMountedPony(entity);
|
IPony ridingPony = getMountedPony(entity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ridingPony != null) {
|
if (ridingPony != null) {
|
||||||
LivingEntity ridee = (LivingEntity)entity.getVehicle();
|
LivingEntity ridee = (LivingEntity)entity.getVehicle();
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class PonyManager implements IPonyManager, IdentifiableResourceReloadList
|
||||||
|
|
||||||
private final PonyConfig config;
|
private final PonyConfig config;
|
||||||
|
|
||||||
private final LoadingCache<Identifier, Pony> poniesCache = CacheBuilder.newBuilder()
|
private final LoadingCache<Identifier, IPony> poniesCache = CacheBuilder.newBuilder()
|
||||||
.expireAfterAccess(30, TimeUnit.SECONDS)
|
.expireAfterAccess(30, TimeUnit.SECONDS)
|
||||||
.build(CacheLoader.from(Pony::new));
|
.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) {
|
public void updateModel(T entity) {
|
||||||
pony = renderer.getEntityPony(entity);
|
pony = renderer.getEntityPony(entity);
|
||||||
playerModel.apply(pony.getMetadata());
|
playerModel.apply(pony.getMetadata());
|
||||||
|
pony.updateForEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPony getPony(T entity) {
|
public IPony getPony(T entity) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.minelittlepony.pony;
|
package com.minelittlepony.pony;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.Box;
|
import net.minecraft.util.math.Box;
|
||||||
|
@ -18,6 +19,11 @@ public interface IPony {
|
||||||
return MineLittlePony.getInstance().getManager().getPony(texture);
|
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.
|
* Returns true if this pony has wings and the will to use them.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue