Java Code Examples for net.minecraft.init.Items.AIR

The following are Jave code examples for showing how to use AIR of the net.minecraft.init.Items class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: pnc-repressurized   File: RecipeOneProbe.java   View Source Code Vote up 6 votes
@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;
}
 
Example 2
Project: SimpleTubes   File: TileTube.java   View Source Code Vote up 6 votes
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();
}
 
Example 3
Project: pnc-repressurized   File: DroneAIDig.java   View Source Code Vote up 5 votes
@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));
    }
}
 
Example 4
Project: harshencastle   File: BaseBlockHarshenSingleInventory.java   View Source Code Vote up 5 votes
@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);
}
 
Example 5
Project: SimpleTubes   File: TubeUtil.java   View Source Code Vote up 5 votes
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);
	}
 
Example 6
Project: ExPetrum   File: BlockSnow.java   View Source Code Vote up 4 votes
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
	return Items.AIR;
}
 
Example 7
Project: Bewitchment   File: ModelHandler.java   View Source Code Vote up 4 votes
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);
}
 
Example 8
Project: Bewitchment   File: ModelHandler.java   View Source Code Vote up 4 votes
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);
}
 
Example 9
Project: ExPetrum   File: BlockWorkedBoulder.java   View Source Code Vote up 4 votes
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
	return Items.AIR;
}
 
Example 10
Project: ExPetrum   File: BlockCrop.java   View Source Code Vote up 4 votes
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
	return Items.AIR;
}
 
Example 11
Project: harshencastle   File: HarshenUtils.java   View Source Code Vote up 4 votes
public static boolean glassContainerHasBlock(CauldronLiquid liquid)
{
	 return liquid.hasState() && Item.getItemFromBlock(((IBlockState)liquid.getStateOrLoc()).getBlock()) != Items.AIR;
}
 
Example 12
Project: harshencastle   File: BaseTileEntityHarshenInventory.java   View Source Code Vote up 4 votes
public boolean isSlotEmpty(int slot)
{	 
	return this.handler.getStackInSlot(slot).getItem() == Items.AIR;
}
 
Example 13
Project: ExPetrum   File: BlockCoralPlant.java   View Source Code Vote up 4 votes
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
	return Items.AIR;
}
 
Example 14
Project: ExPetrum   File: BlockIce.java   View Source Code Vote up 4 votes
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
	return Items.AIR;
}
 
Example 15
Project: ExPetrum   File: BlockVegetation.java   View Source Code Vote up 4 votes
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
	return Items.AIR;
}
 
Example 16
Project: Solar   File: ModelHandler.java   View Source Code Vote up 4 votes
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);
}
 
Example 17
Project: Solar   File: ModelHandler.java   View Source Code Vote up 4 votes
public static void registerModel(Block block, int meta, String variant) {
	Item item = Item.getItemFromBlock(block);
	if(item == Items.AIR) throw new UnsupportedOperationException("This block has no Item!");
	registerModel(item, meta, variant);
}
 
Example 18
Project: ExPetrum   File: BlockSeaweed.java   View Source Code Vote up 4 votes
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
	return Items.AIR;
}
 
Example 19
Project: Solar   File: BlockSchrodingerGlyph.java   View Source Code Vote up 4 votes
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
	return Items.AIR;
}
 
Example 20
Project: PowerProbe   File: BlockPowerProbe.java   View Source Code Vote up 4 votes
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
  return Items.AIR;
}