Added an explicit seeds to particle entities

This commit is contained in:
Unknown 2018-05-10 10:28:55 +02:00 committed by unknown
parent ec5dc249c7
commit 664a6a385e
5 changed files with 8 additions and 8 deletions

View file

@ -17,4 +17,7 @@ public abstract class AbstractEntityFX extends EntityFX {
public void refresh() {
particleMaxAge = Math.max(particleMaxAge, particleAge + 20);
}
// get seed
protected int getSeed() { return getEntityId(); }
}

View file

@ -3,7 +3,6 @@ package cr0s.warpdrive.render;
import cr0s.warpdrive.data.Vector3;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
@ -17,7 +16,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class EntityFXBeam extends EntityFX {
public class EntityFXBeam extends AbstractEntityFX {
private static final int ROTATION_SPEED = 20;
private static final float END_MODIFIER = 1.0F;

View file

@ -2,7 +2,6 @@ package cr0s.warpdrive.render;
import cr0s.warpdrive.data.Vector3;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@ -13,7 +12,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class EntityFXBoundingBox extends EntityFX {
public class EntityFXBoundingBox extends AbstractEntityFX {
private static final ResourceLocation TEXTURE = new ResourceLocation("warpdrive", "textures/particle/bounding_box.png");

View file

@ -2,7 +2,6 @@ package cr0s.warpdrive.render;
import cr0s.warpdrive.data.Vector3;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@ -11,7 +10,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class EntityFXDot extends EntityFX {
public class EntityFXDot extends AbstractEntityFX {
private Vector3 v3Acceleration;
private double friction;

View file

@ -93,12 +93,12 @@ public class EntityFXEnergizing extends AbstractEntityFX {
alpha = 0.5F - (4 - (particleMaxAge - particleAge)) * 0.1F;
} else {
// add random flickering
final double timeAlpha = ((getEntityId() ^ 0x47C8) & 0xFFFF) + particleAge + partialTick + 0.0167D;
final double timeAlpha = ((getSeed() ^ 0x47C8) & 0xFFFF) + particleAge + partialTick + 0.0167D;
alpha += Math.pow(Math.sin(timeAlpha * 0.37D) + Math.sin(0.178D + timeAlpha * 0.17D), 2.0D) * 0.05D;
}
// texture clock is offset to de-synchronize particles
final double timeTexture =(getEntityId() & 0xFFFF) + particleAge + partialTick;
final double timeTexture = (getSeed() & 0xFFFF) + particleAge + partialTick;
// repeated a pixel column, changing periodically, to animate the texture
final double uOffset = ((int) Math.floor(timeTexture * 0.5D) % 16) / 16.0D;