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


Java Item.getItemFromBlock方法代码示例

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


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

示例1: registerBlock

import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
 * Registers the given block.
 * Also adds the respective TileEntity if the block has one.
 * 
 * @param registerItemBlock - {@code true} to also register the block as item.
 */
private static void registerBlock(Block block, boolean registerItemBlock) {//TODO REGISTRY - Register block names with "oft." -prefix to avoid name clash between mods.

	/* Determine block's unlocalised name. */
	String name = block.getClass().getSimpleName().toLowerCase().substring(5);

	/* Register block (and its TileEntity, if existent). */
	if (block.getRegistryName() == null) {
		GameRegistry.register(block.setRegistryName(name).setUnlocalizedName(name));

		if(block instanceof ITileEntityProvider){
			Class<? extends TileEntity> tileEntityClass = ((ITileEntityProvider) block).createNewTileEntity(null, 0).getClass();
			GameRegistry.registerTileEntity(tileEntityClass, tileEntityClass.getSimpleName());
		}
	}

	/* Register block's item if required. */
	if (registerItemBlock && Item.getItemFromBlock(block) == null) {
		GameRegistry.register(new ItemBlock(block).setRegistryName(name));
	}
}
 
开发者ID:DonBruce64,项目名称:OpenFlexiTrack,代码行数:27,代码来源:OFTRegistry.java

示例2: createStackedBlock

import net.minecraft.item.Item; //导入方法依赖的package包/类
@Nullable
protected ItemStack createStackedBlock(IBlockState state)
{
    Item item = Item.getItemFromBlock(this);

    if (item == null)
    {
        return null;
    }
    else
    {
        int i = 0;

        if (item.getHasSubtypes())
        {
            i = this.getMetaFromState(state);
        }

        return new ItemStack(item, 1, i);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:Block.java

示例3: func_175422_a

import net.minecraft.item.Item; //导入方法依赖的package包/类
private void func_175422_a(EntityPlayer player, int slot) {
	ItemStack itemstack = getEquipmentInSlot(slot);

	int j = player.inventory.currentItem;
	ItemStack itemstack1 = player.inventory.getStackInSlot(j);
	ItemStack itemstack2;

	if (player.capabilities.isCreativeMode && (itemstack == null || itemstack.getItem() == Item.getItemFromBlock(Blocks.air)) && itemstack1 != null) {
		itemstack2 = itemstack1.copy();
		itemstack2.stackSize = 1;
		setCurrentItemOrArmor(slot, itemstack2);
	} else if (itemstack1 != null && itemstack1.stackSize > 1) {
		if (itemstack == null) {
			itemstack2 = itemstack1.copy();
			itemstack2.stackSize = 1;
			setCurrentItemOrArmor(slot, itemstack2);
			itemstack1.stackSize--;
		}
	} else {
		setCurrentItemOrArmor(slot, itemstack1);
		player.inventory.setInventorySlotContents(j, itemstack);
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:24,代码来源:EntityArmourStand.java

示例4: getItemDropped

import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    if (fortune > 3)
    {
        fortune = 3;
    }

    return rand.nextInt(10 - fortune * 3) == 0 ? Items.flint : Item.getItemFromBlock(this);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:BlockGravel.java

示例5: getItemDropped

import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Item.getItemFromBlock(Blocks.obsidian);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:BlockEnderChest.java

示例6: getItemDropped

import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
 * Get the Item that this Block should drop when harvested.
 */
@Nullable
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Item.getItemFromBlock(this);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:Block.java

示例7: getItemDropped

import net.minecraft.item.Item; //导入方法依赖的package包/类
public Item getItemDropped(int par1, Random random, int par2) {
	return Item.getItemFromBlock(TechnicalBlock.WasherIdle);
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:4,代码来源:Washer.java

示例8: getItemDropped

import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Item.getItemFromBlock(Blocks.DAYLIGHT_DETECTOR);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:BlockDaylightDetector.java

示例9: transferStackInSlot

import net.minecraft.item.Item; //导入方法依赖的package包/类
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int fromId)
{
	ItemStack movedStackDupe = null;
	Slot slot = (Slot)inventorySlots.get(fromId);

	if (slot != null && slot.getHasStack())
	{
		ItemStack movedStack = slot.getStack();
		movedStackDupe = movedStack.copy();

		if (fromId == TileEntitySmelter.OUTPUT)
		{
			if (!mergeItemStack(movedStack, 4, 40, true))
			{
				return null;
			}
			slot.onSlotChange(movedStack, movedStackDupe);
		}
		else if (fromId != TileEntitySmelter.FUEL && fromId != TileEntitySmelter.INPUT &&
				fromId != TileEntitySmelter.BOOSTER)
		{
			if (SmelterRecipeHandler.instance().getSmeltingResult(movedStack) != null)
			{
				if (!mergeItemStack(movedStack, TileEntitySmelter.INPUT, TileEntitySmelter.INPUT + 1, false))
				{
					return null;
				}
			}
			else if (movedStack.getItem() == Item.getItemFromBlock(Blocks.GRAVEL))
			{
				if (!mergeItemStack(movedStack, TileEntitySmelter.BOOSTER, TileEntitySmelter.BOOSTER + 1, false))
				{
					return null;
				}
			}
			else if (FuelRegistry.getBurnTime(FuelConsumerType.SMELTER, movedStack) > 0)
			{
				if (!mergeItemStack(movedStack, TileEntitySmelter.FUEL, TileEntitySmelter.FUEL + 1, false))
				{
					return null;
				}
			}
			else if (fromId >= 4 && fromId < 31)
			{
				if (!mergeItemStack(movedStack, 31, 40, false))
				{
					return null;
				}
			}
			else if (fromId >= 31 && fromId < 40 && !mergeItemStack(movedStack, 4, 31, false))
			{
				return null;
			}
		}
		else if (!mergeItemStack(movedStack, 4, 40, false))
		{
			return null;
		}
		if (movedStack.getCount() == 0)
		{
			slot.putStack(null);
		}
		else
		{
			slot.onSlotChanged();
		}
		if (movedStack.getCount() == movedStackDupe.getCount())
		{
			return null;
		}
		slot.onTake(player, movedStack);
	}
	return movedStackDupe;
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:76,代码来源:ContainerSmelter.java

示例10: getItem

import net.minecraft.item.Item; //导入方法依赖的package包/类
public Item getItem(World world, int par2, int par3, int par4) {
	return Item.getItemFromBlock(TechnicalBlock.ElectricFurnaceAdvancedIdle);
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:4,代码来源:ElectricFurnaceAdvanced.java

示例11: createStackedBlock

import net.minecraft.item.Item; //导入方法依赖的package包/类
protected ItemStack createStackedBlock(IBlockState state)
{
    return new ItemStack(Item.getItemFromBlock(this), 1, 0);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockHay.java

示例12: getItemDropped

import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Item.getItemFromBlock(this);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:Block.java

示例13: getItemDropped

import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Item.getItemFromBlock(Blocks.stone_slab2);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:BlockStoneSlabNew.java

示例14: getItemDropped

import net.minecraft.item.Item; //导入方法依赖的package包/类
@Override
public Item getItemDropped(int meta, Random rand, int fortune) {
	return Item.getItemFromBlock(this);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:5,代码来源:OldGravel.java

示例15: getItem

import net.minecraft.item.Item; //导入方法依赖的package包/类
public Item getItem(World world, int par2, int par3, int par4) {
	return Item.getItemFromBlock(TechnicalBlock.GrinderMediumIdle);
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:4,代码来源:GrinderMedium.java


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