mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Bat wings for bat ponies. Kinda.
This commit is contained in:
parent
8f7a226b4a
commit
75bb59eeab
6 changed files with 137 additions and 25 deletions
|
@ -0,0 +1,41 @@
|
||||||
|
package com.minelittlepony.model.components;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
|
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||||
|
|
||||||
|
public class BatWings<T extends AbstractPonyModel & IModelPegasus> extends PegasusWings<T> {
|
||||||
|
|
||||||
|
public BatWings(T model, float yOffset, float stretch) {
|
||||||
|
super(model, yOffset, stretch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(float yOffset, float stretch) {
|
||||||
|
int x = 57;
|
||||||
|
|
||||||
|
leftWing = new ModelBatWing<T>(pegasus, false, false, yOffset, stretch, x, 16);
|
||||||
|
rightWing = new ModelBatWing<T>(pegasus, true, false, yOffset, stretch, x - 1, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelWing<T> getRight() {
|
||||||
|
return rightWing;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderPart(float scale) {
|
||||||
|
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.scale(1.3F, 1.3F, 1.3F);
|
||||||
|
|
||||||
|
super.renderPart(scale);
|
||||||
|
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.minelittlepony.model.components;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
|
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||||
|
import com.minelittlepony.render.plane.PlaneRenderer;
|
||||||
|
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.EXT_WING_RP_X;
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.EXT_WING_RP_Y;
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.EXT_WING_RP_Z;
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_X;
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.ROTATE_90;
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.WING_FOLDED_RP_Y;
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.WING_FOLDED_RP_Z;
|
||||||
|
|
||||||
|
public class ModelBatWing<T extends AbstractPonyModel & IModelPegasus> extends ModelWing<T> {
|
||||||
|
|
||||||
|
public ModelBatWing(T pegasus, boolean right, boolean legacy, float y, float scale, int texX, int texY) {
|
||||||
|
super(pegasus, right, legacy, y, scale, texX, 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(60, 16).box(x, 5, 4, 1, 7, 1, scale)
|
||||||
|
.tex(56, 16).box(x, 5, 6, 1, 8, 1, scale)
|
||||||
|
.box(x, 5, 5, 1, 8, 1, scale)
|
||||||
|
.tex(60, 24).box(x, 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 - 1.5F), EXT_WING_RP_Y + rotationPointY - r/3, EXT_WING_RP_Z - 2)
|
||||||
|
.mirror(right)
|
||||||
|
.rotateAngleY = r * 3;
|
||||||
|
|
||||||
|
extended.child().tex(56, 16)
|
||||||
|
.rotate(0.1F, 0, 0)
|
||||||
|
.box(0, -1, 0, 1, 8, 1, scale)
|
||||||
|
.child().tex(60, 16)
|
||||||
|
.rotate(-0.5F, 0, 0)
|
||||||
|
.around(0, -1, -2)
|
||||||
|
.box(0, 0, 2, 1, 7, 1, scale)
|
||||||
|
.child().tex(60, 24)
|
||||||
|
.rotate(-0.5F, 0, 0)
|
||||||
|
.around(0, -2, -1)
|
||||||
|
.box(0, 0, 3, 1, 7, 1, scale);
|
||||||
|
|
||||||
|
PlaneRenderer skin = new PlaneRenderer(pegasus)
|
||||||
|
.tex(56, 32);
|
||||||
|
|
||||||
|
extended.child(0).child(skin);
|
||||||
|
|
||||||
|
if (right) {
|
||||||
|
skin .addWestPlane(0.5F, -1, -6, 8, 8, scale);
|
||||||
|
} else {
|
||||||
|
skin.flip().addWestPlane(0.5F, -1, -6, 8, 8, scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rotateWalking(float swing) {
|
||||||
|
folded.rotateAngleY = swing * 0.05F;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,14 +8,14 @@ import com.minelittlepony.pony.data.PonyWearable;
|
||||||
import com.minelittlepony.render.PonyRenderer;
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
|
||||||
public class ModelWing {
|
public class ModelWing<T extends AbstractPonyModel & IModelPegasus> {
|
||||||
|
|
||||||
private final IModelPegasus pegasus;
|
protected final T pegasus;
|
||||||
|
|
||||||
private final PonyRenderer extended;
|
protected final PonyRenderer extended;
|
||||||
private final PonyRenderer folded;
|
protected final PonyRenderer folded;
|
||||||
|
|
||||||
public <T extends AbstractPonyModel & IModelPegasus> ModelWing(T pegasus, boolean right, boolean legacy, float y, float scale, int texX, int texY) {
|
public ModelWing(T pegasus, boolean right, boolean legacy, float y, float scale, int texX, int texY) {
|
||||||
this.pegasus = pegasus;
|
this.pegasus = pegasus;
|
||||||
|
|
||||||
folded = new PonyRenderer(pegasus, 56, texY).mirror(legacy);
|
folded = new PonyRenderer(pegasus, 56, texY).mirror(legacy);
|
||||||
|
@ -25,7 +25,7 @@ public class ModelWing {
|
||||||
addFeathers(right, legacy, y, scale);
|
addFeathers(right, legacy, y, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addClosedWing(boolean right, float y, float scale) {
|
protected void addClosedWing(boolean right, float y, float scale) {
|
||||||
float x = right ? -6 : 4;
|
float x = right ? -6 : 4;
|
||||||
|
|
||||||
folded.around(HEAD_RP_X, WING_FOLDED_RP_Y + y, WING_FOLDED_RP_Z)
|
folded.around(HEAD_RP_X, WING_FOLDED_RP_Y + y, WING_FOLDED_RP_Z)
|
||||||
|
@ -35,7 +35,7 @@ public class ModelWing {
|
||||||
.rotateAngleX = ROTATE_90;
|
.rotateAngleX = ROTATE_90;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
protected void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
||||||
float r = right ? -1 : 1;
|
float r = right ? -1 : 1;
|
||||||
|
|
||||||
extended.around(r * EXT_WING_RP_X, EXT_WING_RP_Y + rotationPointY, EXT_WING_RP_Z)
|
extended.around(r * EXT_WING_RP_X, EXT_WING_RP_Y + rotationPointY, EXT_WING_RP_Z)
|
||||||
|
|
|
@ -11,12 +11,12 @@ import com.minelittlepony.pony.data.PonyWearable;
|
||||||
|
|
||||||
public class PegasusWings<T extends AbstractPonyModel & IModelPegasus> implements IModelPart {
|
public class PegasusWings<T extends AbstractPonyModel & IModelPegasus> implements IModelPart {
|
||||||
|
|
||||||
private final T pegasus;
|
protected final T pegasus;
|
||||||
|
|
||||||
private ModelWing leftWing;
|
protected ModelWing<T> leftWing;
|
||||||
private ModelWing rightWing;
|
protected ModelWing<T> rightWing;
|
||||||
|
|
||||||
private ModelWing legacyWing;
|
protected ModelWing<T> legacyWing;
|
||||||
|
|
||||||
public PegasusWings(T model, float yOffset, float stretch) {
|
public PegasusWings(T model, float yOffset, float stretch) {
|
||||||
pegasus = model;
|
pegasus = model;
|
||||||
|
@ -28,17 +28,17 @@ public class PegasusWings<T extends AbstractPonyModel & IModelPegasus> implement
|
||||||
public void init(float yOffset, float stretch) {
|
public void init(float yOffset, float stretch) {
|
||||||
int x = 57;
|
int x = 57;
|
||||||
|
|
||||||
leftWing = new ModelWing(pegasus, false, false, yOffset, stretch, x, 32);
|
leftWing = new ModelWing<>(pegasus, false, false, yOffset, stretch, x, 32);
|
||||||
rightWing = new ModelWing(pegasus, true, false, yOffset, stretch, x - 1, 16);
|
rightWing = new ModelWing<>(pegasus, true, false, yOffset, stretch, x - 1, 16);
|
||||||
|
|
||||||
legacyWing = new ModelWing(pegasus, true, true, yOffset, stretch, x, 32);
|
legacyWing = new ModelWing<>(pegasus, true, true, yOffset, stretch, x, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelWing getLeft() {
|
public ModelWing<T> getLeft() {
|
||||||
return leftWing;
|
return leftWing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelWing getRight() {
|
public ModelWing<T> getRight() {
|
||||||
return pegasus.isWearing(PonyWearable.SADDLE_BAGS) ? legacyWing : rightWing;
|
return pegasus.isWearing(PonyWearable.SADDLE_BAGS) ? legacyWing : rightWing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package com.minelittlepony.model.player;
|
package com.minelittlepony.model.player;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.components.BatWings;
|
||||||
import com.minelittlepony.model.components.PegasusWings;
|
import com.minelittlepony.model.components.PegasusWings;
|
||||||
import com.minelittlepony.render.PonyRenderer;
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
import com.minelittlepony.model.capabilities.IModelPegasus;
|
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||||
|
@ -18,7 +20,7 @@ public class ModelBatpony extends ModelEarthPony implements IModelPegasus {
|
||||||
@Override
|
@Override
|
||||||
public void init(float yOffset, float stretch) {
|
public void init(float yOffset, float stretch) {
|
||||||
super.init(yOffset, stretch);
|
super.init(yOffset, stretch);
|
||||||
wings = new PegasusWings<>(this, yOffset, stretch);
|
wings = new BatWings<>(this, yOffset, stretch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,6 +33,7 @@ public class ModelBatpony extends ModelEarthPony implements IModelPegasus {
|
||||||
@Override
|
@Override
|
||||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
|
||||||
wings.renderPart(scale);
|
wings.renderPart(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,15 +41,13 @@ public class ModelBatpony extends ModelEarthPony implements IModelPegasus {
|
||||||
@Override
|
@Override
|
||||||
protected void initEars(PonyRenderer head, float yOffset, float stretch) {
|
protected void initEars(PonyRenderer head, float yOffset, float stretch) {
|
||||||
head.child()
|
head.child()
|
||||||
.rotate(0, 0, -0.1F)
|
.tex(14, 16).box(-4, -6, 0.5F, 1, 2, 2, stretch) // right ear
|
||||||
.tex(14, 16).box(-4, -6, 1, 1, 2, 2, stretch) // right ear
|
.tex(0, 3).box(-4, -6.49F, 2.49F, 1, 1, 1, stretch)
|
||||||
.tex(0, 3).box(-4, -6, 2.5F, 1, 1, 1, stretch)
|
.tex(0, 5).box(-3, -5, 1.5F, 1, 1, 1, stretch);
|
||||||
.tex(0, 5).box(-4, -6.7F, 2, 1, 1, 1, stretch);
|
|
||||||
|
|
||||||
head.child().flip()
|
head.child().flip()
|
||||||
.rotate(0, 0, 0.1F)
|
.tex(14, 16).box( 3, -6, 0.5F, 1, 2, 2, stretch) // left ear
|
||||||
.tex(14, 16).box( 3, -6, 1, 1, 2, 2, stretch) // left ear
|
.tex(0, 3).box( 3, -6.49F, 2.49F, 1, 1, 1, stretch)
|
||||||
.tex(0, 3).box( 3, -6, 2.5F, 1, 1, 1, stretch)
|
.tex(0, 5).box( 2, -5, 1.5F, 1, 1, 1, stretch);
|
||||||
.tex(0, 5).box( 3, -6.7F, 2, 1, 1, 1, stretch);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in a new issue