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;