Fix pony models when using forge.

Closes #15

Also maybe a NPE in hdskins (Probably need more nullchecks)
This commit is contained in:
Matthew Messinger 2016-08-22 17:29:27 -04:00
parent 3390fc8a57
commit 6b3cd62549
8 changed files with 198 additions and 422 deletions

View file

@ -26,7 +26,7 @@ apply plugin: 'org.spongepowered.mixin'
apply plugin: 'mnm.gradle.ap-ide' apply plugin: 'mnm.gradle.ap-ide'
group = 'com.brohoof.minelp' group = 'com.brohoof.minelp'
version = '1.10.2.1' version = '1.10.2.2'
description = 'Mine Little Pony' description = 'Mine Little Pony'
minecraft { minecraft {

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Tue Jul 19 19:10:31 EDT 2016 #Mon Aug 22 11:16:46 EDT 2016
build.number=243 build.number=246

View file

@ -14,6 +14,7 @@ import org.apache.commons.io.FileUtils;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -62,17 +63,20 @@ public final class HDSkinManager {
// try to recreate a broken gameprofile // try to recreate a broken gameprofile
// happens when server sends a random profile with skin and displayname // happens when server sends a random profile with skin and displayname
Property prop = Iterables.getFirst(profile1.getProperties().get("textures"), null); Property prop = Iterables.getFirst(profile1.getProperties().get("textures"), null);
if (prop != null) { if (prop != null && Strings.isNullOrEmpty(prop.getValue())) {
JsonObject obj = new Gson().fromJson(new String(Base64.decodeBase64(prop.getValue())), JsonObject.class); JsonObject obj = new Gson().fromJson(new String(Base64.decodeBase64(prop.getValue())), JsonObject.class);
String name = null; // why are plugins sending a json null?
// this should be optional if (obj != null) {
if (obj.has("profileName")) { String name = null;
name = obj.get("profileName").getAsString(); // this should be optional
} if (obj.has("profileName")) {
// this is required name = obj.get("profileName").getAsString();
if (obj.has("profileId")) { }
UUID uuid = UUIDTypeAdapter.fromString(obj.get("profileId").getAsString()); // this is required
profile1 = new GameProfile(uuid, name); if (obj.has("profileId")) {
UUID uuid = UUIDTypeAdapter.fromString(obj.get("profileId").getAsString());
profile1 = new GameProfile(uuid, name);
}
} }
} }
final GameProfile profile = profile1; final GameProfile profile = profile1;

View file

@ -0,0 +1,118 @@
package com.brohoof.minelittlepony.model;
import com.brohoof.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.PositionTextureVertex;
import net.minecraft.client.model.TexturedQuad;
import net.minecraft.client.renderer.VertexBuffer;
public class ModelPlane extends ModelBox {
private TexturedQuad[] quadList;
private final Face face;
public ModelPlane(PlaneRenderer renderer, int textureX, int textureY,
float x, float y, float z, int w, int h, int d,
float scale, Face face) {
super(renderer, textureX, textureY, x, y, z, w, h, d, scale, false);
this.face = face;
this.quadList = new TexturedQuad[6];
float x2 = x + w;
float y2 = y + h;
float z2 = z + d;
x -= scale;
y -= scale;
z -= scale;
x2 += scale;
y2 += scale;
z2 += scale;
if (renderer.mirror) {
float v = x2;
x2 = x;
x = v;
}
if (renderer.mirrory) {
float v = y2;
y2 = y;
y = v;
}
if (renderer.mirrorz) {
float v = z2;
z2 = z;
z = v;
}
// w:west e:east d:down u:up s:south n:north
PositionTextureVertex wds = new PositionTextureVertex(x, y, z, 0.0F, 0.0F);
PositionTextureVertex eds = new PositionTextureVertex(x2, y, z, 0.0F, 8.0F);
PositionTextureVertex eus = new PositionTextureVertex(x2, y2, z, 8.0F, 8.0F);
PositionTextureVertex wus = new PositionTextureVertex(x, y2, z, 8.0F, 0.0F);
PositionTextureVertex wdn = new PositionTextureVertex(x, y, z2, 0.0F, 0.0F);
PositionTextureVertex edn = new PositionTextureVertex(x2, y, z2, 0.0F, 8.0F);
PositionTextureVertex eun = new PositionTextureVertex(x2, y2, z2, 8.0F, 8.0F);
PositionTextureVertex wun = new PositionTextureVertex(x, y2, z2, 8.0F, 0.0F);
// east
this.quadList[0] = new TexturedQuad(
new PositionTextureVertex[] { edn, eds, eus, eun },
textureX, textureY,
textureX + d, textureY + h,
renderer.textureWidth, renderer.textureHeight);
// west
this.quadList[1] = new TexturedQuad(
new PositionTextureVertex[] { wds, wdn, wun, wus },
textureX, textureY,
textureX + d, textureY + h,
renderer.textureWidth, renderer.textureHeight);
// down
this.quadList[3] = new TexturedQuad(
new PositionTextureVertex[] { edn, wdn, wds, eds },
textureX, textureY,
textureX + w, textureY + d,
renderer.textureWidth, renderer.textureHeight);
// up
this.quadList[2] = new TexturedQuad(
new PositionTextureVertex[] { eus, wus, wun, eun },
textureX, textureY,
textureX + w, textureY + d,
renderer.textureWidth, renderer.textureHeight);
// south
this.quadList[4] = new TexturedQuad(
new PositionTextureVertex[] { eds, wds, wus, eus },
textureX, textureY,
textureX + w, textureY + h,
renderer.textureWidth, renderer.textureHeight);
// north
this.quadList[5] = new TexturedQuad(
new PositionTextureVertex[] { wdn, edn, eun, wun },
textureX, textureY,
textureX + w, textureY + h,
renderer.textureWidth, renderer.textureHeight);
if (renderer.mirror || renderer.mirrory || renderer.mirrorz) {
for (TexturedQuad texturedquad : this.quadList) {
texturedquad.flipFace();
}
}
}
@Override
public void render(VertexBuffer renderer, float scale) {
this.quadList[this.face.ordinal()].draw(renderer, scale);
}
public static enum Face {
EAST,
WEST,
DOWN,
UP,
SOUTH,
NORTH;
}
}

View file

@ -48,13 +48,13 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
muzzle[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); muzzle[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[5].addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); muzzle[5].addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch);
muzzle[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); muzzle[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[6].addSidePlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch); muzzle[6].addWestPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch);
muzzle[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); muzzle[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[7].addSidePlane(2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch); muzzle[7].addEastPlane(2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch);
muzzle[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); muzzle[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[8].addSidePlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch); muzzle[8].addWestPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch);
muzzle[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); muzzle[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[9].addSidePlane(1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch); muzzle[9].addEastPlane(1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch);
muzzle[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); muzzle[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle = MUZZLES.get(PonyGender.STALLION); muzzle = MUZZLES.get(PonyGender.STALLION);
@ -70,9 +70,9 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
muzzle[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); muzzle[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[2].addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); muzzle[2].addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch);
muzzle[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); muzzle[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[3].addSidePlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch); muzzle[3].addWestPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch);
muzzle[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); muzzle[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[4].addSidePlane(2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch); muzzle[4].addEastPlane(2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch);
muzzle[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); muzzle[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
} }

