mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Migrate more parts to json
This commit is contained in:
parent
b332a19a8d
commit
c56c99171a
17 changed files with 228 additions and 193 deletions
|
@ -33,8 +33,8 @@ public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated
|
||||||
|
|
||||||
@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.isHidden = metadata.getRace().isHuman();
|
snout.setVisible(!metadata.getRace().isHuman());
|
||||||
ears.setVisible(!snout.isHidden);
|
ears.setVisible(!metadata.getRace().isHuman());
|
||||||
|
|
||||||
snout.setGender(metadata.getGender());
|
snout.setGender(metadata.getGender());
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T
|
||||||
neck.visible = false;
|
neck.visible = false;
|
||||||
tail.setVisible(false);
|
tail.setVisible(false);
|
||||||
upperTorso.visible = false;
|
upperTorso.visible = false;
|
||||||
snout.isHidden = true;
|
snout.setVisible(false);
|
||||||
steveLeftLeg.visible = false;
|
steveLeftLeg.visible = false;
|
||||||
steveRightLeg.visible = false;
|
steveRightLeg.visible = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,8 +71,8 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
||||||
super.setVisible(visible);
|
super.setVisible(visible);
|
||||||
|
|
||||||
tail.setVisible(false);
|
tail.setVisible(false);
|
||||||
|
snout.setVisible(false);
|
||||||
|
|
||||||
snout.isHidden = true;
|
|
||||||
leftHorn.visible = visible;
|
leftHorn.visible = visible;
|
||||||
rightHorn.visible = visible;
|
rightHorn.visible = visible;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.minelittlepony.client.model.entity.race;
|
package com.minelittlepony.client.model.entity.race;
|
||||||
|
|
||||||
import com.minelittlepony.client.model.part.PegasusWings;
|
|
||||||
import com.minelittlepony.model.IPart;
|
import com.minelittlepony.model.IPart;
|
||||||
import com.minelittlepony.model.IPegasus;
|
import com.minelittlepony.model.IPegasus;
|
||||||
|
|
||||||
|
@ -10,7 +9,7 @@ import net.minecraft.entity.LivingEntity;
|
||||||
|
|
||||||
public class ModelPegasus<T extends LivingEntity> extends ModelEarthPony<T> implements IPegasus {
|
public class ModelPegasus<T extends LivingEntity> extends ModelEarthPony<T> implements IPegasus {
|
||||||
|
|
||||||
protected IPart wings;
|
private IPart wings;
|
||||||
|
|
||||||
public ModelPegasus(boolean smallArms) {
|
public ModelPegasus(boolean smallArms) {
|
||||||
super(smallArms);
|
super(smallArms);
|
||||||
|
@ -21,10 +20,6 @@ public class ModelPegasus<T extends LivingEntity> extends ModelEarthPony<T> impl
|
||||||
return wings;
|
return wings;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initWings(float yOffset, float stretch) {
|
|
||||||
wings = new PegasusWings<>(this, yOffset, stretch);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
|
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
|
||||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
|
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
|
||||||
|
|
|
@ -12,15 +12,11 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class BatWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
public class BatWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
||||||
|
|
||||||
public BatWings(T model, float yOffset, float stretch) {
|
|
||||||
super(model, yOffset, stretch);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void init(float yOffset, float stretch) {
|
public void init(float yOffset, float stretch) {
|
||||||
leftWing = new Wing(pegasus, false, false, yOffset, stretch, 16);
|
/*leftWing = new Wing(pegasus, false, false, yOffset, stretch, 16);
|
||||||
rightWing = new Wing(pegasus, true, false, yOffset, stretch, 16);
|
rightWing = new Wing(pegasus, true, false, yOffset, stretch, 16);
|
||||||
legacyWing = rightWing;
|
legacyWing = rightWing;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,11 +29,7 @@ public class BatWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Wing extends PegasusWings.Wing {
|
public static class Wing extends PegasusWings.Wing {
|
||||||
|
|
||||||
public Wing(T pegasus, boolean right, boolean legacy, float y, float scale, int texY) {
|
|
||||||
super(pegasus, right, legacy, y, scale, texY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected void addClosedWing(boolean right, float y, float scale) {
|
protected void addClosedWing(boolean right, float y, float scale) {
|
||||||
|
@ -53,7 +45,7 @@ public class BatWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
protected void addFeathers(boolean right, float rotationPointY) {
|
||||||
float r = right ? -1 : 1;
|
float r = right ? -1 : 1;
|
||||||
|
|
||||||
extended.around((r * (EXT_WING_RP_X - 2)), EXT_WING_RP_Y + rotationPointY - 1, EXT_WING_RP_Z - 3)
|
extended.around((r * (EXT_WING_RP_X - 2)), EXT_WING_RP_Y + rotationPointY - 1, EXT_WING_RP_Z - 3)
|
||||||
|
@ -63,25 +55,23 @@ public class BatWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
||||||
extended.child().tex(60, 16)
|
extended.child().tex(60, 16)
|
||||||
.mirror(right) // children are unaware of their parents being mirrored, sadly
|
.mirror(right) // children are unaware of their parents being mirrored, sadly
|
||||||
.rotate(0.1F, 0, 0)
|
.rotate(0.1F, 0, 0)
|
||||||
.box(-0.5F, -1, 0, 1, 8, 1, scale + 0.001F) // this was enough to fix z-fighting
|
.box(-0.5F, -1, 0, 1, 8, 1, 0.001F) // this was enough to fix z-fighting
|
||||||
.child().tex(60, 16)
|
.child().tex(60, 16)
|
||||||
.mirror(right)
|
.mirror(right)
|
||||||
.rotate(-0.5F, 0, 0)
|
.rotate(-0.5F, 0, 0)
|
||||||
.around(0, -1, -2)
|
.around(0, -1, -2)
|
||||||
.box(-0.5F, 0, 2, 1, 7, 1, scale);
|
.box(-0.5F, 0, 2, 1, 7, 1, 0);
|
||||||
extended.child(0)
|
extended.child(0)
|
||||||
.child().tex(60, 16)
|
.child().tex(60, 16)
|
||||||
.mirror(right)
|
.mirror(right)
|
||||||
.rotate(-0.5F, 0, 0)
|
.rotate(-0.5F, 0, 0)
|
||||||
.around(0, 4, -2.4F)
|
.around(0, 4, -2.4F)
|
||||||
.box(-0.5F, 0, 3, 1, 7, 1, scale);
|
.box(-0.5F, 0, 3, 1, 7, 1, 0);
|
||||||
|
|
||||||
Part skin = new Part(pegasus)
|
extended.child(0).child(new Part(pegasus) //skin
|
||||||
.tex(56, 32)
|
.tex(56, 32)
|
||||||
.mirror(right)
|
.mirror(right)
|
||||||
.west(0, 0, -7, 16, 8, scale);
|
.west(0, 0, -7, 16, 8, 0));
|
||||||
|
|
||||||
extended.child(0).child(skin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
package com.minelittlepony.client.model.part;
|
|
||||||
|
|
||||||
import net.minecraft.client.model.Model;
|
|
||||||
|
|
||||||
import com.minelittlepony.client.util.render.Part;
|
|
||||||
import com.minelittlepony.model.IPegasus;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public class BugWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
|
||||||
|
|
||||||
public BugWings(T model, float yOffset, float stretch) {
|
|
||||||
super(model, yOffset, stretch);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public void init(float yOffset, float stretch) {
|
|
||||||
leftWing = new Wing(pegasus, false, false, yOffset, stretch, 16);
|
|
||||||
rightWing = new Wing(pegasus, true, false, yOffset, stretch, 16);
|
|
||||||
legacyWing = rightWing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Wing extends PegasusWings.Wing {
|
|
||||||
|
|
||||||
public Wing(T pegasus, boolean right, boolean legacy, float y, float scale, int texY) {
|
|
||||||
super(pegasus, right, legacy, y, scale, texY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
protected void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
|
||||||
float r = right ? -1 : 1;
|
|
||||||
|
|
||||||
extended.around((r * (EXT_WING_RP_X - 2)), EXT_WING_RP_Y + rotationPointY, EXT_WING_RP_Z - 2)
|
|
||||||
.mirror(right)
|
|
||||||
.yaw = r * 3;
|
|
||||||
|
|
||||||
Part primary = new Part(pegasus)
|
|
||||||
.tex(56, 16)
|
|
||||||
.mirror(right)
|
|
||||||
.west(r * -0.5F, 0, -7, 16, 8, scale);
|
|
||||||
Part secondary = new Part(pegasus)
|
|
||||||
.tex(56, 32)
|
|
||||||
.rotate(-0.5F, r * 0.3F, r / 3)
|
|
||||||
.mirror(right)
|
|
||||||
.west(r, 0, -5, 16, 8, scale);
|
|
||||||
|
|
||||||
extended.child(primary);
|
|
||||||
extended.child(secondary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,17 +14,13 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class PegasusWings<T extends Model & IPegasus> implements IPart {
|
public class PegasusWings<T extends Model & IPegasus> implements IPart {
|
||||||
|
|
||||||
protected final T pegasus;
|
protected T pegasus;
|
||||||
|
|
||||||
protected Wing leftWing;
|
protected Wing leftWing;
|
||||||
protected Wing rightWing;
|
protected Wing rightWing;
|
||||||
|
|
||||||
protected Wing legacyWing;
|
protected Wing legacyWing;
|
||||||
|
|
||||||
public PegasusWings(T model, float yOffset, float stretch) {
|
|
||||||
pegasus = model;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Wing getLeft() {
|
public Wing getLeft() {
|
||||||
return leftWing;
|
return leftWing;
|
||||||
}
|
}
|
||||||
|
@ -78,14 +74,10 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart {
|
||||||
|
|
||||||
public static class Wing {
|
public static class Wing {
|
||||||
|
|
||||||
private IPegasus pegasus;
|
protected IPegasus pegasus;
|
||||||
|
|
||||||
private ModelPart extended;
|
protected ModelPart extended;
|
||||||
private ModelPart folded;
|
protected ModelPart folded;
|
||||||
|
|
||||||
public Wing(IPegasus pegasus) {
|
|
||||||
this.pegasus = pegasus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void rotateWalking(float swing) {
|
public void rotateWalking(float swing) {
|
||||||
folded.yaw = swing * 0.15F;
|
folded.yaw = swing * 0.15F;
|
||||||
|
|
|
@ -1,46 +1,18 @@
|
||||||
package com.minelittlepony.client.model.part;
|
package com.minelittlepony.client.model.part;
|
||||||
|
|
||||||
import net.minecraft.client.model.Model;
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
|
||||||
import com.minelittlepony.client.util.render.Part;
|
|
||||||
import com.minelittlepony.model.ICapitated;
|
|
||||||
import com.minelittlepony.model.IPart;
|
import com.minelittlepony.model.IPart;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PonyEars implements IPart {
|
public class PonyEars implements IPart {
|
||||||
|
|
||||||
private final ModelPart head;
|
|
||||||
private final boolean bat;
|
|
||||||
|
|
||||||
private ModelPart right;
|
private ModelPart right;
|
||||||
private ModelPart left;
|
private ModelPart left;
|
||||||
|
|
||||||
public <T extends Model & ICapitated<ModelPart>> PonyEars(ModelPart head, boolean bat) {
|
|
||||||
this.head = head;
|
|
||||||
this.bat = bat;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public void init(float yOffset, float stretch) {
|
|
||||||
right = head.child().tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch);
|
|
||||||
|
|
||||||
if (bat) {
|
|
||||||
right.tex(0, 3).box(-3.5F, -6.49F, 1.001F, 1, 1, 1, stretch)
|
|
||||||
.tex(0, 5).box(-2.998F, -6.49F, 2.001F, 1, 1, 1, stretch);
|
|
||||||
}
|
|
||||||
|
|
||||||
left = head.child().flip().tex(12, 16).box( 2, -6, 1, 2, 2, 2, stretch);
|
|
||||||
|
|
||||||
if (bat) {
|
|
||||||
left.tex(0, 3).box( 2.5F, -6.49F, 1.001F, 1, 1, 1, stretch)
|
|
||||||
.tex(0, 5).box( 1.998F, -6.49F, 2.001F, 1, 1, 1, stretch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) {
|
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,17 +16,13 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class PonySnout implements IPart {
|
public class PonySnout implements IPart {
|
||||||
|
|
||||||
public boolean isHidden = false;
|
private boolean visible = false;
|
||||||
|
|
||||||
private ModelPart mare;
|
private ModelPart mare;
|
||||||
private ModelPart stallion;
|
private ModelPart stallion;
|
||||||
|
|
||||||
private final ICapitated<ModelPart> head;
|
private final ICapitated<ModelPart> head;
|
||||||
|
|
||||||
public <T extends Model & ICapitated<ModelPart>> PonySnout(T pony) {
|
|
||||||
this(pony, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T extends Model & ICapitated<ModelPart>> PonySnout(T pony, int y, int z) {
|
public <T extends Model & ICapitated<ModelPart>> PonySnout(T pony, int y, int z) {
|
||||||
head = pony;
|
head = pony;
|
||||||
|
|
||||||
|
@ -42,7 +38,7 @@ public class PonySnout implements IPart {
|
||||||
((MsonPart)stallion).rotate(x, y, z);
|
((MsonPart)stallion).rotate(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Deprecated
|
||||||
public void init(float yOffset, float stretch) {
|
public void init(float yOffset, float stretch) {
|
||||||
mare.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
mare.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||||
.tex(10, 14).south(-2, 2, -5, 4, 2, stretch)
|
.tex(10, 14).south(-2, 2, -5, 4, 2, stretch)
|
||||||
|
@ -67,8 +63,13 @@ public class PonySnout implements IPart {
|
||||||
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) {
|
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setVisible(boolean visible) {
|
||||||
|
this.visible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
public void setGender(Gender gender) {
|
public void setGender(Gender gender) {
|
||||||
boolean show = !head.hasHeadGear() && !isHidden && MineLittlePony.getInstance().getConfig().snuzzles.get();
|
boolean show = visible && !head.hasHeadGear() && MineLittlePony.getInstance().getConfig().snuzzles.get();
|
||||||
|
|
||||||
mare.visible = (show && gender.isMare());
|
mare.visible = (show && gender.isMare());
|
||||||
stallion.visible = (show && gender.isStallion());
|
stallion.visible = (show && gender.isStallion());
|
||||||
|
|
|
@ -2,54 +2,28 @@ package com.minelittlepony.client.model.part;
|
||||||
|
|
||||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.client.model.IPonyModel;
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.util.render.Part;
|
|
||||||
import com.minelittlepony.model.IPart;
|
import com.minelittlepony.model.IPart;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
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 org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
public class SeaponyTail implements IPart {
|
public class SeaponyTail implements IPart {
|
||||||
|
|
||||||
private static final float TAIL_ROTX = PI / 2;
|
private static final float TAIL_ROTX = PI / 2;
|
||||||
|
|
||||||
private Part tailBase;
|
private ModelPart tailBase;
|
||||||
|
|
||||||
private Part tailTip;
|
private ModelPart tailTip;
|
||||||
private Part tailFins;
|
private ModelPart tailFins;
|
||||||
|
|
||||||
private IPonyModel<?> model;
|
private IPonyModel<?> model;
|
||||||
|
|
||||||
public SeaponyTail(AbstractPonyModel<?> model) {
|
public SeaponyTail(AbstractPonyModel<?> model) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
|
||||||
tailBase = new Part(model, 0, 38);
|
|
||||||
tailTip = new Part(model, 24, 0);
|
|
||||||
tailFins = new Part(model, 56, 20);
|
|
||||||
|
|
||||||
tailBase.addChild(tailTip);
|
|
||||||
tailTip.addChild(tailFins);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(float yOffset, float stretch) {
|
|
||||||
tailBase.rotate(TAIL_ROTX, 0, 0)
|
|
||||||
.offset(0, -4, -2)
|
|
||||||
.around(-2, 10, 8)
|
|
||||||
.box(0, 4, 2, 4, 6, 4, stretch)
|
|
||||||
.flip();
|
|
||||||
|
|
||||||
tailTip.rotate(0, 0, 0).around(1, 5, 1)
|
|
||||||
.box(0, 0, 0, 2, 6, 1, stretch);
|
|
||||||
|
|
||||||
tailFins.offset(1, 0, 4).rotate(-TAIL_ROTX, 0, 0)
|
|
||||||
.top(-8, 0, 0, 8, 8, stretch)
|
|
||||||
.flip().top( 0, 0, 0, 8, 8, stretch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,11 +37,7 @@ public class SeaponyTail implements IPart {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) {
|
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) {
|
||||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
|
||||||
GlStateManager.enableBlend();
|
|
||||||
tailBase.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
tailBase.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||||
GlStateManager.disableBlend();
|
|
||||||
GL11.glPopAttrib();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
package com.minelittlepony.client.model.part;
|
package com.minelittlepony.client.model.part;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.model.Model;
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.render.OverlayTexture;
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
|
||||||
import com.minelittlepony.client.util.render.Part;
|
|
||||||
import com.minelittlepony.model.ICapitated;
|
|
||||||
import com.minelittlepony.model.IPart;
|
import com.minelittlepony.model.IPart;
|
||||||
import com.minelittlepony.util.math.Color;
|
import com.minelittlepony.util.math.Color;
|
||||||
|
|
||||||
|
@ -18,45 +14,22 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.*;
|
|
||||||
|
|
||||||
public class UnicornHorn implements IPart {
|
public class UnicornHorn implements IPart {
|
||||||
|
|
||||||
protected Part horn;
|
private ModelPart horn;
|
||||||
protected Part glow;
|
private ModelPart glow;
|
||||||
|
|
||||||
protected boolean isVisible = true;
|
protected boolean visible = true;
|
||||||
|
|
||||||
public <T extends Model & ICapitated<ModelPart>> UnicornHorn(T pony) {
|
|
||||||
this(pony, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T extends Model & ICapitated<ModelPart>> UnicornHorn(T pony, int y, int z) {
|
|
||||||
horn = new Part(pony, 0, 3);
|
|
||||||
glow = new Part(pony, 0, 3);
|
|
||||||
|
|
||||||
horn.offset(HORN_X, HORN_Y + y, HORN_Z + z)
|
|
||||||
.around(HEAD_RP_X, HEAD_RP_Y, HEAD_RP_Z)
|
|
||||||
.box(0, 0, 0, 1, 4, 1, 0)
|
|
||||||
.pitch = 0.5F;
|
|
||||||
|
|
||||||
glow.offset(HORN_X, HORN_Y + y, HORN_Z + z)
|
|
||||||
.around(HEAD_RP_X, HEAD_RP_Y , HEAD_RP_Z)
|
|
||||||
.cone(0, 0, 0, 1, 4, 1, 0.5F)
|
|
||||||
.cone(0, 0, 0, 1, 3, 1, 0.8F);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, @Nullable UUID interpolatorId) {
|
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, @Nullable UUID interpolatorId) {
|
||||||
if (isVisible) {
|
if (visible) {
|
||||||
horn.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
horn.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderMagic(MatrixStack stack, int tint) {
|
public void renderMagic(MatrixStack stack, int tint) {
|
||||||
if (isVisible) {
|
if (visible) {
|
||||||
horn.rotate(stack);
|
horn.rotate(stack);
|
||||||
|
|
||||||
VertexConsumer vertices = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers().getBuffer(RenderLayer.getTranslucentNoCrumbling());
|
VertexConsumer vertices = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers().getBuffer(RenderLayer.getTranslucentNoCrumbling());
|
||||||
|
@ -66,6 +39,6 @@ public class UnicornHorn implements IPart {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible) {
|
||||||
isVisible = visible;
|
this.visible = visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"texture": {"w": 64, "h": 64},
|
||||||
|
"right": {
|
||||||
|
"texture": {"u": 12, "v": 16},
|
||||||
|
"cubes": [
|
||||||
|
{ "from": [-4, -6, 1], "size": [2, 2, 2] },
|
||||||
|
{ "from": [-3.5, -6.49, 1.001], "size": [1, 1, 1], "texture": {"u": 0, "v": 3} },
|
||||||
|
{ "from": [-2.998, -6.49, 2.001], "size": [1, 1, 1], "texture": {"u": 0, "v": 5} }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"left": {
|
||||||
|
"texture": {"u": 12, "v": 16},
|
||||||
|
"cubes": [
|
||||||
|
{ "from": [2, -6, 1], "size": [2, 2, 2] },
|
||||||
|
{ "from": [2.5, -6.49, 1.001], "size": [1, 1, 1], "texture": {"u": 0, "v": 3} },
|
||||||
|
{ "from": [1.998, -6.49, 2.001], "size": [1, 1, 1], "texture": {"u": 0, "v": 5} }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"left_wing": {
|
||||||
|
"type": "mson:slot",
|
||||||
|
"name": "wings",
|
||||||
|
"implementation": "com.minelittlepony.client.model.part.BatWings$Wing",
|
||||||
|
"content": {
|
||||||
|
"__comment": "TODO"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"right_wing": {
|
||||||
|
"type": "mson:slot",
|
||||||
|
"name": "wings",
|
||||||
|
"implementation": "com.minelittlepony.client.model.part.BatWings$Wing",
|
||||||
|
"content": {
|
||||||
|
"__comment": "TODO"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"legacy_right_wing": "#right_wing"
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
{
|
||||||
|
"left_wing": {
|
||||||
|
"type": "mson:slot",
|
||||||
|
"name": "wings",
|
||||||
|
"implementation": "com.minelittlepony.client.model.part.PegasusWings$Wing",
|
||||||
|
"content": {
|
||||||
|
"folded": { "visible": false },
|
||||||
|
"extended": {
|
||||||
|
"texture": {"u": 56, "v": 19},
|
||||||
|
"center": [2.5, 5.3, 4],
|
||||||
|
"rotate": [30, 0, 0],
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "mson:planar",
|
||||||
|
"texture": {"u": 56, "v": 16},
|
||||||
|
"west": [-0.5, 0, -7, 16, 8]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "mson:planar",
|
||||||
|
"texture": {"u": 56, "v": 32},
|
||||||
|
"rotate": [-0.5, 0.3, 0.3333],
|
||||||
|
"west": [1, 0, -5, 16, 8]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"right_wing": {
|
||||||
|
"type": "mson:slot",
|
||||||
|
"name": "wings",
|
||||||
|
"implementation": "com.minelittlepony.client.model.part.PegasusWings$Wing",
|
||||||
|
"content": {
|
||||||
|
"folded": { "visible": false },
|
||||||
|
"extended": {
|
||||||
|
"texture": {"u": 56, "v": 19},
|
||||||
|
"center": [-2.5, 5.3, 4],
|
||||||
|
"rotate": [-30, 0, 0],
|
||||||
|
"mirror": true,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "mson:planar",
|
||||||
|
"texture": {"u": 56, "v": 16},
|
||||||
|
"mirror": true,
|
||||||
|
"west": [0.5, 0, -7, 16, 8]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "mson:planar",
|
||||||
|
"texture": {"u": 56, "v": 32},
|
||||||
|
"rotate": [-0.5, -0.3, -0.3333],
|
||||||
|
"mirror": true,
|
||||||
|
"west": [-1, 0, -5, 16, 8]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"legacy_right_wing": "#right_wing"
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"texture": {"w": 64, "h": 64},
|
||||||
|
"right": {
|
||||||
|
"texture": {"u": 12, "v": 16},
|
||||||
|
"cubes": [
|
||||||
|
{ "from": [-4, -6, 1], "size": [2, 2, 2] }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"left": {
|
||||||
|
"texture": {"u": 12, "v": 16},
|
||||||
|
"cubes": [
|
||||||
|
{ "from": [2, -6, 1], "size": [2, 2, 2] }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
"texture": {"w": 64, "h": 64},
|
||||||
|
"locals": {
|
||||||
|
"tail_rot_x": 1.57,
|
||||||
|
"tail_rot_x_neg": [0, "-", "#tail_rot_x"]
|
||||||
|
},
|
||||||
|
"base": {
|
||||||
|
"texture": {"u": 0, "v": 38},
|
||||||
|
"center": [-2, 10, 8],
|
||||||
|
"rotate": ["#tail_rot_x", 0, 0],
|
||||||
|
"offset": [0, -4, -2],
|
||||||
|
"mirror": true,
|
||||||
|
"cubes": [
|
||||||
|
{"from": [0, 4, 2], "size": [4, 6, 4]}
|
||||||
|
],
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"name": "tip",
|
||||||
|
"texture": {"u": 24, "v": 0},
|
||||||
|
"center": [1, 5, 1],
|
||||||
|
"cubes": [
|
||||||
|
{"size": [2, 6, 1]}
|
||||||
|
],
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"name": "fins",
|
||||||
|
"texture": {"u": 56, "v": 20},
|
||||||
|
"offset": [1, 0, 4],
|
||||||
|
"rotate": ["#tail_rot_x_neg", 0, 0],
|
||||||
|
"cubes": [
|
||||||
|
{
|
||||||
|
"type": "mson:plane",
|
||||||
|
"face": "up",
|
||||||
|
"position": [-8, 0, 0], "size": [8, 8]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "mson:plane",
|
||||||
|
"face": "up",
|
||||||
|
"mirror": [true, false, false],
|
||||||
|
"position": [0, 0, 0], "size": [8, 8]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"texture": {"w": 64, "h": 64, "u": 0, "v": 3},
|
||||||
|
"locals": {
|
||||||
|
"horn_x": -0.5,
|
||||||
|
"horn_y": -11,
|
||||||
|
"horn_z": -3.5
|
||||||
|
},
|
||||||
|
"bone": {
|
||||||
|
"offset": ["#horn_x", "#horn_y", "#horn_z"],
|
||||||
|
"rotate": [0.5, 0, 0],
|
||||||
|
"cubes": [
|
||||||
|
{ "size": [1, 4, 1] }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"corona": {
|
||||||
|
"offset": ["#horn_x", "#horn_y", "#horn_z"],
|
||||||
|
"rotate": [0.5, 0, 0],
|
||||||
|
"cubes": [
|
||||||
|
{
|
||||||
|
"type": "mson:cone",
|
||||||
|
"size": [1, 4, 1],
|
||||||
|
"stretch": 0.5,
|
||||||
|
"taper": 0.4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "mson:cone",
|
||||||
|
"size": [1, 3, 1],
|
||||||
|
"stretch": 0.8,
|
||||||
|
"taper": 0.4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue