本文整理汇总了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);
}
}
}
示例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;
}
示例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);
}
}
}
示例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());
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
}