View file

@ -668,16 +668,14 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
if (this.textureHeight == 64) { if (this.textureHeight == 64) {
this.bipedBodyWear = new ModelRenderer(this, 16, 32); this.bipedBodyWear = new ModelRenderer(this, 16, 32);
} }
this.Bodypiece[0] = new PlaneRenderer(this, 24, 0);
this.Bodypiece[1] = new PlaneRenderer(this, 24, 0);
this.Bodypiece[0] = new PlaneRenderer(this, 24, 0); this.Bodypiece[0] = new PlaneRenderer(this, 24, 0);
this.Bodypiece[0].mirrorz = true;
this.Bodypiece[1] = new PlaneRenderer(this, 24, 0); this.Bodypiece[1] = new PlaneRenderer(this, 24, 0);
this.Bodypiece[2] = new PlaneRenderer(this, 32, 20); this.Bodypiece[2] = new PlaneRenderer(this, 32, 20);
this.Bodypiece[2].mirrorxy = true; this.Bodypiece[2].mirrorz = true;
this.Bodypiece[3] = new PlaneRenderer(this, 56, 0); this.Bodypiece[3] = new PlaneRenderer(this, 56, 0);
this.Bodypiece[4] = new PlaneRenderer(this, 4, 0); this.Bodypiece[4] = new PlaneRenderer(this, 4, 0);
this.Bodypiece[4].mirrorz = true;
this.Bodypiece[5] = new PlaneRenderer(this, 4, 0); this.Bodypiece[5] = new PlaneRenderer(this, 4, 0);
this.Bodypiece[6] = new PlaneRenderer(this, 36, 16); this.Bodypiece[6] = new PlaneRenderer(this, 36, 16);
this.Bodypiece[7] = new PlaneRenderer(this, 36, 16); this.Bodypiece[7] = new PlaneRenderer(this, 36, 16);
@ -763,17 +761,17 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedBodyWear.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch + 0.25F); this.bipedBodyWear.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch + 0.25F);
this.bipedBodyWear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.bipedBodyWear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[0].addSidePlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 8, 8, stretch); this.Bodypiece[0].addWestPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 8, 8, stretch);
this.Bodypiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[1].addSidePlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 8, 8, stretch); this.Bodypiece[1].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 8, 8, stretch);
this.Bodypiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[2].addTopPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 0, 12, stretch); this.Bodypiece[2].addTopPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 0, 12, stretch);
this.Bodypiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[3].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 0, 8, stretch); this.Bodypiece[3].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 0, 8, stretch);
this.Bodypiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[4].addSidePlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 0, 8, 4, stretch); this.Bodypiece[4].addWestPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 0, 8, 4, stretch);
this.Bodypiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[5].addSidePlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 0, 8, 4, stretch); this.Bodypiece[5].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 0, 8, 4, stretch);
this.Bodypiece[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[6].addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, 0, stretch); this.Bodypiece[6].addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, 0, stretch);
this.Bodypiece[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
@ -785,9 +783,9 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.Bodypiece[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[10].addBottomPlane(-1.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 0, 6, stretch); this.Bodypiece[10].addBottomPlane(-1.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 0, 6, stretch);
this.Bodypiece[10].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[10].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[11].addSidePlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 0, 2, 6, stretch); this.Bodypiece[11].addWestPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 0, 2, 6, stretch);
this.Bodypiece[11].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[11].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[12].addSidePlane(1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 0, 2, 6, stretch); this.Bodypiece[12].addEastPlane(1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 0, 2, 6, stretch);
this.Bodypiece[12].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[12].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[13].addBackPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 2, 2, 0, stretch); this.Bodypiece[13].addBackPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 2, 2, 0, stretch);
this.Bodypiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.Bodypiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
@ -796,9 +794,9 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.BodypieceNeck[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.BodypieceNeck[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[1].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -4.8F + BODY_CENTRE_Z, 4, 4, 0, stretch); this.BodypieceNeck[1].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -4.8F + BODY_CENTRE_Z, 4, 4, 0, stretch);
this.BodypieceNeck[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.BodypieceNeck[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[2].addSidePlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 0, 4, 4, stretch); this.BodypieceNeck[2].addWestPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 0, 4, 4, stretch);
this.BodypieceNeck[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.BodypieceNeck[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[3].addSidePlane(2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 0, 4, 4, stretch); this.BodypieceNeck[3].addEastPlane(2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 0, 4, 4, stretch);
this.BodypieceNeck[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.BodypieceNeck[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck[0].rotateAngleX = NECK_ROT_X; this.BodypieceNeck[0].rotateAngleX = NECK_ROT_X;
this.BodypieceNeck[1].rotateAngleX = NECK_ROT_X; this.BodypieceNeck[1].rotateAngleX = NECK_ROT_X;
@ -857,41 +855,41 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
protected void initTailPositions(float yOffset, float stretch) { protected void initTailPositions(float yOffset, float stretch) {
this.Tail[0].addTopPlane(-2.0F, 1.0F, 2.0F, 4, 0, 4, stretch); this.Tail[0].addTopPlane(-2.0F, 1.0F, 2.0F, 4, 0, 4, stretch);
this.Tail[0].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[0].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[1].addSidePlane(-2.0F, 1.0F, 2.0F, 0, 4, 4, stretch); this.Tail[1].addWestPlane(-2.0F, 1.0F, 2.0F, 0, 4, 4, stretch);
this.Tail[1].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[1].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[2].addBackPlane(-2.0F, 1.0F, 2.0F, 4, 4, 0, stretch); this.Tail[2].addBackPlane(-2.0F, 1.0F, 2.0F, 4, 4, 0, stretch);
this.Tail[2].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[2].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[3].addSidePlane(2.0F, 1.0F, 2.0F, 0, 4, 4, stretch); this.Tail[3].addEastPlane(2.0F, 1.0F, 2.0F, 0, 4, 4, stretch);
this.Tail[3].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[3].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[4].addBackPlane(-2.0F, 1.0F, 6.0F, 4, 4, 0, stretch); this.Tail[4].addBackPlane(-2.0F, 1.0F, 6.0F, 4, 4, 0, stretch);
this.Tail[4].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[4].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[5].addTopPlane(-2.0F, 5.0F, 2.0F, 4, 0, 4, stretch); this.Tail[5].addTopPlane(-2.0F, 5.0F, 2.0F, 4, 0, 4, stretch);
this.Tail[5].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[5].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[6].addSidePlane(-2.0F, 5.0F, 2.0F, 0, 4, 4, stretch); this.Tail[6].addWestPlane(-2.0F, 5.0F, 2.0F, 0, 4, 4, stretch);
this.Tail[6].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[6].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[7].addBackPlane(-2.0F, 5.0F, 2.0F, 4, 4, 0, stretch); this.Tail[7].addBackPlane(-2.0F, 5.0F, 2.0F, 4, 4, 0, stretch);
this.Tail[7].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[7].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[8].addSidePlane(2.0F, 5.0F, 2.0F, 0, 4, 4, stretch); this.Tail[8].addEastPlane(2.0F, 5.0F, 2.0F, 0, 4, 4, stretch);
this.Tail[8].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[8].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[9].addBackPlane(-2.0F, 5.0F, 6.0F, 4, 4, 0, stretch); this.Tail[9].addBackPlane(-2.0F, 5.0F, 6.0F, 4, 4, 0, stretch);
this.Tail[9].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[9].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[10].addTopPlane(-2.0F, 9.0F, 2.0F, 4, 0, 4, stretch); this.Tail[10].addTopPlane(-2.0F, 9.0F, 2.0F, 4, 0, 4, stretch);
this.Tail[10].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[10].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[11].addSidePlane(-2.0F, 9.0F, 2.0F, 0, 4, 4, stretch); this.Tail[11].addWestPlane(-2.0F, 9.0F, 2.0F, 0, 4, 4, stretch);
this.Tail[11].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[11].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[12].addBackPlane(-2.0F, 9.0F, 2.0F, 4, 4, 0, stretch); this.Tail[12].addBackPlane(-2.0F, 9.0F, 2.0F, 4, 4, 0, stretch);
this.Tail[12].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[12].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[13].addSidePlane(2.0F, 9.0F, 2.0F, 0, 4, 4, stretch); this.Tail[13].addEastPlane(2.0F, 9.0F, 2.0F, 0, 4, 4, stretch);
this.Tail[13].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[13].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[14].addBackPlane(-2.0F, 9.0F, 6.0F, 4, 4, 0, stretch); this.Tail[14].addBackPlane(-2.0F, 9.0F, 6.0F, 4, 4, 0, stretch);
this.Tail[14].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[14].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[15].addTopPlane(-2.0F, 13.0F, 2.0F, 4, 0, 4, stretch); this.Tail[15].addTopPlane(-2.0F, 13.0F, 2.0F, 4, 0, 4, stretch);
this.Tail[15].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[15].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[16].addSidePlane(-2.0F, 13.0F, 2.0F, 0, 4, 4, stretch); this.Tail[16].addWestPlane(-2.0F, 13.0F, 2.0F, 0, 4, 4, stretch);
this.Tail[16].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[16].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[17].addBackPlane(-2.0F, 13.0F, 2.0F, 4, 4, 0, stretch); this.Tail[17].addBackPlane(-2.0F, 13.0F, 2.0F, 4, 4, 0, stretch);
this.Tail[17].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[17].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[18].addSidePlane(2.0F, 13.0F, 2.0F, 0, 4, 4, stretch); this.Tail[18].addEastPlane(2.0F, 13.0F, 2.0F, 0, 4, 4, stretch);
this.Tail[18].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[18].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
this.Tail[19].addBackPlane(-2.0F, 13.0F, 6.0F, 4, 4, 0, stretch); this.Tail[19].addBackPlane(-2.0F, 13.0F, 6.0F, 4, 4, 0, stretch);
this.Tail[19].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); this.Tail[19].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);

View file

@ -77,13 +77,13 @@ public class ModelVillagerPony extends ModelPlayerPony {
@Override @Override
protected void initPositions(float yOffset, float stretch) { protected void initPositions(float yOffset, float stretch) {
super.initPositions(yOffset, stretch); super.initPositions(yOffset, stretch);
this.VillagerBagPiece[0].addSidePlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[0].addWestPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch);
this.VillagerBagPiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[1].addSidePlane(-4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[1].addWestPlane(-4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch);
this.VillagerBagPiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[2].addSidePlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[2].addWestPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch);
this.VillagerBagPiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[3].addSidePlane(7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[3].addWestPlane(7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch);
this.VillagerBagPiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.VillagerBagPiece[4].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -2.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); this.VillagerBagPiece[4].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -2.0F + BODY_CENTRE_Z, 8, 0, 3, stretch);
this.VillagerBagPiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); this.VillagerBagPiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);

View file

@ -1,399 +1,55 @@
package com.brohoof.minelittlepony.renderer; package com.brohoof.minelittlepony.renderer;
import static net.minecraft.client.renderer.GlStateManager.*; import com.brohoof.minelittlepony.model.ModelPlane;
import com.brohoof.minelittlepony.model.ModelPlane.Face;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.PositionTextureVertex;
import net.minecraft.client.model.TexturedQuad;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
public class PlaneRenderer extends ModelRenderer { public class PlaneRenderer extends ModelRenderer {
public float textureWidth;
public float textureHeight; public boolean mirrory;
private PositionTextureVertex[] corners; public boolean mirrorz;
private TexturedQuad[] faces;
private int textureOffsetX; private int textureOffsetX;
private int textureOffsetY; private int textureOffsetY;
public float rotationPointX;
public float rotationPointY;
public float rotationPointZ;
public float rotateAngleX;
public float rotateAngleY;
public float rotateAngleZ;
private boolean compiled = false;
private int displayList = 0;
public boolean mirror = false;
public boolean mirrory = false;
public boolean mirrorxy = false;
public boolean showModel = true;
public boolean isHidden = false;
public PlaneRenderer(ModelBase modelbase, int offsetX, int offsetY) {
super(modelbase, offsetX, offsetY);
this.textureOffsetX = offsetX;
this.textureOffsetY = offsetY;
this.textureWidth = modelbase.textureWidth;
this.textureHeight = modelbase.textureHeight;
}
public void addBackPlane(float f, float f1, float f2, int i, int j, int k) {
this.addBackPlane(f, f1, f2, i, j, k, 0.0F);
}
public void addSidePlane(float f, float f1, float f2, int i, int j, int k) {
this.addSidePlane(f, f1, f2, i, j, k, 0.0F);
}
public void addTopPlane(float f, float f1, float f2, int i, int j, int k) {
this.addTopPlane(f, f1, f2, i, j, k, 0.0F);
}
public void addBottomPlane(float f, float f1, float f2, int i, int j, int k) {
this.addBottomPlane(f, f1, f2, i, j, k, 0.0F);
}
public void addBackPlane(float f, float f1, float f2, int i, int j, int k, float f3) {
this.corners = new PositionTextureVertex[8];
this.faces = new TexturedQuad[1];
float f4 = f + i;
float f5 = f1 + j;
float f6 = f2 + k;
f -= f3;
f1 -= f3;
f2 -= f3;
f4 += f3;
f5 += f3;
f6 += f3;
if (this.mirror) {
float positiontexturevertex = f4;
f4 = f;
f = positiontexturevertex;
}
PositionTextureVertex positiontexturevertex = new PositionTextureVertex(f, f1, f2, 0.0F, 0.0F);
PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f4, f1, f2, 0.0F, 8.0F);
PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(f4, f5, f2, 8.0F, 8.0F);
PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(f, f5, f2, 8.0F, 0.0F);
PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(f, f1, f6, 0.0F, 0.0F);
PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f4, f1, f6, 0.0F, 8.0F);
PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8.0F, 8.0F);
PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(f, f5, f6, 8.0F, 0.0F);
this.corners[0] = positiontexturevertex;
this.corners[1] = positiontexturevertex1;
this.corners[2] = positiontexturevertex2;
this.corners[3] = positiontexturevertex3;
this.corners[4] = positiontexturevertex4;
this.corners[5] = positiontexturevertex5;
this.corners[6] = positiontexturevertex6;
this.corners[7] = positiontexturevertex7;
this.faces[0] = new TexturedQuad(
new PositionTextureVertex[] {
positiontexturevertex1,
positiontexturevertex,
positiontexturevertex3,
positiontexturevertex2 },
this.textureOffsetX, this.textureOffsetY,
this.textureOffsetX + i, this.textureOffsetY + j,
this.textureWidth, this.textureHeight);
if (this.mirror) {
this.faces[0].flipFace();
}
}
public void addSidePlane(float f, float f1, float f2, int i, int j, int k, float f3) {
this.corners = new PositionTextureVertex[8];
this.faces = new TexturedQuad[1];
float f4 = f + i;
float f5 = f1 + j;
float f6 = f2 + k;
f -= f3;
f1 -= f3;
f2 -= f3;
f4 += f < 0 ? -f3 : f3;
f5 += f1 < 0 ? -f3 : f3;
f6 += f2 < 0 ? -f3 : f3;
if (this.mirror) {
float positiontexturevertex = f4;
f4 = f;
f = positiontexturevertex;
}
PositionTextureVertex positiontexturevertex = new PositionTextureVertex(f, f1, f2, 0.0F, 0.0F);
PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f4, f1, f2, 0.0F, 8.0F);
PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(f4, f5, f2, 8.0F, 8.0F);
PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(f, f5, f2, 8.0F, 0.0F);
PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(f, f1, f6, 0.0F, 0.0F);
PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f4, f1, f6, 0.0F, 8.0F);
PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8.0F, 8.0F);
PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(f, f5, f6, 8.0F, 0.0F);
this.corners[0] = positiontexturevertex;
this.corners[1] = positiontexturevertex1;
this.corners[2] = positiontexturevertex2;
this.corners[3] = positiontexturevertex3;
this.corners[4] = positiontexturevertex4;
this.corners[5] = positiontexturevertex5;
this.corners[6] = positiontexturevertex6;
this.corners[7] = positiontexturevertex7;
this.faces[0] = new TexturedQuad(
new PositionTextureVertex[] {
positiontexturevertex5,
positiontexturevertex1,
positiontexturevertex2,
positiontexturevertex6 },
this.textureOffsetX, this.textureOffsetY,
this.textureOffsetX + k, this.textureOffsetY + j,
this.textureWidth, this.textureHeight);
if (this.mirror) {
this.faces[0].flipFace();
}
}
public void addTopPlane(float f, float f1, float f2, int i, int j, int k, float f3) {
this.corners = new PositionTextureVertex[8];
this.faces = new TexturedQuad[1];
float f4 = f + i;
float f5 = f1 + j;
float f6 = f2 + k;
f -= f3;
f1 -= f3;
f2 -= f3;
f4 += f3;
f5 += f3;
f6 += f3;
float vertex;
if (this.mirror) {
vertex = f4;
f4 = f;
f = vertex;
}
if (this.mirrory) {
vertex = f6;
f6 = f2;
f2 = vertex;
}
if (this.mirrorxy) {
vertex = f6;
f6 = f2;
f2 = vertex;
vertex = f4;
f4 = f;
f = vertex;
}
PositionTextureVertex positiontexturevertex = new PositionTextureVertex(f, f1, f2, 0.0F, 0.0F);
PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f4, f1, f2, 0.0F, 8.0F);
PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(f4, f5, f2, 8.0F, 8.0F);
PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(f, f5, f2, 8.0F, 0.0F);
PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(f, f1, f6, 0.0F, 0.0F);
PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f4, f1, f6, 0.0F, 8.0F);
PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8.0F, 8.0F);
PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(f, f5, f6, 8.0F, 0.0F);
this.corners[0] = positiontexturevertex;
this.corners[1] = positiontexturevertex1;
this.corners[2] = positiontexturevertex2;
this.corners[3] = positiontexturevertex3;
this.corners[4] = positiontexturevertex4;
this.corners[5] = positiontexturevertex5;
this.corners[6] = positiontexturevertex6;
this.corners[7] = positiontexturevertex7;
this.faces[0] = new TexturedQuad(
new PositionTextureVertex[] {
positiontexturevertex5,
positiontexturevertex4,
positiontexturevertex,
positiontexturevertex1 },
this.textureOffsetX, this.textureOffsetY,
this.textureOffsetX + i, this.textureOffsetY + k,
this.textureWidth, this.textureHeight);
if (this.mirror || this.mirrory) {
this.faces[0].flipFace();
}
}
public void addBottomPlane(float f, float f1, float f2, int i, int j, int k, float f3) {
this.corners = new PositionTextureVertex[8];
this.faces = new TexturedQuad[1];
float f4 = f + i;
float f5 = f1 + j;
float f6 = f2 + k;
f -= f3;
f1 -= f3;
f2 -= f3;
f4 += f3;
f5 += f3;
f6 += f3;
float vertex;
if (this.mirror) {
vertex = f4;
f4 = f;
f = vertex;
}
if (this.mirrory) {
vertex = f6;
f6 = f2;
f2 = vertex;
}
if (this.mirrorxy) {
vertex = f6;
f6 = f2;
f2 = vertex;
vertex = f4;
f4 = f;
f = vertex;
}
PositionTextureVertex positiontexturevertex = new PositionTextureVertex(f, f1, f2, 0.0F, 0.0F);
PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f4, f1, f2, 0.0F, 8.0F);
PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(f4, f5, f2, 8.0F, 8.0F);
PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(f, f5, f2, 8.0F, 0.0F);
PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(f, f1, f6, 0.0F, 0.0F);
PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f4, f1, f6, 0.0F, 8.0F);
PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8.0F, 8.0F);
PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(f, f5, f6, 8.0F, 0.0F);
this.corners[0] = positiontexturevertex;
this.corners[1] = positiontexturevertex1;
this.corners[2] = positiontexturevertex2;
this.corners[3] = positiontexturevertex3;
this.corners[4] = positiontexturevertex4;
this.corners[5] = positiontexturevertex5;
this.corners[6] = positiontexturevertex6;
this.corners[7] = positiontexturevertex7;
this.faces[0] = new TexturedQuad(
new PositionTextureVertex[] {
positiontexturevertex2,
positiontexturevertex3,
positiontexturevertex7,
positiontexturevertex6 },
this.textureOffsetX, this.textureOffsetY,
this.textureOffsetX + i, this.textureOffsetY + k,
this.textureWidth, this.textureHeight);
if (this.mirror || this.mirrory) {
this.faces[0].flipFace();
}
public PlaneRenderer(ModelBase model, int x, int y) {
super(model, x, y);
} }
@Override @Override
public void render(float f) { public ModelRenderer setTextureOffset(int x, int y) {
if (!this.isHidden) { this.textureOffsetX = x;
if (this.showModel) { this.textureOffsetY = y;
if (!this.compiled) { return super.setTextureOffset(x, y);
this.compileDisplayList(f);
}
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) {
callList(this.displayList);
} else {
translate(this.rotationPointX * f, this.rotationPointY * f, this.rotationPointZ * f);
callList(this.displayList);
translate(-this.rotationPointX * f, -this.rotationPointY * f, -this.rotationPointZ * f);
}
} else {
pushMatrix();
translate(this.rotationPointX * f, this.rotationPointY * f, this.rotationPointZ * f);
if (this.rotateAngleZ != 0.0F) {
rotate(this.rotateAngleZ * 57.29578F, 0.0F, 0.0F, 1.0F);
}
if (this.rotateAngleY != 0.0F) {
rotate(this.rotateAngleY * 57.29578F, 0.0F, 1.0F, 0.0F);
}
if (this.rotateAngleX != 0.0F) {
rotate(this.rotateAngleX * 57.29578F, 1.0F, 0.0F, 0.0F);
}
callList(this.displayList);
popMatrix();
}
}
}
} }
@Override public void addPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale, Face face) {
public void renderWithRotation(float f) { this.cubeList.add(new ModelPlane(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, scale, face));
if (!this.isHidden) {
if (this.showModel) {
if (!this.compiled) {
this.compileDisplayList(f);
}
pushMatrix();
translate(this.rotationPointX * f, this.rotationPointY * f, this.rotationPointZ * f);
if (this.rotateAngleY != 0.0F) {
rotate(this.rotateAngleY * 57.29578F, 0.0F, 1.0F, 0.0F);
}
if (this.rotateAngleX != 0.0F) {
rotate(this.rotateAngleX * 57.29578F, 1.0F, 0.0F, 0.0F);
}
if (this.rotateAngleZ != 0.0F) {
rotate(this.rotateAngleZ * 57.29578F, 0.0F, 0.0F, 1.0F);
}
callList(this.displayList);
popMatrix();
}
}
} }
@Override public void addTopPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) {
public void postRender(float scale) { this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.UP);
if (!this.isHidden) {
if (this.showModel) {
if (!this.compiled) {
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 * scale, this.rotationPointY * scale, this.rotationPointZ * scale);
}
} else {
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);
}
if (this.rotateAngleY != 0.0F) {
rotate(this.rotateAngleY * 57.29578F, 0.0F, 1.0F, 0.0F);
}
if (this.rotateAngleX != 0.0F) {
rotate(this.rotateAngleX * 57.29578F, 1.0F, 0.0F, 0.0F);
}
}
}
}
} }
private void compileDisplayList(float f) { public void addBottomPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) {
this.displayList = GLAllocation.generateDisplayLists(1); this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.DOWN);
GL11.glNewList(this.displayList, 4864);
VertexBuffer wr = Tessellator.getInstance().getBuffer();
for (TexturedQuad face : this.faces) {
face.draw(wr, f);
}
GL11.glEndList();
this.compiled = true;
} }
public void addWestPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) {
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.WEST);
}
public void addEastPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) {
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.EAST);
}
public void addFrontPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) {
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.NORTH);
}
public void addBackPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) {
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.SOUTH);
}
} }