Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. package kristenores.mod.entity.wither.UselessWither;
  2.  
  3. import javax.annotation.Nonnull;
  4.  
  5. import kristenores.mod.entity.spider.CopperSpider.EntityCopperSpider;
  6. import net.minecraft.client.model.ModelWither;
  7. import net.minecraft.client.renderer.GlStateManager;
  8. import net.minecraft.client.renderer.entity.Render;
  9. import net.minecraft.client.renderer.entity.RenderLiving;
  10. import net.minecraft.client.renderer.entity.RenderManager;
  11. import net.minecraft.client.renderer.entity.layers.LayerWitherAura;
  12. import net.minecraft.entity.boss.EntityWither;
  13. import net.minecraft.util.ResourceLocation;
  14. import net.minecraftforge.fml.client.registry.IRenderFactory;
  15. import net.minecraftforge.fml.relauncher.Side;
  16. import net.minecraftforge.fml.relauncher.SideOnly;
  17.  
  18. @SideOnly(Side.CLIENT)
  19. public class RenderUselessWither extends RenderLiving<EntityUselessWither>
  20. {
  21. private static final ResourceLocation INVULNERABLE_WITHER_TEXTURES = new ResourceLocation("textures/entity/wither/wither_invulnerable.png");
  22. private static final ResourceLocation WITHER_TEXTURES = new ResourceLocation("textures/entity/wither/wither.png");
  23.  
  24. public RenderUselessWither(RenderManager renderManagerIn)
  25. {
  26. super(renderManagerIn, new ModelWither(0.0F), 1.0F);
  27. }
  28.  
  29. /**
  30. * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
  31. */
  32. protected ResourceLocation getEntityTexture(EntityWither entity)
  33. {
  34. int i = entity.getInvulTime();
  35. return i > 0 && (i > 80 || i / 5 % 2 != 1) ? INVULNERABLE_WITHER_TEXTURES : WITHER_TEXTURES;
  36. }
  37.  
  38. /**
  39. * Allows the render to do state modifications necessary before the model is rendered.
  40. */
  41. protected void preRenderCallback(EntityWither entitylivingbaseIn, float partialTickTime)
  42. {
  43. float f = 2.0F;
  44. int i = entitylivingbaseIn.getInvulTime();
  45.  
  46. if (i > 0)
  47. {
  48. f -= ((float)i - partialTickTime) / 220.0F * 0.5F;
  49. }
  50.  
  51. GlStateManager.scale(f, f, f);
  52. }
  53.  
  54. @Override
  55. @Nonnull
  56. protected ResourceLocation getEntityTexture(@Nonnull EntityUselessWither entity) {
  57. return WITHER_TEXTURES;
  58. }
  59.  
  60. public static class Factory implements IRenderFactory<EntityUselessWither> {
  61.  
  62. @Override
  63. public Render<? super EntityUselessWither> createRenderFor(RenderManager manager) {
  64. return new RenderUselessWither(manager);
  65. }
  66.  
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement