本文整理汇总了Java中net.minecraft.block.BlockPumpkin类的典型用法代码示例。如果您正苦于以下问题:Java BlockPumpkin类的具体用法?Java BlockPumpkin怎么用?Java BlockPumpkin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockPumpkin类属于net.minecraft.block包,在下文中一共展示了BlockPumpkin类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import net.minecraft.block.BlockPumpkin; //导入依赖的package包/类
@Override
public boolean generate(World worldIn, Random rand, BlockPos pos)
{
Block stick = ModBlocks.stick_block;
BlockPos sp = new BlockPos(pos.getX(), pos.getY(), pos.getZ());
BlockPos spUnder = new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ());
Block toReplace = worldIn.getBlockState(sp).getBlock();
Block onTopOf = worldIn.getBlockState(spUnder).getBlock();
if((toReplace == Blocks.AIR ||toReplace == Blocks.TALLGRASS)
&& (worldIn.getBlockState(sp.down()).isSideSolid(worldIn, pos, EnumFacing.UP) && worldIn.getBlockState(sp.down()).getBlock()==Blocks.GRASS)
&& pos.getY()>64)
{
worldIn.setBlockState(pos, stick.getDefaultState().withProperty(BlockPumpkin.FACING, EnumFacing.Plane.HORIZONTAL.random(rand)), 2);
ForageLogger.printWorldGen("Generating stick at X: " + sp.getX() + " Y: " + sp.getY() + " Z: " + sp.getZ() + " on top of " + onTopOf + ".");
}
return false;
}
示例2: isScarecrowAt
import net.minecraft.block.BlockPumpkin; //导入依赖的package包/类
/**
* Returns true if the blocks around the position form a scarecrow figure,
* assuming that the given position is one of the central blocks (not the 'arms')
*/
private boolean isScarecrowAt(World world, BlockPos pos) {
int i = 0;
while (i < 2 && world.getBlockState(pos).getBlock() == Blocks.hay_block) {
++i;
pos = pos.up();
}
// should now always have the head
Block block = world.getBlockState(pos).getBlock();
if (block instanceof BlockPumpkin) {
pos = pos.down();
for (int dy = i; dy < 2; ++dy) {
if (world.getBlockState(pos.down(dy)).getBlock() != Blocks.hay_block) {
return false;
}
}
if (world.getBlockState(pos.east()).getBlock() == Blocks.hay_block && world.getBlockState(pos.west()).getBlock() == Blocks.hay_block) {
return true;
}
if (world.getBlockState(pos.north()).getBlock() == Blocks.hay_block && world.getBlockState(pos.south()).getBlock() == Blocks.hay_block) {
return true;
}
}
return false;
}
示例3: generate
import net.minecraft.block.BlockPumpkin; //导入依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
for (int i = 0; i < 64; ++i)
{
BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).getBlock() == Blocks.grass && Blocks.pumpkin.canPlaceBlockAt(worldIn, blockpos))
{
worldIn.setBlockState(blockpos, Blocks.pumpkin.getDefaultState().withProperty(BlockPumpkin.FACING, EnumFacing.Plane.HORIZONTAL.random(rand)), 2);
}
}
return true;
}
示例4: generate
import net.minecraft.block.BlockPumpkin; //导入依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
for (int i = 0; i < 64; ++i)
{
BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).getBlock() == Blocks.GRASS && Blocks.PUMPKIN.canPlaceBlockAt(worldIn, blockpos))
{
worldIn.setBlockState(blockpos, Blocks.PUMPKIN.getDefaultState().withProperty(BlockPumpkin.FACING, EnumFacing.Plane.HORIZONTAL.random(rand)), 2);
}
}
return true;
}
示例5: getValidVanillaBlockRotations
import net.minecraft.block.BlockPumpkin; //导入依赖的package包/类
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
return (block instanceof BlockBed ||
block instanceof BlockPumpkin ||
block instanceof BlockFenceGate ||
block instanceof BlockEndPortalFrame ||
block instanceof BlockTripWireHook ||
block instanceof BlockCocoa ||
block instanceof BlockRailPowered ||
block instanceof BlockRailDetector ||
block instanceof BlockStairs ||
block instanceof BlockChest ||
block instanceof BlockEnderChest ||
block instanceof BlockFurnace ||
block instanceof BlockLadder ||
block == Blocks.field_150444_as ||
block == Blocks.field_150472_an ||
block instanceof BlockDoor ||
block instanceof BlockRail ||
block instanceof BlockButton ||
block instanceof BlockRedstoneRepeater ||
block instanceof BlockRedstoneComparator ||
block instanceof BlockTrapDoor ||
block instanceof BlockHugeMushroom ||
block instanceof BlockVine ||
block instanceof BlockSkull ||
block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
示例6: getValidVanillaBlockRotations
import net.minecraft.block.BlockPumpkin; //导入依赖的package包/类
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
return (block instanceof BlockBed ||
block instanceof BlockPumpkin ||
block instanceof BlockFenceGate ||
block instanceof BlockEndPortalFrame ||
block instanceof BlockTripWireHook ||
block instanceof BlockCocoa ||
block instanceof BlockRailPowered ||
block instanceof BlockRailDetector ||
block instanceof BlockStairs ||
block instanceof BlockChest ||
block instanceof BlockEnderChest ||
block instanceof BlockFurnace ||
block instanceof BlockLadder ||
block == Blocks.wall_sign ||
block == Blocks.standing_sign ||
block instanceof BlockDoor ||
block instanceof BlockRail ||
block instanceof BlockButton ||
block instanceof BlockRedstoneRepeater ||
block instanceof BlockRedstoneComparator ||
block instanceof BlockTrapDoor ||
block instanceof BlockHugeMushroom ||
block instanceof BlockVine ||
block instanceof BlockSkull ||
block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
示例7: dispenseStack
import net.minecraft.block.BlockPumpkin; //导入依赖的package包/类
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
LogHelper.info("== Dispensing a pumpkin ==");
World world = source.getWorld();
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
BlockPumpkin blockpumpkin = (BlockPumpkin)Blocks.pumpkin;
LogHelper.info(" at " + blockpos);
if (world.isAirBlock(blockpos) && blockpumpkin.canDispenserPlace(world, blockpos))
{
if (!world.isRemote)
{
// Check if it's an enchanted pumpkin. If so, add to the tracker.
if (stack.getTagCompound().getTagList(MagicHelper.GolemEnchantmentsNBTKey, 3) != null) {
ServerInfoTracker.add(stack, blockpos);
}
world.setBlockState(blockpos, blockpumpkin.getDefaultState(), 3);
}
--stack.stackSize;
}
else
{
this.success = false;
}
return stack;
}
示例8: canBeHarvested
import net.minecraft.block.BlockPumpkin; //导入依赖的package包/类
@Override
public boolean canBeHarvested(World world, BlockPos pos, IBlockState blockState) {
return blockState.getBlock() instanceof BlockPumpkin || blockState.getBlock() instanceof BlockMelon;
}
示例9: getBlockType
import net.minecraft.block.BlockPumpkin; //导入依赖的package包/类
private static BlockType getBlockType(Block block) {
if(block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame
|| block instanceof BlockCocoa) {
return BlockType.BED;
}
if(block instanceof BlockRail) {
return BlockType.RAIL;
}
if(block instanceof BlockRailPowered || block instanceof BlockRailDetector) {
return BlockType.RAIL_POWERED;
}
if(block instanceof BlockStairs) {
return BlockType.STAIR;
}
if(block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder
|| block == Blocks.wall_sign) {
return BlockType.CHEST;
}
if(block == Blocks.standing_sign) {
return BlockType.SIGNPOST;
}
if(block instanceof BlockDoor) {
return BlockType.DOOR;
}
if(block instanceof BlockButton) {
return BlockType.BUTTON;
}
if(block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator) {
return BlockType.REDSTONE_REPEATER;
}
if(block instanceof BlockTrapDoor) {
return BlockType.TRAPDOOR;
}
if(block instanceof BlockHugeMushroom) {
return BlockType.MUSHROOM_CAP;
}
if(block instanceof BlockVine) {
return BlockType.VINE;
}
if(block instanceof BlockSkull) {
return BlockType.SKULL;
}
if(block instanceof BlockAnvil) {
return BlockType.ANVIL;
}
if(block instanceof BlockLog) {
return BlockType.LOG;
}
if(block instanceof BlockDispenser || block instanceof BlockPistonBase || block instanceof BlockPistonExtension || block instanceof BlockHopper) {
return BlockType.DISPENSER;
}
if(block instanceof BlockTorch) {
return BlockType.TORCH;
}
if(block instanceof BlockLever) {
return BlockType.LEVER;
}
if(block instanceof BlockTripWireHook) {
return BlockType.TRIP_WIRE_HOOK;
}
return null;
}
示例10: getValidVanillaBlockRotations
import net.minecraft.block.BlockPumpkin; //导入依赖的package包/类
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireSource || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockDetectorRail || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block.blockID == Block.signWall.blockID || block.blockID == Block.signPost.blockID || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockComparator || block instanceof BlockTrapDoor || block instanceof BlockMushroomCap || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}