Some cleanup.

This commit is contained in:
Matthew Messinger 2016-01-26 17:32:53 -05:00
parent 4b61d9c0ad
commit 9e86a57360
4 changed files with 8 additions and 166 deletions

View file

@ -1,11 +1,10 @@
package com.brohoof.minelittlepony.model.part; package com.brohoof.minelittlepony.model.part;
import com.brohoof.minelittlepony.PonyData; import com.brohoof.minelittlepony.PonyData;
import com.brohoof.minelittlepony.model.BodyPart;
import com.brohoof.minelittlepony.model.AbstractPonyModel; import com.brohoof.minelittlepony.model.AbstractPonyModel;
import com.brohoof.minelittlepony.model.BodyPart;
import com.brohoof.minelittlepony.model.PonyModelConstants; import com.brohoof.minelittlepony.model.PonyModelConstants;
import com.brohoof.minelittlepony.renderer.AniParams; import com.brohoof.minelittlepony.renderer.AniParams;
import com.brohoof.minelittlepony.renderer.CompressiveRendering;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
@ -20,9 +19,6 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
public ModelRenderer[] leftWingExt; public ModelRenderer[] leftWingExt;
public ModelRenderer[] rightWingExt; public ModelRenderer[] rightWingExt;
public CompressiveRendering compressiveLeftWing;
public CompressiveRendering compressiveRightWing;
@Override @Override
public void init(AbstractPonyModel pony, float yOffset, float stretch) { public void init(AbstractPonyModel pony, float yOffset, float stretch) {
this.pony = pony; this.pony = pony;
@ -31,29 +27,20 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
this.rightWing = new ModelRenderer[3]; this.rightWing = new ModelRenderer[3];
this.leftWingExt = new ModelRenderer[6]; this.leftWingExt = new ModelRenderer[6];
this.rightWingExt = 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++) { for (int i = 0; i < leftWing.length; i++) {
this.leftWing[i] = new ModelRenderer(pony, 56, 32); this.leftWing[i] = new ModelRenderer(pony, 56, 32);
this.compressiveLeftWing.addCompressed(this.leftWing[i]);
} }
for (int i = 0; i < rightWing.length; i++) { for (int i = 0; i < rightWing.length; i++) {
this.rightWing[i] = new ModelRenderer(pony, 56, 16); this.rightWing[i] = new ModelRenderer(pony, 56, 16);
this.compressiveRightWing.addCompressed(this.rightWing[i]);
} }
for (int i = 0; i < leftWingExt.length; i++) { for (int i = 0; i < leftWingExt.length; i++) {
this.leftWingExt[i] = new ModelRenderer(pony, 56, 35); this.leftWingExt[i] = new ModelRenderer(pony, 56, 35);
this.compressiveLeftWing.addExpanded(this.leftWingExt[i]);
} }
for (int i = 0; i < rightWingExt.length; i++) { for (int i = 0; i < rightWingExt.length; i++) {
this.rightWingExt[i] = new ModelRenderer(pony, 56, 19); 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); initPositions(yOffset, stretch);
} }
@ -147,7 +134,6 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
pony.transform(BodyPart.BODY); pony.transform(BodyPart.BODY);
if (data.getRace() != null && data.getRace().hasWings()) { if (data.getRace() != null && data.getRace().hasWings()) {
if (!pony.isFlying && !pony.isSneak) { if (!pony.isFlying && !pony.isSneak) {
this.setExtendingWings(true);
for (int k1 = 0; k1 < this.leftWing.length; ++k1) { for (int k1 = 0; k1 < this.leftWing.length; ++k1) {
this.leftWing[k1].render(scale); this.leftWing[k1].render(scale);
@ -157,7 +143,6 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
this.rightWing[k1].render(scale); this.rightWing[k1].render(scale);
} }
} else { } else {
this.setExtendingWings(false);
for (int k1 = 0; k1 < this.leftWingExt.length; ++k1) { for (int k1 = 0; k1 < this.leftWingExt.length; ++k1) {
this.leftWingExt[k1].render(scale); 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() { private void sneak() {
for (int i = 0; i < this.leftWingExt.length; ++i) { for (int i = 0; i < this.leftWingExt.length; ++i) {
this.leftWingExt[i].rotationPointY = LEFT_WING_RP_Y_SNEAK; this.leftWingExt[i].rotationPointY = LEFT_WING_RP_Y_SNEAK;

View file

@ -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.popMatrix;
import static net.minecraft.client.renderer.GlStateManager.pushMatrix; import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
import java.util.Random;
import com.brohoof.minelittlepony.model.AbstractPonyModel; import com.brohoof.minelittlepony.model.AbstractPonyModel;
import com.brohoof.minelittlepony.model.BodyPart; import com.brohoof.minelittlepony.model.BodyPart;
import com.brohoof.minelittlepony.model.PonyModelConstants; 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.PonySnout;
import com.brohoof.minelittlepony.model.part.UnicornHorn; import com.brohoof.minelittlepony.model.part.UnicornHorn;
import com.brohoof.minelittlepony.renderer.AniParams; import com.brohoof.minelittlepony.renderer.AniParams;
import com.brohoof.minelittlepony.renderer.CompressiveRendering;
import com.brohoof.minelittlepony.renderer.PlaneRenderer; import com.brohoof.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
@ -820,10 +817,4 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedCape.render(scale); 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);
}
} }

View file

@ -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<CompressiveRendering> me;
private ArrayList<ModelRenderer> expanded;
private ArrayList<ModelRenderer> compressed;
private ModelBase model;
public CompressiveRendering(ModelBase model) {
this.model = model;
this.expanded = new ArrayList<ModelRenderer>(1);
this.compressed = new ArrayList<ModelRenderer>(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()));
}
}

View file

@ -24,12 +24,6 @@ public class PlaneRenderer {
public float rotateAngleX; public float rotateAngleX;
public float rotateAngleY; public float rotateAngleY;
public float rotateAngleZ; 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 boolean compiled = false;
private int displayList = 0; private int displayList = 0;
public boolean mirror = false; public boolean mirror = false;
@ -38,9 +32,9 @@ public class PlaneRenderer {
public boolean showModel = true; public boolean showModel = true;
public boolean isHidden = false; public boolean isHidden = false;
public PlaneRenderer(ModelBase modelbase, int i, int j) { public PlaneRenderer(ModelBase modelbase, int offsetX, int offsetY) {
this.textureOffsetX = i; this.textureOffsetX = offsetX;
this.textureOffsetY = j; this.textureOffsetY = offsetY;
this.textureWidth = modelbase.textureWidth; this.textureWidth = modelbase.textureWidth;
this.textureHeight = modelbase.textureHeight; 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) { 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.corners = new PositionTextureVertex[8];
this.faces = new TexturedQuad[1]; this.faces = new TexturedQuad[1];
float f4 = f + i; 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) { 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.corners = new PositionTextureVertex[8];
this.faces = new TexturedQuad[1]; this.faces = new TexturedQuad[1];
float f4 = f + i; 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) { 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.corners = new PositionTextureVertex[8];
this.faces = new TexturedQuad[1]; this.faces = new TexturedQuad[1];
float f4 = f + i; 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) { 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.corners = new PositionTextureVertex[8];
this.faces = new TexturedQuad[1]; this.faces = new TexturedQuad[1];
float f4 = f + i; 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.isHidden) {
if (this.showModel) { if (this.showModel) {
if (!this.compiled) { if (!this.compiled) {
this.compileDisplayList(f); this.compileDisplayList(scale);
} }
if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { 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) { 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 { } 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) { if (this.rotateAngleZ != 0.0F) {
rotate(this.rotateAngleZ * 57.29578F, 0.0F, 0.0F, 1.0F); rotate(this.rotateAngleZ * 57.29578F, 0.0F, 0.0F, 1.0F);
} }