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
This commit is contained in:
Bob 2023-01-29 22:30:03 +01:00
parent 89e48bb990
commit 917e842efc
2 changed files with 20 additions and 6 deletions

View File

@ -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();

View File

@ -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);