当前位置: 首页>>代码示例>>Java>>正文


Java Blocks.LOG属性代码示例

本文整理汇总了Java中net.minecraft.init.Blocks.LOG属性的典型用法代码示例。如果您正苦于以下问题:Java Blocks.LOG属性的具体用法?Java Blocks.LOG怎么用?Java Blocks.LOG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraft.init.Blocks的用法示例。


在下文中一共展示了Blocks.LOG属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: safeImpact

@Override
void safeImpact(BlockPos pos, @Nullable EnumFacing side, World world, int amplifier) {
	int box = 1 + (int) ((float) amplifier / 2F);

	BlockPos posI = pos.add(box, box, box);
	BlockPos posF = pos.add(-box, -box, -box);

	Iterable<BlockPos> spots = BlockPos.getAllInBox(posI, posF);
	for (BlockPos spot : spots) {
		Block block = world.getBlockState(spot).getBlock();
		IBlockState state = world.getBlockState(spot);
		boolean place = amplifier > 2 || world.rand.nextBoolean();
		if (place && stateMap.containsKey(block)) {
			world.setBlockState(spot, stateMap.get(block), 3);
		} else if (state.getBlock() == Blocks.LOG) {
			world.setBlockState(spot, ModBlocks.nethersteel.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.LOG2) {
			world.setBlockState(spot, ModBlocks.nethersteel.getDefaultState(), 3);
		}
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:21,代码来源:HellsWrothBrew.java

示例2: getTopBlock

public static BlockPos getTopBlock(World world, BlockPos pos)
{
	Chunk chunk = world.getChunkFromBlockCoords(pos);
       BlockPos blockpos;
       BlockPos blockpos1;

       for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
       {
           blockpos1 = blockpos.down();
           IBlockState state = chunk.getBlockState(blockpos1);
           if ((state.getMaterial().blocksMovement() && !state.getBlock().isLeaves(state, world, blockpos1) && !state.getBlock().isFoliage(world, blockpos1) && state.getBlock() != Blocks.LOG
           		&& state.getBlock() != Blocks.LOG2) || state.getBlock() instanceof BlockLiquid)
           	break;
       }
       return blockpos;		
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:16,代码来源:HarshenUtils.java

示例3: safeImpact

@Override
public void safeImpact(BlockPos pos, @Nullable EnumFacing side, World world, int amplifier) {
	int box = 1 + (int) ((float) amplifier / 2F);

	BlockPos posI = pos.add(box, box, box);
	BlockPos posF = pos.add(-box, -box, -box);

	Iterable<BlockPos> spots = BlockPos.getAllInBox(posI, posF);
	for (BlockPos spot : spots) {
		Block block = world.getBlockState(spot).getBlock();
		IBlockState state = world.getBlockState(spot);
		boolean place = amplifier > 2 || world.rand.nextBoolean();
		if (BlockStairs.isBlockStairs(state)) {
			IBlockState newState = Blocks.NETHER_BRICK_STAIRS.getDefaultState()
					.withProperty(BlockStairs.FACING, state.getValue(BlockStairs.FACING))
					.withProperty(BlockStairs.HALF, state.getValue(BlockStairs.HALF));
			world.setBlockState(spot, newState);
		} else if (place && stateMap.containsKey(block)) {
			world.setBlockState(spot, stateMap.get(block), 3);
		} else if (state.getBlock() == Blocks.LOG) {
			world.setBlockState(spot, ModBlocks.nethersteel.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.LOG2) {
			world.setBlockState(spot, ModBlocks.nethersteel.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.BRICK_BLOCK) {
			world.setBlockState(spot, ModBlocks.scorned_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.STONEBRICK) {
			world.setBlockState(spot, ModBlocks.scorned_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.END_BRICKS) {
			world.setBlockState(spot, ModBlocks.scorned_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == ModBlocks.embittered_bricks) {
			world.setBlockState(spot, ModBlocks.scorned_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == ModBlocks.fake_ice_fence) {
			world.setBlockState(spot, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 3);
		}
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:36,代码来源:HellWorldBrew.java

示例4: onVillageBlocks

@SubscribeEvent
public void onVillageBlocks(BiomeEvent.GetVillageBlockID event) {
    IBlockState original = event.getOriginal();

    if (event.getBiome() == ATGBiomes.TUNDRA) {
        if (original.getBlock() == Blocks.LOG || original.getBlock() == Blocks.LOG2) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.LOG.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE).withProperty(BlockLog.LOG_AXIS, original.getValue(BlockLog.LOG_AXIS)));
        } else if (original.getBlock() == Blocks.PLANKS) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.SPRUCE));
        } else if (original.getBlock() == Blocks.OAK_STAIRS) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.SPRUCE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, original.getValue(BlockStairs.FACING)));
        } else if (original.getBlock() == Blocks.OAK_FENCE) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.SPRUCE_FENCE.getDefaultState());
        }
    }
    else if (event.getBiome() == ATGBiomes.SCRUBLAND) {
        if (original.getBlock() == Blocks.LOG || original.getBlock() == Blocks.LOG2) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.LOG2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(BlockLog.LOG_AXIS, original.getValue(BlockLog.LOG_AXIS)));
        } else if (original.getBlock() == Blocks.PLANKS) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.ACACIA));
        } else if (original.getBlock() == Blocks.OAK_STAIRS) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.ACACIA_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, original.getValue(BlockStairs.FACING)));
        } else if (original.getBlock() == Blocks.OAK_FENCE) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.ACACIA_FENCE.getDefaultState());
        }
    }
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:35,代码来源:VillageBlocks.java

示例5: generateTrunk

/**
 * Places the trunk for the big tree that is being generated. Able to generate double-sized trunks by changing a
 * field that is always 1 to 2.
 */
void generateTrunk()
{
    BlockPos blockpos = this.basePos;
    BlockPos blockpos1 = this.basePos.up(this.height);
    Block block = Blocks.LOG;
    this.limb(blockpos, blockpos1, block);

    if (this.trunkSize == 2)
    {
        this.limb(blockpos.east(), blockpos1.east(), block);
        this.limb(blockpos.east().south(), blockpos1.east().south(), block);
        this.limb(blockpos.south(), blockpos1.south(), block);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:WorldGenBigTree.java

示例6: func_150523_a

protected boolean func_150523_a(Block block) {
	return (block.getMaterial(null) == Material.AIR) || (block.getMaterial(null) == Material.LEAVES) || (block == Blocks.GRASS) || (block == Blocks.DIRT) || (block == Blocks.LOG) || (block == Blocks.LOG2) || (block == Blocks.SAPLING) || (block == Blocks.VINE);
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:3,代码来源:WorldGenBamboo.java

示例7: initStacks

public static void initStacks(){
	coke_stack=new ItemStack(coke);
	ash_stack=new ItemStack(ash);
	wood_stack=new ItemStack(Blocks.LOG);
	thatch_stack=new ItemStack(Blocks.HAY_BLOCK);
}
 
开发者ID:EnderiumSmith,项目名称:CharcoalPit,代码行数:6,代码来源:ItemsRegistry.java

示例8: canGrowInto

/**
 * returns whether or not a tree can grow into a block
 * For example, a tree will not grow into stone
 */
protected boolean canGrowInto(Block blockType)
{
    Material material = blockType.getDefaultState().getMaterial();
    return material == Material.AIR || material == Material.LEAVES || blockType == Blocks.GRASS || blockType == Blocks.DIRT || blockType == Blocks.LOG || blockType == Blocks.LOG2 || blockType == Blocks.SAPLING || blockType == Blocks.VINE;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:WorldGenAbstractTree.java

示例9: onItemUse

/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
    ItemStack itemstack = stack.getHeldItem(pos);

    if (!stack.canPlayerEdit(worldIn.offset(hand), hand, itemstack))
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(itemstack.getMetadata());

        if (enumdyecolor == EnumDyeColor.WHITE)
        {
            if (applyBonemeal(itemstack, playerIn, worldIn))
            {
                if (!playerIn.isRemote)
                {
                    playerIn.playEvent(2005, worldIn, 0);
                }

                return EnumActionResult.SUCCESS;
            }
        }
        else if (enumdyecolor == EnumDyeColor.BROWN)
        {
            IBlockState iblockstate = playerIn.getBlockState(worldIn);
            Block block = iblockstate.getBlock();

            if (block == Blocks.LOG && iblockstate.getValue(BlockOldLog.VARIANT) == BlockPlanks.EnumType.JUNGLE)
            {
                if (hand == EnumFacing.DOWN || hand == EnumFacing.UP)
                {
                    return EnumActionResult.FAIL;
                }

                worldIn = worldIn.offset(hand);

                if (playerIn.isAirBlock(worldIn))
                {
                    IBlockState iblockstate1 = Blocks.COCOA.onBlockPlaced(playerIn, worldIn, hand, facing, hitX, hitY, 0, stack);
                    playerIn.setBlockState(worldIn, iblockstate1, 10);

                    if (!stack.capabilities.isCreativeMode)
                    {
                        itemstack.func_190918_g(1);
                    }

                    return EnumActionResult.SUCCESS;
                }
            }

            return EnumActionResult.FAIL;
        }

        return EnumActionResult.PASS;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:61,代码来源:ItemDye.java

示例10: canBlockStay

public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
    pos = pos.offset((EnumFacing)state.getValue(FACING));
    IBlockState iblockstate = worldIn.getBlockState(pos);
    return iblockstate.getBlock() == Blocks.LOG && iblockstate.getValue(BlockOldLog.VARIANT) == BlockPlanks.EnumType.JUNGLE;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:BlockCocoa.java

示例11: onItemUse

/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    if (!playerIn.canPlayerEdit(pos.offset(facing), facing, stack))
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

        if (enumdyecolor == EnumDyeColor.WHITE)
        {
            if (applyBonemeal(stack, worldIn, pos, playerIn))
            {
                if (!worldIn.isRemote)
                {
                    worldIn.playEvent(2005, pos, 0);
                }

                return EnumActionResult.SUCCESS;
            }
        }
        else if (enumdyecolor == EnumDyeColor.BROWN)
        {
            IBlockState iblockstate = worldIn.getBlockState(pos);
            Block block = iblockstate.getBlock();

            if (block == Blocks.LOG && iblockstate.getValue(BlockOldLog.VARIANT) == BlockPlanks.EnumType.JUNGLE)
            {
                if (facing != EnumFacing.DOWN && facing != EnumFacing.UP)
                {
                    pos = pos.offset(facing);

                    if (worldIn.isAirBlock(pos))
                    {
                        IBlockState iblockstate1 = Blocks.COCOA.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, 0, playerIn, stack);
                        worldIn.setBlockState(pos, iblockstate1, 10);

                        if (!playerIn.capabilities.isCreativeMode)
                        {
                            --stack.stackSize;
                        }
                    }

                    return EnumActionResult.SUCCESS;
                }

                return EnumActionResult.FAIL;
            }

            return EnumActionResult.FAIL;
        }

        return EnumActionResult.PASS;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:59,代码来源:ItemDye.java


注:本文中的net.minecraft.init.Blocks.LOG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。