mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-29 07:27:59 +01:00
Add the vindicator and evoker ponies
This commit is contained in:
parent
8dfac7be08
commit
17ee345c11
14 changed files with 471 additions and 43 deletions
10
src/main/java/com/minelittlepony/IPonyData.java
Normal file
10
src/main/java/com/minelittlepony/IPonyData.java
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package com.minelittlepony;
|
||||||
|
|
||||||
|
import net.minecraft.client.resources.data.IMetadataSection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy interface so gson won't go crazy
|
||||||
|
*/
|
||||||
|
public interface IPonyData extends IMetadataSection {
|
||||||
|
|
||||||
|
}
|
|
@ -6,10 +6,12 @@ import com.minelittlepony.gui.PonySettingPanel;
|
||||||
import com.minelittlepony.hdskins.gui.EntityPonyModel;
|
import com.minelittlepony.hdskins.gui.EntityPonyModel;
|
||||||
import com.minelittlepony.hdskins.gui.GuiSkinsMineLP;
|
import com.minelittlepony.hdskins.gui.GuiSkinsMineLP;
|
||||||
import com.minelittlepony.hdskins.gui.RenderPonyModel;
|
import com.minelittlepony.hdskins.gui.RenderPonyModel;
|
||||||
|
import com.minelittlepony.renderer.RenderPonyEvoker;
|
||||||
import com.minelittlepony.renderer.RenderPonyPigman;
|
import com.minelittlepony.renderer.RenderPonyPigman;
|
||||||
import com.minelittlepony.renderer.RenderPonySkeleton;
|
import com.minelittlepony.renderer.RenderPonySkeleton;
|
||||||
import com.minelittlepony.renderer.RenderPonyVex;
|
import com.minelittlepony.renderer.RenderPonyVex;
|
||||||
import com.minelittlepony.renderer.RenderPonyVillager;
|
import com.minelittlepony.renderer.RenderPonyVillager;
|
||||||
|
import com.minelittlepony.renderer.RenderPonyVindicator;
|
||||||
import com.minelittlepony.renderer.RenderPonyZombie;
|
import com.minelittlepony.renderer.RenderPonyZombie;
|
||||||
import com.minelittlepony.renderer.RenderPonyZombieVillager;
|
import com.minelittlepony.renderer.RenderPonyZombieVillager;
|
||||||
import com.minelittlepony.util.MineLPLogger;
|
import com.minelittlepony.util.MineLPLogger;
|
||||||
|
@ -21,12 +23,15 @@ import com.voxelmodpack.hdskins.gui.GuiSkins;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||||
|
import net.minecraft.client.resources.data.MetadataSerializer;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
|
import net.minecraft.entity.monster.EntityEvoker;
|
||||||
import net.minecraft.entity.monster.EntityHusk;
|
import net.minecraft.entity.monster.EntityHusk;
|
||||||
import net.minecraft.entity.monster.EntityPigZombie;
|
import net.minecraft.entity.monster.EntityPigZombie;
|
||||||
import net.minecraft.entity.monster.EntitySkeleton;
|
import net.minecraft.entity.monster.EntitySkeleton;
|
||||||
import net.minecraft.entity.monster.EntityStray;
|
import net.minecraft.entity.monster.EntityStray;
|
||||||
import net.minecraft.entity.monster.EntityVex;
|
import net.minecraft.entity.monster.EntityVex;
|
||||||
|
import net.minecraft.entity.monster.EntityVindicator;
|
||||||
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
||||||
import net.minecraft.entity.monster.EntityZombie;
|
import net.minecraft.entity.monster.EntityZombie;
|
||||||
import net.minecraft.entity.monster.EntityZombieVillager;
|
import net.minecraft.entity.monster.EntityZombieVillager;
|
||||||
|
@ -68,6 +73,9 @@ public class MineLittlePony {
|
||||||
|
|
||||||
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
IReloadableResourceManager irrm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||||
irrm.registerReloadListener(this.ponyManager);
|
irrm.registerReloadListener(this.ponyManager);
|
||||||
|
|
||||||
|
MetadataSerializer ms = Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer;
|
||||||
|
ms.registerMetadataSectionType(new PonyDataSerialzier(), IPonyData.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
void postInit(Minecraft minecraft) {
|
void postInit(Minecraft minecraft) {
|
||||||
|
@ -107,6 +115,8 @@ public class MineLittlePony {
|
||||||
|
|
||||||
if (this.config.illagers) {
|
if (this.config.illagers) {
|
||||||
ModUtilities.addRenderer(EntityVex.class, new RenderPonyVex(rm));
|
ModUtilities.addRenderer(EntityVex.class, new RenderPonyVex(rm));
|
||||||
|
ModUtilities.addRenderer(EntityEvoker.class, new RenderPonyEvoker(rm));
|
||||||
|
ModUtilities.addRenderer(EntityVindicator.class, new RenderPonyVindicator(rm));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,9 @@ import java.awt.image.BufferedImage;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableBiMap;
|
import com.google.common.collect.ImmutableBiMap;
|
||||||
|
import net.minecraft.client.resources.data.IMetadataSection;
|
||||||
|
|
||||||
public class PonyData {
|
public class PonyData implements IPonyData {
|
||||||
|
|
||||||
private static final Map<Integer, PonyRace> RACE_COLORS = ImmutableBiMap.<Integer, PonyRace> builder()
|
private static final Map<Integer, PonyRace> RACE_COLORS = ImmutableBiMap.<Integer, PonyRace> builder()
|
||||||
.put(0xf9b131, PonyRace.EARTH)
|
.put(0xf9b131, PonyRace.EARTH)
|
||||||
|
@ -32,10 +33,6 @@ public class PonyData {
|
||||||
private PonySize size = PonySize.NORMAL;
|
private PonySize size = PonySize.NORMAL;
|
||||||
private int glowColor = 0x4444aa;
|
private int glowColor = 0x4444aa;
|
||||||
|
|
||||||
private int textureWidth;
|
|
||||||
|
|
||||||
private int textureHeight;
|
|
||||||
|
|
||||||
public PonyRace getRace() {
|
public PonyRace getRace() {
|
||||||
return race;
|
return race;
|
||||||
}
|
}
|
||||||
|
@ -80,15 +77,7 @@ public class PonyData {
|
||||||
this.glowColor = glowColor & 0xffffff;
|
this.glowColor = glowColor & 0xffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTextureWidth() {
|
static PonyData parse(BufferedImage image) {
|
||||||
return textureWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTextureHeight() {
|
|
||||||
return textureHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PonyData parse(BufferedImage image) {
|
|
||||||
PonyData data = new PonyData();
|
PonyData data = new PonyData();
|
||||||
|
|
||||||
int race = TriggerPixels.RACE.readColor(image);
|
int race = TriggerPixels.RACE.readColor(image);
|
||||||
|
@ -110,9 +99,6 @@ public class PonyData {
|
||||||
if (color != 0x000000)
|
if (color != 0x000000)
|
||||||
data.glowColor = color;
|
data.glowColor = color;
|
||||||
|
|
||||||
data.textureWidth = image.getWidth();
|
|
||||||
data.textureHeight = image.getHeight();
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +111,7 @@ public class PonyData {
|
||||||
|
|
||||||
private int x, y;
|
private int x, y;
|
||||||
|
|
||||||
private TriggerPixels(int x, int y) {
|
TriggerPixels(int x, int y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
|
|
26
src/main/java/com/minelittlepony/PonyDataSerialzier.java
Normal file
26
src/main/java/com/minelittlepony/PonyDataSerialzier.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package com.minelittlepony;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
import net.minecraft.client.resources.data.IMetadataSectionSerializer;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
public class PonyDataSerialzier implements IMetadataSectionSerializer<IPonyData> {
|
||||||
|
|
||||||
|
public static final String NAME = "pony";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSectionName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PonyData deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
|
return context.deserialize(json, PonyData.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
|
||||||
this.layerRenderers.clear();
|
this.layerRenderers.clear();
|
||||||
|
|
||||||
this.addLayer(new LayerPonyArmor(this));
|
this.addLayer(new LayerPonyArmor(this));
|
||||||
this.addLayer(new LayerHeldPonyItem<AbstractClientPlayer>(this));
|
this.addLayer(new LayerHeldPonyItem(this));
|
||||||
this.addLayer(new LayerArrow(this));
|
this.addLayer(new LayerArrow(this));
|
||||||
this.addLayer(new LayerPonyCape(this));
|
this.addLayer(new LayerPonyCape(this));
|
||||||
this.addLayer(new LayerPonySkull(this));
|
this.addLayer(new LayerPonySkull(this));
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.minelittlepony.model.pony;
|
||||||
|
|
||||||
|
import com.minelittlepony.renderer.HornGlowRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.monster.EntityEvoker;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
|
|
||||||
|
public class ModelEvokerPony extends ModelIllagerPony {
|
||||||
|
|
||||||
|
private HornGlowRenderer[] hornglow;
|
||||||
|
|
||||||
|
public ModelEvokerPony() {
|
||||||
|
hornglow = new HornGlowRenderer[2];
|
||||||
|
for (int i = 0; i < hornglow.length; i++) {
|
||||||
|
hornglow[i] = new HornGlowRenderer(this, 60, 3);
|
||||||
|
hornglow[i].setRotationPoint(0F, 1F, -5F);
|
||||||
|
}
|
||||||
|
hornglow[0].addBox(-0.5F, -12.0F, 3F, 1, 4, 1, 0.5F);
|
||||||
|
hornglow[1].addBox(-0.5F, -12.0F, 3F, 1, 3, 1, 0.8F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||||
|
super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
||||||
|
EntityEvoker evoker = (EntityEvoker) entityIn;
|
||||||
|
|
||||||
|
if (evoker.isCastingSpell()) {
|
||||||
|
GL11.glPushAttrib(24577);
|
||||||
|
disableTexture2D();
|
||||||
|
disableLighting();
|
||||||
|
enableBlend();
|
||||||
|
|
||||||
|
float red = (glowColor >> 16 & 255) / 255.0F;
|
||||||
|
float green = (glowColor >> 8 & 255) / 255.0F;
|
||||||
|
float blue = (glowColor & 255) / 255.0F;
|
||||||
|
blendFunc(GL11.GL_SRC_ALPHA, 1);
|
||||||
|
|
||||||
|
this.illagerHead.postRender(scale);
|
||||||
|
this.horn.postRender(scale);
|
||||||
|
|
||||||
|
color(red, green, blue, 0.4F);
|
||||||
|
this.hornglow[0].render(scale);
|
||||||
|
color(red, green, blue, 0.2F);
|
||||||
|
this.hornglow[1].render(scale);
|
||||||
|
|
||||||
|
enableTexture2D();
|
||||||
|
enableLighting();
|
||||||
|
disableBlend();
|
||||||
|
popAttrib();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,172 @@
|
||||||
|
package com.minelittlepony.model.pony;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.PonyModelConstants;
|
||||||
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.EnumHandSide;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
public abstract class ModelIllagerPony extends ModelBase {
|
||||||
|
|
||||||
|
public boolean isUnicorn;
|
||||||
|
public int glowColor;
|
||||||
|
|
||||||
|
public ModelRenderer illagerHead;
|
||||||
|
public ModelRenderer illagerBody;
|
||||||
|
public ModelRenderer leftForeLeg;
|
||||||
|
public ModelRenderer rightForeLeg;
|
||||||
|
public ModelRenderer leftHindLeg;
|
||||||
|
public ModelRenderer rightHindLeg;
|
||||||
|
public ModelRenderer tail;
|
||||||
|
public ModelRenderer horn;
|
||||||
|
|
||||||
|
ModelIllagerPony() {
|
||||||
|
textureWidth = 64;
|
||||||
|
textureHeight = 64;
|
||||||
|
|
||||||
|
this.setTextureOffset("head.ear1", 24, 4);
|
||||||
|
this.setTextureOffset("head.ear2", 0, 4);
|
||||||
|
this.setTextureOffset("head.snuzzle.mare1", 48, 21);
|
||||||
|
this.setTextureOffset("head.snuzzle.mare2", 49, 20);
|
||||||
|
this.setTextureOffset("head.snuzzle.stallion", 48, 16);
|
||||||
|
|
||||||
|
illagerHead = new ModelRenderer(this, "head");
|
||||||
|
illagerHead.setRotationPoint(0F, 1F, -5F);
|
||||||
|
illagerHead.setTextureOffset(0, 0).addBox(-4F, -6F, -5F, 8, 8, 8);
|
||||||
|
// headwear
|
||||||
|
illagerHead.setTextureOffset(32, 0).addBox(-4F, -6F, -5F, 8, 8, 8, 0.5F);
|
||||||
|
illagerHead.addBox("ear1", 2F, -8F, 0F, 2, 2, 2);
|
||||||
|
illagerHead.addBox("ear2", -4F, -8F, 0F, 2, 2, 2);
|
||||||
|
illagerHead.addBox("snuzzle.mare1", -2F, -0F, -6F, 4, 2, 1);
|
||||||
|
illagerHead.addBox("snuzzle.mare2", -1F, -1F, -6F, 2, 1, 1);
|
||||||
|
illagerHead.addBox("snuzzle.stallion", -2F, -1F, -6F, 4, 3, 1);
|
||||||
|
|
||||||
|
horn = new ModelRenderer(this, 60, 3);
|
||||||
|
horn.addBox(-0.5F, -11.0F, -2F, 1, 4, 1);
|
||||||
|
horn.rotateAngleX = 0.5F;
|
||||||
|
|
||||||
|
this.illagerHead.addChild(horn);
|
||||||
|
|
||||||
|
ModelRenderer illagerNeck = new ModelRenderer(this, 0, 40);
|
||||||
|
illagerNeck.addBox(-2F, 0F, -6F, 4, 4, 4);
|
||||||
|
illagerNeck.rotateAngleX = PonyModelConstants.NECK_ROT_X;
|
||||||
|
|
||||||
|
illagerBody = new ModelRenderer(this);
|
||||||
|
illagerBody.setTextureOffset(0, 16).addBox(-4F, 4F, -5F, 8, 8, 16);
|
||||||
|
illagerBody.addChild(illagerNeck);
|
||||||
|
|
||||||
|
leftForeLeg = new ModelRenderer(this, 32, 16);
|
||||||
|
leftForeLeg.addBox(0F, 0F, -2F, 4, 12, 4).setRotationPoint(0F, 12F, -3F);
|
||||||
|
|
||||||
|
rightForeLeg = new ModelRenderer(this, 32, 48);
|
||||||
|
rightForeLeg.addBox(-2F, 0F, -2F, 4, 12, 4).setRotationPoint(-2F, 12F, -3F);
|
||||||
|
|
||||||
|
leftHindLeg = new ModelRenderer(this, 0, 16);
|
||||||
|
leftHindLeg.addBox(-2F, 0F, -2F, 4, 12, 4).setRotationPoint(2F, 12F, 8F);
|
||||||
|
|
||||||
|
rightHindLeg = new ModelRenderer(this, 0, 48);
|
||||||
|
rightHindLeg.addBox(-2F, 0F, -2F, 4, 12, 4).setRotationPoint(-2F, 12F, 8F);
|
||||||
|
|
||||||
|
ModelRenderer tailStub = new ModelRenderer(this, 52, 24);
|
||||||
|
tailStub.addBox(-0.5F, -1F, -0.5F, 2, 4, 2).setRotationPoint(0F, 0F, 2F);
|
||||||
|
tailStub.rotateAngleX = (float) Math.PI / -3;
|
||||||
|
|
||||||
|
|
||||||
|
this.setTextureOffset("tail.1qtr", 48, 24);
|
||||||
|
this.setTextureOffset("tail.half", 48, 32);
|
||||||
|
this.setTextureOffset("tail.3qtr", 48, 40);
|
||||||
|
this.setTextureOffset("tail.full", 48, 48);
|
||||||
|
|
||||||
|
tail = new ModelRenderer(this, "tail");
|
||||||
|
tail.setRotationPoint(0F, 4F, 11F);
|
||||||
|
tail.addBox("1qtr", -1.5F, -2F, 2F, 4, 4, 4);
|
||||||
|
tail.addBox("half", -1.5F, 2F, 2F, 4, 4, 4);
|
||||||
|
tail.addBox("3qtr", -1.5F, 6F, 2F, 4, 4, 4);
|
||||||
|
tail.addBox("full", -1.5F, 10F, 2F, 4, 4, 4);
|
||||||
|
tail.addChild(tailStub);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||||
|
setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn);
|
||||||
|
|
||||||
|
illagerHead.render(scale);
|
||||||
|
illagerBody.render(scale);
|
||||||
|
leftForeLeg.render(scale);
|
||||||
|
rightForeLeg.render(scale);
|
||||||
|
leftHindLeg.render(scale);
|
||||||
|
rightHindLeg.render(scale);
|
||||||
|
tail.render(scale);
|
||||||
|
|
||||||
|
// mr.render(scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
|
||||||
|
|
||||||
|
final float PI = (float) Math.PI;
|
||||||
|
|
||||||
|
float headRotateAngleY = netHeadYaw * PI / 180;
|
||||||
|
float headRotateAngleX = headPitch * PI / 180;
|
||||||
|
|
||||||
|
final float max = 0.5f;
|
||||||
|
final float min = -1.25f;
|
||||||
|
headRotateAngleX = Math.min(headRotateAngleX, max);
|
||||||
|
headRotateAngleX = Math.max(headRotateAngleX, min);
|
||||||
|
this.illagerHead.rotateAngleY = headRotateAngleY;
|
||||||
|
this.illagerHead.rotateAngleX = headRotateAngleX;
|
||||||
|
|
||||||
|
this.tail.rotateAngleZ = MathHelper.cos(limbSwing * 0.8F) * 0.2F * limbSwingAmount;
|
||||||
|
|
||||||
|
float bodySwingRotation = 0.0F;
|
||||||
|
if (this.swingProgress > -9990.0F) {
|
||||||
|
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * PI * 2.0F) * 0.2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.illagerBody.rotateAngleY = bodySwingRotation * 0.2F;
|
||||||
|
this.illagerBody.rotateAngleY = bodySwingRotation * 0.2F;
|
||||||
|
|
||||||
|
|
||||||
|
this.tail.rotateAngleY = bodySwingRotation;
|
||||||
|
|
||||||
|
|
||||||
|
this.setLegs(limbSwing, limbSwingAmount);
|
||||||
|
this.tail.rotateAngleX = 0.5F * limbSwingAmount;
|
||||||
|
|
||||||
|
|
||||||
|
this.tail.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setLegs(float move, float swing) {
|
||||||
|
this.rotateLegs(move, swing);
|
||||||
|
// this.adjustLegs();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rotateLegs(float move, float swing) {
|
||||||
|
final float PI = (float) Math.PI;
|
||||||
|
float swag = (float) Math.pow(swing, 16.0D);
|
||||||
|
float raQuad = PI * swag * 0.5F;
|
||||||
|
float laQuad = PI * swag;
|
||||||
|
float rlQuad = PI * swag * 0.2F;
|
||||||
|
float llQuad = PI * swag * -0.4F;
|
||||||
|
|
||||||
|
|
||||||
|
this.rightForeLeg.rotateAngleX = MathHelper.cos(move * 0.6662F + (float) Math.PI + raQuad) * 0.45F * swing;
|
||||||
|
this.leftForeLeg.rotateAngleX = MathHelper.cos(move * 0.6662F + laQuad) * 0.45F * swing;
|
||||||
|
this.rightHindLeg.rotateAngleX = MathHelper.cos(move * 0.6662F + rlQuad) * 0.45F * swing;
|
||||||
|
this.leftHindLeg.rotateAngleX = MathHelper.cos(move * 0.6662F + PI + llQuad) * 0.45F * swing;
|
||||||
|
this.rightForeLeg.rotateAngleZ = 0.0F;
|
||||||
|
|
||||||
|
this.leftForeLeg.rotateAngleZ = 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelRenderer getArm(EnumHandSide side) {
|
||||||
|
return side == EnumHandSide.LEFT ? this.leftForeLeg : this.rightForeLeg;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.minelittlepony.model.pony;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.monster.EntityVindicator;
|
||||||
|
import net.minecraft.util.EnumHandSide;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
public class ModelVindicatorPony extends ModelIllagerPony {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
|
||||||
|
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
|
||||||
|
|
||||||
|
EntityVindicator vindicator = (EntityVindicator) entityIn;
|
||||||
|
if (vindicator.isAggressive()) {
|
||||||
|
float f = MathHelper.sin(this.swingProgress * (float) Math.PI);
|
||||||
|
float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float) Math.PI);
|
||||||
|
this.rightForeLeg.rotateAngleZ = 0.0F;
|
||||||
|
this.leftForeLeg.rotateAngleZ = 0.0F;
|
||||||
|
|
||||||
|
if (((EntityLivingBase) entityIn).getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||||
|
this.rightForeLeg.rotateAngleX = -1.8849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
|
||||||
|
// this.leftForeLeg.rotateAngleX = -0.0F + MathHelper.cos(ageInTicks * 0.19F) * 0.5F;
|
||||||
|
this.rightForeLeg.rotateAngleX += f * 2.2F - f1 * 0.4F;
|
||||||
|
// this.leftForeLeg.rotateAngleX += f * 1.2F - f1 * 0.4F;
|
||||||
|
} else {
|
||||||
|
// this.rightForeLeg.rotateAngleX = -0.0F + MathHelper.cos(ageInTicks * 0.19F) * 0.5F;
|
||||||
|
this.leftForeLeg.rotateAngleX = -1.8849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
|
||||||
|
// this.rightForeLeg.rotateAngleX += f * 1.2F - f1 * 0.4F;
|
||||||
|
this.leftForeLeg.rotateAngleX += f * 2.2F - f1 * 0.4F;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rightForeLeg.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
|
||||||
|
this.leftForeLeg.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
|
||||||
|
this.rightForeLeg.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
|
||||||
|
this.leftForeLeg.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.minelittlepony.renderer;
|
||||||
|
|
||||||
|
import com.minelittlepony.PonyData;
|
||||||
|
import com.minelittlepony.PonyDataSerialzier;
|
||||||
|
import com.minelittlepony.model.pony.ModelEvokerPony;
|
||||||
|
import com.minelittlepony.model.pony.ModelIllagerPony;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.resources.IResource;
|
||||||
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
|
import net.minecraft.entity.monster.EntityEvoker;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class RenderPonyEvoker extends RenderLiving<EntityEvoker> {
|
||||||
|
|
||||||
|
private static final ResourceLocation EVOKER = new ResourceLocation("minelittlepony", "textures/entity/illager/evoker_pony.png");
|
||||||
|
|
||||||
|
public RenderPonyEvoker(RenderManager rendermanagerIn) {
|
||||||
|
super(rendermanagerIn, new ModelEvokerPony(), 0.5F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doRender(EntityEvoker entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||||
|
ModelIllagerPony model = (ModelIllagerPony) this.getMainModel();
|
||||||
|
|
||||||
|
IResourceManager resources = Minecraft.getMinecraft().getResourceManager();
|
||||||
|
try {
|
||||||
|
model.glowColor = 0x4444aa;
|
||||||
|
model.isUnicorn = false;
|
||||||
|
IResource resource = resources.getResource(EVOKER);
|
||||||
|
if (resource.hasMetadata()) {
|
||||||
|
PonyData meta = resource.getMetadata(PonyDataSerialzier.NAME);
|
||||||
|
model.isUnicorn = meta.hasMagic();
|
||||||
|
model.glowColor = meta.getGlowColor();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ResourceLocation getEntityTexture(EntityEvoker entity) {
|
||||||
|
return EVOKER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void preRenderCallback(EntityEvoker entitylivingbaseIn, float partialTickTime) {
|
||||||
|
|
||||||
|
GlStateManager.scale(0.9375F, 0.9375F, 0.9375F);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.minelittlepony.renderer;
|
||||||
|
|
||||||
|
import com.minelittlepony.PonyData;
|
||||||
|
import com.minelittlepony.PonyDataSerialzier;
|
||||||
|
import com.minelittlepony.model.pony.ModelIllagerPony;
|
||||||
|
import com.minelittlepony.model.pony.ModelVindicatorPony;
|
||||||
|
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.resources.IResource;
|
||||||
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.monster.EntityVindicator;
|
||||||
|
import net.minecraft.util.EnumHandSide;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class RenderPonyVindicator extends RenderLiving<EntityVindicator> {
|
||||||
|
|
||||||
|
private static final ResourceLocation VINDICATOR = new ResourceLocation("minelittlepony", "textures/entity/illager/vindicator_pony.png");
|
||||||
|
|
||||||
|
public RenderPonyVindicator(RenderManager renderManager) {
|
||||||
|
super(renderManager, new ModelVindicatorPony(), 0.5F);
|
||||||
|
|
||||||
|
this.addLayer(new LayerHeldPonyItem(this) {
|
||||||
|
@Override
|
||||||
|
public void doRenderLayer(EntityLivingBase vindicator, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||||
|
|
||||||
|
if (((EntityVindicator) vindicator).isAggressive()) {
|
||||||
|
super.doRenderLayer(vindicator, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void translateToHand(EnumHandSide side) {
|
||||||
|
((ModelIllagerPony) this.livingPonyEntity.getMainModel()).getArm(side).postRender(0.0625F);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ResourceLocation getEntityTexture(EntityVindicator entity) {
|
||||||
|
return VINDICATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void preRenderCallback(EntityVindicator entitylivingbaseIn, float partialTickTime) {
|
||||||
|
GlStateManager.scale(0.9375F, 0.9375F, 0.9375F);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,19 +1,13 @@
|
||||||
package com.minelittlepony.renderer.layer;
|
package com.minelittlepony.renderer.layer;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
import org.lwjgl.opengl.GL14;
|
|
||||||
|
|
||||||
import com.minelittlepony.PonyData;
|
import com.minelittlepony.PonyData;
|
||||||
import com.minelittlepony.ducks.IRenderPony;
|
import com.minelittlepony.ducks.IRenderPony;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.PlayerModel;
|
|
||||||
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
||||||
import com.minelittlepony.model.pony.ModelPlayerPony;
|
import com.minelittlepony.model.pony.ModelPlayerPony;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelBiped;
|
import net.minecraft.client.model.ModelBiped;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
@ -26,10 +20,14 @@ import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumHandSide;
|
import net.minecraft.util.EnumHandSide;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import org.lwjgl.opengl.GL14;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
|
|
||||||
public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
|
public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
|
||||||
|
|
||||||
private final RenderLivingBase<? extends EntityLivingBase> livingPonyEntity;
|
protected final RenderLivingBase<? extends EntityLivingBase> livingPonyEntity;
|
||||||
private LayerHeldItem held;
|
private LayerHeldItem held;
|
||||||
|
|
||||||
public LayerHeldPonyItem(RenderLivingBase<? extends EntityLivingBase> livingPony) {
|
public LayerHeldPonyItem(RenderLivingBase<? extends EntityLivingBase> livingPony) {
|
||||||
|
@ -40,8 +38,8 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
|
||||||
@Override
|
@Override
|
||||||
public void doRenderLayer(EntityLivingBase entity, float p_177141_2_, float p_177141_3_,
|
public void doRenderLayer(EntityLivingBase entity, float p_177141_2_, float p_177141_3_,
|
||||||
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
||||||
PlayerModel pony = ((IRenderPony) livingPonyEntity).getPony();
|
ModelBase model = livingPonyEntity.getMainModel();
|
||||||
if (pony.getModel() instanceof ModelHumanPlayer) {
|
if (model instanceof ModelHumanPlayer) {
|
||||||
held.doRenderLayer(entity, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_,
|
held.doRenderLayer(entity, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_,
|
||||||
p_177141_7_, scale);
|
p_177141_7_, scale);
|
||||||
return;
|
return;
|
||||||
|
@ -52,9 +50,12 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
|
||||||
ItemStack left = mainRight ? itemOff : itemMain;
|
ItemStack left = mainRight ? itemOff : itemMain;
|
||||||
ItemStack right = mainRight ? itemMain : itemOff;
|
ItemStack right = mainRight ? itemMain : itemOff;
|
||||||
|
|
||||||
if (left != null || right != null) {
|
if (!left.isEmpty() || !right.isEmpty()) {
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
pony.getModel().transform(BodyPart.LEGS);
|
if (model instanceof AbstractPonyModel) {
|
||||||
|
((AbstractPonyModel) model).transform(BodyPart.LEGS);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.livingPonyEntity.getMainModel().isChild) {
|
if (this.livingPonyEntity.getMainModel().isChild) {
|
||||||
translate(0, 0.625, 0);
|
translate(0, 0.625, 0);
|
||||||
rotate(-20, -1, 0, 0);
|
rotate(-20, -1, 0, 0);
|
||||||
|
@ -71,22 +72,15 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
|
||||||
private void renderHeldItem(EntityLivingBase entity, ItemStack drop, ItemCameraTransforms.TransformType transform, EnumHandSide hand) {
|
private void renderHeldItem(EntityLivingBase entity, ItemStack drop, ItemCameraTransforms.TransformType transform, EnumHandSide hand) {
|
||||||
if (!drop.isEmpty()) {
|
if (!drop.isEmpty()) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
AbstractPonyModel thePony = ((IRenderPony) this.livingPonyEntity).getPony().getModel();
|
translateToHand(hand);
|
||||||
PonyData metadata = thePony.metadata;
|
|
||||||
boolean isUnicorn = metadata.hasMagic();
|
|
||||||
if (isUnicorn) {
|
|
||||||
ModelPlayerPony playerModel = (ModelPlayerPony) thePony;
|
|
||||||
ModelRenderer unicornarm = hand == EnumHandSide.LEFT ? playerModel.unicornArmLeft : playerModel.unicornArmRight;
|
|
||||||
unicornarm.postRender(0.0625F);
|
|
||||||
} else {
|
|
||||||
((ModelBiped) this.livingPonyEntity.getMainModel()).postRenderArm(0.0625F, hand);
|
|
||||||
}
|
|
||||||
if (entity.isSneaking()) {
|
if (entity.isSneaking()) {
|
||||||
GlStateManager.translate(0.0F, 0.2F, 0.0F);
|
GlStateManager.translate(0.0F, 0.2F, 0.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
|
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||||
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
|
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
boolean isUnicorn = isUnicorn(this.livingPonyEntity.getMainModel());
|
||||||
boolean isLeft = hand == EnumHandSide.LEFT;
|
boolean isLeft = hand == EnumHandSide.LEFT;
|
||||||
if (isUnicorn) {
|
if (isUnicorn) {
|
||||||
GlStateManager.translate(isLeft ? -0.6F : 0.1F, 1, -.5);
|
GlStateManager.translate(isLeft ? -0.6F : 0.1F, 1, -.5);
|
||||||
|
@ -96,12 +90,28 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
|
||||||
Minecraft.getMinecraft().getItemRenderer().renderItemSide(entity, drop, transform, isLeft);
|
Minecraft.getMinecraft().getItemRenderer().renderItemSide(entity, drop, transform, isLeft);
|
||||||
|
|
||||||
if (isUnicorn) {
|
if (isUnicorn) {
|
||||||
|
PonyData metadata = ((AbstractPonyModel)this.livingPonyEntity.getMainModel()).metadata;
|
||||||
this.renderItemGlow(entity, drop, transform, hand, metadata.getGlowColor());
|
this.renderItemGlow(entity, drop, transform, hand, metadata.getGlowColor());
|
||||||
}
|
}
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isUnicorn(ModelBase model) {
|
||||||
|
return model instanceof AbstractPonyModel && ((AbstractPonyModel) model).metadata.hasMagic();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void translateToHand(EnumHandSide hand) {
|
||||||
|
AbstractPonyModel thePony = ((IRenderPony) this.livingPonyEntity).getPony().getModel();
|
||||||
|
if (thePony.metadata.hasMagic()) {
|
||||||
|
ModelPlayerPony playerModel = (ModelPlayerPony) thePony;
|
||||||
|
ModelRenderer unicornarm = hand == EnumHandSide.LEFT ? playerModel.unicornArmLeft : playerModel.unicornArmRight;
|
||||||
|
unicornarm.postRender(0.0625F);
|
||||||
|
} else {
|
||||||
|
((ModelBiped) this.livingPonyEntity.getMainModel()).postRenderArm(0.0625F, hand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void renderItemGlow(EntityLivingBase entity, ItemStack drop, ItemCameraTransforms.TransformType transform, EnumHandSide hand, int glowColor) {
|
public void renderItemGlow(EntityLivingBase entity, ItemStack drop, ItemCameraTransforms.TransformType transform, EnumHandSide hand, int glowColor) {
|
||||||
|
|
||||||
// enchantments mess up the rendering
|
// enchantments mess up the rendering
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"pony": {
|
||||||
|
"race": "unicorn",
|
||||||
|
"glowColor": 3730130
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in a new issue