Java Code Examples for net.minecraft.init.Blocks.CAULDRON

The following are Jave code examples for showing how to use CAULDRON of the net.minecraft.init.Blocks class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Backmemed   File: PathNavigateGround.java   View Source Code Vote up 4 votes
/**
 * Trims path data from the end to the first sun covered block
 */
protected void removeSunnyPath()
{
    super.removeSunnyPath();

    for (int i = 0; i < this.currentPath.getCurrentPathLength(); ++i)
    {
        PathPoint pathpoint = this.currentPath.getPathPointFromIndex(i);
        PathPoint pathpoint1 = i + 1 < this.currentPath.getCurrentPathLength() ? this.currentPath.getPathPointFromIndex(i + 1) : null;
        IBlockState iblockstate = this.worldObj.getBlockState(new BlockPos(pathpoint.xCoord, pathpoint.yCoord, pathpoint.zCoord));
        Block block = iblockstate.getBlock();

        if (block == Blocks.CAULDRON)
        {
            this.currentPath.setPoint(i, pathpoint.cloneMove(pathpoint.xCoord, pathpoint.yCoord + 1, pathpoint.zCoord));

            if (pathpoint1 != null && pathpoint.yCoord >= pathpoint1.yCoord)
            {
                this.currentPath.setPoint(i + 1, pathpoint1.cloneMove(pathpoint1.xCoord, pathpoint.yCoord + 1, pathpoint1.zCoord));
            }
        }
    }

    if (this.shouldAvoidSun)
    {
        if (this.worldObj.canSeeSky(new BlockPos(MathHelper.floor(this.theEntity.posX), (int)(this.theEntity.getEntityBoundingBox().minY + 0.5D), MathHelper.floor(this.theEntity.posZ))))
        {
            return;
        }

        for (int j = 0; j < this.currentPath.getCurrentPathLength(); ++j)
        {
            PathPoint pathpoint2 = this.currentPath.getPathPointFromIndex(j);

            if (this.worldObj.canSeeSky(new BlockPos(pathpoint2.xCoord, pathpoint2.yCoord, pathpoint2.zCoord)))
            {
                this.currentPath.setCurrentPathLength(j - 1);
                return;
            }
        }
    }
}
 
Example 2
Project: CustomWorldGen   File: PathNavigateGround.java   View Source Code Vote up 4 votes
/**
 * Trims path data from the end to the first sun covered block
 */
protected void removeSunnyPath()
{
    super.removeSunnyPath();

    for (int i = 0; i < this.currentPath.getCurrentPathLength(); ++i)
    {
        PathPoint pathpoint = this.currentPath.getPathPointFromIndex(i);
        PathPoint pathpoint1 = i + 1 < this.currentPath.getCurrentPathLength() ? this.currentPath.getPathPointFromIndex(i + 1) : null;
        IBlockState iblockstate = this.worldObj.getBlockState(new BlockPos(pathpoint.xCoord, pathpoint.yCoord, pathpoint.zCoord));
        Block block = iblockstate.getBlock();

        if (block == Blocks.CAULDRON)
        {
            this.currentPath.setPoint(i, pathpoint.cloneMove(pathpoint.xCoord, pathpoint.yCoord + 1, pathpoint.zCoord));

            if (pathpoint1 != null && pathpoint.yCoord >= pathpoint1.yCoord)
            {
                this.currentPath.setPoint(i + 1, pathpoint1.cloneMove(pathpoint1.xCoord, pathpoint.yCoord + 1, pathpoint1.zCoord));
            }
        }
    }

    if (this.shouldAvoidSun)
    {
        if (this.worldObj.canSeeSky(new BlockPos(MathHelper.floor_double(this.theEntity.posX), (int)(this.theEntity.getEntityBoundingBox().minY + 0.5D), MathHelper.floor_double(this.theEntity.posZ))))
        {
            return;
        }

        for (int j = 0; j < this.currentPath.getCurrentPathLength(); ++j)
        {
            PathPoint pathpoint2 = this.currentPath.getPathPointFromIndex(j);

            if (this.worldObj.canSeeSky(new BlockPos(pathpoint2.xCoord, pathpoint2.yCoord, pathpoint2.zCoord)))
            {
                this.currentPath.setCurrentPathLength(j - 1);
                return;
            }
        }
    }
}