Remove the boolean argument from Pony.getRace

This commit is contained in:
Sollace 2022-11-03 00:46:04 +01:00
parent 9b12a08936
commit da2ccc75fc
11 changed files with 19 additions and 15 deletions

View file

@ -28,7 +28,7 @@ public interface IPony {
* 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.
*/ */
default boolean canFly() { default boolean canFly() {
return getMetadata().getRace().hasWings(); return getRace().hasWings();
} }
/** /**
@ -75,12 +75,15 @@ public interface IPony {
*/ */
boolean isPartiallySubmerged(LivingEntity entity); boolean isPartiallySubmerged(LivingEntity entity);
@Deprecated
default Race getRace(boolean ignorePony) {
return com.minelittlepony.client.pony.Pony.getEffectiveRace(getMetadata().getRace(), ignorePony);
}
/** /**
* Gets the race associated with this pony. * Gets the race associated with this pony.
*
* @param ignorePony True to ignore the client's current pony level setting.
*/ */
Race getRace(boolean ignorePony); Race getRace();
/** /**
* Returns true if an entity is sitting as when riding a vehicle or * Returns true if an entity is sitting as when riding a vehicle or

View file

@ -47,7 +47,7 @@ public class HorseCam {
IPony pony = MineLittlePony.getInstance().getManager().getPony(player); IPony pony = MineLittlePony.getInstance().getManager().getPony(player);
if (!pony.getRace(false).isHuman()) { if (!pony.getRace().isHuman()) {
float factor = pony.getMetadata().getSize().getEyeHeightFactor(); float factor = pony.getMetadata().getSize().getEyeHeightFactor();
pitch = rescaleCameraPitch(player.getStandingEyeHeight() / factor, pitch); pitch = rescaleCameraPitch(player.getStandingEyeHeight() / factor, pitch);
} }

View file

@ -39,7 +39,8 @@ class DummyPony extends DummyPlayer implements IPreviewModel, ModelAttributes.Sw
} }
return MineLittlePony.getInstance().getManager() return MineLittlePony.getInstance().getManager()
.getPony(this) .getPony(this)
.getRace(true) .getMetadata()
.getRace()
.getModelId(super.getModel().contains("slim")); .getModelId(super.getModel().contains("slim"));
} }
} }

View file

@ -21,7 +21,7 @@ abstract class MixinCamera {
IPony pony = MineLittlePony.getInstance().getManager().getPony(MinecraftClient.getInstance().player); IPony pony = MineLittlePony.getInstance().getManager().getPony(MinecraftClient.getInstance().player);
if (!pony.getRace(false).isHuman()) { if (!pony.getRace().isHuman()) {
value *= pony.getMetadata().getSize().getEyeDistanceFactor(); value *= pony.getMetadata().getSize().getEyeDistanceFactor();
} }

View file

@ -46,7 +46,7 @@ abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity implem
IPony pony = MineLittlePony.getInstance().getManager().getPony(this); IPony pony = MineLittlePony.getInstance().getManager().getPony(this);
if (!pony.getRace(false).isHuman()) { if (!pony.getRace().isHuman()) {
float factor = pony.getMetadata().getSize().getEyeHeightFactor(); float factor = pony.getMetadata().getSize().getEyeHeightFactor();
if (factor != 1) { if (factor != 1) {
value *= factor; value *= factor;

View file

@ -41,7 +41,7 @@ abstract class MixinDefaultPlayerSkin {
cir.setReturnValue(MineLittlePony.getInstance().getManager() cir.setReturnValue(MineLittlePony.getInstance().getManager()
.getPony(IPonyManager.getDefaultSkin(uuid), uuid) .getPony(IPonyManager.getDefaultSkin(uuid), uuid)
.getRace(false) .getRace()
.getModelId(IPonyManager.isSlimSkin(uuid))); .getModelId(IPonyManager.isSlimSkin(uuid)));
} }
} }

View file

@ -23,7 +23,7 @@ abstract class MixinEntityRenderDispatcher {
} }
return MineLittlePony.getInstance().getManager() return MineLittlePony.getInstance().getManager()
.getPony(player) .getPony(player)
.getRace(false) .getRace()
.getModelId(player.getModel().contains("slim")); .getModelId(player.getModel().contains("slim"));
} }
} }

View file

@ -158,8 +158,8 @@ public class Pony implements IPony {
} }
@Override @Override
public Race getRace(boolean ignorePony) { public Race getRace() {
return getEffectiveRace(getMetadata().getRace(), ignorePony); return getEffectiveRace(getMetadata().getRace(), true);
} }
@Override @Override

View file

@ -36,7 +36,7 @@ public interface IPonyRenderContext<T extends LivingEntity, M extends EntityMode
* Called by riders to have their transportation adjust their position. * Called by riders to have their transportation adjust their position.
*/ */
default void translateRider(T entity, IPony entityPony, LivingEntity passenger, IPony passengerPony, MatrixStack stack, float ticks) { default void translateRider(T entity, IPony entityPony, LivingEntity passenger, IPony passengerPony, MatrixStack stack, float ticks) {
if (!passengerPony.getRace(false).isHuman()) { if (!passengerPony.getRace().isHuman()) {
float yaw = MathUtil.interpolateDegress((float)entity.prevY, (float)entity.getY(), ticks); float yaw = MathUtil.interpolateDegress((float)entity.prevY, (float)entity.getY(), ticks);
getModelWrapper().applyMetadata(entityPony.getMetadata()); getModelWrapper().applyMetadata(entityPony.getMetadata());

View file

@ -53,7 +53,7 @@ public class PlayerPonySkull implements ISkull {
@Override @Override
public boolean bindPony(IPony pony) { public boolean bindPony(IPony pony) {
Race race = pony.getRace(false); Race race = pony.getRace();
if (race.isHuman()) { if (race.isHuman()) {
return false; return false;
} }

View file

@ -57,7 +57,7 @@ abstract class AbstractNpcRenderer<T extends MobEntity & VillagerDataContainer>
} }
public void render(T entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) { public void render(T entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) {
model = manager.setModel(models.computeIfAbsent(getEntityPony(entity).getRace(false), this::createModel)).body(); model = manager.setModel(models.computeIfAbsent(getEntityPony(entity).getRace(), this::createModel)).body();
super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv); super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv);
} }