Java 类net.minecraft.block.BlockSapling 实例源码

项目:ForestryLegacy    文件:MillForester.java   
@Override
public void growCrop(World world, int cropId, Vect pos) {

    if (cropId == Block.sapling.blockID) {
        ((BlockSapling) Block.sapling).growTree(world, pos.x, pos.y, pos.z, world.rand);
    }

    if (cropId == ForestryBlock.firsapling.blockID) {
        ((BlockFirSapling) ForestryBlock.firsapling).growTree(world, pos.x, pos.y, pos.z, world.rand);
    }

    if (cropId == ForestryBlock.sapling.blockID) {
        ((BlockSaplings) ForestryBlock.sapling).growTree(world, pos.x, pos.y, pos.z, world.rand);
    }

    if (cropId == Block.crops.blockID) {
        ((BlockCrops) Block.crops).fertilize(world, pos.x, pos.y, pos.z);
    }

    if (cropId == Block.netherStalk.blockID) {
        world.setBlockAndMetadataWithNotify(pos.x, pos.y, pos.z, Block.netherStalk.blockID, 3);
    }
}
项目:Wurst-MC-1.12    文件:BonemealAuraMod.java   
private boolean isCorrectBlock(BlockPos pos)
{
    Block block = WBlock.getBlock(pos);

    if(!(block instanceof IGrowable) || block instanceof BlockGrass
        || !((IGrowable)block).canGrow(WMinecraft.getWorld(), pos,
            WBlock.getState(pos), false))
        return false;

    if(block instanceof BlockSapling)
        return saplings.isChecked();
    else if(block instanceof BlockCrops)
        return crops.isChecked();
    else if(block instanceof BlockStem)
        return stems.isChecked();
    else if(block instanceof BlockCocoa)
        return cocoa.isChecked();
    else
        return other.isChecked();
}
项目:CrystalMod    文件:WorksiteTreeFarm.java   
private void countResources() {
    shouldCountResources = false;
    saplingCount = 0;
    bonemealCount = 0;
    ItemStack stack = ItemStackTools.getEmptyStack();
    for (int i = 27; i < 33; i++) {
        stack = inventory.getStackInSlot(i);
        if (!ItemStackTools.isValid(stack)) {
            continue;
        }
        if (stack.getItem() instanceof ItemBlock) {
            ItemBlock item = (ItemBlock) stack.getItem();
            if (item.getBlock() instanceof BlockSapling) {
                saplingCount += ItemStackTools.getStackSize(stack);
            }
        } else if (stack.getItem() == Items.DYE
                && stack.getItemDamage() == EnumDyeColor.WHITE.getDyeDamage()) {
            bonemealCount += ItemStackTools.getStackSize(stack);
        }
    }
}
项目:CrystalMod    文件:WorksiteTreeFarm.java   
@Override
protected void scanBlockPosition(BlockPos pos) {
    IBlockState state;
    if (getWorld().isAirBlock(pos)) {
        state = getWorld().getBlockState(pos.down());
        if (state.getBlock() == Blocks.DIRT || state.getBlock() == Blocks.GRASS) {
            blocksToPlant.add(pos);
        }
    } else {
        state = getWorld().getBlockState(pos);
        if (state.getBlock() instanceof BlockSapling) {
            blocksToFertilize.add(pos);
        } else if (TreeUtil.isLog(state)) {
            if (!blocksToChop.contains(pos)) {
                addTreeBlocks(pos);
            }
        }
    }
}
项目:TravelHut    文件:WorldGenHandler.java   
public static void placeHut(final World world, BlockPos startpos, int[][][] data, IBlockState[] states, Random rand) {
  for (int pass = 0; pass <= 1; pass++) {
    for (int y = 0; y < data.length; y++) {
      for (int x = 0; x < 6; x++) {
        for (int z = 0; z < 6; z++) {
          BlockPos pos = startpos.add(x + 5, -y + 5, z + 5);
          if (data[y][z][x] != -1) {
            IBlockState state = states[data[y][z][x]];
            if (state == null || (pass == 0 && (state.getBlock() instanceof BlockCarpet || state.getBlock() instanceof BlockSapling))) {
              world.setBlockToAir(pos);
            } else if (state.getBlock() instanceof BlockFalling) {
              while (world.getBlockState(pos).getBlock().isReplaceable(world, pos) && !world.isAirBlock(new BlockPos(pos.getX(), 0, pos.getZ()))) {
                world.setBlockState(pos, state);
                world.immediateBlockTick(pos, state, rand);
              }
            } else if (!(state.getBlock() instanceof BlockSlab)
                || (world.getBlockState(pos).getBlock().isReplaceable(world, pos) && world.getBlockState(pos).getMaterial() != Material.WATER)) {
              world.setBlockState(pos, state);
            }
          }
        }
      }
    }
  }
}
项目:NaturalTrees    文件:NaturalTrees.java   
@SubscribeEvent
public void onSaplingGrow(SaplingGrowTreeEvent ev)
{
    IBlockState state = ev.getWorld().getBlockState(ev.getPos());
    Block block = state.getBlock();
    if (block == Blocks.sapling)
    {
        BlockPlanks.EnumType type = state.getValue(BlockSapling.TYPE);

        switch (type)
        {
            case OAK:
                ev.setResult(Event.Result.DENY);
                new BirchTreeGenerator().generateTreeAt(ev.getWorld(), ev.getPos(), ev.getRand());
                break;
        }
    }
}
项目:LegacyFarms    文件:TileMillForester.java   
@Override
public void growCrop(ItemStack crop, BlockPosition blockPos) {
    if (crop.isItemEqual(new ItemStack(Blocks.sapling))) {
        ((BlockSapling) Blocks.sapling).func_149853_b(worldObj, worldObj.rand, blockPos.x, blockPos.y, blockPos.z);
    }
    if (ForestryProxy.moduleArboricultureEnabled) {
        if (crop.isItemEqual(new ItemStack(ForestryProxy.blockSapling))) {
            ForestryProxy.blockSapling.func_149853_b(worldObj, worldObj.rand, blockPos.x, blockPos.y, blockPos.z);
        }
    }
    if (crop.getItem() == Item.getItemFromBlock(Blocks.wheat)) {
        ((BlockCrops) Blocks.wheat).func_149853_b(worldObj, worldObj.rand, blockPos.x, blockPos.y, blockPos.z);
    }
    if (crop.isItemEqual(new ItemStack(Blocks.nether_wart))) {
        blockPos.setBlock(worldObj, blockPos.getBlock(worldObj), 3);
    }
}
项目:TheDarkEra    文件:TDEWorldGenHugeTree.java   
private boolean func_150532_c(World p_150532_1_, Random p_150532_2_, int p_150532_3_, int p_150532_4_, int p_150532_5_)
{
    Block block = p_150532_1_.getBlock(p_150532_3_, p_150532_4_ - 1, p_150532_5_);

    boolean isSoil = block.canSustainPlant(p_150532_1_, p_150532_3_, p_150532_4_ - 1, p_150532_5_, ForgeDirection.UP, (BlockSapling)Blocks.sapling);
    if (isSoil && p_150532_4_ >= 2)
    {
        onPlantGrow(p_150532_1_, p_150532_3_,     p_150532_4_ - 1, p_150532_5_,     p_150532_3_, p_150532_4_, p_150532_5_);
        onPlantGrow(p_150532_1_, p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_,     p_150532_3_, p_150532_4_, p_150532_5_);
        onPlantGrow(p_150532_1_, p_150532_3_,     p_150532_4_ - 1, p_150532_5_ + 1, p_150532_3_, p_150532_4_, p_150532_5_);
        onPlantGrow(p_150532_1_, p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_ + 1, p_150532_3_, p_150532_4_, p_150532_5_);
        return true;
    }
    else
    {
        return false;
    }
}
项目:mcplus_mods    文件:EventHandlerOvergrowth.java   
@SubscribeEvent
public void onEntityItemExpire(ItemExpireEvent parEvent)
{
    if (!REFORESTATION) return;
    if (!(Block.getBlockFromItem(parEvent.entityItem.getEntityItem().getItem()) instanceof BlockSapling)) return;

    BlockSapling sapling = (BlockSapling) Block.getBlockFromItem(parEvent.entityItem.getEntityItem().getItem());
    int x = (int) (parEvent.entity.posX);
    int y = (int) (parEvent.entity.posY + 0.5);
    int z = (int) (parEvent.entity.posZ);
    BlockPos pos = new BlockPos(x, y, z);

    if (sapling.canBlockStay(parEvent.entity.worldObj, pos, sapling.getDefaultState()))
    {
        parEvent.entity.worldObj.setBlockState(pos, sapling.getStateFromMeta(parEvent.entityItem.getEntityItem().getItemDamage()), 3);
    }
    else
    {
        parEvent.extraLife = parEvent.entityItem.lifespan - REFOREST_AGE;
        parEvent.setCanceled(true);
    }
}
项目:Cauldron    文件:WorldGenMegaPineTree.java   
private void func_150540_a(World p_150540_1_, int p_150540_2_, int p_150540_3_, int p_150540_4_)
{
    for (int l = p_150540_3_ + 2; l >= p_150540_3_ - 3; --l)
    {
        Block block = p_150540_1_.getBlock(p_150540_2_, l, p_150540_4_);

        if (block.canSustainPlant(p_150540_1_, p_150540_2_, l, p_150540_4_, ForgeDirection.UP, (BlockSapling)Blocks.sapling))
        {
            this.setBlockAndNotifyAdequately(p_150540_1_, p_150540_2_, l, p_150540_4_, Blocks.dirt, 2);
            break;
        }

        if (block.isAir(p_150540_1_, p_150540_2_, l, p_150540_4_) && l < p_150540_3_)
        {
            break;
        }
    }
}
项目:Cauldron    文件:WorldGenHugeTrees.java   
private boolean func_150532_c(World p_150532_1_, Random p_150532_2_, int p_150532_3_, int p_150532_4_, int p_150532_5_)
{
    Block block = p_150532_1_.getBlock(p_150532_3_, p_150532_4_ - 1, p_150532_5_);

    boolean isSoil = block.canSustainPlant(p_150532_1_, p_150532_3_, p_150532_4_ - 1, p_150532_5_, ForgeDirection.UP, (BlockSapling)Blocks.sapling);
    if (isSoil && p_150532_4_ >= 2)
    {
        onPlantGrow(p_150532_1_, p_150532_3_,     p_150532_4_ - 1, p_150532_5_,     p_150532_3_, p_150532_4_, p_150532_5_);
        onPlantGrow(p_150532_1_, p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_,     p_150532_3_, p_150532_4_, p_150532_5_);
        onPlantGrow(p_150532_1_, p_150532_3_,     p_150532_4_ - 1, p_150532_5_ + 1, p_150532_3_, p_150532_4_, p_150532_5_);
        onPlantGrow(p_150532_1_, p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_ + 1, p_150532_3_, p_150532_4_, p_150532_5_);
        return true;
    }
    else
    {
        return false;
    }
}
项目:Cauldron    文件:WorldGenMegaPineTree.java   
private void func_150540_a(World p_150540_1_, int p_150540_2_, int p_150540_3_, int p_150540_4_)
{
    for (int l = p_150540_3_ + 2; l >= p_150540_3_ - 3; --l)
    {
        Block block = p_150540_1_.getBlock(p_150540_2_, l, p_150540_4_);

        if (block.canSustainPlant(p_150540_1_, p_150540_2_, l, p_150540_4_, ForgeDirection.UP, (BlockSapling)Blocks.sapling))
        {
            this.setBlockAndNotifyAdequately(p_150540_1_, p_150540_2_, l, p_150540_4_, Blocks.dirt, 2);
            break;
        }

        if (block.isAir(p_150540_1_, p_150540_2_, l, p_150540_4_) && l < p_150540_3_)
        {
            break;
        }
    }
}
项目:Cauldron    文件:WorldGenHugeTrees.java   
private boolean func_150532_c(World p_150532_1_, Random p_150532_2_, int p_150532_3_, int p_150532_4_, int p_150532_5_)
{
    Block block = p_150532_1_.getBlock(p_150532_3_, p_150532_4_ - 1, p_150532_5_);

    boolean isSoil = block.canSustainPlant(p_150532_1_, p_150532_3_, p_150532_4_ - 1, p_150532_5_, ForgeDirection.UP, (BlockSapling)Blocks.sapling);
    if (isSoil && p_150532_4_ >= 2)
    {
        onPlantGrow(p_150532_1_, p_150532_3_,     p_150532_4_ - 1, p_150532_5_,     p_150532_3_, p_150532_4_, p_150532_5_);
        onPlantGrow(p_150532_1_, p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_,     p_150532_3_, p_150532_4_, p_150532_5_);
        onPlantGrow(p_150532_1_, p_150532_3_,     p_150532_4_ - 1, p_150532_5_ + 1, p_150532_3_, p_150532_4_, p_150532_5_);
        onPlantGrow(p_150532_1_, p_150532_3_ + 1, p_150532_4_ - 1, p_150532_5_ + 1, p_150532_3_, p_150532_4_, p_150532_5_);
        return true;
    }
    else
    {
        return false;
    }
}
项目:CrystalMod    文件:WorksiteTreeFarm.java   
private void pickupSaplings() {
    BlockPos p1 = getWorkBoundsMin();
    BlockPos p2 = getWorkBoundsMax().add(1, 1, 1);
    AxisAlignedBB bb = new AxisAlignedBB(p1, p2);
    List<EntityItem> items = getWorld().getEntitiesWithinAABB(EntityItem.class, bb);
    ItemStack stack;
    for (EntityItem item : items) {
        stack = item.getEntityItem();
        if (!ItemStackTools.isValid(stack)) {
            continue;
        }
        if (stack.getItem() == Items.APPLE) {
            item.setDead();
            addStackToInventory(stack, RelativeSide.TOP);
            continue;
        }
        if (stack.getItem() instanceof ItemBlock) {
            ItemBlock ib = (ItemBlock) stack.getItem();
            if (ib.getBlock() instanceof BlockSapling) {
                if (!ItemUtil.canInventoryHold(inventory, inventory
                        .getRawIndicesCombined(RelativeSide.FRONT,
                                RelativeSide.TOP), stack)) {
                    break;
                }
                item.setDead();
                addStackToInventory(stack, RelativeSide.FRONT,
                        RelativeSide.TOP);
            }
            if (TreeUtil.isLog(stack)) {
                if (!ItemUtil.canInventoryHold(inventory, inventory
                        .getRawIndicesCombined(RelativeSide.TOP), stack)) {
                    break;
                }
                item.setDead();
                addStackToInventory(stack, RelativeSide.TOP);
            }
        }
    }
}
项目:MidgarCrusade    文件:WorldGenBigTreesDim.java   
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling);
    if (!isSoil)
    {
        return false;
    }
    else
    {
        int i = this.checkBlockLine(aint, aint1);

        if (i == -1)
        {
            return true;
        }
        else if (i < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = i;
            return true;
        }
    }
}
项目:DynamicSurroundings    文件:FootstepsRegistry.java   
private void seedMap() {
    // Iterate through the blockmap looking for known pattern types.
    // Though they probably should all be registered with Forge
    // dictionary it's not a requirement.
    final Iterator<Block> itr = Block.REGISTRY.iterator();
    while (itr.hasNext()) {
        final Block block = itr.next();
        final String blockName = MCHelper.nameOf(block);
        if (block instanceof BlockCrops) {
            final BlockCrops crop = (BlockCrops) block;
            if (crop.getMaxAge() == 3) {
                this.registerBlocks("#beets", blockName);
            } else if (blockName.equals("minecraft:wheat")) {
                this.registerBlocks("#wheat", blockName);
            } else if (crop.getMaxAge() == 7) {
                this.registerBlocks("#crop", blockName);
            }
        } else if (block instanceof BlockSapling) {
            this.registerBlocks("#sapling", blockName);
        } else if (block instanceof BlockReed) {
            this.registerBlocks("#reed", blockName);
        } else if (block instanceof BlockFence) {
            this.registerBlocks("#fence", blockName);
        } else if (block instanceof BlockFlower || block instanceof BlockMushroom) {
            this.registerBlocks("NOT_EMITTER", blockName);
        } else if (block instanceof BlockLog || block instanceof BlockPlanks) {
            this.registerBlocks("wood", blockName);
        } else if (block instanceof BlockDoor) {
            this.registerBlocks("bluntwood", blockName);
        } else if (block instanceof BlockLeaves) {
            this.registerBlocks("leaves", blockName);
        } else if (block instanceof BlockOre) {
            this.registerBlocks("ore", blockName);
        } else if (block instanceof BlockIce) {
            this.registerBlocks("ice", blockName);
        }
    }
}
项目:Easy-Editors    文件:BlockPropertyRegistry.java   
private static void registerVanillaVariantProps() {
    // TODO: omit similar blocks
    registerVariantProperty(BlockStone.VARIANT);
    registerVariantProperty(BlockPlanks.VARIANT);
    registerVariantProperty(BlockSapling.TYPE);
    registerVariantProperty(BlockDirt.VARIANT);
    registerVariantProperty(BlockSand.VARIANT);
    registerVariantProperty(BlockOldLog.VARIANT);
    registerVariantProperty(BlockNewLog.VARIANT);
    registerVariantProperty(BlockOldLeaf.VARIANT);
    registerVariantProperty(BlockNewLeaf.VARIANT);
    registerVariantProperty(BlockSandStone.TYPE);
    registerVariantProperty(BlockTallGrass.TYPE);
    registerVariantProperty(BlockPistonExtension.TYPE);
    registerVariantProperty(BlockColored.COLOR);
    registerVariantProperty(BlockPistonMoving.TYPE);
    registerVariantProperty(Blocks.YELLOW_FLOWER.getTypeProperty());
    registerVariantProperty(Blocks.RED_FLOWER.getTypeProperty());
    registerVariantProperty(BlockStoneSlab.VARIANT);
    registerVariantProperty(BlockWoodSlab.VARIANT);
    registerVariantProperty(BlockAnvil.DAMAGE);
    registerVariantProperty(BlockQuartz.VARIANT);
    registerVariantProperty(BlockCarpet.COLOR);
    registerVariantProperty(BlockDoublePlant.VARIANT);
    registerVariantProperty(BlockStainedGlass.COLOR);
    registerVariantProperty(BlockStainedGlassPane.COLOR);
    registerVariantProperty(BlockPrismarine.VARIANT);
    registerVariantProperty(BlockRedSandstone.TYPE);
    registerVariantProperty(BlockStoneSlabNew.VARIANT);
}
项目:TheDarkEra    文件:TDEWorldGenBigTree.java   
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling);
    if (!isSoil)
    {
        return false;
    }
    else
    {
        int i = this.checkBlockLine(aint, aint1);

        if (i == -1)
        {
            return true;
        }
        else if (i < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = i;
            return true;
        }
    }
}
项目:TheDarkEra    文件:WorldGenDarkJungleTree.java   
public boolean func_150532_c(World world, Random rand, int x, int y, int z) {
        while (world.isAirBlock(x, y, z) && y > 2) {
            y--;
        }
        Block block = world.getBlock(x, y, z);
        if (block != Blocks.grass && block != Blocks.dirt && block != TDEBlocks.dark_grass && block != TDEBlocks.dark_dirt ) {
            return false;
        } else {
            for (int i = -2; i <= 2; i++) {
                for (int j = -2; j <= 2; j++) {
                    if (world.isAirBlock(x + i, y - 1, z + j) && world.isAirBlock(x + i, y - 2, z + j) && !world.isAirBlock(x + i, y, z + j)) {
                        return false;
                    }
                }
            }

    boolean isSoil = block.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling) Blocks.sapling);
    if (isSoil && y >= 2) {
        onPlantGrow(world, x, y - 1, z, x, y, z);
        onPlantGrow(world, x + 1, y - 1, z, x, y, z);
        onPlantGrow(world, x, y - 1, z + 1, x, y, z);
        onPlantGrow(world, x + 1, y - 1, z + 1, x, y, z);
        return true;
    } else {
        return false;       
}
        }
    }
项目:TheDarkEra    文件:WorldGenDarkJungleTree.java   
private void func_150540_a(World p_150540_1_, int p_150540_2_, int p_150540_3_, int p_150540_4_) {
    for (int l = p_150540_3_ + 2; l >= p_150540_3_ - 3; --l) {
        Block block = p_150540_1_.getBlock(p_150540_2_, l, p_150540_4_);

        if (block.canSustainPlant(p_150540_1_, p_150540_2_, l, p_150540_4_, ForgeDirection.UP, (BlockSapling) Blocks.sapling)) {
            this.setBlockAndNotifyAdequately(p_150540_1_, p_150540_2_, l, p_150540_4_, TDEBlocks.dark_grass, 2);
            break;
        }

        if (block.isAir(p_150540_1_, p_150540_2_, l, p_150540_4_) && l < p_150540_3_) {
            break;
        }
    }
}
项目:RidiculousWorld    文件:WorldGenTsundereTree.java   
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling);
    if (!isSoil)
    {
        return false;
    }
    else
    {
        int i = this.checkBlockLine(aint, aint1);

        if (i == -1)
        {
            return true;
        }
        else if (i < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = i;
            return true;
        }
    }
}
项目:RidiculousWorld    文件:WorldGenBigSpookyTree.java   
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling);
    if (!isSoil)
    {
        return false;
    }
    else
    {
        int i = this.checkBlockLine(aint, aint1);

        if (i == -1)
        {
            return true;
        }
        else if (i < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = i;
            return true;
        }
    }
}
项目:MineFantasy    文件:WorldGenEbony.java   
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    int i = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    Block soil = Block.blocksList[i];
    boolean isValidSoil = (soil != null && soil.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Block.sapling));
    if (!isValidSoil)
    {
        return false;
    }
    else
    {
        int j = this.checkBlockLine(aint, aint1);

        if (j == -1)
        {
            return true;
        }
        else if (j < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = j;
            return true;
        }
    }
}
项目:FantasyCraft-Mod    文件:WorldGenFCraftBigTrees.java   
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    int i = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    Block soil = Block.blocksList[i];
    boolean isValidSoil = (soil != null && soil.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Block.sapling));
    if (!isValidSoil)
    {
        return false;
    }
    else
    {
        int j = this.checkBlockLine(aint, aint1);

        if (j == -1)
        {
            return true;
        }
        else if (j < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = j;
            return true;
        }
    }
}
项目:mcplus_mods    文件:EventHandlerOvergrowth.java   
@SubscribeEvent
public void onEntityItemUpdate(EntityEvent.EnteringChunk parEvent)
{
    if (!REFORESTATION) return;
    if (!(parEvent.entity instanceof EntityItem)) return;

    EntityItem entityitem = (EntityItem) parEvent.entity;
    ItemStack itemstack = entityitem.getDataWatcher().getWatchableObjectItemStack(10);
    if (itemstack == null || !(Block.getBlockFromItem(itemstack.getItem()) instanceof BlockSapling)) return;
    entityitem.lifespan = REFOREST_AGE;
}
项目:Dendrology    文件:MineFactoryReloadedMod.java   
@SuppressWarnings("ObjectAllocationInLoop")
@Method(modid = MOD_ID)
private static void registerSaplings()
{
    reportProgress("saplings");

    for (final BlockSapling saplingBlock : ModBlocks.saplingBlocks())
    {
        final MFRSapling sapling = new MFRSapling(saplingBlock);
        registerPlantable(sapling);
        registerFertilizable(sapling);
    }
}
项目:Cauldron    文件:WorldGenBigTree.java   
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling);
    if (!isSoil)
    {
        return false;
    }
    else
    {
        int i = this.checkBlockLine(aint, aint1);

        if (i == -1)
        {
            return true;
        }
        else if (i < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = i;
            return true;
        }
    }
}
项目:Cauldron    文件:WorldGenBigTree.java   
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling);
    if (!isSoil)
    {
        return false;
    }
    else
    {
        int i = this.checkBlockLine(aint, aint1);

        if (i == -1)
        {
            return true;
        }
        else if (i < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = i;
            return true;
        }
    }
}
项目:Rediscovered-Mod-1.6.4    文件:WorldGenBigCherryTrees.java   
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    int i = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    Block soil = Block.blocksList[i];
    boolean isValidSoil = (soil != null && soil.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Block.sapling));
    if (!isValidSoil)
    {
        return false;
    }
    else
    {
        int j = this.checkBlockLine(aint, aint1);

        if (j == -1)
        {
            return true;
        }
        else if (j < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = j;
            return true;
        }
    }
}
项目:TreeGrowingSimulator2014    文件:MessageBonemealParticles.java   
@SideOnly(Side.CLIENT)
@Override
public IMessage onMessage(MessageBonemealParticles message, MessageContext ctx)
{
    EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
    Block block = entity.worldObj.getBlock(message.x, message.y, message.z);
    if (block instanceof BlockSapling)
    {
        entity.worldObj.playAuxSFX(2005, message.x, message.y, message.z, 0);               
    }
    return null;
}
项目:TreeGrowingSimulator2014    文件:TickHandlerTGS.java   
private List<Coord> getNearestBlocks(World world, int xpos, int ypos, int zpos)
{
    List<Coord> list = new ArrayList<Coord>();
    for (int x = -5; x <= 5; x++)
        for (int y = -2; y <= 2; y++)
            for (int z = -5; z <= 5; z++)
            {
                Block block = world.getBlock(x + xpos, y + ypos, z + zpos);
                if (block instanceof BlockSapling || block instanceof BlockEngine)
                    list.add(new Coord(x + xpos, y + ypos, z + zpos));
            }
    return list;
}
项目:CherryPig    文件:ClientProxy.java   
public void registerRenderers(){
    RenderingRegistry.registerEntityRenderingHandler(CPEntityPiggy.class, new IRenderFactory<CPEntityPiggy>() {
        @Override
        public Render<? super CPEntityPiggy> createRenderFor(RenderManager manager)
        {
            return new CPPiggyRender(manager);
        }
    });

    registerItemModel(CPItem.cherryFruit);
    registerItemModel(CPItem.cherryPie);
    registerItemModel(CPItem.cherryPip);

    registerBlockItemModel(CPBlocks.charchoalBlack);
    registerBlockItemModel(CPBlocks.cherryLeaf);
    registerBlockItemModel(CPBlocks.cherrySapling);
    registerBlockItemModel(CPBlocks.cherryLog);
    registerBlockItemModel(CPBlocks.cherryPlanks);
    registerBlockItemModel(CPBlocks.cherryStairs);
    registerBlockItemModel(CPBlocks.flintBlock);

    MinecraftForge.EVENT_BUS.register(new CPEvents());

    //Don't use the CHECK_DECAY or DECAYABLE properties for rendering
    ModelLoader.setCustomStateMapper(CPBlocks.cherryLeaf, new StateMap.Builder().ignore(BlockSapling.STAGE, CHECK_DECAY, DECAYABLE).build());
    ModelLoader.setCustomStateMapper(CPBlocks.cherrySapling, new StateMap.Builder().ignore(BlockSapling.TYPE).build());
}
项目:RuneCraftery    文件:WorldGenBigTree.java   
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    int i = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    Block soil = Block.blocksList[i];
    boolean isValidSoil = (soil != null && soil.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Block.sapling));
    if (!isValidSoil)
    {
        return false;
    }
    else
    {
        int j = this.checkBlockLine(aint, aint1);

        if (j == -1)
        {
            return true;
        }
        else if (j < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = j;
            return true;
        }
    }
}
项目:Project-Zed    文件:TileEntityIndustrialPlanter.java   
private int getFirstSapling() {
    Block currentBlock;
    for (int i = 0; i < getSizeInventory(); i++) {
        if (slots[i] != null) {
            currentBlock = BlockUtils.getBlockFromItem(slots[i].getItem());
            if (currentBlock != null && currentBlock instanceof BlockSapling) return i;
        }
    }

    return -1;
}
项目:Rediscovered-Mod-1.7.10    文件:WorldGenCherryTrees.java   
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling);
    if (!isSoil)
    {
        return false;
    }
    else
    {
        int i = this.checkBlockLine(aint, aint1);

        if (i == -1)
        {
            return true;
        }
        else if (i < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = i;
            return true;
        }
    }
}
项目:BetterNutritionMod    文件:WorldGenBigTree.java   
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    int i = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    Block soil = Block.blocksList[i];
    boolean isValidSoil = (soil != null && soil.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Block.sapling));
    if (!isValidSoil)
    {
        return false;
    }
    else
    {
        int j = this.checkBlockLine(aint, aint1);

        if (j == -1)
        {
            return true;
        }
        else if (j < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = j;
            return true;
        }
    }
}
项目:Sojourn    文件:MapGenDeadTree.java   
/**
 * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
 * limit, is valid.
 */
boolean validTreeLocation()
{
    int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
    int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
    int i = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

    Block soil = Block.blocksList[i];
    boolean isValidSoil = (soil != null && soil.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Block.sapling));
    if (!isValidSoil)
    {
        return false;
    }
    else
    {
        int j = this.checkBlockLine(aint, aint1);

        if (j == -1)
        {
            return true;
        }
        else if (j < 6)
        {
            return false;
        }
        else
        {
            this.heightLimit = j;
            return true;
        }
    }
}
项目:BaseClient    文件:BetterSnow.java   
private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_)
{
    if (p_checkBlock_0_.isFullCube())
    {
        return false;
    }
    else if (p_checkBlock_0_.isOpaqueCube())
    {
        return false;
    }
    else if (p_checkBlock_0_ instanceof BlockSnow)
    {
        return false;
    }
    else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass))
    {
        if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall))
        {
            if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP)
            {
                return true;
            }
            else
            {
                if (p_checkBlock_0_ instanceof BlockLever)
                {
                    Object object = p_checkBlock_1_.getValue(BlockLever.FACING);

                    if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z)
                    {
                        return true;
                    }
                }

                return false;
            }
        }
        else
        {
            return true;
        }
    }
    else
    {
        return true;
    }
}
项目:BaseClient    文件:BetterSnow.java   
private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_)
{
    if (p_checkBlock_0_.isFullCube())
    {
        return false;
    }
    else if (p_checkBlock_0_.isOpaqueCube())
    {
        return false;
    }
    else if (p_checkBlock_0_ instanceof BlockSnow)
    {
        return false;
    }
    else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass))
    {
        if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall))
        {
            if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP)
            {
                return true;
            }
            else
            {
                if (p_checkBlock_0_ instanceof BlockLever)
                {
                    Object object = p_checkBlock_1_.getValue(BlockLever.FACING);

                    if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z)
                    {
                        return true;
                    }
                }

                return false;
            }
        }
        else
        {
            return true;
        }
    }
    else
    {
        return true;
    }
}
项目:Backmemed    文件:BetterSnow.java   
private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_)
{
    if (p_checkBlock_1_.isFullCube())
    {
        return false;
    }
    else if (p_checkBlock_1_.isOpaqueCube())
    {
        return false;
    }
    else if (p_checkBlock_0_ instanceof BlockSnow)
    {
        return false;
    }
    else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass))
    {
        if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall))
        {
            if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP)
            {
                return true;
            }
            else
            {
                if (p_checkBlock_0_ instanceof BlockLever)
                {
                    Object object = p_checkBlock_1_.getValue(BlockLever.FACING);

                    if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z)
                    {
                        return true;
                    }
                }

                return false;
            }
        }
        else
        {
            return true;
        }
    }
    else
    {
        return true;
    }
}