Jump to content

particles falling through blocks?


jtsfour

Recommended Posts

i cant understand why this particle is falling through blocks instead of stopping on top of them?

fyi Precipitation extends EntityFX

 

 

public class DWRainFX extends Precipitation

{

    private static final String __OBFID = "CL_00000934";

 

    public DWRainFX(World par1World, double par2, double par4, double par6)

    {

        super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);

        this.motionX *= 0.30000001192092896D;

        this.motionY = (double)((float)Math.random() * 0.2F + 0.1F);

        this.motionZ *= 0.30000001192092896D;

        this.particleRed = 1.0F;

        this.particleGreen = 1.0F;

        this.particleBlue = 1.0F;

        this.setSize(0.01F, 0.01F);

        this.particleGravity = 0.06F;

        this.particleMaxAge = 35/*(int)(8.0D / (Math.random() * 0.8D + 0.2D))*/;

    }

 

    /**

    * Called to update the entity's position/logic.

    */

    public void onUpdate()

    {

        this.prevPosX = this.posX;

        this.prevPosY = this.posY;

        this.prevPosZ = this.posZ;

        this.motionY -= (double)this.particleGravity;

        this.moveEntity(this.motionX, this.motionY, this.motionZ);

        this.motionX *= 0.9800000190734863D;

        this.motionY *= 0.9800000190734863D;

        this.motionZ *= 0.9800000190734863D;

 

        if (this.particleMaxAge-- <= 0)

        {

            this.setDead();

        }

 

        if (this.onGround)

        {

          // this.worldObj.set

        if (Math.random() < 0.5D)

            {

                this.setDead();

            }

 

            this.motionX *= 0.699999988079071D;

            this.motionZ *= 0.699999988079071D;

            //this.motionY = 0.0;

        }

 

        Material material = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial();

 

        if (material.isLiquid() || material.isSolid())

        {

            double d0 = (double)((float)(MathHelper.floor_double(this.posY) + 1) - BlockLiquid.getLiquidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))));

 

            if (this.posY < d0)

            {

                this.setDead();

            }

        }

    }

   

    public int getID(){

    return 1;

    }

   

    public String getName(){

    return "rain";

    }

   

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.