net.minecraft.block.BlockBush Java Examples

The following examples show how to use net.minecraft.block.BlockBush. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorldGenPlant.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
public boolean generate(World worldIn, Random rand, BlockPos position) {
    for (IBlockState iblockstate = worldIn.getBlockState(position); (iblockstate.getBlock().isAir(iblockstate, worldIn, position) || iblockstate.getBlock().isLeaves(iblockstate, worldIn, position)) && position.getY() > 0; iblockstate = worldIn.getBlockState(position)) {
        position = position.down();
    }

    for (int i = 0; i < 128; ++i) {
        BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));

        boolean canStay = true;

        if (state.getBlock() instanceof BlockBush && !(((BlockBush) state.getBlock()).canBlockStay(worldIn, blockpos, this.state))) {
            canStay = false;
        }

        if (worldIn.isAirBlock(blockpos) && canStay) {
            worldIn.setBlockState(blockpos, this.state, 2);
        }
    }

    return true;
}
 
Example #2
Source File: WorldGenPlant.java    From Traverse-Legacy-1-12-2 with MIT License 6 votes vote down vote up
public boolean generate(World worldIn, Random rand, BlockPos position) {
    for (IBlockState iblockstate = worldIn.getBlockState(position); (iblockstate.getBlock().isAir(iblockstate, worldIn, position) || iblockstate.getBlock().isLeaves(iblockstate, worldIn, position)) && position.getY() > 0; iblockstate = worldIn.getBlockState(position)) {
        position = position.down();
    }

    for (int i = 0; i < 128; ++i) {
        BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));

        boolean canStay = true;

        if (state.getBlock() instanceof BlockBush && !(((BlockBush) state.getBlock()).canBlockStay(worldIn, blockpos, this.state))) {
            canStay = false;
        }

        if (worldIn.isAirBlock(blockpos) && canStay) {
            worldIn.setBlockState(blockpos, this.state, 2);
        }
    }

    return true;
}
 
Example #3
Source File: TofuEventLoader.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@SubscribeEvent
  public void decorateBiome(DecorateBiomeEvent.Post event)
  {
      World worldObj = event.getWorld();
      Random rand = event.getRand();
      @SuppressWarnings("deprecation")
BlockPos pos = event.getPos();
      // Hellsoybeans
      if (rand.nextInt(600) < Math.min((Math.abs(pos.getX()) + Math.abs(pos.getZ())) / 2, 400) - 100)
      {
          if (Biome.getIdForBiome(worldObj.getBiome(pos)) == Biome.getIdForBiome(Biomes.HELL))
          {
              int k = pos.getX();
              int l = pos.getZ();
              BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos();
              
              for (int i = 0; i < 10; ++i)
              {
                  int j1 = k + rand.nextInt(16) + 8;
                  int k1 = rand.nextInt(128);
                  int l1 = l + rand.nextInt(16) + 8;
                  mutable.setPos(j1, k1, l1);
                  
                  (new WorldGenCrops((BlockBush)BlockLoader.SOYBEAN_NETHER)
                  		{ 
                  			@Override
						protected IBlockState getStateToPlace() {
                  				return this.plantBlock.getDefaultState().withProperty(BlockSoybeanNether.AGE, 7);
                  			}
                  		})
                  		.generate(worldObj, rand, mutable);           
              }
          }
      }
  }
 
Example #4
Source File: GraveyardGenerator.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
private boolean isGroundBlock(IBlockState blockState) {
	if (blockState == null || blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG || blockState.getBlock() == Blocks.LOG2
			|| blockState.getBlock() instanceof BlockBush) {
		return false;
	}
	return blockState.isOpaqueCube();
}
 
Example #5
Source File: MonolithGenerator.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
private boolean isGroundBlock(IBlockState blockState) {

		if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG || blockState.getBlock() instanceof BlockBush) {
			return false;
		}

		return blockState.isOpaqueCube();
	}
 
Example #6
Source File: DebugModeClearGrass.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
public void debugActionBlockClicked(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
    pos = pos.toImmutable();
    for (int x = -radius; x < radius; x++) {
        for (int z = -radius; z < radius; z++) {
            BlockPos loc = pos.add(x, 0, z);
            Block block = world.getBlockState(loc).getBlock();
            if (block instanceof BlockBush) {
                world.destroyBlock(loc, false);
            }
        }
    }
}
 
Example #7
Source File: BlockCandelilla.java    From GardenCollection with MIT License 5 votes vote down vote up
public BlockCandelilla (String blockName) {
    setBlockTextureName(GardenTrees.MOD_ID + ":candelilla");
    setBlockName(blockName);
    setHardness(0);
    setStepSound(BlockBush.soundTypeGrass);
    setCreativeTab(ModCreativeTabs.tabGardenTrees);
}
 
Example #8
Source File: WorldGenCrops.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public WorldGenCrops(BlockBush blockIn)
{
    this.plantBlock = blockIn;
}
 
Example #9
Source File: BastionsLairEntranceGenerator.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
private boolean isGroundBlock(IBlockState blockState) {
	if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG || blockState.getBlock() instanceof BlockBush) {
		return false;
	}
	return blockState.isOpaqueCube();
}
 
Example #10
Source File: BastionsLairGenerator.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
private boolean isGroundBlock(IBlockState blockState) {
	if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG || blockState.getBlock() instanceof BlockBush) {
		return false;
	}
	return blockState.isOpaqueCube();
}
 
Example #11
Source File: TileEntityToroSpawner.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
private boolean isGroundBlock(IBlockState blockState) {
	if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG || blockState.getBlock() instanceof BlockBush) {
		return false;
	}
	return blockState.isOpaqueCube();
}
 
Example #12
Source File: QuestBase.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
protected static boolean isGroundBlock(IBlockState blockState) {
	if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG || blockState.getBlock() instanceof BlockBush) {
		return false;
	}
	return blockState.isOpaqueCube();
}
 
Example #13
Source File: QuestBase.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
protected static boolean cantBuildOver(IBlockState blockState) {
	if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() instanceof BlockBush) {
		return false;
	}
	return blockState.isOpaqueCube();
}
 
Example #14
Source File: CivilizationHandlers.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
private boolean isGroundBlock(IBlockState blockState) {
	if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() instanceof BlockBush) {
		return false;
	}
	return blockState.isOpaqueCube();
}
 
Example #15
Source File: MageTowerGenerator.java    From ToroQuest with GNU General Public License v3.0 3 votes vote down vote up
private boolean isGroundBlock(IBlockState blockState) {

		if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG || blockState.getBlock() instanceof BlockBush) {
			return false;
		}

		return blockState.isOpaqueCube();

	}
 
Example #16
Source File: EventHandlers.java    From ToroQuest with GNU General Public License v3.0 3 votes vote down vote up
private boolean isGroundBlock(IBlockState blockState) {

		if (blockState.getBlock() == Blocks.LEAVES || blockState.getBlock() == Blocks.LEAVES2 || blockState.getBlock() == Blocks.LOG
				|| blockState.getBlock() instanceof BlockBush) {
			return false;
		}

		return blockState.isOpaqueCube();

	}