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


Java ItemBlock.getBlock方法代码示例

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


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

示例1: registerItemModel

import net.minecraft.item.ItemBlock; //导入方法依赖的package包/类
@Override
public void registerItemModel(Item item) {
    if(item instanceof IItemColored)
        COLOR_ITEMS.add((IItemColored) item);
    if(item instanceof ItemBlock)
    {
        ItemBlock itemBlock = (ItemBlock) item;
        Block block = itemBlock.getBlock();
        ResourceLocation resloc = block.getRegistryName();
        if(block instanceof IBlockVariants) {
            for (IBlockState state : ((IBlockVariants) block).getValidStates()) {
                ModelLoader.setCustomModelResourceLocation(item, block.getMetaFromState(state), new ModelResourceLocation(resloc, ((IBlockVariants) block).getBlockStateName(state)));
            }
        }
        else
            ModelLoader.setCustomModelResourceLocation(item,0,new ModelResourceLocation(resloc, "inventory"));
    }
    else
        ModelLoader.setCustomModelResourceLocation(item,0,new ModelResourceLocation(item.getRegistryName(), "inventory"));

}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:22,代码来源:ClientProxy.java

示例2: registerItems

import net.minecraft.item.ItemBlock; //导入方法依赖的package包/类
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
	registry = event.getRegistry();

	wallet = register(new ItemWallet("wallet"));
	linkingCard = register(new ItemLinkingCard("linking_card"));

	penny = register(new ItemMoneyBase("penny", 0.01F));
	nickel = register(new ItemMoneyBase("nickel", 0.05F));
	dime = register(new ItemMoneyBase("dime", 0.10F));
	quarter = register(new ItemMoneyBase("quarter", 0.25F));

	dollarBill = register(new ItemMoneyBase("dollar_bill", 1F));
	fiveDollarBill = register(new ItemMoneyBase("five_dollar_bill", 5F));
	tenDollarBill = register(new ItemMoneyBase("ten_dollar_bill", 10F));
	twentyDollarBill = register(new ItemMoneyBase("twenty_dollar_bill", 20F));
	fiftyDollarBill = register(new ItemMoneyBase("fifty_dollar_bill", 50F));
	hundredDollarBill = register(new ItemMoneyBase("hundred_dollar_bill", 100F));

	for (ItemBlock ib : itemBlocks) {
		registry.register(ib);
		if (ib.getBlock() instanceof BlockBasic) {
			((BlockBasic) ib.getBlock()).registerItemModel(ib);
		}
	}
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:27,代码来源:ItemHandler.java

示例3: getLightLevel

