mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-16 17:44:23 +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);
|
super.render(move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
|
||||||
if (metadata.hasMagic()) {
|
if (metadata.hasHorn()) {
|
||||||
getHead().applyTransform(scale);
|
getHead().applyTransform(scale);
|
||||||
horn.renderPart(scale, null);
|
horn.renderPart(scale, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,10 +86,10 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
|
||||||
protected void renderHead(float scale) {
|
protected void renderHead(float scale) {
|
||||||
super.renderHead(scale);
|
super.renderHead(scale);
|
||||||
|
|
||||||
if (canCast()) {
|
if (hasHorn()) {
|
||||||
head.applyTransform(scale);
|
head.applyTransform(scale);
|
||||||
horn.renderPart(scale, attributes.interpolatorId);
|
horn.renderPart(scale, attributes.interpolatorId);
|
||||||
if (isCasting()) {
|
if (canCast() && isCasting()) {
|
||||||
horn.renderMagic(getMagicColor(), scale);
|
horn.renderMagic(getMagicColor(), scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,9 +122,14 @@ public class PonyData implements IPonyData {
|
||||||
return glowColor;
|
return glowColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasHorn() {
|
||||||
|
return getRace() != null && getRace().getEffectiveRace(false).hasHorn();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasMagic() {
|
public boolean hasMagic() {
|
||||||
return getRace() != null && getRace().getEffectiveRace(false).hasHorn() && getGlowColor() != 0;
|
return hasHorn() && getGlowColor() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,6 +15,13 @@ public interface IUnicorn<ArmModel> extends IModel {
|
||||||
return getMetadata().hasMagic();
|
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).
|
* Returns true if this model is currently using magic (horn is lit).
|
||||||
* @return
|
* @return
|
||||||
|
|
|
@ -38,6 +38,11 @@ public interface IPonyData {
|
||||||
*/
|
*/
|
||||||
int getGlowColor();
|
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.
|
* Returns true if and only if this metadata represents a pony that can cast magic.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue