mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Clean up the PonyRenderers
This commit is contained in:
parent
8a7253b345
commit
de082acaea
44 changed files with 609 additions and 744 deletions
|
@ -6,9 +6,7 @@ import com.minelittlepony.client.model.components.PonyEars;
|
|||
import com.minelittlepony.client.model.components.PonySnout;
|
||||
import com.minelittlepony.client.model.components.PonyTail;
|
||||
import com.minelittlepony.client.transform.PonyTransformation;
|
||||
import com.minelittlepony.client.util.render.AbstractRenderer;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
|
@ -27,10 +25,10 @@ import static com.mojang.blaze3d.platform.GlStateManager.*;
|
|||
*/
|
||||
public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPonyModel<T> {
|
||||
|
||||
protected PlaneRenderer upperTorso;
|
||||
protected PlaneRenderer upperTorsoOverlay;
|
||||
protected Part upperTorso;
|
||||
protected Part upperTorsoOverlay;
|
||||
|
||||
protected PlaneRenderer neck;
|
||||
protected Part neck;
|
||||
|
||||
protected IPart tail;
|
||||
protected PonySnout snout;
|
||||
|
@ -128,10 +126,10 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
|
||||
head.setRotationPoint(1, 2, isSneaking ? -1 : 1);
|
||||
|
||||
AbstractRenderer.shiftRotationPoint(rightArm, 0, 2, 6);
|
||||
AbstractRenderer.shiftRotationPoint(leftArm, 0, 2, 6);
|
||||
AbstractRenderer.shiftRotationPoint(rightLeg, 0, 2, -8);
|
||||
AbstractRenderer.shiftRotationPoint(leftLeg, 0, 2, -8);
|
||||
Part.shiftRotationPoint(rightArm, 0, 2, 6);
|
||||
Part.shiftRotationPoint(leftArm, 0, 2, 6);
|
||||
Part.shiftRotationPoint(rightLeg, 0, 2, -8);
|
||||
Part.shiftRotationPoint(leftLeg, 0, 2, -8);
|
||||
}
|
||||
|
||||
protected void ponyRide() {
|
||||
|
@ -555,13 +553,13 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
}
|
||||
|
||||
protected void initHead(float yOffset, float stretch) {
|
||||
head = new PonyRenderer(this, 0, 0)
|
||||
head = new Part(this, 0, 0)
|
||||
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
|
||||
.box(-4, -4, -4, 8, 8, 8, stretch);
|
||||
initEars(((PonyRenderer)head), yOffset, stretch);
|
||||
initEars(((Part)head), yOffset, stretch);
|
||||
|
||||
headwear = new PonyRenderer(this, 32, 0)
|
||||
headwear = new Part(this, 32, 0)
|
||||
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
|
||||
.box(-4, -4, -4, 8, 8, 8, stretch + 0.5F);
|
||||
|
@ -570,7 +568,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
snout.init(yOffset, stretch);
|
||||
}
|
||||
|
||||
protected void initEars(PonyRenderer head, float yOffset, float stretch) {
|
||||
protected void initEars(Part head, float yOffset, float stretch) {
|
||||
ears = new PonyEars(head, false);
|
||||
ears.init(yOffset, stretch);
|
||||
}
|
||||
|
@ -589,11 +587,11 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
cuboidList.add(bodyOverlay);
|
||||
}
|
||||
|
||||
body = new PonyRenderer(this, 16, 16)
|
||||
body = new Part(this, 16, 16)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.box(-4, 4, -2, 8, 8, 4, stretch);
|
||||
|
||||
upperTorso = new PlaneRenderer(this, 24, 0);
|
||||
upperTorso = new Part(this, 24, 0);
|
||||
upperTorso.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.tex(24, 0) .east( 4, -4, -4, 8, 8, stretch) // body sides
|
||||
|
@ -614,7 +612,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
.flipZ().west(-1, 2, 2, 2, 6, stretch)
|
||||
.rotate(0.5F, 0, 0);
|
||||
|
||||
neck = new PlaneRenderer(this, 0, 16)
|
||||
neck = new Part(this, 0, 16)
|
||||
.at(NECK_CENTRE_X, NECK_CENTRE_Y, NECK_CENTRE_Z)
|
||||
.rotate(NECK_ROT_X, 0, 0).around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.north(0, 0, 0, 4, 4, stretch)
|
||||
|
@ -627,7 +625,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
bodyOverlay.addBox(-4, 4, -2, 8, 8, 4, stretch);
|
||||
bodyOverlay.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
|
||||
|
||||
upperTorsoOverlay = new PlaneRenderer(this, 24, 0);
|
||||
upperTorsoOverlay = new Part(this, 24, 0);
|
||||
upperTorsoOverlay.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.tex(12, 32) .east( 4, -4, -4, 4, 8, stretch) // body sides a
|
||||
|
|
|
@ -5,15 +5,14 @@ import net.minecraft.client.render.entity.model.BipedEntityModel;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.armour.ArmourVariant;
|
||||
import com.minelittlepony.model.armour.IArmour;
|
||||
|
||||
public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T> implements IArmour {
|
||||
|
||||
public PonyRenderer chestPiece;
|
||||
public Part chestPiece;
|
||||
|
||||
public Cuboid steveRightLeg;
|
||||
public Cuboid steveLeftLeg;
|
||||
|
@ -74,7 +73,7 @@ public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void initEars(PonyRenderer head, float yOffset, float stretch) {
|
||||
protected void initEars(Part head, float yOffset, float stretch) {
|
||||
stretch /= 2;
|
||||
head.tex(0, 0).box(-4, -6, 1, 2, 2, 2, stretch) // right ear
|
||||
.tex(0, 4).box( 2, -6, 1, 2, 2, 2, stretch); // left ear
|
||||
|
@ -84,12 +83,12 @@ public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T
|
|||
protected void initBody(float yOffset, float stretch) {
|
||||
super.initBody(yOffset, stretch);
|
||||
|
||||
chestPiece = new PonyRenderer(this, 16, 8)
|
||||
chestPiece = new Part(this, 16, 8)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.box(-4, 4, -2, 8, 8, 16, stretch);
|
||||
|
||||
// fits the legacy player's torso to our pony bod.
|
||||
upperTorso = new PlaneRenderer(this, 24, 0);
|
||||
upperTorso = new Part(this, 24, 0);
|
||||
upperTorso.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.tex(32, 23).east( 4, -4, -4, 8, 8, stretch)
|
||||
|
@ -101,14 +100,14 @@ public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T
|
|||
|
||||
@Override
|
||||
protected void preInitLegs() {
|
||||
leftArm = new PonyRenderer(this, 0, 16).flip();
|
||||
rightArm = new PonyRenderer(this, 0, 16);
|
||||
leftArm = new Part(this, 0, 16).flip();
|
||||
rightArm = new Part(this, 0, 16);
|
||||
|
||||
leftLeg = new PonyRenderer(this, 48, 8).flip();
|
||||
rightLeg = new PonyRenderer(this, 48, 8);
|
||||
leftLeg = new Part(this, 48, 8).flip();
|
||||
rightLeg = new Part(this, 48, 8);
|
||||
|
||||
steveLeftLeg = new PonyRenderer(this, 0, 16).flip();
|
||||
steveRightLeg = new PonyRenderer(this, 0, 16);
|
||||
steveLeftLeg = new Part(this, 0, 16).flip();
|
||||
steveRightLeg = new Part(this, 0, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.client.model.components;
|
|||
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
@ -75,7 +75,7 @@ public class BatWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
|||
.around(0, 4, -2.4F)
|
||||
.box(-0.5F, 0, 3, 1, 7, 1, scale);
|
||||
|
||||
PlaneRenderer skin = new PlaneRenderer(pegasus)
|
||||
Part skin = new Part(pegasus)
|
||||
.tex(56, 32)
|
||||
.mirror(right)
|
||||
.west(0, 0, -7, 16, 8, scale);
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.client.model.components;
|
|||
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
public class BugWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
||||
|
@ -37,11 +37,11 @@ public class BugWings<T extends Model & IPegasus> extends PegasusWings<T> {
|
|||
.mirror(right)
|
||||
.yaw = r * 3;
|
||||
|
||||
PlaneRenderer primary = new PlaneRenderer(pegasus)
|
||||
Part primary = new Part(pegasus)
|
||||
.tex(56, 16)
|
||||
.mirror(right)
|
||||
.west(r * -0.5F, 0, -7, 16, 8, scale);
|
||||
PlaneRenderer secondary = new PlaneRenderer(pegasus)
|
||||
Part secondary = new Part(pegasus)
|
||||
.tex(56, 32)
|
||||
.rotate(-0.5F, r * 0.3F, r / 3)
|
||||
.mirror(right)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import com.minelittlepony.client.pony.PonyData;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.pony.IPonyData;
|
||||
|
||||
|
@ -14,7 +14,7 @@ public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated
|
|||
|
||||
private final UnicornHorn horn;
|
||||
|
||||
private final PonyRenderer ears;
|
||||
private final Part ears;
|
||||
|
||||
public IPonyData metadata = new PonyData();
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated
|
|||
|
||||
snout.init(0, 0);
|
||||
|
||||
ears = new PonyRenderer(this, 0, 0)
|
||||
ears = new Part(this, 0, 0)
|
||||
.offset(0, -3, 2).around(0, 0, -2)
|
||||
.tex(12, 16).box(-3.999F, -6, 1, 2, 2, 2, 0)
|
||||
.flip().box( 1.999F, -6, 1, 2, 2, 2, 0);
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.client.model.components;
|
|||
import net.minecraft.client.model.Model;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
@ -89,14 +89,14 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart {
|
|||
|
||||
protected final T pegasus;
|
||||
|
||||
protected final PonyRenderer extended;
|
||||
protected final PonyRenderer folded;
|
||||
protected final Part extended;
|
||||
protected final Part folded;
|
||||
|
||||
public Wing(T pegasus, boolean right, boolean legacy, float y, float scale, int texY) {
|
||||
this.pegasus = pegasus;
|
||||
|
||||
folded = new PonyRenderer(pegasus, 56, texY).mirror(legacy);
|
||||
extended = new PonyRenderer(pegasus, 56 + ((!right || legacy) ? 1 : 0), texY + 3);
|
||||
folded = new Part(pegasus, 56, texY).mirror(legacy);
|
||||
extended = new Part(pegasus, 56 + ((!right || legacy) ? 1 : 0), texY + 3);
|
||||
|
||||
addClosedWing(right, y, scale);
|
||||
addFeathers(right, legacy, y, scale);
|
||||
|
@ -125,7 +125,7 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart {
|
|||
addFeather(5, l, 0, 0, 3, scale + 0.19F).pitch = -0.85F;
|
||||
}
|
||||
|
||||
private PonyRenderer addFeather(int i, boolean l, float y, float z, int h, float scale) {
|
||||
private Part addFeather(int i, boolean l, float y, float z, int h, float scale) {
|
||||
return extended.child(i).around(0, 0, 0).mirror(l).box(-0.5F, y, z, 1, h, 2, scale);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.client.model.components;
|
|||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.model.IPart;
|
||||
|
||||
|
@ -11,13 +11,13 @@ import java.util.UUID;
|
|||
|
||||
public class PonyEars implements IPart {
|
||||
|
||||
private final PonyRenderer head;
|
||||
private final Part head;
|
||||
private final boolean bat;
|
||||
|
||||
private PonyRenderer right;
|
||||
private PonyRenderer left;
|
||||
private Part right;
|
||||
private Part left;
|
||||
|
||||
public <T extends Model & ICapitated<Cuboid>> PonyEars(PonyRenderer head, boolean bat) {
|
||||
public <T extends Model & ICapitated<Cuboid>> PonyEars(Part head, boolean bat) {
|
||||
this.head = head;
|
||||
this.bat = bat;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
@ -18,8 +18,8 @@ public class PonyElytra<T extends LivingEntity> extends EntityModel<T> {
|
|||
|
||||
public boolean isSneaking;
|
||||
|
||||
private PonyRenderer rightWing = new PonyRenderer(this, 22, 0);
|
||||
private PonyRenderer leftWing = new PonyRenderer(this, 22, 0);
|
||||
private Part rightWing = new Part(this, 22, 0);
|
||||
private Part leftWing = new Part(this, 22, 0);
|
||||
|
||||
public PonyElytra() {
|
||||
leftWing .box(-10, 0, 0, 10, 20, 2, 1);
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.model.Cuboid;
|
|||
import net.minecraft.client.model.Model;
|
||||
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.pony.meta.Gender;
|
||||
|
@ -15,8 +15,8 @@ public class PonySnout implements IPart {
|
|||
|
||||
public boolean isHidden = false;
|
||||
|
||||
private PlaneRenderer mare;
|
||||
private PlaneRenderer stallion;
|
||||
private Part mare;
|
||||
private Part stallion;
|
||||
|
||||
private final ICapitated<Cuboid> head;
|
||||
|
||||
|
@ -27,8 +27,8 @@ public class PonySnout implements IPart {
|
|||
public <T extends Model & ICapitated<Cuboid>> PonySnout(T pony, int x, int y, int z) {
|
||||
head = pony;
|
||||
|
||||
mare = new PlaneRenderer(pony).offset(HEAD_CENTRE_X + x, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z + 0.25F);
|
||||
stallion = new PlaneRenderer(pony).offset(HEAD_CENTRE_X + x, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z);
|
||||
mare = new Part(pony).offset(HEAD_CENTRE_X + x, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z + 0.25F);
|
||||
stallion = new Part(pony).offset(HEAD_CENTRE_X + x, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z);
|
||||
|
||||
pony.getHead().addChild(stallion);
|
||||
pony.getHead().addChild(mare);
|
||||
|
|
|
@ -4,12 +4,12 @@ import net.minecraft.client.model.Model;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IPart;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class PonyTail extends PlaneRenderer implements IPart {
|
||||
public class PonyTail extends Part implements IPart {
|
||||
|
||||
private static final int SEGMENTS = 4;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class PonyTail extends PlaneRenderer implements IPart {
|
|||
render(scale);
|
||||
}
|
||||
|
||||
private class TailSegment extends PlaneRenderer {
|
||||
private class TailSegment extends Part {
|
||||
|
||||
private final int index;
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@ package com.minelittlepony.client.model.components;
|
|||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
|
@ -17,19 +16,19 @@ public class SeaponyTail implements IPart {
|
|||
|
||||
private static final float TAIL_ROTX = PI / 2;
|
||||
|
||||
private PonyRenderer tailBase;
|
||||
private Part tailBase;
|
||||
|
||||
private PlaneRenderer tailTip;
|
||||
private PlaneRenderer tailFins;
|
||||
private Part tailTip;
|
||||
private Part tailFins;
|
||||
|
||||
private IPonyModel<?> model;
|
||||
|
||||
public SeaponyTail(AbstractPonyModel<?> model) {
|
||||
this.model = model;
|
||||
|
||||
tailBase = new PonyRenderer(model, 0, 38);
|
||||
tailTip = new PlaneRenderer(model, 24, 0);
|
||||
tailFins = new PlaneRenderer(model, 56, 20);
|
||||
tailBase = new Part(model, 0, 38);
|
||||
tailTip = new Part(model, 24, 0);
|
||||
tailFins = new Part(model, 56, 20);
|
||||
|
||||
tailBase.addChild(tailTip);
|
||||
tailTip.addChild(tailFins);
|
||||
|
|
|
@ -5,8 +5,7 @@ import net.minecraft.client.model.Cuboid;
|
|||
import net.minecraft.client.model.Model;
|
||||
|
||||
import com.minelittlepony.client.util.render.Color;
|
||||
import com.minelittlepony.client.util.render.GlowRenderer;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.model.IPart;
|
||||
|
||||
|
@ -20,8 +19,8 @@ import static org.lwjgl.opengl.GL11.*;
|
|||
|
||||
public class UnicornHorn implements IPart {
|
||||
|
||||
protected PonyRenderer horn;
|
||||
protected GlowRenderer glow;
|
||||
protected Part horn;
|
||||
protected Part glow;
|
||||
|
||||
protected boolean isVisible = true;
|
||||
|
||||
|
@ -30,8 +29,8 @@ public class UnicornHorn implements IPart {
|
|||
}
|
||||
|
||||
public <T extends Model & ICapitated<Cuboid>> UnicornHorn(T pony, float yOffset, float stretch, int x, int y, int z) {
|
||||
horn = new PonyRenderer(pony, 0, 3);
|
||||
glow = new GlowRenderer(pony, 0, 3);
|
||||
horn = new Part(pony, 0, 3);
|
||||
glow = new Part(pony, 0, 3);
|
||||
|
||||
horn.offset(HORN_X + x, HORN_Y + y, HORN_Z + z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
|
@ -40,8 +39,8 @@ public class UnicornHorn implements IPart {
|
|||
|
||||
glow.offset(HORN_X + x, HORN_Y + y, HORN_Z + z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.box(0, 0, 0, 1, 4, 1, stretch + 0.5F)
|
||||
.box(0, 0, 0, 1, 3, 1, stretch + 0.8F);
|
||||
.cone(0, 0, 0, 1, 4, 1, stretch + 0.5F)
|
||||
.cone(0, 0, 0, 1, 3, 1, stretch + 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,10 +58,11 @@ public class UnicornHorn implements IPart {
|
|||
enableBlend();
|
||||
blendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
horn.applyTransform(scale);
|
||||
|
||||
MinecraftClient.getInstance().gameRenderer.disableLightmap();
|
||||
Color.glColor(tint, 0.4F);
|
||||
|
||||
horn.applyTransform(scale);
|
||||
glow.render(scale);
|
||||
|
||||
MinecraftClient.getInstance().gameRenderer.enableLightmap();
|
||||
|
|
|
@ -6,59 +6,59 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.util.Arm;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.PI;
|
||||
|
||||
public class ModelBreezie<T extends LivingEntity> extends BipedEntityModel<T> {
|
||||
|
||||
PonyRenderer neck;
|
||||
PonyRenderer tail;
|
||||
PonyRenderer tailStub;
|
||||
Part neck;
|
||||
Part tail;
|
||||
Part tailStub;
|
||||
|
||||
PonyRenderer leftWing;
|
||||
PonyRenderer rightWing;
|
||||
Part leftWing;
|
||||
Part rightWing;
|
||||
|
||||
public ModelBreezie() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
headwear.visible = false;
|
||||
head = new PonyRenderer(this)
|
||||
.child(new PonyRenderer(this)
|
||||
head = new Part(this)
|
||||
.child(new Part(this)
|
||||
.addBox(-3, -6, -3, 6, 6, 6).around(0, 0, -4)
|
||||
.tex(28, 0).addBox( 2, -7, 1, 1, 1, 1)
|
||||
.tex(24, 0).addBox(-3, -7, 1, 1, 1, 1)
|
||||
.tex(24, 9).addBox(-1, -2, -4, 2, 2, 1))
|
||||
.child(new PonyRenderer(this)
|
||||
.child(new Part(this)
|
||||
.tex(28, 2).addBox( 1, -11, -3, 1, 6, 1)
|
||||
.tex(24, 2).addBox(-2, -11, -3, 1, 6, 1)
|
||||
.rotate(-0.2617994F, 0, 0));
|
||||
|
||||
body = new PonyRenderer(this, 2, 12)
|
||||
body = new Part(this, 2, 12)
|
||||
.addBox(0, 0, 0, 6, 7, 14).rotate(-0.5235988F, 0, 0).around(-3, 1, -3);
|
||||
|
||||
leftArm = new PonyRenderer(this, 28, 12).addBox(0, 0, 0, 2, 12, 2).around( 1, 8, -5);
|
||||
rightArm = new PonyRenderer(this, 36, 12).addBox(0, 0, 0, 2, 12, 2).around(-3, 8, -5);
|
||||
leftLeg = new PonyRenderer(this, 8, 12) .addBox(0, 0, 0, 2, 12, 2).around( 1, 12, 3);
|
||||
rightLeg = new PonyRenderer(this, 0, 12) .addBox(0, 0, 0, 2, 12, 2).around(-3, 12, 3);
|
||||
leftArm = new Part(this, 28, 12).addBox(0, 0, 0, 2, 12, 2).around( 1, 8, -5);
|
||||
rightArm = new Part(this, 36, 12).addBox(0, 0, 0, 2, 12, 2).around(-3, 8, -5);
|
||||
leftLeg = new Part(this, 8, 12) .addBox(0, 0, 0, 2, 12, 2).around( 1, 12, 3);
|
||||
rightLeg = new Part(this, 0, 12) .addBox(0, 0, 0, 2, 12, 2).around(-3, 12, 3);
|
||||
|
||||
neck = new PonyRenderer(this, 40, 0)
|
||||
neck = new Part(this, 40, 0)
|
||||
.addBox(0, 0, 0, 2, 5, 2)
|
||||
.rotate(0.0872665F, 0, 0).around(-1, -2, -4);
|
||||
|
||||
tailStub = new PonyRenderer(this, 40, 7)
|
||||
tailStub = new Part(this, 40, 7)
|
||||
.addBox(0, 0, 0, 1, 1, 3).around(-0.5F, 8, 8);
|
||||
|
||||
tail = new PonyRenderer(this, 32, 0)
|
||||
tail = new Part(this, 32, 0)
|
||||
.addBox(0, 0, 1, 2, 9, 2).around(-1, 7, 10);
|
||||
|
||||
leftWing = new PonyRenderer(this, 0, 40)
|
||||
leftWing = new Part(this, 0, 40)
|
||||
.addBox(0, -12, 0, 24, 24, 0)
|
||||
.rotate(0, -0.6981317F, 0).around(2, 3, 1);
|
||||
leftWing.setTextureSize(64, 32);
|
||||
|
||||
rightWing = new PonyRenderer(this, 0, 40)
|
||||
rightWing = new Part(this, 0, 40)
|
||||
.addBox(-24, -12, 0, 24, 24, 0, true)
|
||||
.rotate(0, 0.6981317F, 0).around(-2, 3, 1);
|
||||
rightWing.setTextureSize(64, 32);
|
||||
|
@ -84,16 +84,16 @@ public class ModelBreezie<T extends LivingEntity> extends BipedEntityModel<T> {
|
|||
leftArm.pitch = MathHelper.cos(move * 0.6662F) * swing;
|
||||
leftArm.roll = 0;
|
||||
|
||||
((PonyRenderer)rightArm).rotate(swing * MathHelper.cos(move * 0.6662F + PI), 0, 0);
|
||||
((PonyRenderer)leftLeg) .rotate(swing * MathHelper.cos(move * 0.6662F + PI) * 1.4F, 0, 0);
|
||||
((PonyRenderer)rightLeg).rotate(swing * MathHelper.cos(move * 0.6662F) * 1.4F, 0, 0);
|
||||
((Part)rightArm).rotate(swing * MathHelper.cos(move * 0.6662F + PI), 0, 0);
|
||||
((Part)leftLeg) .rotate(swing * MathHelper.cos(move * 0.6662F + PI) * 1.4F, 0, 0);
|
||||
((Part)rightLeg).rotate(swing * MathHelper.cos(move * 0.6662F) * 1.4F, 0, 0);
|
||||
|
||||
if (isRiding) {
|
||||
leftArm.pitch += -PI / 5;
|
||||
rightArm.pitch += -PI / 5;
|
||||
|
||||
rotateLegRiding(((PonyRenderer)leftLeg), -1);
|
||||
rotateLegRiding(((PonyRenderer)rightLeg), 1);
|
||||
rotateLegRiding(((Part)leftLeg), -1);
|
||||
rotateLegRiding(((Part)rightLeg), 1);
|
||||
}
|
||||
|
||||
rotateArm(leftArm, leftArmPose, 1);
|
||||
|
@ -119,7 +119,7 @@ public class ModelBreezie<T extends LivingEntity> extends BipedEntityModel<T> {
|
|||
}
|
||||
}
|
||||
|
||||
protected void rotateLegRiding(PonyRenderer leg, float factor) {
|
||||
protected void rotateLegRiding(Part leg, float factor) {
|
||||
leg.rotate(-1.4137167F, factor * PI / 10, factor * 0.07853982F);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.entity.mob.EndermanEntity;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.components.PonySnout;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
|
@ -17,8 +17,8 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
|||
public boolean isAlicorn;
|
||||
public boolean isBoss;
|
||||
|
||||
private PonyRenderer leftHorn;
|
||||
private PonyRenderer rightHorn;
|
||||
private Part leftHorn;
|
||||
private Part rightHorn;
|
||||
|
||||
public ModelEnderStallion() {
|
||||
super();
|
||||
|
@ -76,14 +76,14 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
|||
|
||||
@Override
|
||||
protected void initHead(float yOffset, float stretch) {
|
||||
head = new PonyRenderer(this, 0, 0)
|
||||
head = new Part(this, 0, 0)
|
||||
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
|
||||
.box(-4, -4, -4, 8, 8, 8, stretch)
|
||||
.tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch)
|
||||
.flip().box( 2, -6, 1, 2, 2, 2, stretch);
|
||||
|
||||
leftHorn = ((PonyRenderer)head).child().tex(0, 52);
|
||||
leftHorn = ((Part)head).child().tex(0, 52);
|
||||
leftHorn.tex(0, 52)
|
||||
.rotate(0.1F, 0, -0.8F)
|
||||
.offset(-2, -10, -3)
|
||||
|
@ -93,7 +93,7 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
|||
.around(-3.9F, -6, 0.001F)
|
||||
.box(0, 0, 0, 2, 6, 2, stretch);
|
||||
|
||||
rightHorn = ((PonyRenderer)head).child().tex(0, 52);
|
||||
rightHorn = ((Part)head).child().tex(0, 52);
|
||||
rightHorn.tex(8, 52)
|
||||
.rotate(0.1F, 0, 0.8F)
|
||||
.offset(0, -10, -3)
|
||||
|
@ -103,7 +103,7 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
|||
.around(3.9F, -6, 0.001F)
|
||||
.box(0, 0, 0, 2, 6, 2, stretch);
|
||||
|
||||
headwear = new PonyRenderer(this, 32, 0)
|
||||
headwear = new Part(this, 32, 0)
|
||||
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
|
||||
.box(-4, -4, -4, 8, 8, 8, stretch - 0.5F);
|
||||
|
|
|
@ -5,9 +5,9 @@ import net.minecraft.client.render.entity.model.GuardianEntityModel;
|
|||
import net.minecraft.entity.mob.GuardianEntity;
|
||||
|
||||
import com.minelittlepony.client.model.IPonyMixinModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
|
||||
public class ModelGuardianPony extends GuardianEntityModel implements IPonyMixinModel.Caster<GuardianEntity, ModelSeapony<GuardianEntity>, PonyRenderer> {
|
||||
public class ModelGuardianPony extends GuardianEntityModel implements IPonyMixinModel.Caster<GuardianEntity, ModelSeapony<GuardianEntity>, Part> {
|
||||
private final ModelSeapony<GuardianEntity> mixin = new ModelSeapony<>();
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,8 +4,7 @@ import com.minelittlepony.client.model.armour.ModelPonyArmour;
|
|||
import com.minelittlepony.client.model.armour.ArmourWrapper;
|
||||
import com.minelittlepony.client.model.components.SeaponyTail;
|
||||
import com.minelittlepony.client.model.races.ModelUnicorn;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
|
@ -18,11 +17,11 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
||||
|
||||
PonyRenderer bodyCenter;
|
||||
Part bodyCenter;
|
||||
|
||||
PlaneRenderer leftFin;
|
||||
PlaneRenderer centerFin;
|
||||
PlaneRenderer rightFin;
|
||||
Part leftFin;
|
||||
Part centerFin;
|
||||
Part rightFin;
|
||||
|
||||
public ModelSeapony(boolean smallArms) {
|
||||
super(smallArms);
|
||||
|
@ -66,15 +65,15 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
|||
leftLegOverlay.visible = false;
|
||||
rightLegOverlay.visible = false;
|
||||
|
||||
centerFin = new PlaneRenderer(this, 58, 28)
|
||||
centerFin = new Part(this, 58, 28)
|
||||
.rotate(PI / 2 - 0.1F, 0, 0).around(0, 6, 9)
|
||||
.east(0, -6, 0, 12, 6, stretch);
|
||||
|
||||
leftFin = new PlaneRenderer(this, 56, 16)
|
||||
leftFin = new Part(this, 56, 16)
|
||||
.rotate(0, FIN_ROT_Y, 0).around(3, -6, 3)
|
||||
.flipZ().east(0, 0, 0, 12, 8, stretch);
|
||||
|
||||
rightFin = new PlaneRenderer(this, 56, 16)
|
||||
rightFin = new Part(this, 56, 16)
|
||||
.rotate(0, -FIN_ROT_Y, 0).around(-3, -6, 3)
|
||||
.west(0, 0, 0, 12, 8, stretch);
|
||||
}
|
||||
|
@ -88,7 +87,7 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
|||
@Override
|
||||
protected void initBody(float yOffset, float stretch) {
|
||||
super.initBody(yOffset, stretch);
|
||||
bodyCenter = new PonyRenderer(this, 0, 48)
|
||||
bodyCenter = new Part(this, 0, 48)
|
||||
.around(0, 6, 1)
|
||||
.box(-3, -1, 0, 6, 7, 9, stretch).flip();
|
||||
}
|
||||
|
|
|
@ -11,15 +11,14 @@ import com.minelittlepony.client.model.components.BatWings;
|
|||
import com.minelittlepony.client.model.components.PonyEars;
|
||||
import com.minelittlepony.client.model.races.ModelAlicorn;
|
||||
import com.minelittlepony.client.render.entities.villager.PonyTextures;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.pony.meta.Race;
|
||||
|
||||
public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> extends ModelAlicorn<T> implements ModelWithHat {
|
||||
|
||||
private PlaneRenderer apron;
|
||||
private PlaneRenderer trinket;
|
||||
private Part apron;
|
||||
private Part trinket;
|
||||
|
||||
private IPart batWings;
|
||||
|
||||
|
@ -42,7 +41,7 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void initEars(PonyRenderer head, float yOffset, float stretch) {
|
||||
protected void initEars(Part head, float yOffset, float stretch) {
|
||||
ears = new PonyEars(head, true);
|
||||
ears.init(yOffset, stretch);
|
||||
}
|
||||
|
@ -76,11 +75,11 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
|
|||
public void init(float yOffset, float stretch) {
|
||||
super.init(yOffset, stretch);
|
||||
|
||||
apron = new PlaneRenderer(this, 56, 16)
|
||||
apron = new Part(this, 56, 16)
|
||||
.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.south(-4, -4, -9, 8, 10, stretch);
|
||||
trinket = new PlaneRenderer(this, 0, 3)
|
||||
trinket = new Part(this, 0, 3)
|
||||
.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.south(-2, -4, -9, 4, 5, stretch);
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.client.model.entities;
|
|||
|
||||
import com.minelittlepony.client.model.IMobModel;
|
||||
import com.minelittlepony.client.model.races.ModelAlicorn;
|
||||
import com.minelittlepony.client.util.render.AbstractRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
|
||||
import net.minecraft.entity.mob.HostileEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -27,10 +27,10 @@ public class ModelZombiePony<Zombie extends HostileEntity> extends ModelAlicorn<
|
|||
|
||||
if (islookAngleRight(move)) {
|
||||
rotateArmHolding(rightArm, 1, getSwingAmount(), ticks);
|
||||
AbstractRenderer.shiftRotationPoint(rightArm, 0.5F, 1.5F, 3);
|
||||
Part.shiftRotationPoint(rightArm, 0.5F, 1.5F, 3);
|
||||
} else {
|
||||
rotateArmHolding(leftArm, -1, getSwingAmount(), ticks);
|
||||
AbstractRenderer.shiftRotationPoint(leftArm, -0.5F, 1.5F, 3);
|
||||
Part.shiftRotationPoint(leftArm, -0.5F, 1.5F, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.entity.mob.ZombieVillagerEntity;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.IMobModel;
|
||||
import com.minelittlepony.client.util.render.AbstractRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
|
||||
public class ModelZombieVillagerPony extends ModelVillagerPony<ZombieVillagerEntity> implements IMobModel {
|
||||
|
||||
|
@ -15,10 +15,10 @@ public class ModelZombieVillagerPony extends ModelVillagerPony<ZombieVillagerEnt
|
|||
|
||||
if (islookAngleRight(move)) {
|
||||
rotateArmHolding(rightArm, 1, getSwingAmount(), ticks);
|
||||
AbstractRenderer.shiftRotationPoint(rightArm, 0.5F, 1.5F, 3);
|
||||
Part.shiftRotationPoint(rightArm, 0.5F, 1.5F, 3);
|
||||
} else {
|
||||
rotateArmHolding(leftArm, -1, getSwingAmount(), ticks);
|
||||
AbstractRenderer.shiftRotationPoint(leftArm, -0.5F, 1.5F, 3);
|
||||
Part.shiftRotationPoint(leftArm, -0.5F, 1.5F, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.minelittlepony.client.util.render.Color;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
@ -19,14 +19,14 @@ public class ChristmasHat extends AbstractGear {
|
|||
|
||||
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/antlers.png");
|
||||
|
||||
private PonyRenderer left;
|
||||
private PonyRenderer right;
|
||||
private Part left;
|
||||
private Part right;
|
||||
|
||||
private int tint;
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
left = new PonyRenderer(this, 0, 0).size(16, 8)
|
||||
left = new Part(this, 0, 0).size(16, 8)
|
||||
.around(-7, 0.5F, 0.5F)
|
||||
.offset(-7, 0, 0)
|
||||
.at(3, -4, 0)
|
||||
|
@ -35,7 +35,7 @@ public class ChristmasHat extends AbstractGear {
|
|||
.tex(4, 2).box(2, -1, 0, 1, 1, 1, stretch)
|
||||
.tex(8, 2).box(4, -1, 0, 1, 1, 1, stretch);
|
||||
|
||||
right = new PonyRenderer(this, 0, 4).size(16, 8)
|
||||
right = new Part(this, 0, 4).size(16, 8)
|
||||
.around(7, 0.5F, 0.5F)
|
||||
.offset(0, 0, 0)
|
||||
.at(-3, -4, 0)
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.client.model.gear;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
|
@ -15,11 +15,11 @@ public class Muffin extends AbstractGear implements IStackable {
|
|||
|
||||
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/muffin.png");
|
||||
|
||||
private PonyRenderer crown;
|
||||
private Part crown;
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
crown = new PonyRenderer(this, 0, 0).size(64, 44)
|
||||
crown = new Part(this, 0, 0).size(64, 44)
|
||||
.around(-4, -12, -6)
|
||||
.box(0, 0, 0, 8, 4, 8, stretch)
|
||||
.box(3, -1.5F, 3, 2, 2, 2, stretch)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
@ -18,10 +18,10 @@ public class SaddleBags extends AbstractGear {
|
|||
|
||||
public static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/saddlebags.png");
|
||||
|
||||
private PlaneRenderer leftBag;
|
||||
private PlaneRenderer rightBag;
|
||||
private Part leftBag;
|
||||
private Part rightBag;
|
||||
|
||||
private PlaneRenderer strap;
|
||||
private Part strap;
|
||||
|
||||
private boolean hangLow = false;
|
||||
|
||||
|
@ -32,9 +32,9 @@ public class SaddleBags extends AbstractGear {
|
|||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
leftBag = new PlaneRenderer(this, 56, 19);
|
||||
rightBag = new PlaneRenderer(this, 56, 19);
|
||||
strap = new PlaneRenderer(this, 56, 19);
|
||||
leftBag = new Part(this, 56, 19);
|
||||
rightBag = new Part(this, 56, 19);
|
||||
strap = new Part(this, 56, 19);
|
||||
|
||||
float y = -0.5F;
|
||||
int x = 4;
|
||||
|
|
|
@ -3,8 +3,7 @@ package com.minelittlepony.client.model.gear;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
|
@ -15,15 +14,15 @@ import java.util.UUID;
|
|||
public class Stetson extends AbstractGear implements IStackable {
|
||||
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/stetson.png");
|
||||
|
||||
private PlaneRenderer rimshot;
|
||||
private Part rimshot;
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
rimshot = new PlaneRenderer(this).size(64, 64)
|
||||
rimshot = new Part(this).size(64, 64)
|
||||
.tex(16, 33).top(-9, yOffset - 4, -12, 16, 17, stretch)
|
||||
.tex(0, 33).bottom(-9, yOffset - 3.999F, -12, 16, 17, stretch)
|
||||
.rotate(-0.3F, 0, 0.1F)
|
||||
.child(new PonyRenderer(this).size(64, 64)
|
||||
.child(new Part(this).size(64, 64)
|
||||
.tex(0, 0).box(-5, yOffset - 8, -6, 9, 4, 9, stretch)
|
||||
.tex(0, 13).box(-6, yOffset - 6, -7, 11, 2, 11, stretch));
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.client.model.gear;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
|
@ -15,7 +15,7 @@ public class WitchHat extends AbstractGear implements IStackable {
|
|||
|
||||
private static final Identifier WITCH_TEXTURES = new Identifier("textures/entity/witch.png");
|
||||
|
||||
private PonyRenderer witchHat;
|
||||
private Part witchHat;
|
||||
|
||||
@Override
|
||||
public void renderPart(float scale, UUID interpolatorId) {
|
||||
|
@ -24,7 +24,7 @@ public class WitchHat extends AbstractGear implements IStackable {
|
|||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
witchHat = new PonyRenderer(this).size(64, 128);
|
||||
witchHat = new Part(this).size(64, 128);
|
||||
witchHat.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.tex(0, 64).box(-5, -6, -7, 10, 2, 10, stretch)
|
||||
.child(0).around(1.75F, -4, 2)
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.entity.LivingEntity;
|
|||
|
||||
import com.minelittlepony.client.model.components.BatWings;
|
||||
import com.minelittlepony.client.model.components.PonyEars;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
|
||||
public class ModelBatpony<T extends LivingEntity> extends ModelPegasus<T> {
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class ModelBatpony<T extends LivingEntity> extends ModelPegasus<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void initEars(PonyRenderer head, float yOffset, float stretch) {
|
||||
protected void initEars(Part head, float yOffset, float stretch) {
|
||||
ears = new PonyEars(head, true);
|
||||
ears.init(yOffset, stretch);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.races;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
|
@ -9,7 +9,7 @@ public class ModelEarthPony<T extends LivingEntity> extends AbstractPonyModel<T>
|
|||
|
||||
private final boolean smallArms;
|
||||
|
||||
public PonyRenderer bipedCape;
|
||||
public Part bipedCape;
|
||||
|
||||
public ModelEarthPony(boolean smallArms) {
|
||||
super(smallArms);
|
||||
|
@ -44,7 +44,7 @@ public class ModelEarthPony<T extends LivingEntity> extends AbstractPonyModel<T>
|
|||
@Override
|
||||
protected void initHead(float yOffset, float stretch) {
|
||||
super.initHead(yOffset, stretch);
|
||||
bipedCape = new PonyRenderer(this, 0, 0)
|
||||
bipedCape = new Part(this, 0, 0)
|
||||
.size(64, 32).box(-5, 0, -1, 10, 16, 1, stretch);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.races;
|
||||
|
||||
import com.minelittlepony.client.model.components.UnicornHorn;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
|
@ -12,10 +12,10 @@ import net.minecraft.util.math.MathHelper;
|
|||
/**
|
||||
* Used for both unicorns and alicorns since there's no logical way to keep them distinct and not duplicate stuff.
|
||||
*/
|
||||
public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> implements IUnicorn<PonyRenderer> {
|
||||
public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> implements IUnicorn<Part> {
|
||||
|
||||
public PonyRenderer unicornArmRight;
|
||||
public PonyRenderer unicornArmLeft;
|
||||
public Part unicornArmRight;
|
||||
public Part unicornArmLeft;
|
||||
|
||||
public UnicornHorn horn;
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public PonyRenderer getUnicornArmForSide(Arm side) {
|
||||
public Part getUnicornArmForSide(Arm side) {
|
||||
return side == Arm.LEFT ? unicornArmLeft : unicornArmRight;
|
||||
}
|
||||
|
||||
|
@ -98,8 +98,8 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
|
|||
@Override
|
||||
protected void initLegs(float yOffset, float stretch) {
|
||||
super.initLegs(yOffset, stretch);
|
||||
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
|
||||
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
|
||||
unicornArmLeft = new Part(this, 40, 32).size(64, 64);
|
||||
unicornArmRight = new Part(this, 40, 32).size(64, 64);
|
||||
|
||||
int armLength = attributes.armLength;
|
||||
int armWidth = attributes.armWidth;
|
||||
|
|
|
@ -4,14 +4,14 @@ import net.minecraft.entity.LivingEntity;
|
|||
|
||||
import com.minelittlepony.client.model.armour.ModelPonyArmour;
|
||||
import com.minelittlepony.client.model.armour.ArmourWrapper;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
public class ModelZebra<T extends LivingEntity> extends ModelEarthPony<T> {
|
||||
|
||||
public PonyRenderer bristles;
|
||||
public Part bristles;
|
||||
|
||||
public ModelZebra(boolean useSmallArms) {
|
||||
super(useSmallArms);
|
||||
|
@ -37,7 +37,7 @@ public class ModelZebra<T extends LivingEntity> extends ModelEarthPony<T> {
|
|||
protected void initHead(float yOffset, float stretch) {
|
||||
super.initHead(yOffset, stretch);
|
||||
|
||||
bristles = new PonyRenderer(this, 56, 32);
|
||||
bristles = new Part(this, 56, 32);
|
||||
head.addChild(bristles);
|
||||
|
||||
bristles.offset(-1, -1, -3)
|
||||
|
|
|
@ -13,7 +13,7 @@ import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical;
|
|||
import com.minelittlepony.client.render.layer.LayerPonyArmor;
|
||||
import com.minelittlepony.client.render.layer.LayerPonyCustomHead;
|
||||
import com.minelittlepony.client.render.layer.LayerPonyElytra;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
@ -120,7 +120,7 @@ public abstract class RenderPonyMob<T extends MobEntity, M extends EntityModel<T
|
|||
return MineLittlePony.getInstance().getManager().getPony(findTexture(entity));
|
||||
}
|
||||
|
||||
public abstract static class Caster<T extends MobEntity, M extends ClientPonyModel<T> & IUnicorn<PonyRenderer>> extends RenderPonyMob<T, M> {
|
||||
public abstract static class Caster<T extends MobEntity, M extends ClientPonyModel<T> & IUnicorn<Part>> extends RenderPonyMob<T, M> {
|
||||
|
||||
public Caster(EntityRenderDispatcher manager, M model) {
|
||||
super(manager, model);
|
||||
|
|
|
@ -10,14 +10,14 @@ import net.minecraft.village.VillagerProfession;
|
|||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.render.entities.RenderPonyMob;
|
||||
import com.minelittlepony.client.render.layer.LayerGear;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
import com.minelittlepony.util.resources.ITextureSupplier;
|
||||
|
||||
abstract class AbstractVillagerRenderer<
|
||||
T extends MobEntity & VillagerDataContainer,
|
||||
M extends ClientPonyModel<T> & IUnicorn<PonyRenderer> & ModelWithHat> extends RenderPonyMob.Caster<T, M> {
|
||||
M extends ClientPonyModel<T> & IUnicorn<Part> & ModelWithHat> extends RenderPonyMob.Caster<T, M> {
|
||||
|
||||
private final ITextureSupplier<T> baseTextures;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.client.render.layer;
|
|||
import com.minelittlepony.client.PonyRenderManager;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.Part;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class LayerHeldPonyItemMagical<T extends LivingEntity, M extends EntityMo
|
|||
@Override
|
||||
protected void renderArm(Arm side) {
|
||||
if (isUnicorn()) {
|
||||
((IUnicorn<PonyRenderer>)getModel()).getUnicornArmForSide(side).applyTransform(0.0625F);
|
||||
((IUnicorn<Part>)getModel()).getUnicornArmForSide(side).applyTransform(0.0625F);
|
||||
} else {
|
||||
super.renderArm(side);
|
||||
}
|
||||
|
|
|
@ -1,211 +0,0 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public abstract class AbstractRenderer<T extends AbstractRenderer<T>> extends Cuboid {
|
||||
|
||||
protected final Model baseModel;
|
||||
|
||||
protected int textureOffsetX;
|
||||
protected int textureOffsetY;
|
||||
|
||||
protected float modelOffsetX;
|
||||
protected float modelOffsetY;
|
||||
protected float modelOffsetZ;
|
||||
|
||||
public AbstractRenderer(Model model) {
|
||||
super(model);
|
||||
baseModel = model;
|
||||
}
|
||||
|
||||
public AbstractRenderer(Model model, int texX, int texY) {
|
||||
super(model, texX, texY);
|
||||
baseModel = model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to create a new instance of this renderer (used for child renderers)
|
||||
*/
|
||||
protected abstract T copySelf();
|
||||
|
||||
@Override
|
||||
public T setTextureOffset(int x, int y) {
|
||||
this.textureOffsetX = x;
|
||||
this.textureOffsetY = y;
|
||||
super.setTextureOffset(x, y);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flips the mirror flag. All faces are mirrored until this is called again.
|
||||
*/
|
||||
public T flip() {
|
||||
return mirror(!mirror);
|
||||
}
|
||||
|
||||
public T mirror(boolean m) {
|
||||
mirror = m;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the texture offset
|
||||
*/
|
||||
public T tex(int x, int y) {
|
||||
return setTextureOffset(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the texture size for this renderer.
|
||||
*/
|
||||
public T size(int w, int h) {
|
||||
return (T) setTextureSize(w, h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Positions this model in space.
|
||||
*/
|
||||
public T at(float x, float y, float z) {
|
||||
return (T)at(this, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an offset to be used on all shapes and children created through this renderer.
|
||||
*/
|
||||
public T offset(float x, float y, float z) {
|
||||
modelOffsetX = x;
|
||||
modelOffsetY = y;
|
||||
modelOffsetZ = z;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the rotation center of the given renderer by the given amounts in each direction.
|
||||
*/
|
||||
public static void shiftRotationPoint(Cuboid renderer, float x, float y, float z) {
|
||||
renderer.rotationPointX += x;
|
||||
renderer.rotationPointY += y;
|
||||
renderer.rotationPointZ += z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this renderer's rotation angles.
|
||||
*/
|
||||
public T rotate(float x, float y, float z) {
|
||||
pitch = x;
|
||||
yaw = y;
|
||||
roll = z;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Positions a given model in space by setting its offset values divided
|
||||
* by 16 to account for scaling applied inside the model.
|
||||
*/
|
||||
public static <T extends Cuboid> T at(T renderer, float x, float y, float z) {
|
||||
renderer.x = x / 16;
|
||||
renderer.y = y / 16;
|
||||
renderer.z = z / 16;
|
||||
return renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates this model to align itself with the angles of another.
|
||||
*/
|
||||
public void rotateTo(Cuboid other) {
|
||||
rotate(other.pitch, other.yaw, other.roll);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts this model to align its center with the center of another.
|
||||
*/
|
||||
public T rotateAt(Cuboid other) {
|
||||
return around(other.rotationPointX, other.rotationPointY, other.rotationPointZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rotation point.
|
||||
*/
|
||||
public T around(float x, float y, float z) {
|
||||
setRotationPoint(x, y, z);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets or creates a new child model based on its unique index.
|
||||
* New children will be of the same type and inherit the same textures and offsets of the original.
|
||||
*/
|
||||
public T child(int index) {
|
||||
if (children == null || index >= children.size()) {
|
||||
return child();
|
||||
}
|
||||
return (T)children.get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a brand new child under this renderer.
|
||||
*/
|
||||
public T child() {
|
||||
T copy = copySelf();
|
||||
child(copy.offset(modelOffsetX, modelOffsetY, modelOffsetZ));
|
||||
copy.textureHeight = textureHeight;
|
||||
copy.textureWidth = textureWidth;
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new child renderer and returns itself for chaining.
|
||||
*/
|
||||
public <K extends Cuboid> T child(K child) {
|
||||
addChild(child);
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T addBox(String partName, float offX, float offY, float offZ, int width, int height, int depth, float unknown, int texX, int texY) {
|
||||
partName = name + "." + partName;
|
||||
|
||||
setTextureOffset(texX, texY);
|
||||
addBox(offX, offY, offZ, width, height, depth);
|
||||
boxes.get(boxes.size() - 1).setName(partName);
|
||||
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T addBox(float offX, float offY, float offZ, int width, int height, int depth) {
|
||||
addBox(offX, offY, offZ, width, height, depth, 0);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T addBox(float offX, float offY, float offZ, int width, int height, int depth, boolean mirrored) {
|
||||
addBox(offX, offY, offZ, width, height, depth, 0, mirrored);
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) {
|
||||
addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
|
||||
createBox(modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor, mirrored);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a textured box.
|
||||
*/
|
||||
public T box(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) {
|
||||
addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror);
|
||||
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
protected void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
|
||||
boxes.add(new Box<>(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, mirrored));
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
|
||||
public class Box<T extends Cuboid> extends net.minecraft.client.model.Box {
|
||||
|
||||
protected final T parent;
|
||||
|
||||
public Box(T renderer, int texU, int texV, float x, float y, float z, int dx, int dy, int dz, float delta) {
|
||||
super(renderer, texU, texV, x, y, z, dx, dy, dz, delta);
|
||||
parent = renderer;
|
||||
}
|
||||
|
||||
public Box(T renderer, int texU, int texV, float x, float y, float z, int dx, int dy, int dz, float delta, boolean mirror) {
|
||||
super(renderer, texU, texV, x, y, z, dx, dy, dz, delta, mirror);
|
||||
parent = renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new vertex mapping the given (x, y, z) coordinates to a texture offset.
|
||||
*/
|
||||
protected Vertex vert(float x, float y, float z, int texX, int texY) {
|
||||
return new Vertex(x, y, z, texX, texY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new quad with the given spacial vertices.
|
||||
*/
|
||||
protected Quad quad(int startX, int width, int startY, int height, Vertex ...verts) {
|
||||
return new Quad(verts,
|
||||
startX, startY,
|
||||
startX + width, startY + height,
|
||||
parent.textureWidth, parent.textureHeight);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.Box;
|
||||
import net.minecraft.client.model.Quad;
|
||||
import net.minecraft.client.model.Vertex;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
|
||||
class Cone extends Box {
|
||||
|
||||
private Quad[] polygons;
|
||||
|
||||
public Cone(Part renderer, int texX, int texY, float xMin, float yMin, float zMin, int w, int h, int d, float scale) {
|
||||
super(renderer, texX, texY, xMin, yMin, zMin, w, h, d, scale);
|
||||
|
||||
float xMax = xMin + w + scale;
|
||||
float yMax = yMin + h + scale;
|
||||
float zMax = zMin + d + scale;
|
||||
|
||||
xMin -= scale;
|
||||
yMin -= scale;
|
||||
zMin -= scale;
|
||||
|
||||
if (renderer.mirror) {
|
||||
float v = xMax;
|
||||
xMax = xMin;
|
||||
xMin = v;
|
||||
}
|
||||
|
||||
float tipInset = 0.4f;
|
||||
|
||||
float tipXmin = xMin + w * tipInset;
|
||||
float tipZmin = zMin + d * tipInset;
|
||||
float tipXMax = xMax - w * tipInset;
|
||||
float tipZMax = zMax - d * tipInset;
|
||||
|
||||
// w:west e:east d:down u:up s:south n:north
|
||||
Vertex wds = renderer.vert(tipXmin, yMin, tipZmin, 0, 0);
|
||||
Vertex eds = renderer.vert(tipXMax, yMin, tipZmin, 0, 8);
|
||||
Vertex eus = renderer.vert(xMax, yMax, zMin, 8, 8);
|
||||
Vertex wus = renderer.vert(xMin, yMax, zMin, 8, 0);
|
||||
Vertex wdn = renderer.vert(tipXmin, yMin, tipZMax, 0, 0);
|
||||
Vertex edn = renderer.vert(tipXMax, yMin, tipZMax, 0, 8);
|
||||
Vertex eun = renderer.vert(xMax, yMax, zMax, 8, 8);
|
||||
Vertex wun = renderer.vert(xMin, yMax, zMax, 8, 0);
|
||||
|
||||
polygons = new Quad[] {
|
||||
renderer.quad(texX + d + w, d, texY + d, h, edn, eds, eus, eun),
|
||||
renderer.quad(texX, d, texY + d, h, wds, wdn, wun, wus),
|
||||
renderer.quad(texX + d, w, texY, d, edn, wdn, wds, eds),
|
||||
renderer.quad(texX + d + w, w, texY + d, -d, eus, wus, wun, eun),
|
||||
renderer.quad(texX + d, w, texY + d, h, eds, wds, wus, eus),
|
||||
renderer.quad(texX + d + w + d, w, texY + d, h, wdn, edn, eun, wun)
|
||||
};
|
||||
|
||||
if (renderer.mirror) {
|
||||
for (Quad i : polygons) {
|
||||
i.flip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(BufferBuilder buffer, float scale) {
|
||||
for (Quad i : polygons) {
|
||||
i.render(buffer, scale);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
public class GlowRenderer extends AbstractRenderer<GlowRenderer> {
|
||||
public GlowRenderer(Model model, int x, int y) {
|
||||
super(model, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
|
||||
boxes.add(new HornGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GlowRenderer copySelf() {
|
||||
return new GlowRenderer(baseModel, textureOffsetX, textureOffsetY);
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
|
||||
/**
|
||||
* Like a normal box, but with the top narrowed a bit.
|
||||
*/
|
||||
public class HornGlow extends Box<GlowRenderer> {
|
||||
|
||||
private Quad[] polygons;
|
||||
|
||||
public HornGlow(GlowRenderer renderer, int texX, int texY, float xMin, float yMin, float zMin, int w, int h, int d, float scale) {
|
||||
super(renderer, texX, texY, xMin, yMin, zMin, w, h, d, scale);
|
||||
|
||||
float xMax = xMin + w + scale;
|
||||
float yMax = yMin + h + scale;
|
||||
float zMax = zMin + d + scale;
|
||||
|
||||
xMin -= scale;
|
||||
yMin -= scale;
|
||||
zMin -= scale;
|
||||
|
||||
if (renderer.mirror) {
|
||||
float v = xMax;
|
||||
xMax = xMin;
|
||||
xMin = v;
|
||||
}
|
||||
|
||||
float tipInset = 0.4f;
|
||||
|
||||
float tipXmin = xMin + w * tipInset;
|
||||
float tipZmin = zMin + d * tipInset;
|
||||
float tipXMax = xMax - w * tipInset;
|
||||
float tipZMax = zMax - d * tipInset;
|
||||
|
||||
// w:west e:east d:down u:up s:south n:north
|
||||
Vertex wds = vert(tipXmin, yMin, tipZmin, 0, 0);
|
||||
Vertex eds = vert(tipXMax, yMin, tipZmin, 0, 8);
|
||||
Vertex eus = vert(xMax, yMax, zMin, 8, 8);
|
||||
Vertex wus = vert(xMin, yMax, zMin, 8, 0);
|
||||
Vertex wdn = vert(tipXmin, yMin, tipZMax, 0, 0);
|
||||
Vertex edn = vert(tipXMax, yMin, tipZMax, 0, 8);
|
||||
Vertex eun = vert(xMax, yMax, zMax, 8, 8);
|
||||
Vertex wun = vert(xMin, yMax, zMax, 8, 0);
|
||||
|
||||
polygons = new Quad[] {
|
||||
quad(texX + d + w, d, texY + d, h, edn, eds, eus, eun),
|
||||
quad(texX, d, texY + d, h, wds, wdn, wun, wus),
|
||||
quad(texX + d, w, texY, d, edn, wdn, wds, eds),
|
||||
quad(texX + d + w, w, texY + d, -d, eus, wus, wun, eun),
|
||||
quad(texX + d, w, texY + d, h, eds, wds, wus, eus),
|
||||
quad(texX + d + w + d, w, texY + d, h, wdn, edn, eun, wun)
|
||||
};
|
||||
|
||||
if (renderer.mirror) {
|
||||
for (Quad i : polygons) {
|
||||
i.flip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(BufferBuilder buffer, float scale) {
|
||||
for (Quad i : polygons) {
|
||||
i.render(buffer, scale);
|
||||
}
|
||||
}
|
||||
}
|
288
src/main/java/com/minelittlepony/client/util/render/Part.java
Normal file
288
src/main/java/com/minelittlepony/client/util/render/Part.java
Normal file
|
@ -0,0 +1,288 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.Box;
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.model.Model;
|
||||
import net.minecraft.client.model.Quad;
|
||||
import net.minecraft.client.model.Vertex;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
public class Part extends Cuboid {
|
||||
|
||||
protected final Model baseModel;
|
||||
|
||||
protected int textureOffsetX;
|
||||
protected int textureOffsetY;
|
||||
|
||||
protected float modelOffsetX;
|
||||
protected float modelOffsetY;
|
||||
protected float modelOffsetZ;
|
||||
|
||||
public boolean mirrory;
|
||||
public boolean mirrorz;
|
||||
|
||||
public Part(Model model) {
|
||||
super(model);
|
||||
baseModel = model;
|
||||
}
|
||||
|
||||
public Part(Model model, int texX, int texY) {
|
||||
super(model, texX, texY);
|
||||
baseModel = model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to create a new instance of this renderer (used for child renderers)
|
||||
*/
|
||||
protected Part copySelf() {
|
||||
return new Part(baseModel, textureOffsetX, textureOffsetY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Part setTextureOffset(int x, int y) {
|
||||
this.textureOffsetX = x;
|
||||
this.textureOffsetY = y;
|
||||
super.setTextureOffset(x, y);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flips the mirror flag. All faces are mirrored until this is called again.
|
||||
*/
|
||||
public Part flip() {
|
||||
return mirror(!mirror);
|
||||
}
|
||||
|
||||
public Part mirror(boolean m) {
|
||||
mirror = m;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the texture offset
|
||||
*/
|
||||
public Part tex(int x, int y) {
|
||||
return setTextureOffset(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the texture size for this renderer.
|
||||
*/
|
||||
public Part size(int w, int h) {
|
||||
return (Part)setTextureSize(w, h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Positions this model in space.
|
||||
*/
|
||||
public Part at(float x, float y, float z) {
|
||||
return at(this, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an offset to be used on all shapes and children created through this renderer.
|
||||
*/
|
||||
public Part offset(float x, float y, float z) {
|
||||
modelOffsetX = x;
|
||||
modelOffsetY = y;
|
||||
modelOffsetZ = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the rotation center of the given renderer by the given amounts in each direction.
|
||||
*/
|
||||
public static void shiftRotationPoint(Cuboid renderer, float x, float y, float z) {
|
||||
renderer.rotationPointX += x;
|
||||
renderer.rotationPointY += y;
|
||||
renderer.rotationPointZ += z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this renderer's rotation angles.
|
||||
*/
|
||||
public Part rotate(float x, float y, float z) {
|
||||
pitch = x;
|
||||
yaw = y;
|
||||
roll = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Positions a given model in space by setting its offset values divided
|
||||
* by 16 to account for scaling applied inside the model.
|
||||
*/
|
||||
public static <T extends Cuboid> T at(T renderer, float x, float y, float z) {
|
||||
renderer.x = x / 16;
|
||||
renderer.y = y / 16;
|
||||
renderer.z = z / 16;
|
||||
return renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates this model to align itself with the angles of another.
|
||||
*/
|
||||
public void rotateTo(Cuboid other) {
|
||||
rotate(other.pitch, other.yaw, other.roll);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts this model to align its center with the center of another.
|
||||
*/
|
||||
public Part rotateAt(Cuboid other) {
|
||||
return around(other.rotationPointX, other.rotationPointY, other.rotationPointZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rotation point.
|
||||
*/
|
||||
public Part around(float x, float y, float z) {
|
||||
setRotationPoint(x, y, z);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets or creates a new child model based on its unique index.
|
||||
* New children will be of the same type and inherit the same textures and offsets of the original.
|
||||
*/
|
||||
public Part child(int index) {
|
||||
if (children == null || index >= children.size()) {
|
||||
return child();
|
||||
}
|
||||
return (Part)children.get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a brand new child under this renderer.
|
||||
*/
|
||||
public Part child() {
|
||||
Part copy = copySelf();
|
||||
child(copy.offset(modelOffsetX, modelOffsetY, modelOffsetZ));
|
||||
copy.textureHeight = textureHeight;
|
||||
copy.textureWidth = textureWidth;
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new child renderer and returns itself for chaining.
|
||||
*/
|
||||
public <K extends Cuboid> Part child(K child) {
|
||||
addChild(child);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flips the Z bit. Any calls to add a plane will be mirrored until this is called again.
|
||||
*/
|
||||
public Part flipZ() {
|
||||
mirrorz = !mirrorz;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flips the Y bit. Any calls to add a plane will be mirrored until this is called again.
|
||||
*/
|
||||
public Part flipY() {
|
||||
mirrory = !mirrory;
|
||||
return this;
|
||||
}
|
||||
|
||||
private Part addPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale, Direction face) {
|
||||
boxes.add(new Plane(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scale, face));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Part top(float offX, float offY, float offZ, int width, int depth, float scale) {
|
||||
return addPlane(offX, offY, offZ, width, 0, depth, scale, Direction.UP);
|
||||
}
|
||||
|
||||
public Part bottom(float offX, float offY, float offZ, int width, int depth, float scale) {
|
||||
return addPlane(offX, offY, offZ, width, 0, depth, scale, Direction.DOWN);
|
||||
}
|
||||
|
||||
public Part west(float offX, float offY, float offZ, int height, int depth, float scale) {
|
||||
return addPlane(offX, offY, offZ, 0, height, depth, scale, Direction.WEST);
|
||||
}
|
||||
|
||||
public Part east(float offX, float offY, float offZ, int height, int depth, float scale) {
|
||||
return addPlane(offX, offY, offZ, 0, height, depth, scale, Direction.EAST);
|
||||
}
|
||||
|
||||
public Part north(float offX, float offY, float offZ, int width, int height, float scale) {
|
||||
return addPlane(offX, offY, offZ - scale * 2, width, height, 0, scale, Direction.NORTH);
|
||||
}
|
||||
|
||||
public Part south(float offX, float offY, float offZ, int width, int height, float scale) {
|
||||
return addPlane(offX, offY, offZ + scale * 2, width, height, 0, scale, Direction.SOUTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Part addBox(String partName, float offX, float offY, float offZ, int width, int height, int depth, float unknown, int texX, int texY) {
|
||||
partName = name + "." + partName;
|
||||
|
||||
setTextureOffset(texX, texY);
|
||||
addBox(offX, offY, offZ, width, height, depth);
|
||||
boxes.get(boxes.size() - 1).setName(partName);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Part addBox(float offX, float offY, float offZ, int width, int height, int depth) {
|
||||
addBox(offX, offY, offZ, width, height, depth, 0);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Part addBox(float offX, float offY, float offZ, int width, int height, int depth, boolean mirrored) {
|
||||
addBox(offX, offY, offZ, width, height, depth, 0, mirrored);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) {
|
||||
addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
|
||||
createBox(offX, offY, offZ, width, height, depth, scaleFactor, mirrored);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a textured box.
|
||||
*/
|
||||
public Part box(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) {
|
||||
addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Part cone(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) {
|
||||
boxes.add(new Cone(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
|
||||
boxes.add(new Box(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor, mirrored));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new vertex mapping the given (x, y, z) coordinates to a texture offset.
|
||||
*/
|
||||
Vertex vert(float x, float y, float z, int texX, int texY) {
|
||||
return new Vertex(x, y, z, texX, texY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new quad with the given spacial vertices.
|
||||
*/
|
||||
Quad quad(int startX, int width, int startY, int height, Vertex ...verts) {
|
||||
return new Quad(verts,
|
||||
startX, startY,
|
||||
startX + width, startY + height,
|
||||
textureWidth, textureHeight);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.Box;
|
||||
import net.minecraft.client.model.Quad;
|
||||
import net.minecraft.client.model.Vertex;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
class Plane extends Box {
|
||||
|
||||
private Quad quad;
|
||||
|
||||
public Plane(Part renderer, int textureX, int textureY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, Direction face) {
|
||||
super(renderer, textureX, textureY, xMin, yMin, zMin, w, h, d, scale, false);
|
||||
|
||||
float xMax = xMin + w + scale;
|
||||
float yMax = yMin + h + scale;
|
||||
float zMax = zMin + d + scale;
|
||||
|
||||
xMin -= scale;
|
||||
yMin -= scale;
|
||||
zMin -= scale;
|
||||
|
||||
if (renderer.mirror) {
|
||||
float v = xMax;
|
||||
xMax = xMin;
|
||||
xMin = v;
|
||||
}
|
||||
|
||||
if (renderer.mirrory) {
|
||||
float v = yMax;
|
||||
yMax = yMin;
|
||||
yMin = v;
|
||||
}
|
||||
|
||||
if (renderer.mirrorz) {
|
||||
float v = zMax;
|
||||
zMax = zMin;
|
||||
zMin = v;
|
||||
}
|
||||
|
||||
// w:west e:east d:down u:up s:south n:north
|
||||
Vertex wds = renderer.vert(xMin, yMin, zMin, 0, 0);
|
||||
Vertex eds = renderer.vert(xMax, yMin, zMin, 0, 8);
|
||||
Vertex eus = renderer.vert(xMax, yMax, zMin, 8, 8);
|
||||
Vertex wus = renderer.vert(xMin, yMax, zMin, 8, 0);
|
||||
Vertex wdn = renderer.vert(xMin, yMin, zMax, 0, 0);
|
||||
Vertex edn = renderer.vert(xMax, yMin, zMax, 0, 8);
|
||||
Vertex eun = renderer.vert(xMax, yMax, zMax, 8, 8);
|
||||
Vertex wun = renderer.vert(xMin, yMax, zMax, 8, 0);
|
||||
|
||||
if (face == Direction.EAST) {
|
||||
quad = renderer.quad(textureX, d, textureY, h, edn, eds, eus, eun);
|
||||
}
|
||||
if (face == Direction.WEST) {
|
||||
quad = renderer.quad(textureX, d, textureY, h, wds, wdn, wun, wus);
|
||||
}
|
||||
if (face == Direction.UP) {
|
||||
quad = renderer.quad(textureX, w, textureY, d, edn, wdn, wds, eds);
|
||||
}
|
||||
if (face == Direction.DOWN) {
|
||||
quad = renderer.quad(textureX, w, textureY, d, eus, wus, wun, eun);
|
||||
}
|
||||
if (face == Direction.SOUTH) {
|
||||
quad = renderer.quad(textureX, w, textureY, h, eds, wds, wus, eus);
|
||||
}
|
||||
if (face == Direction.NORTH) {
|
||||
quad = renderer.quad(textureX, w, textureY, h, wdn, edn, eun, wun);
|
||||
}
|
||||
|
||||
if (renderer.mirror || renderer.mirrory || renderer.mirrorz) {
|
||||
quad.flip();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull BufferBuilder buffer, float scale) {
|
||||
quad.render(buffer, scale);
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
public class PonyRenderer extends AbstractRenderer<PonyRenderer> {
|
||||
|
||||
public PonyRenderer(Model model) {
|
||||
super(model);
|
||||
}
|
||||
|
||||
public PonyRenderer(Model model, int texX, int texY) {
|
||||
super(model, texX, texY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PonyRenderer copySelf() {
|
||||
return new PonyRenderer(baseModel, textureOffsetX, textureOffsetY);
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
public class Quad extends net.minecraft.client.model.Quad {
|
||||
|
||||
Quad(Vertex[] vertices, int texcoordU1, int texcoordV1, int texcoordU2, int texcoordV2, float textureWidth, float textureHeight) {
|
||||
super(vertices, texcoordU1, texcoordV1, texcoordU2, texcoordV2, textureWidth, textureHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverses the order of the vertices belonging to this quad.
|
||||
* Positions of the vertices stay the same but the order of rendering is reversed to go counter-clockwise.
|
||||
*
|
||||
* Reversal also affects the cross-product used to calculate texture orientation.
|
||||
* <pre>
|
||||
* Normal:
|
||||
* 0-----1
|
||||
* |\ |
|
||||
* | \ |
|
||||
* | \|
|
||||
* 3-----2
|
||||
*
|
||||
* After flipFace:
|
||||
*
|
||||
* 3-----2
|
||||
* | /|
|
||||
* | / |
|
||||
* |/ |
|
||||
* 0-----1
|
||||
* </pre>
|
||||
*/
|
||||
@Override
|
||||
public void flip() {
|
||||
super.flip();
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.minelittlepony.client.util.render;
|
||||
|
||||
public class Vertex extends net.minecraft.client.model.Vertex {
|
||||
|
||||
public Vertex(float x, float y, float z, float texX, float texY) {
|
||||
super(x, y, z, texX, texY);
|
||||
}
|
||||
|
||||
private Vertex(Vertex old, float texX, float texY) {
|
||||
super(old, texX, texY);
|
||||
}
|
||||
|
||||
// The MCP name is misleading.
|
||||
// This is meant to return a COPY with the given texture position
|
||||
@Override
|
||||
public Vertex remap(float texX, float texY) {
|
||||
return new Vertex(this, texX, texY);
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
package com.minelittlepony.client.util.render.plane;
|
||||
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import com.minelittlepony.client.util.render.Box;
|
||||
import com.minelittlepony.client.util.render.Quad;
|
||||
import com.minelittlepony.client.util.render.Vertex;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ModelPlane extends Box<PlaneRenderer> {
|
||||
|
||||
private Quad quad;
|
||||
|
||||
public boolean hidden = false;
|
||||
|
||||
public ModelPlane(PlaneRenderer renderer, int textureX, int textureY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, Direction face) {
|
||||
super(renderer, textureX, textureY, xMin, yMin, zMin, w, h, d, scale, false);
|
||||
|
||||
float xMax = xMin + w + scale;
|
||||
float yMax = yMin + h + scale;
|
||||
float zMax = zMin + d + scale;
|
||||
|
||||
xMin -= scale;
|
||||
yMin -= scale;
|
||||
zMin -= scale;
|
||||
|
||||
if (renderer.mirror) {
|
||||
float v = xMax;
|
||||
xMax = xMin;
|
||||
xMin = v;
|
||||
}
|
||||
|
||||
if (renderer.mirrory) {
|
||||
float v = yMax;
|
||||
yMax = yMin;
|
||||
yMin = v;
|
||||
}
|
||||
|
||||
if (renderer.mirrorz) {
|
||||
float v = zMax;
|
||||
zMax = zMin;
|
||||
zMin = v;
|
||||
}
|
||||
|
||||
// w:west e:east d:down u:up s:south n:north
|
||||
Vertex wds = vert(xMin, yMin, zMin, 0, 0);
|
||||
Vertex eds = vert(xMax, yMin, zMin, 0, 8);
|
||||
Vertex eus = vert(xMax, yMax, zMin, 8, 8);
|
||||
Vertex wus = vert(xMin, yMax, zMin, 8, 0);
|
||||
Vertex wdn = vert(xMin, yMin, zMax, 0, 0);
|
||||
Vertex edn = vert(xMax, yMin, zMax, 0, 8);
|
||||
Vertex eun = vert(xMax, yMax, zMax, 8, 8);
|
||||
Vertex wun = vert(xMin, yMax, zMax, 8, 0);
|
||||
|
||||
if (face == Direction.EAST) {
|
||||
quad = quad(textureX, d, textureY, h, edn, eds, eus, eun);
|
||||
}
|
||||
if (face == Direction.WEST) {
|
||||
quad = quad(textureX, d, textureY, h, wds, wdn, wun, wus);
|
||||
}
|
||||
if (face == Direction.UP) {
|
||||
quad = quad(textureX, w, textureY, d, edn, wdn, wds, eds);
|
||||
}
|
||||
if (face == Direction.DOWN) {
|
||||
quad = quad(textureX, w, textureY, d, eus, wus, wun, eun);
|
||||
}
|
||||
if (face == Direction.SOUTH) {
|
||||
quad = quad(textureX, w, textureY, h, eds, wds, wus, eus);
|
||||
}
|
||||
if (face == Direction.NORTH) {
|
||||
quad = quad(textureX, w, textureY, h, wdn, edn, eun, wun);
|
||||
}
|
||||
|
||||
if (renderer.mirror || renderer.mirrory || renderer.mirrorz) {
|
||||
quad.flip();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull BufferBuilder buffer, float scale) {
|
||||
if (!hidden) {
|
||||
quad.render(buffer, scale);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package com.minelittlepony.client.util.render.plane;
|
||||
|
||||
import net.minecraft.client.model.Model;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import com.minelittlepony.client.util.render.AbstractRenderer;
|
||||
|
||||
public class PlaneRenderer extends AbstractRenderer<PlaneRenderer> {
|
||||
|
||||
public boolean mirrory, mirrorz;
|
||||
|
||||
public PlaneRenderer(Model model) {
|
||||
super(model);
|
||||
}
|
||||
|
||||
public PlaneRenderer(Model model, int x, int y) {
|
||||
super(model, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flips the Z bit. Any calls to add a plane will be mirrored until this is called again.
|
||||
*/
|
||||
public PlaneRenderer flipZ() {
|
||||
mirrorz = !mirrorz;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flips the Y bit. Any calls to add a plane will be mirrored until this is called again.
|
||||
*/
|
||||
public PlaneRenderer flipY() {
|
||||
mirrory = !mirrory;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlaneRenderer copySelf() {
|
||||
return new PlaneRenderer(baseModel, textureOffsetX, textureOffsetY);
|
||||
}
|
||||
|
||||
private PlaneRenderer addPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale, Direction face) {
|
||||
boxes.add(new ModelPlane(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scale, face));
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlaneRenderer top(float offX, float offY, float offZ, int width, int depth, float scale) {
|
||||
return addPlane(offX, offY, offZ, width, 0, depth, scale, Direction.UP);
|
||||
}
|
||||
|
||||
public PlaneRenderer bottom(float offX, float offY, float offZ, int width, int depth, float scale) {
|
||||
return addPlane(offX, offY, offZ, width, 0, depth, scale, Direction.DOWN);
|
||||
}
|
||||
|
||||
public PlaneRenderer west(float offX, float offY, float offZ, int height, int depth, float scale) {
|
||||
return addPlane(offX, offY, offZ, 0, height, depth, scale, Direction.WEST);
|
||||
}
|
||||
|
||||
public PlaneRenderer east(float offX, float offY, float offZ, int height, int depth, float scale) {
|
||||
return addPlane(offX, offY, offZ, 0, height, depth, scale, Direction.EAST);
|
||||
}
|
||||
|
||||
public PlaneRenderer north(float offX, float offY, float offZ, int width, int height, float scale) {
|
||||
return addPlane(offX, offY, offZ - scale * 2, width, height, 0, scale, Direction.NORTH);
|
||||
}
|
||||
|
||||
public PlaneRenderer south(float offX, float offY, float offZ, int width, int height, float scale) {
|
||||
return addPlane(offX, offY, offZ + scale * 2, width, height, 0, scale, Direction.SOUTH);
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.client.util.render.plane;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
Loading…
Reference in a new issue