本文整理匯總了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;
}
示例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();
}
示例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));
}
}
示例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);
}
示例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);
}
示例6: getItemDropped
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Items.AIR;
}
示例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);
}
示例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);
}
示例9: glassContainerHasBlock
public static boolean glassContainerHasBlock(CauldronLiquid liquid)
{
return liquid.hasState() && Item.getItemFromBlock(((IBlockState)liquid.getStateOrLoc()).getBlock()) != Items.AIR;
}
示例10: isSlotEmpty
public boolean isSlotEmpty(int slot)
{
return this.handler.getStackInSlot(slot).getItem() == Items.AIR;
}
示例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);
}
示例12: getItemDropped
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Items.AIR;
}
示例13: getItemDropped
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Items.AIR;
}