Fixed weird jetpack particles
This commit is contained in:
parent
314f4b3082
commit
62bc5c267a
4 changed files with 49 additions and 25 deletions
common/mekanism/client
|
@ -9,6 +9,9 @@ import mekanism.common.item.ItemJetpack;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.particle.EntityFlameFX;
|
||||
import net.minecraft.client.particle.EntitySmokeFX;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
@ -25,6 +28,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
public class RenderTickHandler implements ITickHandler
|
||||
{
|
||||
public Random rand = new Random();
|
||||
public Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
@Override
|
||||
public void tickStart(EnumSet<TickType> type, Object... tickData) {}
|
||||
|
@ -33,7 +37,6 @@ public class RenderTickHandler implements ITickHandler
|
|||
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
float partialTick = (Float)tickData[0];
|
||||
Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
if(mc.thePlayer != null && mc.theWorld != null)
|
||||
{
|
||||
|
@ -125,19 +128,36 @@ public class RenderTickHandler implements ITickHandler
|
|||
mRight.translate(rRight);
|
||||
|
||||
Vector3 v = new Vector3(p).translate(vLeft);
|
||||
world.spawnParticle("flame", v.x, v.y, v.z, mLeft.x, mLeft.y, mLeft.z);
|
||||
world.spawnParticle("smoke", v.x, v.y, v.z, mLeft.x, mLeft.y, mLeft.z);
|
||||
spawnAndSetParticle("flame", world, v.x, v.y, v.z, mLeft.x, mLeft.y, mLeft.z);
|
||||
spawnAndSetParticle("smoke", world, v.x, v.y, v.z, mLeft.x, mLeft.y, mLeft.z);
|
||||
|
||||
v = new Vector3(p).translate(vRight);
|
||||
world.spawnParticle("flame", v.x, v.y, v.z, mRight.x, mRight.y, mRight.z);
|
||||
world.spawnParticle("smoke", v.x, v.y, v.z, mRight.x, mRight.y, mRight.z);
|
||||
spawnAndSetParticle("flame", world, v.x, v.y, v.z, mRight.x, mRight.y, mRight.z);
|
||||
spawnAndSetParticle("smoke", world, v.x, v.y, v.z, mRight.x, mRight.y, mRight.z);
|
||||
|
||||
v = new Vector3(p).translate(vCenter);
|
||||
world.spawnParticle("flame", v.x, v.y, v.z, mCenter.x, mCenter.y, mCenter.z);
|
||||
world.spawnParticle("smoke", v.x, v.y, v.z, mCenter.x, mCenter.y, mCenter.z);
|
||||
spawnAndSetParticle("flame", world, v.x, v.y, v.z, mCenter.x, mCenter.y, mCenter.z);
|
||||
spawnAndSetParticle("smoke", world, v.x, v.y, v.z, mCenter.x, mCenter.y, mCenter.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnAndSetParticle(String s, World world, double x, double y, double z, double velX, double velY, double velZ)
|
||||
{
|
||||
EntityFX fx = null;
|
||||
|
||||
if(s.equals("flame"))
|
||||
{
|
||||
fx = new EntityFlameFX(world, x, y, z, velX, velY, velZ);
|
||||
}
|
||||
else if(s.equals("smoke"))
|
||||
{
|
||||
fx = new EntitySmokeFX(world, x, y, z, velX, velY, velZ);
|
||||
}
|
||||
|
||||
mc.effectRenderer.addEffect(fx);
|
||||
fx.onUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> ticks()
|
||||
|
|
|
@ -15,15 +15,7 @@ public class GasMaskSound extends PlayerSound
|
|||
@Override
|
||||
public boolean update(World world)
|
||||
{
|
||||
if(player.isDead)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(player.worldObj != world)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(!world.loadedEntityList.contains(player))
|
||||
if(!super.update(world))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -16,15 +16,7 @@ public class JetpackSound extends PlayerSound
|
|||
@Override
|
||||
public boolean update(World world)
|
||||
{
|
||||
if(player.isDead)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(player.worldObj != world)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(!world.loadedEntityList.contains(player))
|
||||
if(!super.update(world))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package mekanism.client.sound;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public abstract class PlayerSound extends Sound
|
||||
|
@ -23,6 +24,25 @@ public abstract class PlayerSound extends Sound
|
|||
return Math.min(1, ((float)ticksSincePlay/20F))*0.3F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(World world)
|
||||
{
|
||||
if(player.isDead)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(player.worldObj != world)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(!world.loadedEntityList.contains(player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3 getLocation()
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue