當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。