Posted December 4, 20168 yr I have try to make my entity death animation like an ender dragon. But I getting render issues, item in the hand disappear, incorrect entity model rendered. Render Code : package stevekung.mods.moreplanets.module.planets.diona.client.renderer.entity; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.boss.BossStatus; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import stevekung.mods.moreplanets.module.planets.diona.client.model.ModelInfectedCrystallizeSlimeBoss; import stevekung.mods.moreplanets.module.planets.diona.client.renderer.entity.layer.LayerInfectedCrystallizeSlimeBossBarrier; import stevekung.mods.moreplanets.module.planets.diona.client.renderer.entity.layer.LayerInfectedCrystallizeSlimeBossDeath; import stevekung.mods.moreplanets.module.planets.diona.entity.EntityInfectedCrystallizeSlimeBoss; public class RenderInfectedCrystallizeSlimeBoss extends RenderLiving<EntityInfectedCrystallizeSlimeBoss> { private static ResourceLocation texture = new ResourceLocation("moreplanets:textures/entity/infected_crystallize_slime_boss.png"); private static ResourceLocation beamTexture = new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"); private static ResourceLocation explodeTexture = new ResourceLocation("textures/entity/enderdragon/dragon_exploding.png"); public RenderInfectedCrystallizeSlimeBoss(RenderManager manager) { super(manager, new ModelInfectedCrystallizeSlimeBoss(), 1.0F); this.addLayer(new LayerInfectedCrystallizeSlimeBossBarrier(this)); this.addLayer(new LayerInfectedCrystallizeSlimeBossDeath()); } @Override protected void renderModel(EntityInfectedCrystallizeSlimeBoss entitylivingbaseIn, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) { //GlStateManager.pushMatrix(); if (entitylivingbaseIn.deathTicks > 0) { float f = entitylivingbaseIn.deathTicks / 200.0F; GlStateManager.depthFunc(515); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(516, f); this.bindTexture(RenderInfectedCrystallizeSlimeBoss.explodeTexture); this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.depthFunc(514); } this.bindEntityTexture(entitylivingbaseIn); this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); //super.renderModel(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); //GlStateManager.popMatrix(); } @Override protected ResourceLocation getEntityTexture(EntityInfectedCrystallizeSlimeBoss entity) { return RenderInfectedCrystallizeSlimeBoss.texture; } @Override public void doRender(EntityInfectedCrystallizeSlimeBoss entity, double x, double y, double z, float entityYaw, float partialTicks) { this.shadowSize = 0.25F * entity.getSlimeSize(); BossStatus.setBossStatus(entity, false); if (entity.tentacle != null) { this.drawRechargeRay(entity, x, y, z, partialTicks); } super.doRender(entity, x, y, z, entityYaw, partialTicks); } @Override protected void preRenderCallback(EntityInfectedCrystallizeSlimeBoss entity, float partialTicks) { float f = entity.getSlimeSize(); float f1 = (entity.prevSquishFactor + (entity.squishFactor - entity.prevSquishFactor) * partialTicks) / (f * 0.5F + 1.0F); float f2 = 1.0F / (f1 + 1.0F); GlStateManager.scale(f2 * f, 1.0F / f2 * f, f2 * f); } protected void drawRechargeRay(EntityInfectedCrystallizeSlimeBoss entity, double x, double y, double z, float partialTicks) { float f1 = MathHelper.sin(0.0F * 0.2F) / 2.0F + 0.5F; f1 = (f1 * f1 + f1) * 0.2F; float f2 = (float)(entity.tentacle.posX - entity.posX - (entity.prevPosX - entity.posX) * (1.0F - partialTicks)); float f3 = (float)(f1 + entity.tentacle.posY - entity.posY - (entity.prevPosY - entity.posY) * (1.0F - partialTicks)); float f4 = (float)(entity.tentacle.posZ - entity.posZ - (entity.prevPosZ - entity.posZ) * (1.0F - partialTicks)); float f5 = MathHelper.sqrt_float(f2 * f2 + f4 * f4); float f6 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y + 2.0F, (float)z); GlStateManager.rotate((float)-Math.atan2(f4, f2) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float)-Math.atan2(f5, f3) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableCull(); this.bindTexture(RenderInfectedCrystallizeSlimeBoss.beamTexture); GlStateManager.shadeModel(7425); float f7 = 0.0F - (entity.ticksExisted + partialTicks) * 0.01F; float f8 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4) / 32.0F - (entity.ticksExisted + partialTicks) * 0.01F; worldrenderer.begin(5, DefaultVertexFormats.POSITION_TEX_COLOR); for (int j = 0; j <= 8; ++j) { float f9 = MathHelper.sin(j % 8 * (float)Math.PI * 2.0F / 8.0F) * 0.75F; float f10 = MathHelper.cos(j % 8 * (float)Math.PI * 2.0F / 8.0F) * 0.75F; float f11 = j % 8 * 1.0F / 8.0F; worldrenderer.pos(f9 * 0.2F, f10 * 0.2F, 0.0D).tex(f11, f8).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(f9, f10, f6).tex(f11, f7).color(255, 255, 255, 255).endVertex(); } tessellator.draw(); GlStateManager.enableCull(); GlStateManager.shadeModel(7424); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); } } Barrier Layer : package stevekung.mods.moreplanets.module.planets.diona.client.renderer.entity.layer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import stevekung.mods.moreplanets.module.planets.diona.client.model.ModelInfectedCrystallizeSlimeBoss; import stevekung.mods.moreplanets.module.planets.diona.client.renderer.entity.RenderInfectedCrystallizeSlimeBoss; import stevekung.mods.moreplanets.module.planets.diona.entity.EntityInfectedCrystallizeSlimeBoss; @SideOnly(Side.CLIENT) public class LayerInfectedCrystallizeSlimeBossBarrier implements LayerRenderer<EntityInfectedCrystallizeSlimeBoss> { private RenderInfectedCrystallizeSlimeBoss creeperRenderer; private ModelInfectedCrystallizeSlimeBoss creeperModel = new ModelInfectedCrystallizeSlimeBoss(); private static ResourceLocation barrierTexture = new ResourceLocation("galacticraftcore:textures/model/power.png"); private static ResourceLocation textureGlow = new ResourceLocation("moreplanets:textures/entity/infected_crystallize_slime_boss_glow.png"); public LayerInfectedCrystallizeSlimeBossBarrier(RenderInfectedCrystallizeSlimeBoss creeperRendererIn) { this.creeperRenderer = creeperRendererIn; } @Override public void doRenderLayer(EntityInfectedCrystallizeSlimeBoss entity, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { if (entity.barrier) { GlStateManager.pushMatrix(); this.creeperRenderer.bindTexture(LayerInfectedCrystallizeSlimeBossBarrier.textureGlow); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(1, 1); GlStateManager.disableLighting(); GlStateManager.depthMask(!entity.isInvisible()); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); GlStateManager.enableLighting(); float time = entity.ticksExisted + partialTicks; float sin = (MathHelper.sin(time / 4) + 1F) / 2F + 0.15F; GlStateManager.color(sin, sin, sin, sin); this.creeperRenderer.getMainModel().render(entity, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); this.creeperRenderer.func_177105_a(entity, partialTicks); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.popMatrix(); boolean flag = entity.isInvisible(); GlStateManager.depthMask(!flag); this.creeperRenderer.bindTexture(LayerInfectedCrystallizeSlimeBossBarrier.barrierTexture); GlStateManager.matrixMode(5890); GlStateManager.loadIdentity(); float f = entity.ticksExisted + partialTicks; GlStateManager.translate(f * 0.01F, f * 0.01F, 0.0F); GlStateManager.matrixMode(5888); GlStateManager.enableBlend(); GlStateManager.color(0.5F, 0.5F, 0.5F, 1.0F); GlStateManager.disableLighting(); GlStateManager.blendFunc(1, 1); this.creeperModel.setModelAttributes(this.creeperRenderer.getMainModel()); this.creeperModel.render(entity, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); GlStateManager.matrixMode(5890); GlStateManager.loadIdentity(); GlStateManager.matrixMode(5888); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.depthMask(flag); } else { GlStateManager.pushMatrix(); this.creeperRenderer.bindTexture(LayerInfectedCrystallizeSlimeBossBarrier.textureGlow); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(1, 1); GlStateManager.disableLighting(); GlStateManager.depthMask(!entity.isInvisible()); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); GlStateManager.enableLighting(); float time = entity.ticksExisted + partialTicks; float sin = (MathHelper.sin(time / 4) + 1F) / 2F + 0.15F; GlStateManager.color(sin, sin, sin, sin); this.creeperRenderer.getMainModel().render(entity, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); this.creeperRenderer.func_177105_a(entity, partialTicks); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.popMatrix(); } } @Override public boolean shouldCombineTextures() { return false; } } Beam Layer (copied from RenderDragon) package stevekung.mods.moreplanets.module.planets.diona.client.renderer.entity.layer; import java.util.Random; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import stevekung.mods.moreplanets.module.planets.diona.entity.EntityInfectedCrystallizeSlimeBoss; @SideOnly(Side.CLIENT) public class LayerInfectedCrystallizeSlimeBossDeath implements LayerRenderer<EntityInfectedCrystallizeSlimeBoss> { @Override public void doRenderLayer(EntityInfectedCrystallizeSlimeBoss entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { if (entitylivingbaseIn.deathTicks > 0) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); RenderHelper.disableStandardItemLighting(); float f = (entitylivingbaseIn.deathTicks + partialTicks) / 200.0F; float f1 = 0.0F; if (f > 0.8F) { f1 = (f - 0.8F) / 0.2F; } Random random = new Random(432L); GlStateManager.disableTexture2D(); GlStateManager.shadeModel(7425); GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 1); GlStateManager.disableAlpha(); GlStateManager.enableCull(); GlStateManager.depthMask(false); GlStateManager.pushMatrix(); GlStateManager.translate(0.0F, 1.0F, 0.0F); for (int i = 0; i < (f + f * f) / 2.0F * 60.0F; ++i) { GlStateManager.rotate(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(random.nextFloat() * 360.0F + f * 90.0F, 0.0F, 0.0F, 1.0F); float f2 = random.nextFloat() * 20.0F + 5.0F + f1 * 10.0F; float f3 = random.nextFloat() * 2.0F + 1.0F + f1 * 2.0F; worldrenderer.begin(6, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(0.0D, 0.0D, 0.0D).color(100, 100, 255, (int)(255.0F * (1.0F - f1))).endVertex(); worldrenderer.pos(-0.866D * f3, f2, -0.5F * f3).color(100, 100, 255, 0).endVertex(); worldrenderer.pos(0.866D * f3, f2, -0.5F * f3).color(100, 100, 255, 0).endVertex(); worldrenderer.pos(0.0D, f2, 1.0F * f3).color(100, 100, 255, 0).endVertex(); worldrenderer.pos(-0.866D * f3, f2, -0.5F * f3).color(100, 100, 255, 0).endVertex(); tessellator.draw(); } GlStateManager.popMatrix(); GlStateManager.depthMask(true); GlStateManager.disableCull(); GlStateManager.disableBlend(); GlStateManager.shadeModel(7424); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableTexture2D(); GlStateManager.enableAlpha(); RenderHelper.enableStandardItemLighting(); } } @Override public boolean shouldCombineTextures() { return false; } }
December 5, 20168 yr Hello? Define render issues. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
March 17, 20178 yr Author This video will explain the problem. My Render Entity Spoiler package stevekung.mods.moreplanets.module.planets.diona.client.renderer.entity; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import stevekung.mods.moreplanets.module.planets.diona.client.model.ModelInfectedCrystallizeSlimeBoss; import stevekung.mods.moreplanets.module.planets.diona.client.renderer.entity.layer.LayerInfectedCrystallizeSlimeBossBarrier; import stevekung.mods.moreplanets.module.planets.diona.client.renderer.entity.layer.LayerInfectedCrystallizeSlimeBossDeath; import stevekung.mods.moreplanets.module.planets.diona.entity.EntityInfectedCrystallizeSlimeBoss; import stevekung.mods.moreplanets.util.MorePlanetsBossStatus; import stevekung.mods.moreplanets.util.helper.ColorHelper; public class RenderInfectedCrystallizeSlimeBoss extends RenderLiving<EntityInfectedCrystallizeSlimeBoss> { private ModelInfectedCrystallizeSlimeBoss model = new ModelInfectedCrystallizeSlimeBoss(); public RenderInfectedCrystallizeSlimeBoss(RenderManager manager) { super(manager, new ModelInfectedCrystallizeSlimeBoss(), 1.0F); this.addLayer(new LayerInfectedCrystallizeSlimeBossBarrier(this)); this.addLayer(new LayerInfectedCrystallizeSlimeBossDeath()); } @Override protected void renderModel(EntityInfectedCrystallizeSlimeBoss entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (entity.deathTicks > 0) { float f = entity.deathTicks / 200.0F; GlStateManager.depthFunc(515); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(516, f); this.bindTexture(new ResourceLocation("textures/entity/enderdragon/dragon_exploding.png")); this.model.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.depthFunc(514); } this.bindEntityTexture(entity); this.model.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); if (entity.hurtTime > 0) { GlStateManager.depthFunc(514); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 771); GlStateManager.color(1.0F, 0.0F, 0.0F, 0.5F); this.model.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); GlStateManager.depthFunc(515); } } @Override protected ResourceLocation getEntityTexture(EntityInfectedCrystallizeSlimeBoss entity) { return new ResourceLocation("moreplanets:textures/entity/infected_crystallize_slime_boss.png"); } @Override public void doRender(EntityInfectedCrystallizeSlimeBoss entity, double x, double y, double z, float entityYaw, float partialTicks) { this.shadowSize = 0.25F * entity.getSlimeSize(); MorePlanetsBossStatus.setBossStatus(entity, "Diona Boss", ColorHelper.rgbToDecimal(157, 147, 183)); if (entity.tentacle != null) { this.drawRechargeRay(entity, x, y, z, partialTicks); } super.doRender(entity, x, y, z, entityYaw, partialTicks); } @Override protected void preRenderCallback(EntityInfectedCrystallizeSlimeBoss entity, float partialTicks) { float f = entity.getSlimeSize(); float f1 = (entity.prevSquishFactor + (entity.squishFactor - entity.prevSquishFactor) * partialTicks) / (f * 0.5F + 1.0F); float f2 = 1.0F / (f1 + 1.0F); GlStateManager.scale(f2 * f, 1.0F / f2 * f, f2 * f); } protected void drawRechargeRay(EntityInfectedCrystallizeSlimeBoss entity, double x, double y, double z, float partialTicks) { float f1 = MathHelper.sin(0.0F * 0.2F) / 2.0F + 0.5F; f1 = (f1 * f1 + f1) * 0.2F; float f2 = (float)(entity.tentacle.posX - entity.posX - (entity.prevPosX - entity.posX) * (1.0F - partialTicks)); float f3 = (float)(f1 + entity.tentacle.posY - entity.posY - (entity.prevPosY - entity.posY) * (1.0F - partialTicks)); float f4 = (float)(entity.tentacle.posZ - entity.posZ - (entity.prevPosZ - entity.posZ) * (1.0F - partialTicks)); float f5 = MathHelper.sqrt_float(f2 * f2 + f4 * f4); float f6 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y + 2.0F, (float)z); GlStateManager.rotate((float)-Math.atan2(f4, f2) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float)-Math.atan2(f5, f3) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.disableCull(); GlStateManager.disableBlend(); this.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png")); GlStateManager.shadeModel(7425); float f7 = 0.0F - (entity.ticksExisted + partialTicks) * 0.01F; float f8 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4) / 32.0F - (entity.ticksExisted + partialTicks) * 0.01F; worldrenderer.begin(5, DefaultVertexFormats.POSITION_TEX_COLOR); for (int j = 0; j <= 8; ++j) { float f9 = MathHelper.sin(j % 8 * (float)Math.PI * 2.0F / 8.0F) * 0.75F; float f10 = MathHelper.cos(j % 8 * (float)Math.PI * 2.0F / 8.0F) * 0.75F; float f11 = j % 8 * 1.0F / 8.0F; worldrenderer.pos(f9 * 0.2F, f10 * 0.2F, 0.0D).tex(f11, f8).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(f9, f10, f6).tex(f11, f7).color(255, 255, 255, 255).endVertex(); } tessellator.draw(); GlStateManager.enableCull(); GlStateManager.enableBlend(); GlStateManager.shadeModel(7424); GlStateManager.popMatrix(); } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.