Added the initial body of the Corrupted sheep, as well as the rendering. Moved most of the aspected demon stuff to a new base class.

This commit is contained in:
WayofTime 2016-09-17 08:06:31 -04:00
parent f900fef846
commit 7b55293a40
15 changed files with 721 additions and 94 deletions

View file

@ -0,0 +1,15 @@
package WayofTime.bloodmagic.client.render.entity;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep;
public class CorruptedSheepRenderFactory implements IRenderFactory<EntityCorruptedSheep>
{
@Override
public Render<? super EntityCorruptedSheep> createRenderFor(RenderManager manager)
{
return new RenderCorruptedSheep(manager);
}
}

View file

@ -0,0 +1,32 @@
package WayofTime.bloodmagic.client.render.entity;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.client.render.entity.layer.LayerCorruptedSheepWool;
import WayofTime.bloodmagic.client.render.entity.layer.LayerWill;
import WayofTime.bloodmagic.client.render.model.ModelCorruptedSheep;
import WayofTime.bloodmagic.client.render.model.ModelCorruptedSheep2;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep;
@SideOnly(Side.CLIENT)
public class RenderCorruptedSheep extends RenderLiving<EntityCorruptedSheep>
{
private static final ResourceLocation SHEARED_SHEEP_TEXTURES = new ResourceLocation("textures/entity/sheep/sheep.png");
public RenderCorruptedSheep(RenderManager renderManagerIn)
{
super(renderManagerIn, new ModelCorruptedSheep2(0), 0.7F);
this.addLayer(new LayerCorruptedSheepWool(this));
this.addLayer(new LayerWill<EntityCorruptedSheep>(this, new ModelCorruptedSheep(1.1f)));
this.addLayer(new LayerWill<EntityCorruptedSheep>(this, new ModelCorruptedSheep2(1.1f)));
}
@Override
protected ResourceLocation getEntityTexture(EntityCorruptedSheep entity)
{
return SHEARED_SHEEP_TEXTURES;
}
}

View file

@ -1,6 +1,5 @@
package WayofTime.bloodmagic.client.render.entity;
import net.minecraft.client.model.ModelCreeper;
import net.minecraft.client.model.ModelZombie;
import net.minecraft.client.model.ModelZombieVillager;
import net.minecraft.client.renderer.entity.RenderBiped;
@ -18,7 +17,7 @@ import WayofTime.bloodmagic.entity.mob.EntityCorruptedZombie;
@SideOnly(Side.CLIENT)
public class RenderCorruptedZombie extends RenderBiped<EntityCorruptedZombie>
{
private static final ResourceLocation ZOMBIE_TEXTURES = new ResourceLocation("bloodmagic", "textures/entities/zombie_raw.png");
private static final ResourceLocation ZOMBIE_TEXTURES = new ResourceLocation("textures/entity/zombie/zombie.png");
private final ModelZombieVillager zombieVillagerModel;
public RenderCorruptedZombie(RenderManager renderManagerIn)

View file

@ -0,0 +1,58 @@
package WayofTime.bloodmagic.client.render.entity.layer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.client.render.entity.RenderCorruptedSheep;
import WayofTime.bloodmagic.client.render.model.ModelCorruptedSheep;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep;
@SideOnly(Side.CLIENT)
public class LayerCorruptedSheepWool implements LayerRenderer<EntityCorruptedSheep>
{
private static final ResourceLocation TEXTURE = new ResourceLocation("textures/entity/sheep/sheep_fur.png");
private final RenderCorruptedSheep sheepRenderer;
private final ModelCorruptedSheep sheepModel = new ModelCorruptedSheep(1);
public LayerCorruptedSheepWool(RenderCorruptedSheep renderCorruptedSheep)
{
this.sheepRenderer = renderCorruptedSheep;
}
public void doRenderLayer(EntityCorruptedSheep entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
if (!entitylivingbaseIn.getSheared() && !entitylivingbaseIn.isInvisible())
{
this.sheepRenderer.bindTexture(TEXTURE);
if (entitylivingbaseIn.hasCustomName() && "jeb_".equals(entitylivingbaseIn.getCustomNameTag()))
{
int i1 = 25;
int i = entitylivingbaseIn.ticksExisted / 25 + entitylivingbaseIn.getEntityId();
int j = EnumDyeColor.values().length;
int k = i % j;
int l = (i + 1) % j;
float f = ((float) (entitylivingbaseIn.ticksExisted % 25) + partialTicks) / 25.0F;
float[] afloat1 = EntityCorruptedSheep.getDyeRgb(EnumDyeColor.byMetadata(k));
float[] afloat2 = EntityCorruptedSheep.getDyeRgb(EnumDyeColor.byMetadata(l));
GlStateManager.color(afloat1[0] * (1.0F - f) + afloat2[0] * f, afloat1[1] * (1.0F - f) + afloat2[1] * f, afloat1[2] * (1.0F - f) + afloat2[2] * f);
} else
{
float[] afloat = EntityCorruptedSheep.getDyeRgb(entitylivingbaseIn.getFleeceColor());
GlStateManager.color(afloat[0], afloat[1], afloat[2]);
}
this.sheepModel.setModelAttributes(this.sheepRenderer.getMainModel());
this.sheepModel.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks);
this.sheepModel.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
}
}
public boolean shouldCombineTextures()
{
return true;
}
}

View file

@ -3,7 +3,6 @@ package WayofTime.bloodmagic.client.render.entity.layer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.layers.LayerCreeperCharge;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
@ -13,7 +12,7 @@ import WayofTime.bloodmagic.entity.mob.EntityDemonBase;
@SideOnly(Side.CLIENT)
public class LayerWill<T extends EntityDemonBase> implements LayerRenderer<T>
{
private static final ResourceLocation LIGHTNING_TEXTURE = new ResourceLocation("bloodmagic", "textures/entities/overlay/overlay_raw.png");
private static final ResourceLocation RAW_TEXTURE = new ResourceLocation("bloodmagic", "textures/entities/overlay/overlay_raw.png");
private final RenderLiving<T> renderer;
private final ModelBase model;
@ -24,34 +23,34 @@ public class LayerWill<T extends EntityDemonBase> implements LayerRenderer<T>
}
@Override
public void doRenderLayer(EntityDemonBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
public void doRenderLayer(EntityDemonBase demon, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
// if (entitylivingbaseIn.getPowered())
{
boolean flag = entitylivingbaseIn.isInvisible();
GlStateManager.depthMask(!flag);
this.renderer.bindTexture(LIGHTNING_TEXTURE);
GlStateManager.matrixMode(5890);
GlStateManager.loadIdentity();
float f = (float) entitylivingbaseIn.ticksExisted + partialTicks;
GlStateManager.translate(f * 0.01F, f * 0.01F, 0.0F);
GlStateManager.matrixMode(5888);
GlStateManager.enableBlend();
float f1 = 0.5F;
GlStateManager.color(0.5F, 0.5F, 0.5F, 1.0F);
GlStateManager.disableLighting();
GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
this.model.setModelAttributes(this.renderer.getMainModel());
this.model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
GlStateManager.matrixMode(5890);
GlStateManager.loadIdentity();
GlStateManager.matrixMode(5888);
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.depthMask(flag);
}
// if (demon.getPowered())
boolean flag = demon.isInvisible();
GlStateManager.depthMask(!flag);
this.renderer.bindTexture(RAW_TEXTURE);
GlStateManager.matrixMode(5890);
GlStateManager.loadIdentity();
float f = (float) demon.ticksExisted + partialTicks;
GlStateManager.translate(f * 0.01F, f * 0.01F, 0.0F);
GlStateManager.matrixMode(5888);
GlStateManager.enableBlend();
float f1 = 0.5F;
GlStateManager.color(f1, f1, f1, 1.0F);
GlStateManager.disableLighting();
GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
this.model.setModelAttributes(this.renderer.getMainModel());
this.model.render(demon, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
GlStateManager.matrixMode(5890);
GlStateManager.loadIdentity();
GlStateManager.matrixMode(5888);
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.depthMask(flag);
}
@Override
public boolean shouldCombineTextures()
{
return false;

View file

@ -0,0 +1,63 @@
package WayofTime.bloodmagic.client.render.model;
import net.minecraft.client.model.ModelQuadruped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep;
@SideOnly(Side.CLIENT)
public class ModelCorruptedSheep extends ModelQuadruped
{
private float headRotationAngleX;
public ModelCorruptedSheep(float scale)
{
super(12, scale);
this.head = new ModelRenderer(this, 0, 0);
this.head.addBox(-3.0F, -4.0F, -4.0F, 6, 6, 6, 0.6F * scale);
this.head.setRotationPoint(0.0F, 6.0F, -8.0F);
this.body = new ModelRenderer(this, 28, 8);
this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 1.75F * scale);
this.body.setRotationPoint(0.0F, 5.0F, 2.0F);
float f = 0.5F;
this.leg1 = new ModelRenderer(this, 0, 16);
this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F * scale);
this.leg1.setRotationPoint(-3.0F, 12.0F, 7.0F);
this.leg2 = new ModelRenderer(this, 0, 16);
this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F * scale);
this.leg2.setRotationPoint(3.0F, 12.0F, 7.0F);
this.leg3 = new ModelRenderer(this, 0, 16);
this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F * scale);
this.leg3.setRotationPoint(-3.0F, 12.0F, -5.0F);
this.leg4 = new ModelRenderer(this, 0, 16);
this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, 0.5F * scale);
this.leg4.setRotationPoint(3.0F, 12.0F, -5.0F);
}
/**
* Used for easily adding entity-dependent animations. The second and third
* float params here are the same second and third as in the
* setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
{
super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime);
this.head.rotationPointY = 6.0F + ((EntityCorruptedSheep) entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F;
this.headRotationAngleX = ((EntityCorruptedSheep) entitylivingbaseIn).getHeadRotationAngleX(partialTickTime);
}
/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are
* used for animating the movement of arms and legs, where par1 represents
* the time(so that arms and legs swing back and forth) and par2 represents
* how "far" arms and legs can swing at most.
*/
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);
this.head.rotateAngleX = this.headRotationAngleX;
}
}

