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

How to use
withSize
method
in
slimeknights.mantle.util.ItemStackList

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

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/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

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 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

/**
 * @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/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/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

/**
 * 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;
}
slimeknights.mantle.utilItemStackListwithSize

Javadoc

Create an empty ItemStackList with the given size

Popular methods of ItemStackList

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

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • startActivity (Activity)
  • getSystemService (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • JFileChooser (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top Vim 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