mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-03-30 16:27:43 +02:00
Remove hasHorn and hasMagic from IPonyData
This commit is contained in:
parent
557845c6e3
commit
aedb4e49f7
13 changed files with 34 additions and 59 deletions
|
@ -3,10 +3,10 @@ package com.minelittlepony.api.model;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import com.minelittlepony.api.config.PonyConfig;
|
||||||
import com.minelittlepony.api.model.armour.IArmour;
|
import com.minelittlepony.api.model.armour.IArmour;
|
||||||
import com.minelittlepony.api.pony.IPonyData;
|
import com.minelittlepony.api.pony.IPonyData;
|
||||||
import com.minelittlepony.api.pony.meta.Size;
|
import com.minelittlepony.api.pony.meta.*;
|
||||||
import com.minelittlepony.api.pony.meta.Wearable;
|
|
||||||
|
|
||||||
public interface IModel {
|
public interface IModel {
|
||||||
/**
|
/**
|
||||||
|
@ -51,11 +51,15 @@ public interface IModel {
|
||||||
*/
|
*/
|
||||||
boolean isRiding();
|
boolean isRiding();
|
||||||
|
|
||||||
|
default Race getRace() {
|
||||||
|
return PonyConfig.getEffectiveRace(getMetadata().getRace());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this model is being applied to a race that has wings.
|
* Returns true if this model is being applied to a race that has wings.
|
||||||
*/
|
*/
|
||||||
default boolean canFly() {
|
default boolean canFly() {
|
||||||
return getMetadata().getRace().hasWings();
|
return getRace().hasWings();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,15 +4,15 @@ public interface IUnicorn extends IModel {
|
||||||
/**
|
/**
|
||||||
* Returns true if this model is being applied to a race that can use magic.
|
* Returns true if this model is being applied to a race that can use magic.
|
||||||
*/
|
*/
|
||||||
default boolean canCast() {
|
default boolean hasMagic() {
|
||||||
return getMetadata().hasMagic();
|
return getRace().hasHorn() && getMagicColor() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this model has an visible horns.
|
* Returns true if this model has an visible horns.
|
||||||
*/
|
*/
|
||||||
default boolean hasHorn() {
|
default boolean hasHorn() {
|
||||||
return getMetadata().hasHorn();
|
return getRace().hasHorn();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,6 +45,13 @@ public interface IPony extends Comparable<IPony> {
|
||||||
return PonyConfig.getEffectiveRace(metadata().getRace());
|
return PonyConfig.getEffectiveRace(metadata().getRace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if and only if this metadata represents a pony that can cast magic.
|
||||||
|
*/
|
||||||
|
default boolean hasMagic() {
|
||||||
|
return race().hasHorn() && metadata().getGlowColor() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the texture used for rendering this pony.
|
* Gets the texture used for rendering this pony.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,6 +16,8 @@ import java.util.UUID;
|
||||||
public interface IPonyData extends Comparable<IPonyData> {
|
public interface IPonyData extends Comparable<IPonyData> {
|
||||||
/**
|
/**
|
||||||
* Gets this pony's race.
|
* Gets this pony's race.
|
||||||
|
*
|
||||||
|
* This is the actual race value. For the effective race, prefer going through {@link IPony#race}
|
||||||
*/
|
*/
|
||||||
Race getRace();
|
Race getRace();
|
||||||
|
|
||||||
|
@ -44,18 +46,6 @@ public interface IPonyData extends Comparable<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.
|
|
||||||
*/
|
|
||||||
default boolean hasMagic() {
|
|
||||||
return hasHorn() && getGlowColor() != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of wearables that this pony is carrying.
|
* Returns an array of wearables that this pony is carrying.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,8 +23,6 @@ public class MsgPonyData implements IPonyData {
|
||||||
private final Gender gender;
|
private final Gender gender;
|
||||||
private final Size size;
|
private final Size size;
|
||||||
private final int glowColor;
|
private final int glowColor;
|
||||||
private final boolean hasHorn;
|
|
||||||
private final boolean hasMagic;
|
|
||||||
|
|
||||||
private final boolean noSkin;
|
private final boolean noSkin;
|
||||||
|
|
||||||
|
@ -49,8 +47,6 @@ public class MsgPonyData implements IPonyData {
|
||||||
gender = buffer.readEnumConstant(Gender.class);
|
gender = buffer.readEnumConstant(Gender.class);
|
||||||
size = new MsgSize(buffer);
|
size = new MsgSize(buffer);
|
||||||
glowColor = buffer.readInt();
|
glowColor = buffer.readInt();
|
||||||
hasHorn = buffer.readBoolean();
|
|
||||||
hasMagic = buffer.readBoolean();
|
|
||||||
noSkin = buffer.readBoolean();
|
noSkin = buffer.readBoolean();
|
||||||
Wearable[] gear = new Wearable[buffer.readInt()];
|
Wearable[] gear = new Wearable[buffer.readInt()];
|
||||||
Wearable[] all = Wearable.values();
|
Wearable[] all = Wearable.values();
|
||||||
|
@ -68,8 +64,6 @@ public class MsgPonyData implements IPonyData {
|
||||||
gender = data.getGender();
|
gender = data.getGender();
|
||||||
size = data.getSize();
|
size = data.getSize();
|
||||||
glowColor = data.getGlowColor();
|
glowColor = data.getGlowColor();
|
||||||
hasHorn = data.hasHorn();
|
|
||||||
hasMagic = data.hasMagic();
|
|
||||||
wearables = Wearable.flags(data.getGear());
|
wearables = Wearable.flags(data.getGear());
|
||||||
wearableColor = data.getTriggerPixels().get("gear").getColorCode();
|
wearableColor = data.getTriggerPixels().get("gear").getColorCode();
|
||||||
this.noSkin = noSkin;
|
this.noSkin = noSkin;
|
||||||
|
@ -82,8 +76,6 @@ public class MsgPonyData implements IPonyData {
|
||||||
buffer.writeEnumConstant(gender);
|
buffer.writeEnumConstant(gender);
|
||||||
new MsgSize(size).toBuffer(buffer);
|
new MsgSize(size).toBuffer(buffer);
|
||||||
buffer.writeInt(glowColor);
|
buffer.writeInt(glowColor);
|
||||||
buffer.writeBoolean(hasHorn);
|
|
||||||
buffer.writeBoolean(hasMagic);
|
|
||||||
buffer.writeBoolean(noSkin);
|
buffer.writeBoolean(noSkin);
|
||||||
|
|
||||||
Wearable[] gear = getGear();
|
Wearable[] gear = getGear();
|
||||||
|
@ -129,16 +121,6 @@ public class MsgPonyData implements IPonyData {
|
||||||
return glowColor;
|
return glowColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasHorn() {
|
|
||||||
return hasHorn;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasMagic() {
|
|
||||||
return hasMagic;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Wearable[] getGear() {
|
public Wearable[] getGear() {
|
||||||
return Wearable.flags(wearables);
|
return Wearable.flags(wearables);
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.minelittlepony.client.model;
|
package com.minelittlepony.client.model;
|
||||||
|
|
||||||
|
import com.minelittlepony.api.config.PonyConfig;
|
||||||
import com.minelittlepony.api.model.ICapitated;
|
import com.minelittlepony.api.model.ICapitated;
|
||||||
import com.minelittlepony.api.pony.IPonyData;
|
import com.minelittlepony.api.pony.IPonyData;
|
||||||
|
import com.minelittlepony.api.pony.meta.Race;
|
||||||
import com.minelittlepony.client.model.part.PonyEars;
|
import com.minelittlepony.client.model.part.PonyEars;
|
||||||
import com.minelittlepony.client.model.part.PonySnout;
|
import com.minelittlepony.client.model.part.PonySnout;
|
||||||
import com.minelittlepony.client.model.part.UnicornHorn;
|
import com.minelittlepony.client.model.part.UnicornHorn;
|
||||||
|
@ -52,15 +54,18 @@ public class PonySkullModel extends SkullEntityModel implements MsonModel, ICapi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
||||||
snout.setVisible(!metadata.getRace().isHuman());
|
|
||||||
ears.setVisible(!metadata.getRace().isHuman());
|
Race race = PonyConfig.getEffectiveRace(metadata.getRace());
|
||||||
|
|
||||||
|
snout.setVisible(!race.isHuman());
|
||||||
|
ears.setVisible(!race.isHuman());
|
||||||
|
|
||||||
snout.setGender(metadata.getGender());
|
snout.setGender(metadata.getGender());
|
||||||
|
|
||||||
hair.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
hair.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||||
head.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
head.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||||
|
|
||||||
if (metadata.hasHorn()) {
|
if (race.hasHorn()) {
|
||||||
getHead().rotate(stack);
|
getHead().rotate(stack);
|
||||||
horn.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, null);
|
horn.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class SkeleponyModel<T extends HostileEntity> extends AlicornModel<T> imp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCast() {
|
public boolean hasMagic() {
|
||||||
return isUnicorn;
|
return isUnicorn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,7 @@ public class SeaponyModel<T extends LivingEntity> extends UnicornModel<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public boolean hasMagic() {
|
||||||
protected void renderBody(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
protected void renderBody(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
||||||
body.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
body.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||||
abdomin.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
abdomin.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||||
|
@ -123,7 +124,6 @@ public class SeaponyModel<T extends LivingEntity> extends UnicornModel<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCast() {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class UnicornModel<T extends LivingEntity> extends EarthPonyModel<T> impl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModelPart getArm(Arm side) {
|
public ModelPart getArm(Arm side) {
|
||||||
if (canCast() && getArmPoseForSide(side) != ArmPose.EMPTY && MineLittlePony.getInstance().getConfig().tpsmagic.get()) {
|
if (hasMagic() && getArmPoseForSide(side) != ArmPose.EMPTY && MineLittlePony.getInstance().getConfig().tpsmagic.get()) {
|
||||||
return side == Arm.LEFT ? unicornArmLeft : unicornArmRight;
|
return side == Arm.LEFT ? unicornArmLeft : unicornArmRight;
|
||||||
}
|
}
|
||||||
return super.getArm(side);
|
return super.getArm(side);
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.minelittlepony.client.pony;
|
||||||
import net.minecraft.client.texture.NativeImage;
|
import net.minecraft.client.texture.NativeImage;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.minelittlepony.api.config.PonyConfig;
|
|
||||||
import com.minelittlepony.api.pony.IPonyData;
|
import com.minelittlepony.api.pony.IPonyData;
|
||||||
import com.minelittlepony.api.pony.TriggerPixelSet;
|
import com.minelittlepony.api.pony.TriggerPixelSet;
|
||||||
import com.minelittlepony.api.pony.TriggerPixelType;
|
import com.minelittlepony.api.pony.TriggerPixelType;
|
||||||
|
@ -54,7 +53,7 @@ class NativePonyData implements IPonyData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Race getRace() {
|
public Race getRace() {
|
||||||
return PonyConfig.getEffectiveRace(race.getValue());
|
return race.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,11 +91,6 @@ class NativePonyData implements IPonyData {
|
||||||
return glowColor;
|
return glowColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasHorn() {
|
|
||||||
return getRace().hasHorn();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Wearable[] getGear() {
|
public Wearable[] getGear() {
|
||||||
return Wearable.flags(wearables.getValue());
|
return Wearable.flags(wearables.getValue());
|
||||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
import com.minelittlepony.api.config.PonyConfig;
|
|
||||||
import com.minelittlepony.api.pony.IPonyData;
|
import com.minelittlepony.api.pony.IPonyData;
|
||||||
import com.minelittlepony.api.pony.TriggerPixelType;
|
import com.minelittlepony.api.pony.TriggerPixelType;
|
||||||
import com.minelittlepony.api.pony.meta.*;
|
import com.minelittlepony.api.pony.meta.*;
|
||||||
|
@ -93,7 +92,7 @@ public class PonyData implements IPonyData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Race getRace() {
|
public Race getRace() {
|
||||||
return PonyConfig.getEffectiveRace(race);
|
return race;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -101,7 +100,6 @@ public class PonyData implements IPonyData {
|
||||||
return tailLength;
|
return tailLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TailShape getTailShape() {
|
public TailShape getTailShape() {
|
||||||
return tailShape;
|
return tailShape;
|
||||||
|
@ -132,11 +130,6 @@ public class PonyData implements IPonyData {
|
||||||
return glowColor;
|
return glowColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasHorn() {
|
|
||||||
return getRace().hasHorn();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Wearable[] getGear() {
|
public Wearable[] getGear() {
|
||||||
return Wearable.flags(wearables);
|
return Wearable.flags(wearables);
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class LevitatingItemRenderer {
|
||||||
|
|
||||||
matrix.push();
|
matrix.push();
|
||||||
|
|
||||||
boolean doMagic = MineLittlePony.getInstance().getConfig().fpsmagic.get() && pony.metadata().hasMagic();
|
boolean doMagic = MineLittlePony.getInstance().getConfig().fpsmagic.get() && pony.hasMagic();
|
||||||
|
|
||||||
if (doMagic) {
|
if (doMagic) {
|
||||||
setupPerspective(itemRenderer, entity, stack, left, matrix);
|
setupPerspective(itemRenderer, entity, stack, left, matrix);
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class GlowingItemFeature<T extends LivingEntity, M extends EntityModel<T>
|
||||||
protected boolean isUnicorn() {
|
protected boolean isUnicorn() {
|
||||||
return MineLittlePony.getInstance().getConfig().tpsmagic.get()
|
return MineLittlePony.getInstance().getConfig().tpsmagic.get()
|
||||||
&& getContextModel() instanceof IUnicorn
|
&& getContextModel() instanceof IUnicorn
|
||||||
&& ((IUnicorn)getContextModel()).canCast();
|
&& ((IUnicorn)getContextModel()).hasMagic();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue