mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-23 21:49:45 +00:00
Blue slime balance
This commit is contained in:
1 parent
12b99e6f32
commit
57d8a3b405
108 files changed
+2776
-2126
No files matched your search
@@ -0,0 +1,80 @@
|
||||
package mods.tinker.tconstruct.client.entityrender;
|
||||
|
||||
import mods.tinker.tconstruct.entity.BlueSlime;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class SlimeRender extends RenderLiving
|
||||
{
|
||||
private ModelBase scaleAmount;
|
||||
|
||||
public SlimeRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
|
||||
{
|
||||
super(par1ModelBase, par3);
|
||||
this.scaleAmount = par2ModelBase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether Slime Render should pass or not.
|
||||
*/
|
||||
protected int shouldSlimeRenderPass(BlueSlime par1EdibleSlime, int par2, float par3)
|
||||
{
|
||||
if (par1EdibleSlime.getHasActivePotion())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (par2 == 0)
|
||||
{
|
||||
this.setRenderPassModel(this.scaleAmount);
|
||||
GL11.glEnable(GL11.GL_NORMALIZE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (par2 == 1)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the scale for the slime based on getSlimeSize in EdibleSlime
|
||||
*/
|
||||
protected void scaleSlime(BlueSlime par1EdibleSlime, float par2)
|
||||
{
|
||||
float f1 = (float)par1EdibleSlime.getSlimeSize();
|
||||
float f2 = (par1EdibleSlime.field_70812_c + (par1EdibleSlime.field_70811_b - par1EdibleSlime.field_70812_c) * par2) / (f1 * 0.5F + 1.0F);
|
||||
float f3 = 1.0F / (f2 + 1.0F);
|
||||
GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
|
||||
* entityLiving, partialTickTime
|
||||
*/
|
||||
protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
|
||||
{
|
||||
this.scaleSlime((BlueSlime)par1EntityLiving, par2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries whether should render the specified pass or not.
|
||||
*/
|
||||
protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
|
||||
{
|
||||
return this.shouldSlimeRenderPass((BlueSlime)par1EntityLiving, par2, par3);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user