本文整理汇总了Java中net.minecraft.block.BlockTallGrass类的典型用法代码示例。如果您正苦于以下问题:Java BlockTallGrass类的具体用法?Java BlockTallGrass怎么用?Java BlockTallGrass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockTallGrass类属于net.minecraft.block包,在下文中一共展示了BlockTallGrass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
IChunkProvider chunkProvider) {
for (int i = 0; i < 25; i++)
{
int x = chunkX * 16 + random.nextInt(16);
int z = chunkZ * 16 + random.nextInt(16);
BlockPos pos = world.getHeight(new BlockPos(x, 0, z));
if (world.getBlockState(pos).getBlock() instanceof BlockTallGrass)
{
world.setBlockState(pos, ARKCraftBlocks.berryBush.getDefaultState());
}
}
}
示例2: placeGrass
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
void placeGrass(World world, BlockPos pos, Random random, int fertility) {
Block block = world.getBlockState(pos.down()).getBlock();
if (block instanceof BlockGrass && block.canPlaceBlockAt(world, pos)) {
if (fertility < 50 && random.nextInt(15) == 0) {
world.setBlockState(pos, Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.DEAD_BUSH), 2);
return;
}
if (fertility > 200 && random.nextInt(3) == 0) {
if (random.nextInt(20) == 0) {
if (random.nextBoolean()) {
world.setBlockState(pos, Blocks.brown_mushroom.getDefaultState());
} else {
world.setBlockState(pos, Blocks.red_mushroom.getDefaultState());
}
return;
}
world.setBlockState(pos, Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.FERN), 2);
return;
}
world.setBlockState(pos, Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS), 2);
}
}
示例3: addWinnowingRecipes
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
private static void addWinnowingRecipes() {
IWinnowingMachineHandler winnowing = CulinaryCultivationAPI.winnowing;
ItemStack tallGrass = new ItemStack(Blocks.TALLGRASS, 1, BlockTallGrass.EnumType.GRASS.getMeta());
ItemStack doubleTallGrass = new ItemStack(Blocks.DOUBLE_PLANT, 1, BlockDoublePlant.EnumPlantType.GRASS.getMeta());
//Culinary Cultivation outputs
winnowing.addOutput(tallGrass, new ItemStack(CROP_SEEDS, 1, ProductType.CUCUMBER.getMetadata()), 10);
winnowing.addOutput(tallGrass, new ItemStack(CROP_SEEDS, 1, ProductType.TOMATO.getMetadata()), 8);
winnowing.addJunk(tallGrass, new ItemStack(GENERAL, 1, ItemGeneral.Type.CHAFF_PILE.getMetadata()), 10);
winnowing.addRecipe(doubleTallGrass, new ItemStack(CROP_SEEDS, 1, ProductType.BLACK_PEPPER_DRUPE.getMetadata()), 18);
winnowing.addRecipe(doubleTallGrass, new ItemStack(CROP_SEEDS, 1, ProductType.CORN.getMetadata()), 8);
//Vanilla outputs
winnowing.addOutput(tallGrass, new ItemStack(Items.WHEAT_SEEDS), 10);
winnowing.addOutput(tallGrass, new ItemStack(Items.BEETROOT_SEEDS), 2);
winnowing.addOutput(tallGrass, new ItemStack(Items.PUMPKIN_SEEDS), 1);
winnowing.addRecipe(new ItemStack(Blocks.SAPLING, 1, BlockPlanks.EnumType.JUNGLE.getMetadata()), new ItemStack(Items.MELON_SEEDS), 1, new ItemStack(Blocks.DEADBUSH), 10);
winnowing.addRecipe(new ItemStack(Items.WHEAT), new ItemStack(Items.WHEAT_SEEDS), 15, new ItemStack(GENERAL, 1, ItemGeneral.Type.CHAFF_PILE.getMetadata()), 90);
}
示例4: notifyBlockUpdate
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
@Override
public void notifyBlockUpdate(World worldIn, BlockPos pos, IBlockState oldState, IBlockState currentState, int flags) {
if (currentState.getBlock() == Blocks.FIRE && !(worldIn.getBlockState(pos.down()).getBlock() instanceof BlockObsidian) && !(worldIn.getBlockState(pos.down()).getBlock() instanceof BlockBush) && !(worldIn.getBlockState(pos.down()).getBlock() instanceof BlockTallGrass)) {
IBlockState newStateBlock = BlockRegistry.specialfire.getDefaultState().withProperty(BlockSpecialFire.AGE, currentState.getValue(BlockFire.AGE)).withProperty(BlockSpecialFire.NORTH, currentState.getValue(BlockFire.NORTH)).withProperty(BlockSpecialFire.EAST, currentState.getValue(BlockFire.EAST)).withProperty(BlockSpecialFire.SOUTH, currentState.getValue(BlockFire.SOUTH)).withProperty(BlockSpecialFire.WEST, currentState.getValue(BlockFire.WEST)).withProperty(BlockSpecialFire.UPPER, currentState.getValue(BlockFire.UPPER));
worldIn.setBlockState(pos, newStateBlock, flags);
}
}
示例5: getRandomWorldGenForGrass
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
@Override
public WorldGenerator getRandomWorldGenForGrass(Random random)
{
return random.nextInt(4) == 0 ?
new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) :
new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
}
示例6: registerVanillaVariantProps
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
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);
}
示例7: interceptGrassDrop
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void interceptGrassDrop(BlockEvent.HarvestDropsEvent event) {
// Skip silk touch.
if (event.isSilkTouching()) {
return;
}
// Fetch the blockstate.
final IBlockState state = event.getState();
// Skip Air or Error
if (state == null || state.getBlock() == null) {
return;
}
// Fetch the world random.
final Random rand = event.getWorld().rand;
// Log
// This line was oddly ignoring the debug settings...
//AgriCore.getLogger("agricraft").debug("Intercepted! Block: {0}", state.getBlock());
// Add grass drops if grass block.
if (state.getBlock() instanceof BlockTallGrass) {
// Wipe other drops, if needed.
if (AgriCraftConfig.wipeGrassDrops) {
event.getDrops().clear();
}
// Log
// Commenented out to prevent spam.
//AgriCore.getLogger("agricraft").debug("Inserting Drops!");
// Add the drops.
addGrassDrops(event.getDrops(), rand);
}
}
示例8: getRandomWorldGenForGrass
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
/**
* Gets a WorldGen appropriate for this biome.
*/
public WorldGenerator getRandomWorldGenForGrass(Random rand)
{
return rand.nextInt(4) == 0 ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
}
示例9: getRandomWorldGenForGrass
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
/**
* Gets a WorldGen appropriate for this biome.
*/
public WorldGenerator getRandomWorldGenForGrass(Random rand)
{
return rand.nextInt(5) > 0 ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
}
示例10: getRandomWorldGenForGrass
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
/**
* Gets a WorldGen appropriate for this biome.
*/
public WorldGenerator getRandomWorldGenForGrass(Random rand)
{
return new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
}
示例11: WorldGenTallGrass
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
public WorldGenTallGrass(BlockTallGrass.EnumType p_i45629_1_)
{
this.tallGrassState = Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, p_i45629_1_);
}
示例12: checkBlock
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
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;
}
}
示例13: getRandomWorldGenForGrass
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
@Override
public WorldGenerator getRandomWorldGenForGrass(Random rand)
{
return rand.nextInt(4) == 0 ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : super.getRandomWorldGenForGrass(rand);
}
示例14: WorldGenTallGrass
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
public WorldGenTallGrass(BlockTallGrass.EnumType p_i45629_1_)
{
this.tallGrassState = Blocks.TALLGRASS.getDefaultState().withProperty(BlockTallGrass.TYPE, p_i45629_1_);
}
示例15: checkBlock
import net.minecraft.block.BlockTallGrass; //导入依赖的package包/类
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;
}
}