當前位置: 首頁>>代碼示例>>Java>>正文


Java Blocks.CAULDRON屬性代碼示例

本文整理匯總了Java中net.minecraft.init.Blocks.CAULDRON屬性的典型用法代碼示例。如果您正苦於以下問題:Java Blocks.CAULDRON屬性的具體用法?Java Blocks.CAULDRON怎麽用?Java Blocks.CAULDRON使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.init.Blocks的用法示例。


在下文中一共展示了Blocks.CAULDRON屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: removeSunnyPath

/**
 * 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;
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:44,代碼來源:PathNavigateGround.java

示例2: removeSunnyPath

/**
 * 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;
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:44,代碼來源:PathNavigateGround.java


注:本文中的net.minecraft.init.Blocks.CAULDRON屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。