BlockSoulSand: Difference between revisions

From Minecraft Parkour Wiki
Content added Content deleted
(created page)
 
mNo edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[SourceCode|Back to SourceCode]]
[[SourceCode|Back to SourceCode]]
<br /><syntaxhighlight lang="java" line="1">
<syntaxhighlight lang="java" line="1">
package net.minecraft.block;
package net.minecraft.block;


Line 10: Line 10:
}
}



/* When is this actually used? Normally, speed is always reset to 0 on soulsand */
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
return new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX()+1.0, pos.getY()+0.875, pos.getZ()+1.0);
}


/* called from Entity.doBlockCollisions() */
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
{
entityIn.motionX *= 0.4D;
entityIn.motionX *= 0.4D;
entityIn.motionZ *= 0.4D;
entityIn.motionZ *= 0.4D;
//note that EACH surrounding soulsand block applies this effect.
}
}
}
}

Latest revision as of 18:36, 28 March 2020

Back to SourceCode

package net.minecraft.block;

public class BlockSoulSand extends Block
{
    public BlockSoulSand()
    {
        super(Material.sand, MapColor.brownColor);
    }


    public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
    {
        return new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX()+1.0, pos.getY()+0.875, pos.getZ()+1.0);
    }


    /* called from Entity.doBlockCollisions() */
    public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
    {
        entityIn.motionX *= 0.4D;
        entityIn.motionZ *= 0.4D;
        //note that EACH surrounding soulsand block applies this effect.
    }
}