Tabnine Logo
slimeknights.mantle.util
Code IndexAdd Tabnine to your IDE (free)

How to use slimeknights.mantle.util

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

origin: SlimeKnights/TinkersConstruct

/** Returns a fixed size DEEP copy of the list */
public static NonNullList<ItemStack> deepCopyFixedNonNullList(NonNullList<ItemStack> in) {
 return RecipeMatchRegistry.copyItemStackArray(in);
}
origin: SlimeKnights/TinkersConstruct

protected void setTooltips(List<String> tooltips) {
 // convert \n in localized text to actual newlines
 if(tooltips != null) {
  for(int i = 0; i < tooltips.size(); i++) {
   tooltips.set(i, LocUtils.convertNewlines(tooltips.get(i)));
  }
 }
 this.tooltips = tooltips;
}
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

/** Registers a casting recipe for casting table */
public static void registerTableCasting(ItemStack output, ItemStack cast, Fluid fluid, int amount) {
 RecipeMatch rm = null;
 if(cast != ItemStack.EMPTY) {
  rm = RecipeMatch.ofNBT(cast);
 }
 registerTableCasting(new CastingRecipe(output, rm, fluid, amount));
}
origin: SlimeKnights/TinkersConstruct

public boolean matches(ItemStack input) {
 return this.input != null && this.input.matches(ListUtil.getListFrom(input)).isPresent();
}
origin: SlimeKnights/TinkersConstruct

/** Registers this itemstack NBT-SENSITIVE to melt into amount of the given fluid. */
public static void registerMelting(ItemStack stack, Fluid fluid, int amount) {
 registerMelting(new MeltingRecipe(new RecipeMatch.ItemCombination(amount, stack), fluid));
}
origin: SlimeKnights/TinkersConstruct

/**
 * Adds a new drying recipe
 *
 * @param input  Input ItemStack
 * @param output Output ItemStack
 * @param time   Recipe time in ticks
 */
public static void registerDryingRecipe(ItemStack input, ItemStack output, int time) {
 if(output.isEmpty() || input.isEmpty()) {
  return;
 }
 addDryingRecipe(new DryingRecipe(new RecipeMatch.Item(input, 1), output, time));
}
origin: SlimeKnights/TinkersConstruct

/**
 * Adds a new drying recipe
 *
 * @param oredict Input ore dictionary entry
 * @param output  Output ItemStack
 * @param time    Recipe time in ticks
 */
public static void registerDryingRecipe(String oredict, ItemStack output, int time) {
 if(output.isEmpty() || oredict == null) {
  return;
 }
 addDryingRecipe(new DryingRecipe(new RecipeMatch.Oredict(oredict, 1), output, time));
}
origin: SlimeKnights/TinkersConstruct

 @Override
 public List<List<ItemStack>> getItems() {
  ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();

  for(RecipeMatch rm : items) {
   List<ItemStack> in = rm.getInputs();
   if(!in.isEmpty()) {
    builder.add(in);
   }
  }

  return builder.build();
 }
}
origin: SlimeKnights/TinkersConstruct

/** Registers a casting recipe for the casting basin */
public static void registerBasinCasting(ItemStack output, ItemStack cast, Fluid fluid, int amount) {
 RecipeMatch rm = null;
 if(!cast.isEmpty()) {
  rm = RecipeMatch.ofNBT(cast);
 }
 registerBasinCasting(new CastingRecipe(output, rm, fluid, amount));
}
origin: SlimeKnights/TinkersConstruct

public boolean matches(ItemStack stack) {
 return input.matches(ListUtil.getListFrom(stack)).isPresent();
}
origin: SlimeKnights/TinkersConstruct

/** Registers this block with all its metadatas to melt into amount of the given fluid. */
public static void registerMelting(Block block, Fluid fluid, int amount) {
 ItemStack stack = new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE);
 registerMelting(new MeltingRecipe(new RecipeMatch.Item(stack, 1, amount), fluid));
}
origin: SlimeKnights/TinkersConstruct

public static void registerMelting(String oredict, Fluid fluid, int amount) {
 registerMelting(new MeltingRecipe(new RecipeMatch.Oredict(oredict, 1, amount), fluid));
}
origin: SlimeKnights/TinkersConstruct

@Override
public List<List<ItemStack>> getItems() {
 ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
 for(RecipeMatch rm : items) {
  List<ItemStack> in = rm.getInputs();
  if(!in.isEmpty()) {
   builder.add(in);
  }
 }
 return builder.build();
}
origin: SlimeKnights/TinkersConstruct

public void setText(List<String> text, List<String> tooltips) {
 // convert \n in localized text to actual newlines
 if(text != null) {
  text = Lists.newArrayList(text);
  for(int i = 0; i < text.size(); i++) {
   text.set(i, LocUtils.convertNewlines(text.get(i)));
  }
 }
 this.text = text;
 updateSliderParameters();
 setTooltips(tooltips);
}
origin: SlimeKnights/TinkersConstruct

@Override
public boolean matches(ItemStack cast, Fluid fluid) {
 if((cast.isEmpty() && this.cast == null) || (this.cast != null && this.cast.matches(ListUtil.getListFrom(cast)).isPresent())) {
  return this.fluid.getFluid() == fluid;
 }
 return false;
}
origin: SlimeKnights/TinkersConstruct

 public static List<MeltingRecipe> getSmeltingRecipes() {
  List<MeltingRecipe> recipes = new ArrayList<>();

  for(MeltingRecipe recipe : TinkerRegistry.getAllMeltingRecipies()) {
   if(recipe.output != null && recipe.input != null && recipe.input.getInputs() != null && recipe.input.getInputs().size() > 0) {
    recipes.add(recipe);
   }
  }

  return recipes;
 }
}
origin: SlimeKnights/TinkersConstruct

 public static List<DryingRecipe> getDryingRecipes() {
  List<DryingRecipe> recipes = new ArrayList<>();

  for(DryingRecipe recipe : TinkerRegistry.getAllDryingRecipes()) {
   if(recipe.output != null && recipe.input != null && recipe.input.getInputs() != null && recipe.input.getInputs().size() > 0) {
    recipes.add(recipe);
   }
  }

  return recipes;
 }
}
origin: SlimeKnights/TinkersConstruct

public DryingRecipeWrapper(DryingRecipe recipe) {
 this.input = ImmutableList.of(recipe.input.getInputs());
 this.output = ImmutableList.of(recipe.getResult());
 this.time = recipe.getTime();
}
origin: SlimeKnights/TinkersConstruct

public CastingRecipeWrapper(CastingRecipe recipe, IDrawable castingBlock) {
 // cast is not required
 if(recipe.cast != null) {
  cast = recipe.cast.getInputs();
 }
 else {
  cast = ImmutableList.of();
 }
 this.inputFluid = ImmutableList.of(recipe.getFluid());
 this.recipe = recipe;
 this.output = ImmutableList.of(recipe.getResult());
 this.castingBlock = castingBlock;
}
slimeknights.mantle.util

Most used classes

  • RecipeMatch
    Utility class that allows to find a specific subset of items in a list of itemstacks. Matches can be
  • LocUtils
  • RecipeMatch$ItemCombination
    A combination of multiple items. NBT SENSITIVE!
  • ItemStackList
  • RecipeMatch$Item
    A specific amount of a certain item is needed. Supports wildcard-metadata. Not NBT sensitive.
  • RecipeMatch$Oredict,
  • RecipeMatchRegistry,
  • ImmutableConcatList$ListItr,
  • ImmutableConcatList,
  • SlimeknightException,
  • TradeGeneric
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