mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01: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.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.model.armour.IArmour;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.api.pony.meta.Size;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.api.pony.meta.*;
|
||||
|
||||
public interface IModel {
|
||||
/**
|
||||
|
@ -51,11 +51,15 @@ public interface IModel {
|
|||
*/
|
||||
boolean isRiding();
|
||||
|
||||
default Race getRace() {
|
||||
return PonyConfig.getEffectiveRace(getMetadata().getRace());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this model is being applied to a race that has wings.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
default boolean canCast() {
|
||||
return getMetadata().hasMagic();
|
||||
default boolean hasMagic() {
|
||||
return getRace().hasHorn() && getMagicColor() != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this model has an visible horns.
|
||||
*/
|
||||
default boolean hasHorn() {
|
||||
return getMetadata().hasHorn();
|
||||
return getRace().hasHorn();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,6 +45,13 @@ public interface IPony extends Comparable<IPony> {
|
|||
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.
|
||||
*/
|
||||
|
|
|
@ -16,6 +16,8 @@ import java.util.UUID;
|
|||
public interface IPonyData extends Comparable<IPonyData> {
|
||||
/**
|
||||
* Gets this pony's race.
|
||||
*
|
||||
* This is the actual race value. For the effective race, prefer going through {@link IPony#race}
|
||||
*/
|
||||
Race getRace();
|
||||
|
||||
|
@ -44,18 +46,6 @@ public interface IPonyData extends Comparable<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.
|
||||
*/
|
||||
default boolean hasMagic() {
|
||||
return hasHorn() && getGlowColor() != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Size size;
|
||||
private final int glowColor;
|
||||
private final boolean hasHorn;
|
||||
private final boolean hasMagic;
|
||||
|
||||
private final boolean noSkin;
|
||||
|
||||
|
@ -49,8 +47,6 @@ public class MsgPonyData implements IPonyData {
|
|||
gender = buffer.readEnumConstant(Gender.class);
|
||||
size = new MsgSize(buffer);
|
||||
glowColor = buffer.readInt();
|
||||
hasHorn = buffer.readBoolean();
|
||||
hasMagic = buffer.readBoolean();
|
||||
noSkin = buffer.readBoolean();
|
||||
Wearable[] gear = new Wearable[buffer.readInt()];
|
||||
Wearable[] all = Wearable.values();
|
||||
|
@ -68,8 +64,6 @@ public class MsgPonyData implements IPonyData {
|
|||
gender = data.getGender();
|
||||
size = data.getSize();
|
||||
glowColor = data.getGlowColor();
|
||||
hasHorn = data.hasHorn();
|
||||
hasMagic = data.hasMagic();
|
||||
wearables = Wearable.flags(data.getGear());
|
||||
wearableColor = data.getTriggerPixels().get("gear").getColorCode();
|
||||
this.noSkin = noSkin;
|
||||
|
@ -82,8 +76,6 @@ public class MsgPonyData implements IPonyData {
|
|||
buffer.writeEnumConstant(gender);
|
||||
new MsgSize(size).toBuffer(buffer);
|
||||
buffer.writeInt(glowColor);
|
||||
buffer.writeBoolean(hasHorn);
|
||||
buffer.writeBoolean(hasMagic);
|
||||
buffer.writeBoolean(noSkin);
|
||||
|
||||
Wearable[] gear = getGear();
|
||||
|
@ -129,16 +121,6 @@ public class MsgPonyData implements IPonyData {
|
|||
return glowColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasHorn() {
|
||||
return hasHorn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMagic() {
|
||||
return hasMagic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Wearable[] getGear() {
|
||||
return Wearable.flags(wearables);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.model.ICapitated;
|
||||
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.PonySnout;
|
||||
import com.minelittlepony.client.model.part.UnicornHorn;
|
||||
|
@ -52,15 +54,18 @@ public class PonySkullModel extends SkullEntityModel implements MsonModel, ICapi
|
|||
|
||||
@Override
|
||||
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());
|
||||
|
||||
hair.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);
|
||||
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
|
||||
public boolean canCast() {
|
||||
public boolean hasMagic() {
|
||||
return isUnicorn;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ public class SeaponyModel<T extends LivingEntity> extends UnicornModel<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMagic() {
|
||||
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);
|
||||
abdomin.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||
|
@ -123,7 +124,6 @@ public class SeaponyModel<T extends LivingEntity> extends UnicornModel<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public class UnicornModel<T extends LivingEntity> extends EarthPonyModel<T> impl
|
|||
|
||||
@Override
|
||||
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 super.getArm(side);
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.minelittlepony.client.pony;
|
|||
import net.minecraft.client.texture.NativeImage;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.api.pony.TriggerPixelSet;
|
||||
import com.minelittlepony.api.pony.TriggerPixelType;
|
||||
|
@ -54,7 +53,7 @@ class NativePonyData implements IPonyData {
|
|||
|
||||
@Override
|
||||
public Race getRace() {
|
||||
return PonyConfig.getEffectiveRace(race.getValue());
|
||||
return race.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,11 +91,6 @@ class NativePonyData implements IPonyData {
|
|||
return glowColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasHorn() {
|
||||
return getRace().hasHorn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Wearable[] getGear() {
|
||||
return Wearable.flags(wearables.getValue());
|
||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.client.MinecraftClient;
|
|||
import net.minecraft.util.Identifier;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.api.pony.TriggerPixelType;
|
||||
import com.minelittlepony.api.pony.meta.*;
|
||||
|
@ -93,7 +92,7 @@ public class PonyData implements IPonyData {
|
|||
|
||||
@Override
|
||||
public Race getRace() {
|
||||
return PonyConfig.getEffectiveRace(race);
|
||||
return race;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,7 +100,6 @@ public class PonyData implements IPonyData {
|
|||
return tailLength;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TailShape getTailShape() {
|
||||
return tailShape;
|
||||
|
@ -132,11 +130,6 @@ public class PonyData implements IPonyData {
|
|||
return glowColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasHorn() {
|
||||
return getRace().hasHorn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Wearable[] getGear() {
|
||||
return Wearable.flags(wearables);
|
||||
|
|
|
@ -84,7 +84,7 @@ public class LevitatingItemRenderer {
|
|||
|
||||
matrix.push();
|
||||
|
||||
boolean doMagic = MineLittlePony.getInstance().getConfig().fpsmagic.get() && pony.metadata().hasMagic();
|
||||
boolean doMagic = MineLittlePony.getInstance().getConfig().fpsmagic.get() && pony.hasMagic();
|
||||
|
||||
if (doMagic) {
|
||||
setupPerspective(itemRenderer, entity, stack, left, matrix);
|
||||
|
|
|
@ -27,7 +27,7 @@ public class GlowingItemFeature<T extends LivingEntity, M extends EntityModel<T>
|
|||
protected boolean isUnicorn() {
|
||||
return MineLittlePony.getInstance().getConfig().tpsmagic.get()
|
||||
&& getContextModel() instanceof IUnicorn
|
||||
&& ((IUnicorn)getContextModel()).canCast();
|
||||
&& ((IUnicorn)getContextModel()).hasMagic();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue