Java 类net.minecraft.block.BlockOldLog 实例源码

项目:BetterChests    文件:CocoaHandler.java   
@Override
public boolean canHandlePlant(Collection<ItemStack> items, World world, BlockPos pos, IBlockState state) {
    if (!WorldUtil.isBlockAir(state)) {
        return false;
    }
    boolean found = false;
    for (EnumFacing dir : EnumFacing.HORIZONTALS) {
        BlockPos toCheck = pos.offset(dir);
        IBlockState other = world.getBlockState(toCheck);
        if (other.getBlock() == Blocks.LOG && other.getValue(BlockOldLog.VARIANT) == EnumType.JUNGLE) {
            found = true;
            break;
        }
    }
    return found && items.stream().anyMatch(this::canPlantStack);
}
项目:customstuff4    文件:WrappedBlockStateTests.java   
@Test
public void test_deserialization_propertiesAsObject()
{
    WrappedBlockState state = gson.fromJson("{ \"block\": \"minecraft:log\", \"properties\" : { \"variant\" : \"spruce\"} }", WrappedBlockState.class);
    IBlockState blockState = state.createState();

    assertNotNull(state);
    assertNotNull(blockState);
    assertSame(Blocks.LOG, blockState.getBlock());
    assertSame(BlockPlanks.EnumType.SPRUCE, blockState.getValue(BlockOldLog.VARIANT));
}
项目:customstuff4    文件:WrappedBlockStateTests.java   
@Test
public void test_deserialization_propertiesAsString()
{
    WrappedBlockState state = gson.fromJson("{ \"block\": \"minecraft:log\", \"properties\" : \"variant=spruce,axis=z\" }", WrappedBlockState.class);
    IBlockState blockState = state.createState();

    assertNotNull(state);
    assertNotNull(blockState);
    assertSame(Blocks.LOG, blockState.getBlock());
    assertSame(BlockPlanks.EnumType.SPRUCE, blockState.getValue(BlockOldLog.VARIANT));
    assertSame(BlockLog.EnumAxis.Z, blockState.getValue(BlockLog.LOG_AXIS));
}
项目:modName    文件:VillageBlocks.java   
@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());
        }
    }
}
项目:InspiringWorld    文件:EnderTreeNormalGen.java   
public EnderTreeNormalGen(boolean notify) {
    super(notify);
    this.minTreeHeight = 4;
    this.metaWood = Blocks.LOG.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK);
    this.oakLeaves = Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT,
        BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, false);
    this.enderLeaves = IWTechBlocks.BLOCK_ENDER_LEAVES.getDefaultState();
}
项目:Easy-Editors    文件:BlockPropertyRegistry.java   
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);
}
项目:SecurityCraft    文件:ItemBlockReinforcedLog.java   
@Override
public String getUnlocalizedName(ItemStack stack)
{
    int dmg = stack.getMetadata();

    if(block instanceof BlockReinforcedOldLog)
        return getUnlocalizedName() + "_" + BlockOldLog.field_150168_M[dmg & 3];
    else if(block instanceof BlockReinforcedNewLog)
        return getUnlocalizedName() + "_" + BlockNewLog.field_150169_M[dmg & 3];

    return getUnlocalizedName();
}
项目:ProgressiveAutomation    文件:Vanilla.java   
private IBlockState getCorrectCocoState(World worldObj, BlockPos pos) {
    if (worldObj.isAirBlock(pos)) {
        for (EnumFacing facing : EnumFacing.Plane.HORIZONTAL) {
            BlockPos testPos = pos.offset(facing);
            IBlockState testState = worldObj.getBlockState(testPos);
            Block testBlock = testState.getBlock();
            if (testBlock == Blocks.LOG && testState.getValue(BlockOldLog.VARIANT) == BlockPlanks.EnumType.JUNGLE) {
                return Blocks.COCOA.getDefaultState().withProperty(BlockHorizontal.FACING, facing);
            }
        }
    }
    return null;
}
项目:minecraft-roguelike    文件:Log.java   
public static void setType(MetaBlock log, Wood type){
    switch(type){
    case OAK: log.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); return;
    case SPRUCE: log.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); return;
    case BIRCH: log.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.BIRCH); return;
    case JUNGLE: log.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); return;
    case ACACIA: log.withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA); return;
    case DARKOAK: log.withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.DARK_OAK); return;
    default: log.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); return;
    }
}
项目:EnderIO    文件:AxeHarvestingTarget.java   
private static EnumType getVariant(IBlockState bs) {
  if (bs.getProperties().containsKey(BlockNewLog.VARIANT)) {
    return bs.getValue(BlockNewLog.VARIANT);
  }
  if (bs.getProperties().containsKey(BlockOldLog.VARIANT)) {
    return bs.getValue(BlockOldLog.VARIANT);
  }
  return null;
}
项目:Backmemed    文件:ItemDye.java   
/**
 * 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;
    }
}
项目:CustomWorldGen    文件:ItemDye.java   
/**
 * 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;
    }
}
项目:ExpandedRailsMod    文件:ItemDye.java   
/**
 * 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.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, 0, playerIn);
                        worldIn.setBlockState(pos, iblockstate1, 10);

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

                    return EnumActionResult.SUCCESS;
                }

                return EnumActionResult.FAIL;
            }

            return EnumActionResult.FAIL;
        }

        return EnumActionResult.PASS;
    }
}
项目:BetterChests    文件:CocoaHandler.java   
private boolean isJungleTree(IBlockState state) {
    return state.getBlock() == Blocks.LOG && state.getValue(BlockOldLog.VARIANT) == EnumType.JUNGLE;
}
项目:EnderIO    文件:CocoaFarmer.java   
private boolean validBlock(@Nonnull IBlockState iblockstate) {
  return iblockstate.getBlock() == Blocks.LOG && iblockstate.getValue(BlockOldLog.VARIANT) == BlockPlanks.EnumType.JUNGLE;
}