From 917e842efcdaea8cff6d2c5fc1c9da3d8d4ab840 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 29 Jan 2023 22:30:03 +0100 Subject: [PATCH] solved the mystery of the wacky wobbling particles layer 3 particles move weirdly if the player moves, that is due to some render context vars are not properly set up when layer 3 renders (before layers 0-2 in fact), so simply providing the values manually solves the wobblyness --- .../java/com/hbm/particle/ParticleAmatFlash.java | 13 ++++++++++--- src/main/java/com/hbm/particle/ParticleGiblet.java | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/hbm/particle/ParticleAmatFlash.java b/src/main/java/com/hbm/particle/ParticleAmatFlash.java index e01a28dca..4dbba4363 100644 --- a/src/main/java/com/hbm/particle/ParticleAmatFlash.java +++ b/src/main/java/com/hbm/particle/ParticleAmatFlash.java @@ -6,9 +6,11 @@ import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; @SideOnly(Side.CLIENT) @@ -25,10 +27,15 @@ public class ParticleAmatFlash extends EntityFX { } public void renderParticle(Tessellator tess, float interp, float x, float y, float z, float tx, float tz) { + + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)interp; + double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)interp; + double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp; - float pX = (float) ((this.prevPosX + (this.posX - this.prevPosX) * (double) interp - interpPosX)); - float pY = (float) ((this.prevPosY + (this.posY - this.prevPosY) * (double) interp - interpPosY)); - float pZ = (float) ((this.prevPosZ + (this.posZ - this.prevPosZ) * (double) interp - interpPosZ)); + float pX = (float) ((this.prevPosX + (this.posX - this.prevPosX) * (double) interp - dX)); + float pY = (float) ((this.prevPosY + (this.posY - this.prevPosY) * (double) interp - dY)); + float pZ = (float) ((this.prevPosZ + (this.posZ - this.prevPosZ) * (double) interp - dZ)); GL11.glPushMatrix(); diff --git a/src/main/java/com/hbm/particle/ParticleGiblet.java b/src/main/java/com/hbm/particle/ParticleGiblet.java index f61a9ad2e..c09a00799 100644 --- a/src/main/java/com/hbm/particle/ParticleGiblet.java +++ b/src/main/java/com/hbm/particle/ParticleGiblet.java @@ -11,6 +11,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -66,11 +67,17 @@ public class ParticleGiblet extends EntityFX { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); this.theRenderEngine.bindTexture(texture); + + /* use this instead of EntityFX.interpPosN since interpPosN isn't set up correctly for the current tick for layer 3 particles */ + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)interp; + double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)interp; + double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp; float f10 = this.particleScale * 0.1F; - float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) interp - interpPosX); - float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) interp - interpPosY); - float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) interp - interpPosZ); + float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) interp - dX); + float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) interp - dY); + float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) interp - dZ); tess.startDrawingQuads(); tess.setNormal(0.0F, 1.0F, 0.0F);