-
-
Save anonymous/fbeee5aee9c7ea08e113 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wesserboysMod.client.particles; | |
import net.minecraft.client.Minecraft; | |
import net.minecraft.client.particle.EntityFX; | |
import net.minecraft.world.World; | |
public class ParticleHelper { | |
public static void spawnParticle(EntityFX particle){ | |
Minecraft mc = Minecraft.getMinecraft(); | |
if(mc != null && mc.renderViewEntity != null && mc.effectRenderer != null){ | |
int particleSetting = mc.gameSettings.particleSetting; | |
if(particleSetting == 2 || (particleSetting == 1 && particle.worldObj.rand.nextInt(3) == 0)){ | |
return; | |
} | |
double distanceX = mc.renderViewEntity.posX - particle.posX; | |
double distanceY = mc.renderViewEntity.posY - particle.posY; | |
double distanceZ = mc.renderViewEntity.posZ - particle.posZ; | |
double maxDistance = 16; | |
if(distanceX * distanceX + distanceY * distanceY + distanceZ * distanceZ > maxDistance * maxDistance){ | |
return; | |
} | |
if(particle != null){ | |
mc.effectRenderer.addEffect(particle); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment