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


Java Items.AIR属性代码示例

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


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

示例1: matches

@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
    boolean probeFound = false, helmetFound = false;
    for (int i = 0; i < inv.getSizeInventory(); i++) {
        Item item = inv.getStackInSlot(i).getItem();
        if (item == Itemss.PNEUMATIC_HELMET) {
            if (helmetFound) return false;
            helmetFound = true;
        } else if (item == CraftingRegistrator.ONE_PROBE) {
            if (probeFound) return false;
            probeFound = true;
        } else if (item != Items.AIR) {
            return false;
        }
    }
    return probeFound && helmetFound;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:17,代码来源:RecipeOneProbe.java

示例2: handleItemServerSide

public void handleItemServerSide(byte type, TubeItem item) {
	if (item.getItemStack() == null || item == null || item.getItemStack().getItem() == Items.AIR || item.getItemStack() == ItemStack.EMPTY)
		return;

	if (!world.isRemote) {
		switch (type) {
			case ITEM_ADD:
				itemList.add(item);
				byte dir = (byte) (item.getDirection() != null ? item.getDirection().ordinal() : -1);
				int color = item.getColor() != null ? item.getColor().getMetadata() : -1;
				PacketHandler.sendToAll(new PacketItemAdd(this, item.getId(), item.getItemStack(), item.getProgress(), dir, color));
				break;
			case ITEM_REMOVE:
				itemList.remove(item);
				PacketHandler.sendToAll(new PacketItemRemove(this, item.getId()));
				break;
		}
	}

	markDirty();
}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:21,代码来源:TileTube.java

示例3: getSilkTouchBlock

@Nonnull
private static ItemStack getSilkTouchBlock(Block block, IBlockState state) {
    Item item = Item.getItemFromBlock(block);
    if (item == Items.AIR) {
        return ItemStack.EMPTY;
    } else {
        return new ItemStack(item, 1, block.getMetaFromState(state));
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:DroneAIDig.java

示例4: breakBlock

@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{	
	BaseTileEntityHarshenSingleItemInventory te = (BaseTileEntityHarshenSingleItemInventory) worldIn.getTileEntity(pos);
	IItemHandler handler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);

	if(!worldIn.isRemote)
		if(isBreakNBT(handler.getStackInSlot(0)))
		{
			ItemStackHandler handlerStack = new ItemStackHandler(1);
			handlerStack.setStackInSlot(0, handler.getStackInSlot(0));
			ItemStack stack = new ItemStack(this);
	        String stackName = "";
			NBTTagCompound nbttagcompound = new NBTTagCompound();
			if(handlerStack.getStackInSlot(0).getItem() != Items.AIR)
			{
		        nbttagcompound.setTag("ItemStackHandler", handlerStack.serializeNBT());
		        stackName +=  I18n.translateToLocal(handlerStack.getStackInSlot(0).getItem().getUnlocalizedName() + ".name");
			}
			addNBT(handler.getStackInSlot(0), nbttagcompound, worldIn, pos);
			if(!nbttagcompound.getKeySet().isEmpty() || !handlerStack.getStackInSlot(0).isEmpty())
			{
				stack.setTagCompound(nbttagcompound);
				stackName += extraName(nbttagcompound, handlerStack.getStackInSlot(0).getItem() != Items.AIR);
				stackName = stackName.equals("")? "�r" + getLocalizedName() : "�r" + getLocalizedName() + " (" + stackName + ")";
				stack.setStackDisplayName(stackName);
			}
			if(!creativeBreakMap.containsKey(pos) || !creativeBreakMap.get(pos))
				worldIn.spawnEntity(new EntityItem(worldIn, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack));
			creativeBreakMap.remove(pos);
		}
		else
			InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(), handler.getStackInSlot(0));
	super.breakBlock(worldIn, pos, state);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:35,代码来源:BaseBlockHarshenSingleInventory.java

示例5: extract

public static Pair<ItemStack, Integer> extract(TileEntity tile, EnumFacing from, int[] col, IInventory inv, boolean fullStack) {

		if (tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, from)) {
			IItemHandlerModifiable handler = (IItemHandlerModifiable) tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, from);
			if (handler != null) {
				int invSize = handler.getSlots();

				for (int i = 0; i < invSize; i++) {
					ItemStack current = handler.getStackInSlot(i);

					for (int j = 0; j < inv.getSizeInventory(); j++) {
						ItemStack stack = inv.getStackInSlot(j);
						int color = -1;
						if (stack != null && stack != ItemStack.EMPTY && stack.getItem() != Items.AIR) {
							if (areItemStacksEqual(stack, current)) {
								int column = j >= 0 && j <= 3 ? 0 : j >= 4 && j <= 7 ? 1 : j >= 8 && j <= 11 ? 2 : j >= 12 && j <= 15 ? 3 : j >= 16 || j <= 19 ? 4 : -1;

								if (column == -1)
									return null;

								color = col[column];

								if (current != null && !current.isEmpty() && current.getItem() != Items.AIR) {
									ItemStack extracted = handler.extractItem(i, !fullStack ? 1 : current.getCount(), false);
									return Pair.of(extracted, color);
								}
							}
						}
					}

				}
			}
		} // TODO: TileEntities that don't have capabilities - needs testing

		return Pair.of(ItemStack.EMPTY, -1);
	}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:36,代码来源:TubeUtil.java

示例6: getItemDropped

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
	return Items.AIR;
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:5,代码来源:BlockSnow.java

示例7: registerForgeModel

public static void registerForgeModel(Block block, int meta, String variant) {
	Item item = Item.getItemFromBlock(block);
	if (item == Items.AIR) throw new UnsupportedOperationException("This block has no Item!");
	ModelResourceLocation modelResourceLocation = new ModelResourceLocation(item.getRegistryName(), variant);
	ModelLoader.setCustomModelResourceLocation(item, meta, modelResourceLocation);
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:6,代码来源:ModelHandler.java

示例8: registerModel

public static void registerModel(Block block, int meta) {
	Item item = Item.getItemFromBlock(block);
	if (item == Items.AIR) throw new UnsupportedOperationException("This block has no Item!");
	registerModel(item, meta);
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:5,代码来源:ModelHandler.java

示例9: glassContainerHasBlock

public static boolean glassContainerHasBlock(CauldronLiquid liquid)
{
	 return liquid.hasState() && Item.getItemFromBlock(((IBlockState)liquid.getStateOrLoc()).getBlock()) != Items.AIR;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:4,代码来源:HarshenUtils.java

示例10: isSlotEmpty

public boolean isSlotEmpty(int slot)
{	 
	return this.handler.getStackInSlot(slot).getItem() == Items.AIR;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:4,代码来源:BaseTileEntityHarshenInventory.java

示例11: registerModel

public static void registerModel(Block block, int meta, ModelResourceLocation location) {
	Item item = Item.getItemFromBlock(block);
	if(item == Items.AIR) throw new UnsupportedOperationException("This block has no Item!");
	registerModel(item, meta, location);
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:5,代码来源:ModelHandler.java

示例12: getItemDropped

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
	return Items.AIR;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:4,代码来源:BlockSchrodingerGlyph.java

示例13: getItemDropped

public Item getItemDropped(IBlockState state, Random rand, int fortune) {
  return Items.AIR;
}
 
开发者ID:ToroCraft,项目名称:PowerProbe,代码行数:3,代码来源:BlockPowerProbe.java


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