import net.minecraft.item.ItemBlock; //导入方法依赖的package包/类
public static int getLightLevel(ItemStack p_getLightLevel_0_)
{
    if (p_getLightLevel_0_ == null)
    {
        return 0;
    }
    else
    {
        Item item = p_getLightLevel_0_.getItem();

        if (item instanceof ItemBlock)
        {
            ItemBlock itemblock = (ItemBlock)item;
            Block block = itemblock.getBlock();

            if (block != null)
            {
                return block.getLightValue();
            }
        }

        return item == Items.lava_bucket ? Blocks.lava.getLightValue() : (item != Items.blaze_rod && item != Items.blaze_powder ? (item == Items.glowstone_dust ? 8 : (item == Items.prismarine_crystals ? 8 : (item == Items.magma_cream ? 8 : (item == Items.nether_star ? Blocks.beacon.getLightValue() / 2 : 0)))) : 10);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:DynamicLights.java

示例4: getLightLevel

import net.minecraft.item.ItemBlock; //导入方法依赖的package包/类
public static int getLightLevel(ItemStack p_getLightLevel_0_)
{
    if (p_getLightLevel_0_ == null)
    {
        return 0;
    }
    else
    {
        Item item = p_getLightLevel_0_.getItem();

        if (item instanceof ItemBlock)
        {
            ItemBlock itemblock = (ItemBlock)item;
            Block block = itemblock.getBlock();

            if (block != null)
            {
                return block.getLightValue(block.getDefaultState());
            }
        }

        return item == Items.LAVA_BUCKET ? Blocks.LAVA.getLightValue(Blocks.LAVA.getDefaultState()) : (item != Items.BLAZE_ROD && item != Items.BLAZE_POWDER ? (item == Items.GLOWSTONE_DUST ? 8 : (item == Items.PRISMARINE_CRYSTALS ? 8 : (item == Items.MAGMA_CREAM ? 8 : (item == Items.NETHER_STAR ? Blocks.BEACON.getLightValue(Blocks.BEACON.getDefaultState()) / 2 : 0)))) : 10);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:DynamicLights.java

示例5: doBlockInteraction

import net.minecraft.item.ItemBlock; //导入方法依赖的package包/类
@Override
protected boolean doBlockInteraction(BlockPos pos, double distToBlock) {
    if (drone.getPathNavigator().hasNoPath()) {
        EnumFacing side = ProgWidgetPlace.getDirForSides(((ISidedWidget) widget).getSides());
        for (int i = 0; i < drone.getInv().getSlots(); i++) {
            ItemStack droneStack = drone.getInv().getStackInSlot(i);
            if (droneStack.getItem() instanceof ItemBlock && ((ItemBlock) droneStack.getItem()).getBlock().canPlaceBlockOnSide(drone.world(), pos, ProgWidgetPlace.getDirForSides(((ISidedWidget) widget).getSides()))) {
                if (widget.isItemValidForFilters(droneStack)) {
                    ItemBlock itemBlock = (ItemBlock) droneStack.getItem();
                    Block block = itemBlock.getBlock();
                    if (drone.world().mayPlace(block, pos, false, side, drone instanceof EntityDrone ? (EntityDrone) drone : null)) {
                        int newMeta = itemBlock.getMetadata(droneStack.getMetadata());
                        setFakePlayerAccordingToDir();
                        IBlockState iblockstate1 = block.getStateForPlacement(drone.world(), pos, side, side.getFrontOffsetX(), side.getFrontOffsetY(), side.getFrontOffsetZ(), newMeta, drone.getFakePlayer(), EnumHand.MAIN_HAND);
                        if (itemBlock.placeBlockAt(droneStack, drone.getFakePlayer(), drone.world(), pos, side, side.getFrontOffsetX(), side.getFrontOffsetY(), side.getFrontOffsetZ(), iblockstate1)) {
                            drone.addAir(null, -PneumaticValues.DRONE_USAGE_PLACE);
                            SoundType soundType = block.getSoundType(iblockstate1, drone.world(), pos, drone.getFakePlayer());
                            drone.world().playSound(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F, false);
                            droneStack.shrink(1);
                            if (droneStack.getCount() <= 0) {
                                drone.getInv().setStackInSlot(i, ItemStack.EMPTY);
                            }
                        }
                        return false;
                    }
                }
            }
        }
        return false;
    } else {
        return true;
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:34,代码来源:DroneAIPlace.java

示例6: worksWith

import net.minecraft.item.ItemBlock; //导入方法依赖的package包/类
protected boolean worksWith(final Block referenceBlock, final int referenceMetadata) {
    for (ItemStack stack : blocks) {
        if (stack != null && stack.getItem() instanceof ItemBlock) {
            final ItemBlock item = (ItemBlock) stack.getItem();
            final Block supportedBlock = item.getBlock();
            final int supportedMetadata = item.getMetadata(stack.getItemDamage());
            if (referenceBlock == supportedBlock && (referenceMetadata == supportedMetadata || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:14,代码来源:DriverSidedBlock.java

示例7: isTranslucentBlock

import net.minecraft.item.ItemBlock; //导入方法依赖的package包/类
private static boolean isTranslucentBlock(ItemStack stack)
{
    if (stack == null)
    {
        return false;
    }
    else
    {
        Item item = stack.getItem();

        if (item == null)
        {
            return false;
        }
        else if (!(item instanceof ItemBlock))
        {
            return false;
        }
        else
        {
            ItemBlock itemblock = (ItemBlock)item;
            Block block = itemblock.getBlock();

            if (block == null)
            {
                return false;
            }
            else
            {
                BlockRenderLayer blockrenderlayer = block.getBlockLayer();
                return blockrenderlayer == BlockRenderLayer.TRANSLUCENT;
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:36,代码来源:Shaders.java


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