From 9e86a57360912761f75a8dc820f7fa2b4166aa53 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Tue, 26 Jan 2016 17:32:53 -0500 Subject: [PATCH] Some cleanup. --- .../model/part/PegasusWings.java | 32 +------ .../model/pony/ModelPlayerPony.java | 9 -- .../renderer/CompressiveRendering.java | 89 ------------------- .../renderer/PlaneRenderer.java | 44 ++------- 4 files changed, 8 insertions(+), 166 deletions(-) delete mode 100644 src/main/java/com/brohoof/minelittlepony/renderer/CompressiveRendering.java diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java b/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java index 63a28c8e..50dca3da 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java +++ b/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java @@ -1,11 +1,10 @@ package com.brohoof.minelittlepony.model.part; import com.brohoof.minelittlepony.PonyData; -import com.brohoof.minelittlepony.model.BodyPart; import com.brohoof.minelittlepony.model.AbstractPonyModel; +import com.brohoof.minelittlepony.model.BodyPart; import com.brohoof.minelittlepony.model.PonyModelConstants; import com.brohoof.minelittlepony.renderer.AniParams; -import com.brohoof.minelittlepony.renderer.CompressiveRendering; import net.minecraft.client.model.ModelRenderer; import net.minecraft.util.MathHelper; @@ -20,9 +19,6 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { public ModelRenderer[] leftWingExt; public ModelRenderer[] rightWingExt; - public CompressiveRendering compressiveLeftWing; - public CompressiveRendering compressiveRightWing; - @Override public void init(AbstractPonyModel pony, float yOffset, float stretch) { this.pony = pony; @@ -31,29 +27,20 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { this.rightWing = new ModelRenderer[3]; this.leftWingExt = new ModelRenderer[6]; this.rightWingExt = new ModelRenderer[6]; - this.compressiveLeftWing = new CompressiveRendering(pony); - this.compressiveRightWing = new CompressiveRendering(pony); for (int i = 0; i < leftWing.length; i++) { this.leftWing[i] = new ModelRenderer(pony, 56, 32); - this.compressiveLeftWing.addCompressed(this.leftWing[i]); } for (int i = 0; i < rightWing.length; i++) { this.rightWing[i] = new ModelRenderer(pony, 56, 16); - this.compressiveRightWing.addCompressed(this.rightWing[i]); } for (int i = 0; i < leftWingExt.length; i++) { this.leftWingExt[i] = new ModelRenderer(pony, 56, 35); - this.compressiveLeftWing.addExpanded(this.leftWingExt[i]); } for (int i = 0; i < rightWingExt.length; i++) { this.rightWingExt[i] = new ModelRenderer(pony, 56, 19); - this.compressiveRightWing.addExpanded(this.rightWingExt[i]); } - this.compressiveLeftWing.setChance(2); - this.compressiveRightWing.setChance(2); - initPositions(yOffset, stretch); } @@ -147,7 +134,6 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { pony.transform(BodyPart.BODY); if (data.getRace() != null && data.getRace().hasWings()) { if (!pony.isFlying && !pony.isSneak) { - this.setExtendingWings(true); for (int k1 = 0; k1 < this.leftWing.length; ++k1) { this.leftWing[k1].render(scale); @@ -157,7 +143,6 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { this.rightWing[k1].render(scale); } } else { - this.setExtendingWings(false); for (int k1 = 0; k1 < this.leftWingExt.length; ++k1) { this.leftWingExt[k1].render(scale); @@ -170,21 +155,6 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { } } - private void setExtendingWings(boolean compress) { - this.compressiveLeftWing.setIsCompressed(compress); - this.compressiveRightWing.setIsCompressed(compress); - } - - public void setWingCompression(boolean pegasus) { - if (pegasus) { - this.compressiveLeftWing.init_Safe(); - this.compressiveRightWing.init_Safe(); - } else { - this.compressiveLeftWing.deInit_Safe(); - this.compressiveRightWing.deInit_Safe(); - } - } - private void sneak() { for (int i = 0; i < this.leftWingExt.length; ++i) { this.leftWingExt[i].rotationPointY = LEFT_WING_RP_Y_SNEAK; diff --git a/src/main/java/com/brohoof/minelittlepony/model/pony/ModelPlayerPony.java b/src/main/java/com/brohoof/minelittlepony/model/pony/ModelPlayerPony.java index 2c82bd21..d9afe8be 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/pony/ModelPlayerPony.java +++ b/src/main/java/com/brohoof/minelittlepony/model/pony/ModelPlayerPony.java @@ -3,8 +3,6 @@ package com.brohoof.minelittlepony.model.pony; import static net.minecraft.client.renderer.GlStateManager.popMatrix; import static net.minecraft.client.renderer.GlStateManager.pushMatrix; -import java.util.Random; - import com.brohoof.minelittlepony.model.AbstractPonyModel; import com.brohoof.minelittlepony.model.BodyPart; import com.brohoof.minelittlepony.model.PonyModelConstants; @@ -13,7 +11,6 @@ import com.brohoof.minelittlepony.model.part.PonyEars; import com.brohoof.minelittlepony.model.part.PonySnout; import com.brohoof.minelittlepony.model.part.UnicornHorn; import com.brohoof.minelittlepony.renderer.AniParams; -import com.brohoof.minelittlepony.renderer.CompressiveRendering; import com.brohoof.minelittlepony.renderer.PlaneRenderer; import net.minecraft.client.model.ModelRenderer; @@ -820,10 +817,4 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst this.bipedCape.render(scale); } - @Override - public ModelRenderer getRandomModelBox(Random par1Random) { - Object part = this.boxList.get(par1Random.nextInt(this.boxList.size())); - return part instanceof ModelRenderer ? (ModelRenderer) part : ((CompressiveRendering) part).getARenderer(par1Random); - } - } diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/CompressiveRendering.java b/src/main/java/com/brohoof/minelittlepony/renderer/CompressiveRendering.java deleted file mode 100644 index e352c346..00000000 --- a/src/main/java/com/brohoof/minelittlepony/renderer/CompressiveRendering.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.brohoof.minelittlepony.renderer; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Random; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; - -public class CompressiveRendering { - private boolean isCompressed; - private int chance = 1; - private Collection me; - private ArrayList expanded; - private ArrayList compressed; - private ModelBase model; - - public CompressiveRendering(ModelBase model) { - this.model = model; - this.expanded = new ArrayList(1); - this.compressed = new ArrayList(1); - model.boxList.remove(this.compressed); - } - - public void addExpanded(ModelRenderer expanded) { - this.model.boxList.remove(expanded); - this.expanded.add(expanded); - } - - public void addExpanded(ModelRenderer expanded, int weighted) { - this.model.boxList.remove(expanded); - this.expanded.addAll(Collections.nCopies(weighted, expanded)); - } - - public void addCompressed(ModelRenderer compressed) { - this.model.boxList.remove(compressed); - this.compressed.add(compressed); - } - - public void addCompressed(ModelRenderer compressed, int weighted) { - this.model.boxList.remove(compressed); - this.compressed.addAll(Collections.nCopies(weighted, compressed)); - } - - public void setChance(int chance) { - this.chance = chance; - } - - public int getChance() { - return this.chance; - } - - public void init() { - this.me = Collections.nCopies(this.chance, this); - this.model.boxList.addAll(this.me); - } - - public void deInit() { - this.model.boxList.removeAll(this.me); - this.me = null; - } - - public void init_Safe() { - if (this.me == null) { - this.init(); - } - - } - - public void deInit_Safe() { - if (this.me != null) { - this.deInit(); - } - - } - - public void setIsCompressed(boolean isCompressed) { - this.isCompressed = isCompressed; - } - - public boolean getIsCompressed() { - return this.isCompressed; - } - - public ModelRenderer getARenderer(Random rand) { - return this.isCompressed ? (ModelRenderer) this.compressed.get(rand.nextInt(this.compressed.size())) - : (ModelRenderer) this.expanded.get(rand.nextInt(this.expanded.size())); - } -} diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/PlaneRenderer.java b/src/main/java/com/brohoof/minelittlepony/renderer/PlaneRenderer.java index fa0dc9d4..d18abb22 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/PlaneRenderer.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/PlaneRenderer.java @@ -24,12 +24,6 @@ public class PlaneRenderer { public float rotateAngleX; public float rotateAngleY; public float rotateAngleZ; - public float field_35977_i; - public float field_35975_j; - public float field_35976_k; - public float field_35973_l; - public float field_35974_m; - public float field_35972_n; private boolean compiled = false; private int displayList = 0; public boolean mirror = false; @@ -38,9 +32,9 @@ public class PlaneRenderer { public boolean showModel = true; public boolean isHidden = false; - public PlaneRenderer(ModelBase modelbase, int i, int j) { - this.textureOffsetX = i; - this.textureOffsetY = j; + public PlaneRenderer(ModelBase modelbase, int offsetX, int offsetY) { + this.textureOffsetX = offsetX; + this.textureOffsetY = offsetY; this.textureWidth = modelbase.textureWidth; this.textureHeight = modelbase.textureHeight; } @@ -62,12 +56,6 @@ public class PlaneRenderer { } public void addBackPlane(float f, float f1, float f2, int i, int j, int k, float f3) { - this.field_35977_i = f; - this.field_35975_j = f1; - this.field_35976_k = f2; - this.field_35973_l = f + i; - this.field_35974_m = f1 + j; - this.field_35972_n = f2 + k; this.corners = new PositionTextureVertex[8]; this.faces = new TexturedQuad[1]; float f4 = f + i; @@ -117,12 +105,6 @@ public class PlaneRenderer { } public void addSidePlane(float f, float f1, float f2, int i, int j, int k, float f3) { - this.field_35977_i = f; - this.field_35975_j = f1; - this.field_35976_k = f2; - this.field_35973_l = f + i; - this.field_35974_m = f1 + j; - this.field_35972_n = f2 + k; this.corners = new PositionTextureVertex[8]; this.faces = new TexturedQuad[1]; float f4 = f + i; @@ -172,12 +154,6 @@ public class PlaneRenderer { } public void addTopPlane(float f, float f1, float f2, int i, int j, int k, float f3) { - this.field_35977_i = f; - this.field_35975_j = f1; - this.field_35976_k = f2; - this.field_35973_l = f + i; - this.field_35974_m = f1 + j; - this.field_35972_n = f2 + k; this.corners = new PositionTextureVertex[8]; this.faces = new TexturedQuad[1]; float f4 = f + i; @@ -243,12 +219,6 @@ public class PlaneRenderer { } public void addBottomPlane(float f, float f1, float f2, int i, int j, int k, float f3) { - this.field_35977_i = f; - this.field_35975_j = f1; - this.field_35976_k = f2; - this.field_35973_l = f + i; - this.field_35974_m = f1 + j; - this.field_35972_n = f2 + k; this.corners = new PositionTextureVertex[8]; this.faces = new TexturedQuad[1]; float f4 = f + i; @@ -384,19 +354,19 @@ public class PlaneRenderer { } } - public void postRender(float f) { + public void postRender(float scale) { if (!this.isHidden) { if (this.showModel) { if (!this.compiled) { - this.compileDisplayList(f); + this.compileDisplayList(scale); } if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) { - translate(this.rotationPointX * f, this.rotationPointY * f, this.rotationPointZ * f); + translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); } } else { - translate(this.rotationPointX * f, this.rotationPointY * f, this.rotationPointZ * f); + translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); if (this.rotateAngleZ != 0.0F) { rotate(this.rotateAngleZ * 57.29578F, 0.0F, 0.0F, 1.0F); }