View file

@ -0,0 +1,50 @@
package WayofTime.bloodmagic.client.render.model;
import net.minecraft.client.model.ModelQuadruped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep;
@SideOnly(Side.CLIENT)
public class ModelCorruptedSheep2 extends ModelQuadruped
{
private float headRotationAngleX;
public ModelCorruptedSheep2(float scale)
{
super(12, scale);
this.head = new ModelRenderer(this, 0, 0);
this.head.addBox(-3.0F, -4.0F, -6.0F, 6, 6, 8, scale);
this.head.setRotationPoint(0.0F, 6.0F, -8.0F);
this.body = new ModelRenderer(this, 28, 8);
this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, scale);
this.body.setRotationPoint(0.0F, 5.0F, 2.0F);
}
/**
* Used for easily adding entity-dependent animations. The second and third
* float params here are the same second and third as in the
* setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
{
super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime);
this.head.rotationPointY = 6.0F + ((EntityCorruptedSheep) entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F;
this.headRotationAngleX = ((EntityCorruptedSheep) entitylivingbaseIn).getHeadRotationAngleX(partialTickTime);
}
/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are
* used for animating the movement of arms and legs, where par1 represents
* the time(so that arms and legs swing back and forth) and par2 represents
* how "far" arms and legs can swing at most.
*/
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);
this.head.rotateAngleX = this.headRotationAngleX;
}
}