mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
Separate the horn and magic checks
This commit is contained in:
parent
71a1a0ceac
commit
b3b165f803
5 changed files with 21 additions and 4 deletions
|
@ -53,7 +53,7 @@ public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated
|
|||
|
||||
super.render(move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (metadata.hasMagic()) {
|
||||
if (metadata.hasHorn()) {
|
||||
getHead().applyTransform(scale);
|
||||
horn.renderPart(scale, null);
|
||||
}
|
||||
|
|
|
@ -86,10 +86,10 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
|
|||
protected void renderHead(float scale) {
|
||||
super.renderHead(scale);
|
||||
|
||||
if (canCast()) {
|
||||
if (hasHorn()) {
|
||||
head.applyTransform(scale);
|
||||
horn.renderPart(scale, attributes.interpolatorId);
|
||||
if (isCasting()) {
|
||||
if (canCast() && isCasting()) {
|
||||
horn.renderMagic(getMagicColor(), scale);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,9 +122,14 @@ public class PonyData implements IPonyData {
|
|||
return glowColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasHorn() {
|
||||
return getRace() != null && getRace().getEffectiveRace(false).hasHorn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMagic() {
|
||||
return getRace() != null && getRace().getEffectiveRace(false).hasHorn() && getGlowColor() != 0;
|
||||
return hasHorn() && getGlowColor() != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,6 +15,13 @@ public interface IUnicorn<ArmModel> extends IModel {
|
|||
return getMetadata().hasMagic();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this model has an visible horns.
|
||||
*/
|
||||
default boolean hasHorn() {
|
||||
return getMetadata().hasHorn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this model is currently using magic (horn is lit).
|
||||
* @return
|
||||
|
|
|
@ -38,6 +38,11 @@ public interface IPonyData {
|
|||
*/
|
||||
int getGlowColor();
|
||||
|
||||
/**
|
||||
* Returns true if and only if this metadata represents a pony that has a horn.
|
||||
*/
|
||||
boolean hasHorn();
|
||||
|
||||
/**
|
||||
* Returns true if and only if this metadata represents a pony that can cast magic.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue