Tabnine Logo
ItemStackList
Code IndexAdd Tabnine to your IDE (free)

How to use
ItemStackList
in
slimeknights.mantle.util

Best Java code snippets using slimeknights.mantle.util.ItemStackList (Showing top 17 results out of 315)

origin: SlimeKnights/TinkersConstruct

 @Override
 protected ItemStackList getDemoTools(ItemStack[][] inputItems) {
  if(inputItems.length == 0) {
   return ItemStackList.create();
  }

  ItemStackList demo = super.getDemoTools(inputItems);

  ItemStackList out = ItemStackList.create();

  for(int i = 0; i < inputItems[0].length; i++) {
   if(inputItems[0][i].getItem() == TinkerTools.sharpeningKit) {
    Material material = TinkerTools.sharpeningKit.getMaterial(inputItems[0][i]);
    IModifier modifier = TinkerRegistry.getModifier("fortify" + material.getIdentifier());
    if(modifier != null) {
     ItemStack stack = demo.get(i % demo.size()).copy();
     modifier.apply(stack);
     out.add(stack);
    }
   }
  }

  return out;
 }
}
origin: SlimeKnights/TinkersConstruct

 protected ItemStackList getDemoTools(ItemStack[][] inputItems) {
  ItemStackList demo = ItemStackList.withSize(tool.size());

  for(int i = 0; i < tool.size(); i++) {
   if(tool.get(i) instanceof ToolCore) {
    ToolCore core = (ToolCore) tool.get(i);
    List<Material> mats = ImmutableList.of(TinkerMaterials.wood, TinkerMaterials.cobalt, TinkerMaterials.ardite, TinkerMaterials.manyullyn);
    mats = mats.subList(0, core.getRequiredComponents().size());
    demo.set(i, ((ToolCore) tool.get(i)).buildItemForRendering(mats));
   }
   else if(tool != null) {
    demo.set(i, new ItemStack(tool.get(i)));
   }

   if(!demo.get(i).isEmpty()) {
    modifier.apply(demo.get(i));
   }
  }

  return demo;
 }
}
origin: SlimeKnights/TinkersConstruct

input = ItemStackList.of(stacks);
origin: SlimeKnights/Mantle

/**
 * Creates a new list with the same content. ItemStacks are shared between lists!
 * @param fixed If true the list will have fixed size
 */
public ItemStackList copy(boolean fixed) {
 ItemStackList copy = fixed ? withSize(this.size()) : create();
 for(int i = 0; i < size(); i++) {
  copy.set(i, get(i));
 }
 return copy;
}
origin: SlimeKnights/Mantle

/**
 * Checks if an Itemstack at a specific index is not empty
 *
 * @param index The index to check
 * @return true if the itemstack at index <i>index</i> is not empty, false otherwise or if the index is out of bounds
 */
public boolean hasItem(int index) {
 return index >= 0 && index < size() && !get(index).isEmpty();
}
origin: SlimeKnights/Mantle

/**
 * Create an ItemStackList from the given elements.
 */
public static ItemStackList of(IInventory inventory) {
 ItemStackList itemStackList = withSize(inventory.getSizeInventory());
 for(int i = 0; i < inventory.getSizeInventory(); i++) {
  itemStackList.add(inventory.getStackInSlot(i));
 }
 return itemStackList;
}
origin: SlimeKnights/Mantle

/**
 * Sets the itemstack at the given index to Itemstack.EMPTY.
 * Does nothing if the index is out of bounds.
 *
 * @param index The index to set empty
 */
public void setEmpty(int index) {
 if(index >= 0 && index < size()) {
  set(index, ItemStack.EMPTY);
 }
}
origin: SlimeKnights/Mantle

/**
 * Create an ItemStackList from the given elements.
 */
public static ItemStackList of(Collection<ItemStack> boringList) {
 ItemStackList itemStackList = create();
 itemStackList.addAll(boringList);
 return itemStackList;
}
origin: SlimeKnights/Mantle

public void resize(int size) {
 ItemStackList newInventory = ItemStackList.withSize(size);
 for (int i = 0; i < size && i < inventory.size(); i++) {
  newInventory.set(i, inventory.get(i));
 }
 inventory = newInventory;
}
origin: SlimeKnights/TinkersConstruct

private NonNullList<ItemStack> getInputs() {
 NonNullList<ItemStack> input = NonNullList.withSize(tile.getSizeInventory() - 1, ItemStack.EMPTY);
 for(int i = 1; i < tile.getSizeInventory(); i++) {
  input.set(i - 1, tile.getStackInSlot(i));
 }
 return input;
}
origin: SlimeKnights/Mantle

public static ItemStackList create() {
 return new ItemStackList();
}
origin: SlimeKnights/Mantle

 /**
  * Creates a new list with the same content, but Itemstacks are copied too,
  * meaning changes to the copy will not affect the itemstacks in the original list.
  * @param fixed If true the list will have fixed size
  */
 public ItemStackList deepCopy(boolean fixed) {
  ItemStackList copy = fixed ? withSize(this.size()) : create();
  for(int i = 0; i < size(); i++) {
   copy.set(i, get(i).copy());
  }
  return copy;
 }
}
origin: SlimeKnights/Mantle

/**
 * Create an ItemStackList from the given elements.
 */
public static ItemStackList of(ItemStack... element) {
 ItemStackList itemStackList = create();
 itemStackList.addAll(Arrays.asList(element));
 return itemStackList;
}
origin: SlimeKnights/TinkersConstruct

private ItemStack buildTool() throws TinkerGuiException {
 NonNullList<ItemStack> input = ItemStackList.withSize(tile.getSizeInventory());
 for(int i = 0; i < input.size(); i++) {
  input.set(i, tile.getStackInSlot(i));
 }
 ItemStack result = ToolBuilder.tryBuildTool(input, toolName, getBuildableTools());
 if(!result.isEmpty()) {
  TinkerCraftingEvent.ToolCraftingEvent.fireEvent(result, player, input);
 }
 return result;
}
origin: SlimeKnights/Mantle

/**
 * Create an empty ItemStackList with the given size
 */
public static ItemStackList withSize(int size) {
 ItemStack[] aobject = new ItemStack[size];
 Arrays.fill(aobject, ItemStack.EMPTY);
 return new ItemStackList(Arrays.asList(aobject));
}
origin: SlimeKnights/Mantle

/**
 * @param name Localization String for the inventory title. Can be overridden through setCustomName
 */
public TileInventory(String name, int inventorySize, int maxStackSize) {
 this.inventory = NonNullList.<ItemStack> withSize(inventorySize, ItemStack.EMPTY);
 this.stackSizeLimit = maxStackSize;
 this.inventoryTitle = name;
 this.itemHandler = new InvWrapper(this);
}
origin: SlimeKnights/TinkersConstruct

NonNullList<ItemStack> inputItems = ItemStackList.of(Util.deepCopyFixedNonNullList(toolPartsIn));
if(!TinkerEvent.OnToolPartReplacement.fireEvent(inputItems, toolStack)) {
slimeknights.mantle.utilItemStackList

Most used methods

  • add
  • create
  • get
  • set
  • size
  • withSize
    Create an empty ItemStackList with the given size
  • <init>
  • addAll
  • of
    Create an ItemStackList from the given elements.

Popular in Java

  • Reactive rest calls using spring rest template
  • onCreateOptionsMenu (Activity)
  • findViewById (Activity)
  • setScale (BigDecimal)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Socket (java.net)
    Provides a client-side TCP socket.
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now