2020-08-09 17:46:58 +02:00
|
|
|
package mod.acgaming.spackenmobs.render;
|
2020-08-23 10:30:02 +02:00
|
|
|
|
2020-08-09 17:46:58 +02:00
|
|
|
import mod.acgaming.spackenmobs.entities.EntitySmavaCreeper;
|
2020-08-27 20:12:55 +02:00
|
|
|
import net.minecraft.client.renderer.GlStateManager;
|
2020-08-09 17:46:58 +02:00
|
|
|
import net.minecraft.client.renderer.entity.Render;
|
|
|
|
import net.minecraft.client.renderer.entity.RenderCreeper;
|
|
|
|
import net.minecraft.client.renderer.entity.RenderManager;
|
|
|
|
import net.minecraft.client.renderer.entity.layers.LayerCreeperCharge;
|
|
|
|
import net.minecraft.entity.monster.EntityCreeper;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2020-08-27 20:12:55 +02:00
|
|
|
import net.minecraft.util.math.MathHelper;
|
2020-08-09 17:46:58 +02:00
|
|
|
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
2020-08-11 20:12:48 +02:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2020-08-09 17:46:58 +02:00
|
|
|
|
2020-08-11 20:12:48 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
2020-08-23 15:38:40 +02:00
|
|
|
public class RenderSmavaCreeper extends RenderCreeper
|
|
|
|
{
|
2020-08-27 20:12:55 +02:00
|
|
|
public static class Factory implements IRenderFactory<EntitySmavaCreeper>
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public Render<? super EntitySmavaCreeper> createRenderFor(RenderManager manager)
|
|
|
|
{
|
|
|
|
return new RenderSmavaCreeper(manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
private static final ResourceLocation SMAVA_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/smava_creeper.png");
|
2020-08-27 20:12:55 +02:00
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
public static final Factory FACTORY = new Factory();
|
2020-08-09 17:46:58 +02:00
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
public RenderSmavaCreeper(RenderManager renderManagerIn)
|
|
|
|
{
|
|
|
|
super(renderManagerIn);
|
|
|
|
this.addLayer(new LayerCreeperCharge(this));
|
|
|
|
}
|
2020-08-23 10:30:02 +02:00
|
|
|
|
2020-08-27 20:12:55 +02:00
|
|
|
protected int getColorMultiplier(EntitySmavaCreeper entitylivingbaseIn, float lightBrightness, float partialTickTime)
|
|
|
|
{
|
|
|
|
float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);
|
|
|
|
|
|
|
|
if ((int) (f * 10.0F) % 2 == 0)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int i = (int) (f * 0.2F * 255.0F);
|
|
|
|
i = MathHelper.clamp(i, 0, 255);
|
|
|
|
return i << 24 | 822083583;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-23 10:30:02 +02:00
|
|
|
@Override
|
2020-08-23 15:38:40 +02:00
|
|
|
protected ResourceLocation getEntityTexture(EntityCreeper entity)
|
|
|
|
{
|
|
|
|
return SMAVA_TEXTURE;
|
|
|
|
}
|
|
|
|
|
2020-08-27 20:12:55 +02:00
|
|
|
protected void preRenderCallback(EntitySmavaCreeper entitylivingbaseIn, float partialTickTime)
|
2020-08-23 15:38:40 +02:00
|
|
|
{
|
2020-08-27 20:12:55 +02:00
|
|
|
float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);
|
|
|
|
float f1 = 1.0F + MathHelper.sin(f * 100.0F) * f * 0.01F;
|
|
|
|
f = MathHelper.clamp(f, 0.0F, 1.0F);
|
|
|
|
f = f * f;
|
|
|
|
f = f * f;
|
|
|
|
float f2 = (1.0F + f * 0.4F) * f1;
|
|
|
|
float f3 = (1.0F + f * 0.1F) / f1;
|
|
|
|
GlStateManager.scale(f2, f3, f2);
|
2020-08-23 10:30:02 +02:00
|
|
|
}
|
2020-08-09 17:46:58 +02:00
|
|
|
}
|