From de082acaead42ad7137b9010623855374cb1895d Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 7 Nov 2019 15:53:20 +0200 Subject: [PATCH] Clean up the PonyRenderers --- .../client/model/AbstractPonyModel.java | 34 +-- .../client/model/armour/ModelPonyArmour.java | 23 +- .../client/model/components/BatWings.java | 4 +- .../client/model/components/BugWings.java | 6 +- .../model/components/ModelPonyHead.java | 6 +- .../client/model/components/PegasusWings.java | 12 +- .../client/model/components/PonyEars.java | 10 +- .../client/model/components/PonyElytra.java | 6 +- .../client/model/components/PonySnout.java | 10 +- .../client/model/components/PonyTail.java | 6 +- .../client/model/components/SeaponyTail.java | 15 +- .../client/model/components/UnicornHorn.java | 18 +- .../client/model/entities/ModelBreezie.java | 50 +-- .../model/entities/ModelEnderStallion.java | 14 +- .../model/entities/ModelGuardianPony.java | 4 +- .../client/model/entities/ModelSeapony.java | 19 +- .../model/entities/ModelVillagerPony.java | 13 +- .../model/entities/ModelZombiePony.java | 6 +- .../entities/ModelZombieVillagerPony.java | 6 +- .../client/model/gear/ChristmasHat.java | 10 +- .../client/model/gear/Muffin.java | 6 +- .../client/model/gear/SaddleBags.java | 14 +- .../client/model/gear/Stetson.java | 9 +- .../client/model/gear/WitchHat.java | 6 +- .../client/model/races/ModelBatpony.java | 4 +- .../client/model/races/ModelEarthPony.java | 6 +- .../client/model/races/ModelUnicorn.java | 14 +- .../client/model/races/ModelZebra.java | 6 +- .../client/render/entities/RenderPonyMob.java | 4 +- .../villager/AbstractVillagerRenderer.java | 4 +- .../layer/LayerHeldPonyItemMagical.java | 4 +- .../client/util/render/AbstractRenderer.java | 211 ------------- .../client/util/render/Box.java | 35 --- .../client/util/render/Cone.java | 68 +++++ .../client/util/render/GlowRenderer.java | 19 -- .../client/util/render/HornGlow.java | 68 ----- .../client/util/render/Part.java | 288 ++++++++++++++++++ .../client/util/render/Plane.java | 82 +++++ .../client/util/render/PonyRenderer.java | 19 -- .../client/util/render/Quad.java | 35 --- .../client/util/render/Vertex.java | 19 -- .../client/util/render/plane/ModelPlane.java | 87 ------ .../util/render/plane/PlaneRenderer.java | 69 ----- .../util/render/plane/package-info.java | 4 - 44 files changed, 609 insertions(+), 744 deletions(-) delete mode 100644 src/main/java/com/minelittlepony/client/util/render/AbstractRenderer.java delete mode 100644 src/main/java/com/minelittlepony/client/util/render/Box.java create mode 100644 src/main/java/com/minelittlepony/client/util/render/Cone.java delete mode 100644 src/main/java/com/minelittlepony/client/util/render/GlowRenderer.java delete mode 100644 src/main/java/com/minelittlepony/client/util/render/HornGlow.java create mode 100644 src/main/java/com/minelittlepony/client/util/render/Part.java create mode 100644 src/main/java/com/minelittlepony/client/util/render/Plane.java delete mode 100644 src/main/java/com/minelittlepony/client/util/render/PonyRenderer.java delete mode 100644 src/main/java/com/minelittlepony/client/util/render/Quad.java delete mode 100644 src/main/java/com/minelittlepony/client/util/render/Vertex.java delete mode 100644 src/main/java/com/minelittlepony/client/util/render/plane/ModelPlane.java delete mode 100644 src/main/java/com/minelittlepony/client/util/render/plane/PlaneRenderer.java delete mode 100644 src/main/java/com/minelittlepony/client/util/render/plane/package-info.java diff --git a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java index 2eba9455..877ee345 100644 --- a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java @@ -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 extends ClientPonyModel { - 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 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 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 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 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 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 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 diff --git a/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java b/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java index d9e6a347..5bb331e9 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java +++ b/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java @@ -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 extends AbstractPonyModel implements IArmour { - public PonyRenderer chestPiece; + public Part chestPiece; public Cuboid steveRightLeg; public Cuboid steveLeftLeg; @@ -74,7 +73,7 @@ public class ModelPonyArmour extends AbstractPonyModel extends AbstractPonyModel extends AbstractPonyModel extends PegasusWings { .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); diff --git a/src/main/java/com/minelittlepony/client/model/components/BugWings.java b/src/main/java/com/minelittlepony/client/model/components/BugWings.java index fcbe3d7b..c098ab9a 100644 --- a/src/main/java/com/minelittlepony/client/model/components/BugWings.java +++ b/src/main/java/com/minelittlepony/client/model/components/BugWings.java @@ -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 extends PegasusWings { @@ -37,11 +37,11 @@ public class BugWings extends PegasusWings { .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) diff --git a/src/main/java/com/minelittlepony/client/model/components/ModelPonyHead.java b/src/main/java/com/minelittlepony/client/model/components/ModelPonyHead.java index b6f83543..0d6ec0b4 100644 --- a/src/main/java/com/minelittlepony/client/model/components/ModelPonyHead.java +++ b/src/main/java/com/minelittlepony/client/model/components/ModelPonyHead.java @@ -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); diff --git a/src/main/java/com/minelittlepony/client/model/components/PegasusWings.java b/src/main/java/com/minelittlepony/client/model/components/PegasusWings.java index 9f9747e8..52d94703 100644 --- a/src/main/java/com/minelittlepony/client/model/components/PegasusWings.java +++ b/src/main/java/com/minelittlepony/client/model/components/PegasusWings.java @@ -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 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 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); } diff --git a/src/main/java/com/minelittlepony/client/model/components/PonyEars.java b/src/main/java/com/minelittlepony/client/model/components/PonyEars.java index fe2b5459..08a3268a 100644 --- a/src/main/java/com/minelittlepony/client/model/components/PonyEars.java +++ b/src/main/java/com/minelittlepony/client/model/components/PonyEars.java @@ -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 > PonyEars(PonyRenderer head, boolean bat) { + public > PonyEars(Part head, boolean bat) { this.head = head; this.bat = bat; } diff --git a/src/main/java/com/minelittlepony/client/model/components/PonyElytra.java b/src/main/java/com/minelittlepony/client/model/components/PonyElytra.java index 18779f18..c36488c4 100644 --- a/src/main/java/com/minelittlepony/client/model/components/PonyElytra.java +++ b/src/main/java/com/minelittlepony/client/model/components/PonyElytra.java @@ -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 extends EntityModel { 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); diff --git a/src/main/java/com/minelittlepony/client/model/components/PonySnout.java b/src/main/java/com/minelittlepony/client/model/components/PonySnout.java index 436ab9b9..8bd5c21f 100644 --- a/src/main/java/com/minelittlepony/client/model/components/PonySnout.java +++ b/src/main/java/com/minelittlepony/client/model/components/PonySnout.java @@ -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 head; @@ -27,8 +27,8 @@ public class PonySnout implements IPart { public > 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); diff --git a/src/main/java/com/minelittlepony/client/model/components/PonyTail.java b/src/main/java/com/minelittlepony/client/model/components/PonyTail.java index 6e9bbea3..3faa73b3 100644 --- a/src/main/java/com/minelittlepony/client/model/components/PonyTail.java +++ b/src/main/java/com/minelittlepony/client/model/components/PonyTail.java @@ -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; diff --git a/src/main/java/com/minelittlepony/client/model/components/SeaponyTail.java b/src/main/java/com/minelittlepony/client/model/components/SeaponyTail.java index 047bf5c9..08a988fc 100644 --- a/src/main/java/com/minelittlepony/client/model/components/SeaponyTail.java +++ b/src/main/java/com/minelittlepony/client/model/components/SeaponyTail.java @@ -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); diff --git a/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java b/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java index 08fbf12e..c7bcac49 100644 --- a/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java +++ b/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java @@ -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 > 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(); diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelBreezie.java b/src/main/java/com/minelittlepony/client/model/entities/ModelBreezie.java index 5833691c..6cd8d565 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelBreezie.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelBreezie.java @@ -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 extends BipedEntityModel { - 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 extends BipedEntityModel { 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 extends BipedEntityModel { } } - protected void rotateLegRiding(PonyRenderer leg, float factor) { + protected void rotateLegRiding(Part leg, float factor) { leg.rotate(-1.4137167F, factor * PI / 10, factor * 0.07853982F); } diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java b/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java index ee20c0df..98b646bc 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java @@ -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 { 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 { @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 { .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 { .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); diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelGuardianPony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelGuardianPony.java index e45f3c5a..b0da79dc 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelGuardianPony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelGuardianPony.java @@ -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, PonyRenderer> { +public class ModelGuardianPony extends GuardianEntityModel implements IPonyMixinModel.Caster, Part> { private final ModelSeapony mixin = new ModelSeapony<>(); @Override diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java index 047b991f..0e6ef7e0 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java @@ -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 extends ModelUnicorn { - 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 extends ModelUnicorn { 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 extends ModelUnicorn { @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(); } diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java index 101b5707..5c0732ac 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java @@ -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 extends ModelAlicorn implements ModelWithHat { - private PlaneRenderer apron; - private PlaneRenderer trinket; + private Part apron; + private Part trinket; private IPart batWings; @@ -42,7 +41,7 @@ public class ModelVillagerPony 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 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); diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelZombiePony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelZombiePony.java index c4a08331..d4425b61 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelZombiePony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelZombiePony.java @@ -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 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); } } diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelZombieVillagerPony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelZombieVillagerPony.java index 89169279..6b0ee6ed 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelZombieVillagerPony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelZombieVillagerPony.java @@ -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 implements IMobModel { @@ -15,10 +15,10 @@ public class ModelZombieVillagerPony extends ModelVillagerPony extends ModelPegasus { @@ -18,7 +18,7 @@ public class ModelBatpony extends ModelPegasus { } @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); } diff --git a/src/main/java/com/minelittlepony/client/model/races/ModelEarthPony.java b/src/main/java/com/minelittlepony/client/model/races/ModelEarthPony.java index 5919a289..1dbf5a50 100644 --- a/src/main/java/com/minelittlepony/client/model/races/ModelEarthPony.java +++ b/src/main/java/com/minelittlepony/client/model/races/ModelEarthPony.java @@ -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 extends AbstractPonyModel private final boolean smallArms; - public PonyRenderer bipedCape; + public Part bipedCape; public ModelEarthPony(boolean smallArms) { super(smallArms); @@ -44,7 +44,7 @@ public class ModelEarthPony extends AbstractPonyModel @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); } diff --git a/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java b/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java index f4f0f27c..cde3b02a 100644 --- a/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java +++ b/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java @@ -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 extends ModelEarthPony implements IUnicorn { +public class ModelUnicorn extends ModelEarthPony implements IUnicorn { - public PonyRenderer unicornArmRight; - public PonyRenderer unicornArmLeft; + public Part unicornArmRight; + public Part unicornArmLeft; public UnicornHorn horn; @@ -66,7 +66,7 @@ public class ModelUnicorn extends ModelEarthPony 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 extends ModelEarthPony 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; diff --git a/src/main/java/com/minelittlepony/client/model/races/ModelZebra.java b/src/main/java/com/minelittlepony/client/model/races/ModelZebra.java index ed4971ce..0e37aaf7 100644 --- a/src/main/java/com/minelittlepony/client/model/races/ModelZebra.java +++ b/src/main/java/com/minelittlepony/client/model/races/ModelZebra.java @@ -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 extends ModelEarthPony { - public PonyRenderer bristles; + public Part bristles; public ModelZebra(boolean useSmallArms) { super(useSmallArms); @@ -37,7 +37,7 @@ public class ModelZebra extends ModelEarthPony { 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) diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyMob.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyMob.java index 7e394fa7..a2cd7cf9 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyMob.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyMob.java @@ -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 & IUnicorn> extends RenderPonyMob { + public abstract static class Caster & IUnicorn> extends RenderPonyMob { public Caster(EntityRenderDispatcher manager, M model) { super(manager, model); diff --git a/src/main/java/com/minelittlepony/client/render/entities/villager/AbstractVillagerRenderer.java b/src/main/java/com/minelittlepony/client/render/entities/villager/AbstractVillagerRenderer.java index 2f1723dc..82ad47aa 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/villager/AbstractVillagerRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entities/villager/AbstractVillagerRenderer.java @@ -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 & IUnicorn & ModelWithHat> extends RenderPonyMob.Caster { + M extends ClientPonyModel & IUnicorn & ModelWithHat> extends RenderPonyMob.Caster { private final ITextureSupplier baseTextures; diff --git a/src/main/java/com/minelittlepony/client/render/layer/LayerHeldPonyItemMagical.java b/src/main/java/com/minelittlepony/client/render/layer/LayerHeldPonyItemMagical.java index 203c2ba7..1c5ad438 100644 --- a/src/main/java/com/minelittlepony/client/render/layer/LayerHeldPonyItemMagical.java +++ b/src/main/java/com/minelittlepony/client/render/layer/LayerHeldPonyItemMagical.java @@ -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)getModel()).getUnicornArmForSide(side).applyTransform(0.0625F); + ((IUnicorn)getModel()).getUnicornArmForSide(side).applyTransform(0.0625F); } else { super.renderArm(side); } diff --git a/src/main/java/com/minelittlepony/client/util/render/AbstractRenderer.java b/src/main/java/com/minelittlepony/client/util/render/AbstractRenderer.java deleted file mode 100644 index 320d2202..00000000 --- a/src/main/java/com/minelittlepony/client/util/render/AbstractRenderer.java +++ /dev/null @@ -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> 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 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 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)); - } -} diff --git a/src/main/java/com/minelittlepony/client/util/render/Box.java b/src/main/java/com/minelittlepony/client/util/render/Box.java deleted file mode 100644 index 27a000df..00000000 --- a/src/main/java/com/minelittlepony/client/util/render/Box.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.minelittlepony.client.util.render; - -import net.minecraft.client.model.Cuboid; - -public class Box 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); - } -} \ No newline at end of file diff --git a/src/main/java/com/minelittlepony/client/util/render/Cone.java b/src/main/java/com/minelittlepony/client/util/render/Cone.java new file mode 100644 index 00000000..119a80c1 --- /dev/null +++ b/src/main/java/com/minelittlepony/client/util/render/Cone.java @@ -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); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/minelittlepony/client/util/render/GlowRenderer.java b/src/main/java/com/minelittlepony/client/util/render/GlowRenderer.java deleted file mode 100644 index 96fa7e6a..00000000 --- a/src/main/java/com/minelittlepony/client/util/render/GlowRenderer.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.minelittlepony.client.util.render; - -import net.minecraft.client.model.Model; - -public class GlowRenderer extends AbstractRenderer { - 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); - } -} diff --git a/src/main/java/com/minelittlepony/client/util/render/HornGlow.java b/src/main/java/com/minelittlepony/client/util/render/HornGlow.java deleted file mode 100644 index ca37a303..00000000 --- a/src/main/java/com/minelittlepony/client/util/render/HornGlow.java +++ /dev/null @@ -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 { - - 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); - } - } -} diff --git a/src/main/java/com/minelittlepony/client/util/render/Part.java b/src/main/java/com/minelittlepony/client/util/render/Part.java new file mode 100644 index 00000000..7178b437 --- /dev/null +++ b/src/main/java/com/minelittlepony/client/util/render/Part.java @@ -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 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 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); + } +} diff --git a/src/main/java/com/minelittlepony/client/util/render/Plane.java b/src/main/java/com/minelittlepony/client/util/render/Plane.java new file mode 100644 index 00000000..d362e9d6 --- /dev/null +++ b/src/main/java/com/minelittlepony/client/util/render/Plane.java @@ -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); + } +} diff --git a/src/main/java/com/minelittlepony/client/util/render/PonyRenderer.java b/src/main/java/com/minelittlepony/client/util/render/PonyRenderer.java deleted file mode 100644 index d30a6e78..00000000 --- a/src/main/java/com/minelittlepony/client/util/render/PonyRenderer.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.minelittlepony.client.util.render; - -import net.minecraft.client.model.Model; - -public class PonyRenderer extends AbstractRenderer { - - 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); - } -} diff --git a/src/main/java/com/minelittlepony/client/util/render/Quad.java b/src/main/java/com/minelittlepony/client/util/render/Quad.java deleted file mode 100644 index 83471a90..00000000 --- a/src/main/java/com/minelittlepony/client/util/render/Quad.java +++ /dev/null @@ -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. - *
-     * Normal:
-     * 0-----1
-     * |\    |
-     * |  \  |
-     * |    \|
-     * 3-----2
-     *
-     * After flipFace:
-     *
-     * 3-----2
-     * |    /|
-     * |  /  |
-     * |/    |
-     * 0-----1
-     * 
- */ - @Override - public void flip() { - super.flip(); - } -} \ No newline at end of file diff --git a/src/main/java/com/minelittlepony/client/util/render/Vertex.java b/src/main/java/com/minelittlepony/client/util/render/Vertex.java deleted file mode 100644 index 176a57e6..00000000 --- a/src/main/java/com/minelittlepony/client/util/render/Vertex.java +++ /dev/null @@ -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); - } -} diff --git a/src/main/java/com/minelittlepony/client/util/render/plane/ModelPlane.java b/src/main/java/com/minelittlepony/client/util/render/plane/ModelPlane.java deleted file mode 100644 index a75d9d97..00000000 --- a/src/main/java/com/minelittlepony/client/util/render/plane/ModelPlane.java +++ /dev/null @@ -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 { - - 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); - } - } -} diff --git a/src/main/java/com/minelittlepony/client/util/render/plane/PlaneRenderer.java b/src/main/java/com/minelittlepony/client/util/render/plane/PlaneRenderer.java deleted file mode 100644 index 6c604828..00000000 --- a/src/main/java/com/minelittlepony/client/util/render/plane/PlaneRenderer.java +++ /dev/null @@ -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 { - - 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); - } -} diff --git a/src/main/java/com/minelittlepony/client/util/render/plane/package-info.java b/src/main/java/com/minelittlepony/client/util/render/plane/package-info.java deleted file mode 100644 index 7b1cafa4..00000000 --- a/src/main/java/com/minelittlepony/client/util/render/plane/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@ParametersAreNonnullByDefault -package com.minelittlepony.client.util.render.plane; - -import javax.annotation.ParametersAreNonnullByDefault;