mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Fixed crash when viewing a villager or witch that does not have a custom name
This commit is contained in:
parent
e6da9aceca
commit
f7a92ea3e9
4 changed files with 16 additions and 12 deletions
|
@ -28,7 +28,7 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
|
||||||
@Override
|
@Override
|
||||||
public void animateModel(T entity, float limbSwing, float limbSwingAmount, float partialTickTime) {
|
public void animateModel(T entity, float limbSwing, float limbSwingAmount, float partialTickTime) {
|
||||||
profession = entity.getVillagerData().getProfession();
|
profession = entity.getVillagerData().getProfession();
|
||||||
special = "Derpy".equals(entity.getCustomName().getString());
|
special = entity.hasCustomName() && "Derpy".equals(entity.getCustomName().getString());
|
||||||
special2 = special && entity.getUuid().getLeastSignificantBits() % 20 == 0;
|
special2 = special && entity.getUuid().getLeastSignificantBits() % 20 == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class ModelWitchPony extends ModelZebra<WitchEntity> {
|
||||||
public void updateLivingState(WitchEntity entity, IPony pony) {
|
public void updateLivingState(WitchEntity entity, IPony pony) {
|
||||||
super.updateLivingState(entity, pony);
|
super.updateLivingState(entity, pony);
|
||||||
|
|
||||||
if ("Filly".equals(entity.getCustomName().getString())) {
|
if (entity.hasCustomName() && "Filly".equals(entity.getCustomName().getString())) {
|
||||||
isChild = true;
|
isChild = true;
|
||||||
}
|
}
|
||||||
leftArmPose = ArmPose.EMPTY;
|
leftArmPose = ArmPose.EMPTY;
|
||||||
|
|
|
@ -32,12 +32,14 @@ public class RenderPonyVillager extends RenderPonyMob.Caster<VillagerEntity, Mod
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier findTexture(VillagerEntity entity) {
|
public Identifier findTexture(VillagerEntity entity) {
|
||||||
String name = entity.getCustomName().getString();
|
if (entity.hasCustomName()) {
|
||||||
if ("Derpy".equals(name) || (entity.isBaby() && "Dinky".equals(name))) {
|
String name = entity.getCustomName().getString();
|
||||||
if (entity.isBaby()) {
|
if ("Derpy".equals(name) || (entity.isBaby() && "Dinky".equals(name))) {
|
||||||
return EGG_2;
|
if (entity.isBaby()) {
|
||||||
|
return EGG_2;
|
||||||
|
}
|
||||||
|
return EGG;
|
||||||
}
|
}
|
||||||
return EGG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PROFESSIONS.supplyTexture(entity.getVillagerData());
|
return PROFESSIONS.supplyTexture(entity.getVillagerData());
|
||||||
|
|
|
@ -25,12 +25,14 @@ public class RenderPonyZombieVillager extends RenderPonyMob.Caster<ZombieVillage
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier findTexture(ZombieVillagerEntity entity) {
|
public Identifier findTexture(ZombieVillagerEntity entity) {
|
||||||
String name = entity.getCustomName().getString();
|
if (entity.hasCustomName()) {
|
||||||
if ("Derpy".equals(name) || (entity.isBaby() && "Dinky".equals(name))) {
|
String name = entity.getCustomName().getString();
|
||||||
if (entity.isBaby()) {
|
if ("Derpy".equals(name) || (entity.isBaby() && "Dinky".equals(name))) {
|
||||||
return EGG_2;
|
if (entity.isBaby()) {
|
||||||
|
return EGG_2;
|
||||||
|
}
|
||||||
|
return EGG;
|
||||||
}
|
}
|
||||||
return EGG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PROFESSIONS.supplyTexture(entity.getVillagerData());
|
return PROFESSIONS.supplyTexture(entity.getVillagerData());
|
||||||
|
|
Loading…
Reference in a new issue