mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Move the individual wing models into their main models
This commit is contained in:
parent
1e9a663aa2
commit
3889f57315
7 changed files with 187 additions and 210 deletions
|
@ -3,6 +3,7 @@ package com.minelittlepony.client.model.components;
|
|||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -15,13 +16,9 @@ public class BatWings<T extends AbstractPonyModel & IPegasus> extends PegasusWin
|
|||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
leftWing = new ModelBatWing<>(pegasus, false, false, yOffset, stretch, 16);
|
||||
rightWing = new ModelBatWing<>(pegasus, true, false, yOffset, stretch, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelWing<T> getRight() {
|
||||
return rightWing;
|
||||
leftWing = new Wing(pegasus, false, false, yOffset, stretch, 16);
|
||||
rightWing = new Wing(pegasus, true, false, yOffset, stretch, 16);
|
||||
legacyWing = rightWing;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,4 +31,61 @@ public class BatWings<T extends AbstractPonyModel & IPegasus> extends PegasusWin
|
|||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public class Wing extends PegasusWings<T>.Wing {
|
||||
|
||||
public Wing(T pegasus, boolean right, boolean legacy, float y, float scale, int texY) {
|
||||
super(pegasus, right, legacy, y, scale, texY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addClosedWing(boolean right, float y, float scale) {
|
||||
float x = right ? -4 : 3;
|
||||
|
||||
folded.around(HEAD_RP_X, WING_FOLDED_RP_Y + y - 1, WING_FOLDED_RP_Z - 2)
|
||||
.mirror(right)
|
||||
.tex(56, 16).box(x * 0.9F, 5, 4, 1, 4, 1, scale)
|
||||
.tex(56, 16).box(x, 5, 6, 1, 7, 1, scale)
|
||||
.box(x, 5, 5, 1, 6, 1, scale)
|
||||
.tex(56, 16).box(x * 0.9F, 5, 7, 1, 7, 1, scale)
|
||||
.rotateAngleX = ROTATE_90;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
||||
float r = right ? -1 : 1;
|
||||
|
||||
extended.around((r * (EXT_WING_RP_X - 2)), EXT_WING_RP_Y + rotationPointY - 1, EXT_WING_RP_Z - 3)
|
||||
.mirror(right)
|
||||
.rotateAngleY = r * 3;
|
||||
|
||||
extended.child().tex(60, 16)
|
||||
.mirror(right) // children are unaware of their parents being mirrored, sadly
|
||||
.rotate(0.1F, 0, 0)
|
||||
.box(-0.5F, -1, 0, 1, 8, 1, scale + 0.001F) // this was enough to fix z-fighting
|
||||
.child().tex(60, 16)
|
||||
.mirror(right)
|
||||
.rotate(-0.5F, 0, 0)
|
||||
.around(0, -1, -2)
|
||||
.box(-0.5F, 0, 2, 1, 7, 1, scale);
|
||||
extended.child(0)
|
||||
.child().tex(60, 16)
|
||||
.mirror(right)
|
||||
.rotate(-0.5F, 0, 0)
|
||||
.around(0, 4, -2.4F)
|
||||
.box(-0.5F, 0, 3, 1, 7, 1, scale);
|
||||
|
||||
PlaneRenderer skin = new PlaneRenderer(pegasus)
|
||||
.tex(56, 32)
|
||||
.mirror(right)
|
||||
.west(0, 0, -7, 16, 8, scale);
|
||||
|
||||
extended.child(0).child(skin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateWalking(float swing) {
|
||||
folded.rotateAngleY = swing * 0.05F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
public class BugWings<T extends AbstractPonyModel & IPegasus> extends PegasusWings<T> {
|
||||
|
@ -11,12 +12,47 @@ public class BugWings<T extends AbstractPonyModel & IPegasus> extends PegasusWin
|
|||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
leftWing = new ModelBugWing<>(pegasus, false, false, yOffset, stretch, 16);
|
||||
rightWing = new ModelBugWing<>(pegasus, true, false, yOffset, stretch, 16);
|
||||
leftWing = new Wing(pegasus, false, false, yOffset, stretch, 16);
|
||||
rightWing = new Wing(pegasus, true, false, yOffset, stretch, 16);
|
||||
legacyWing = rightWing;
|
||||
}
|
||||
|
||||
public class Wing extends PegasusWings<T>.Wing {
|
||||
|
||||
public Wing(T pegasus, boolean right, boolean legacy, float y, float scale, int texY) {
|
||||
super(pegasus, right, legacy, y, scale, texY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelWing<T> getRight() {
|
||||
return rightWing;
|
||||
protected void addClosedWing(boolean right, float y, float scale) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
||||
float r = right ? -1 : 1;
|
||||
|
||||
extended.around((r * (EXT_WING_RP_X - 2)), EXT_WING_RP_Y + rotationPointY, EXT_WING_RP_Z - 2)
|
||||
.mirror(right)
|
||||
.rotateAngleY = r * 3;
|
||||
|
||||
PlaneRenderer primary = new PlaneRenderer(pegasus)
|
||||
.tex(56, 16)
|
||||
.mirror(right)
|
||||
.west(r * -0.5F, 0, -7, 16, 8, scale);
|
||||
PlaneRenderer secondary = new PlaneRenderer(pegasus)
|
||||
.tex(56, 32)
|
||||
.rotate(-0.5F, r * 0.3F, r / 3)
|
||||
.mirror(right)
|
||||
.west(r, 0, -5, 16, 8, scale);
|
||||
|
||||
extended.child(primary);
|
||||
extended.child(secondary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float scale) {
|
||||
extended.render(scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
public class ModelBatWing<T extends AbstractPonyModel & IPegasus> extends ModelWing<T> {
|
||||
|
||||
public ModelBatWing(T pegasus, boolean right, boolean legacy, float y, float scale, int texY) {
|
||||
super(pegasus, right, legacy, y, scale, texY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addClosedWing(boolean right, float y, float scale) {
|
||||
float x = right ? -4 : 3;
|
||||
|
||||
folded.around(HEAD_RP_X, WING_FOLDED_RP_Y + y - 1, WING_FOLDED_RP_Z - 2)
|
||||
.mirror(right)
|
||||
.tex(56, 16).box(x * 0.9F, 5, 4, 1, 4, 1, scale)
|
||||
.tex(56, 16).box(x, 5, 6, 1, 7, 1, scale)
|
||||
.box(x, 5, 5, 1, 6, 1, scale)
|
||||
.tex(56, 16).box(x * 0.9F, 5, 7, 1, 7, 1, scale)
|
||||
.rotateAngleX = ROTATE_90;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
||||
float r = right ? -1 : 1;
|
||||
|
||||
extended.around((r * (EXT_WING_RP_X - 2)), EXT_WING_RP_Y + rotationPointY - 1, EXT_WING_RP_Z - 3)
|
||||
.mirror(right)
|
||||
.rotateAngleY = r * 3;
|
||||
|
||||
extended.child().tex(60, 16)
|
||||
.mirror(right) // children are unaware of their parents being mirrored, sadly
|
||||
.rotate(0.1F, 0, 0)
|
||||
.box(-0.5F, -1, 0, 1, 8, 1, scale + 0.001F) // this was enough to fix z-fighting
|
||||
.child().tex(60, 16)
|
||||
.mirror(right)
|
||||
.rotate(-0.5F, 0, 0)
|
||||
.around(0, -1, -2)
|
||||
.box(-0.5F, 0, 2, 1, 7, 1, scale);
|
||||
extended.child(0)
|
||||
.child().tex(60, 16)
|
||||
.mirror(right)
|
||||
.rotate(-0.5F, 0, 0)
|
||||
.around(0, 4, -2.4F)
|
||||
.box(-0.5F, 0, 3, 1, 7, 1, scale);
|
||||
|
||||
PlaneRenderer skin = new PlaneRenderer(pegasus)
|
||||
.tex(56, 32)
|
||||
.mirror(right)
|
||||
.west(0, 0, -7, 16, 8, scale);
|
||||
|
||||
extended.child(0).child(skin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateWalking(float swing) {
|
||||
folded.rotateAngleY = swing * 0.05F;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
public class ModelBugWing<T extends AbstractPonyModel & IPegasus> extends ModelWing<T> {
|
||||
|
||||
public ModelBugWing(T pegasus, boolean right, boolean legacy, float y, float scale, int texY) {
|
||||
super(pegasus, right, legacy, y, scale, texY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addClosedWing(boolean right, float y, float scale) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
||||
float r = right ? -1 : 1;
|
||||
|
||||
extended.around((r * (EXT_WING_RP_X - 2)), EXT_WING_RP_Y + rotationPointY, EXT_WING_RP_Z - 2)
|
||||
.mirror(right)
|
||||
.rotateAngleY = r * 3;
|
||||
|
||||
PlaneRenderer primary = new PlaneRenderer(pegasus)
|
||||
.tex(56, 16)
|
||||
.mirror(right)
|
||||
.west(r * -0.5F, 0, -7, 16, 8, scale);
|
||||
PlaneRenderer secondary = new PlaneRenderer(pegasus)
|
||||
.tex(56, 32)
|
||||
.rotate(-0.5F, r * 0.3F, r / 3)
|
||||
.mirror(right)
|
||||
.west(r, 0, -5, 16, 8, scale);
|
||||
|
||||
extended.child(primary);
|
||||
extended.child(secondary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float scale) {
|
||||
extended.render(scale);
|
||||
}
|
||||
}
|
|
@ -27,7 +27,8 @@ public class ModelPonyHead extends ModelHumanoidHead implements ICapitated<Model
|
|||
|
||||
snout.init(0, 0);
|
||||
|
||||
ears = new PonyRenderer(this, 0, 0).offset(0, -3, 2).around(0, 0, -2)
|
||||
ears = new PonyRenderer(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);
|
||||
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
||||
public class ModelWing<T extends AbstractPonyModel & IPegasus> implements PonyModelConstants {
|
||||
|
||||
protected final T pegasus;
|
||||
|
||||
protected final PonyRenderer extended;
|
||||
protected final PonyRenderer folded;
|
||||
|
||||
public ModelWing(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);
|
||||
|
||||
addClosedWing(right, y, scale);
|
||||
addFeathers(right, legacy, y, scale);
|
||||
}
|
||||
|
||||
protected void addClosedWing(boolean right, float y, float scale) {
|
||||
float x = right ? -6 : 4;
|
||||
|
||||
folded.around(HEAD_RP_X, WING_FOLDED_RP_Y + y, WING_FOLDED_RP_Z)
|
||||
.box(x, 5, 2, 2, 6, 2, scale)
|
||||
.box(x, 5, 4, 2, 8, 2, scale)
|
||||
.box(x, 5, 6, 2, 6, 2, scale)
|
||||
.rotateAngleX = ROTATE_90;
|
||||
}
|
||||
|
||||
protected void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
||||
float r = right ? -1 : 1;
|
||||
|
||||
extended.around(r * EXT_WING_RP_X, EXT_WING_RP_Y + rotationPointY, EXT_WING_RP_Z)
|
||||
.rotateAngleY = r * 3;
|
||||
addFeather(0, l, 6, 0, 9, scale + 0.1F);
|
||||
addFeather(1, l, -1, -0.3F, 8, scale + 0.1F) .rotateAngleX = -0.85F;
|
||||
addFeather(2, l, 1.8F, 1.3F, 8, scale - 0.1F) .rotateAngleX = -0.75F;
|
||||
addFeather(3, l, 5, 2, 8, scale) .rotateAngleX = -0.5F;
|
||||
addFeather(4, l, 0, -0.2F, 6, scale + 0.3F);
|
||||
addFeather(5, l, 0, 0, 3, scale + 0.19F).rotateAngleX = -0.85F;
|
||||
}
|
||||
|
||||
private PonyRenderer 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);
|
||||
}
|
||||
|
||||
public void rotateWalking(float swing) {
|
||||
folded.rotateAngleY = swing * 0.15F;
|
||||
}
|
||||
|
||||
public void rotateFlying(float angle) {
|
||||
extended.rotateAngleZ = angle;
|
||||
}
|
||||
|
||||
public void render(float scale) {
|
||||
if (pegasus.wingsAreOpen()) {
|
||||
extended.render(scale);
|
||||
} else {
|
||||
boolean bags = pegasus.isWearing(Wearable.SADDLE_BAGS);
|
||||
if (bags) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0, 0, 0.198F);
|
||||
}
|
||||
folded.render(scale);
|
||||
if (bags) {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +1,25 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
public class PegasusWings<T extends AbstractPonyModel & IPegasus> implements IPart {
|
||||
public class PegasusWings<T extends AbstractPonyModel & IPegasus> implements IPart, PonyModelConstants {
|
||||
|
||||
protected final T pegasus;
|
||||
|
||||
protected ModelWing<T> leftWing;
|
||||
protected ModelWing<T> rightWing;
|
||||
protected Wing leftWing;
|
||||
protected Wing rightWing;
|
||||
|
||||
protected ModelWing<T> legacyWing;
|
||||
protected Wing legacyWing;
|
||||
|
||||
public PegasusWings(T model, float yOffset, float stretch) {
|
||||
pegasus = model;
|
||||
|
@ -28,17 +29,17 @@ public class PegasusWings<T extends AbstractPonyModel & IPegasus> implements IPa
|
|||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
leftWing = new ModelWing<>(pegasus, false, false, yOffset, stretch, 32);
|
||||
rightWing = new ModelWing<>(pegasus, true, false, yOffset, stretch, 16);
|
||||
leftWing = new Wing(pegasus, false, false, yOffset, stretch, 32);
|
||||
rightWing = new Wing(pegasus, true, false, yOffset, stretch, 16);
|
||||
|
||||
legacyWing = new ModelWing<>(pegasus, true, true, yOffset, stretch, 32);
|
||||
legacyWing = new Wing(pegasus, true, true, yOffset, stretch, 32);
|
||||
}
|
||||
|
||||
public ModelWing<T> getLeft() {
|
||||
public Wing getLeft() {
|
||||
return leftWing;
|
||||
}
|
||||
|
||||
public ModelWing<T> getRight() {
|
||||
public Wing getRight() {
|
||||
return pegasus.isWearing(Wearable.SADDLE_BAGS) ? legacyWing : rightWing;
|
||||
}
|
||||
|
||||
|
@ -84,4 +85,73 @@ public class PegasusWings<T extends AbstractPonyModel & IPegasus> implements IPa
|
|||
getLeft().render(scale);
|
||||
getRight().render(scale);
|
||||
}
|
||||
|
||||
public class Wing {
|
||||
|
||||
protected final T pegasus;
|
||||
|
||||
protected final PonyRenderer extended;
|
||||
protected final PonyRenderer 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);
|
||||
|
||||
addClosedWing(right, y, scale);
|
||||
addFeathers(right, legacy, y, scale);
|
||||
}
|
||||
|
||||
protected void addClosedWing(boolean right, float y, float scale) {
|
||||
float x = right ? -6 : 4;
|
||||
|
||||
folded.around(HEAD_RP_X, WING_FOLDED_RP_Y + y, WING_FOLDED_RP_Z)
|
||||
.box(x, 5, 2, 2, 6, 2, scale)
|
||||
.box(x, 5, 4, 2, 8, 2, scale)
|
||||
.box(x, 5, 6, 2, 6, 2, scale)
|
||||
.rotateAngleX = ROTATE_90;
|
||||
}
|
||||
|
||||
protected void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
||||
float r = right ? -1 : 1;
|
||||
|
||||
extended.around(r * EXT_WING_RP_X, EXT_WING_RP_Y + rotationPointY, EXT_WING_RP_Z)
|
||||
.rotateAngleY = r * 3;
|
||||
addFeather(0, l, 6, 0, 9, scale + 0.1F);
|
||||
addFeather(1, l, -1, -0.3F, 8, scale + 0.1F) .rotateAngleX = -0.85F;
|
||||
addFeather(2, l, 1.8F, 1.3F, 8, scale - 0.1F) .rotateAngleX = -0.75F;
|
||||
addFeather(3, l, 5, 2, 8, scale) .rotateAngleX = -0.5F;
|
||||
addFeather(4, l, 0, -0.2F, 6, scale + 0.3F);
|
||||
addFeather(5, l, 0, 0, 3, scale + 0.19F).rotateAngleX = -0.85F;
|
||||
}
|
||||
|
||||
private PonyRenderer 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);
|
||||
}
|
||||
|
||||
public void rotateWalking(float swing) {
|
||||
folded.rotateAngleY = swing * 0.15F;
|
||||
}
|
||||
|
||||
public void rotateFlying(float angle) {
|
||||
extended.rotateAngleZ = angle;
|
||||
}
|
||||
|
||||
public void render(float scale) {
|
||||
if (pegasus.wingsAreOpen()) {
|
||||
extended.render(scale);
|
||||
} else {
|
||||
boolean bags = pegasus.isWearing(Wearable.SADDLE_BAGS);
|
||||
if (bags) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0, 0, 0.198F);
|
||||
}
|
||||
folded.render(scale);
|
||||
if (bags) {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue