當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。