@Override
 public void mirror(IOreDictEntry other) {
   if (other instanceof MCOreDictEntry) {
     MineTweakerAPI.apply(new ActionMirror(id, ((MCOreDictEntry) other).id));
   } else {
     MineTweakerAPI.logError("not a valid oredict entry");
   }
 }
 @Override
 public void addAll(IOreDictEntry entry) {
   if (entry instanceof MCOreDictEntry) {
     MineTweakerAPI.apply(new ActionAddAll(id, ((MCOreDictEntry) entry).id));
   } else {
     MineTweakerAPI.logError("not a valid entry");
   }
 }
Exemple #3
0
 // Adding a new cooking recipe for the iron plate
 @ZenMethod
 public static void addRecipe(
     IItemStack output, IItemStack input, int cookingTime, boolean isOvenRecipe) {
   if ((output == null) || (input == null)) {
     MineTweakerAPI.getLogger().logError("Iron Plate: Neither input nor output may be null!");
     return;
   }
   MineTweakerAPI.apply(new Add(new PlateRecipeWrapper(output, input, cookingTime, isOvenRecipe)));
 }
 /**
  * Adds an implosion compressor recipe with one or two outputs.
  *
  * @param output array with 1-2 outputs
  * @param input primary input
  * @param tnt amount of TNT needed
  */
 @ZenMethod
 public static void addRecipe(IItemStack[] output, IItemStack input, int tnt) {
   if (output.length == 0) {
     MineTweakerAPI.logError("Implosion compressor recipe requires at least 1 output");
   } else {
     MineTweakerAPI.apply(
         new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input, tnt));
   }
 }
Exemple #5
0
 // Add a heat source
 @ZenMethod
 public static void registerHeatSource(IItemStack block) {
   if (block == null) {
     MineTweakerAPI.getLogger().logError("Iron Plate: Heat source block must not be null!");
     return;
   }
   if (!isABlock(toStack(block))) {
     MineTweakerAPI.getLogger()
         .logError(
             "Heat source for Cooking Iron Plate must be a block: "
                 + toStack(block).getDisplayName());
     return;
   }
   MineTweakerAPI.apply(new PlateBlockAddition(block));
 }
 @Override
 public void add(IItemStack item) {
   ItemStack stack = getItemStack(item);
   if (stack != null) {
     MineTweakerAPI.apply(new ActionAddItem(id, stack));
   }
 }
Exemple #7
0
 private void logProcessorRecipes() {
   for (IProcessorRecipe recipe : RecipeRegisterManager.processorRecipe.getRecipes()) {
     String o = "mods.amt.Processor.addRecipe(" + getItemDeclaration(recipe.getOutput());
     float sec = recipe.getChance();
     boolean ret = recipe.forceReturnContainer();
     if ((recipe.getSecondary() != null) | (sec != 0) | ret) {
       o += ", " + getItemDeclaration(recipe.getSecondary());
     }
     o += ", [";
     boolean first = true;
     for (Object x : recipe.getInput()) {
       if (!first) {
         o += ", ";
       } else {
         first = false;
       }
       o += getObjectDeclaration(x);
     }
     o += "], ";
     if (recipe.isFoodRecipe()) {
       o += "true";
     } else {
       o += "false";
     }
     if ((sec != 0) | ret) {
       o += ", " + sec;
     }
     if (ret) {
       o += ", true";
     }
     MineTweakerAPI.logCommand(o + ");");
   }
 }
 @Override
 public IItemStack withDamage(int damage) {
   if (stack.getItem().getHasSubtypes()) {
     MineTweakerAPI.logWarning("subitems don't have damaged states");
     return this;
   } else {
     ItemStack result = new ItemStack(stack.getItem(), stack.getCount(), damage);
     result.setTagCompound(stack.getTagCompound());
     return new MCItemStack(result, tag);
   }
 }
 @Override
 public IIngredient anyDamage() {
   if (stack.getItem().getHasSubtypes()) {
     MineTweakerAPI.logWarning("subitems don't have damaged states");
     return this;
   } else {
     ItemStack result =
         new ItemStack(stack.getItem(), stack.getCount(), OreDictionary.WILDCARD_VALUE);
     result.setTagCompound(stack.getTagCompound());
     return new MCItemStack(result, tag);
   }
 }
Exemple #10
0
 private void logBarrelRecipes(IPlayer player) {
   for (Map.Entry<Fluid, Fluid> entry : BrewingRecipe.instance.recipeMap().entrySet()) {
     if (player != null)
       player.sendChat(
           getItemDeclaration(entry.getKey()) + " ---> " + getItemDeclaration(entry.getValue()));
     MineTweakerAPI.logCommand(
         "mods.amt.Pan.addChocolateRecipe("
             + getItemDeclaration(entry.getValue())
             + ", "
             + getItemDeclaration(entry.getKey())
             + ");");
   }
 }
Exemple #11
0
 private void logIceRecipes() {
   for (IIceRecipe recipe : RecipeRegisterManager.iceRecipe.getRecipeList()) {
     String output =
         "mods.amt.IceMaker.addRecipe("
             + getItemDeclaration(recipe.getOutput())
             + ", "
             + getItemDeclaration(recipe.getInput());
     ItemStack container = recipe.getContainer();
     if (container != null) output += ", " + getItemDeclaration(container);
     output += ");";
     MineTweakerAPI.logCommand(output);
   }
 }
Exemple #12
0
 private void logChocolateRecipes(IPlayer player) {
   for (Map.Entry<Object, ItemStack> entry :
       RecipeRegisterManager.chocoRecipe.getRecipeList().entrySet()) {
     String input = getObjectDeclaration(entry.getKey());
     if (player != null) player.sendChat(input + " ---> " + getItemDeclaration(entry.getValue()));
     MineTweakerAPI.logCommand(
         "mods.amt.Pan.addChocolateRecipe("
             + getItemDeclaration(entry.getValue())
             + ", "
             + input
             + ");");
   }
 }
Exemple #13
0
 private void logTeaRecipes() {
   for (ITeaRecipe recipe : RecipeRegisterManager.teaRecipe.getRecipeList()) {
     String o = "mods.amt.Processor.addRecipe(" + getItemDeclaration(recipe.getOutput());
     ItemStack milk = recipe.getOutputMilk();
     if (milk != null) {
       o += ", " + getItemDeclaration(milk);
     }
     o += ", " + getItemDeclaration(recipe.getInput()) + ", \"" + recipe.getTex() + "\"";
     if ((milk != null) && (recipe.getTex() != recipe.getMilkTex())) {
       o += ", \"" + recipe.getMilkTex() + "\"";
     }
     MineTweakerAPI.logCommand(o + ");");
   }
 }
  public void addFuelPattern(SetFuelPattern pattern) {
    List<IItemStack> items = pattern.getPattern().getItems();
    if (items == null) {
      MineTweakerAPI.logError("Cannot set fuel for <*>");
      return;
    }

    for (IItemStack item : pattern.getPattern().getItems()) {
      if (!quickList.containsKey(item.getName())) {
        quickList.put(item.getName(), new ArrayList<SetFuelPattern>());
      }
      quickList.get(item.getName()).add(pattern);
    }
  }
  @Override
  public void remove(IItemStack item) {
    ItemStack result = null;
    for (ItemStack itemStack : OreDictionary.getOres(id)) {
      if (item.matches(getIItemStackWildcardSize(itemStack))) {
        result = itemStack;
        break;
      }
    }

    if (result != null) {
      MineTweakerAPI.apply(new ActionRemoveItem(id, result));
    }
  }
Exemple #16
0
 private void logEvaporatorRecipes() {
   for (IEvaporatorRecipe recipe : RecipeRegisterManager.evaporatorRecipe.getRecipeList()) {
     ItemStack input = recipe.getInput();
     ItemStack output = recipe.getOutput();
     FluidStack secondary = recipe.getSecondary();
     String o = "mods.amt.Evaporator.addRecipe(";
     if (output != null) o += getItemDeclaration(output) + ", ";
     if (secondary != null) o += getItemDeclaration(secondary) + ", ";
     o += getItemDeclaration(input);
     if (!recipe.returnContainer()) o += ", false";
     o += ");";
     MineTweakerAPI.logCommand(o);
   }
 }
Exemple #17
0
    // Loops through the registry, to find the item that matches, saves that recipe then removes it
    @Override
    public void apply() {
      for (IPlateRecipe r : RecipeRegisterManager.plateRecipe.getRecipeList()) {
        if (r.getOutput() != null && areEqual(r.getOutput(), stack)) {
          recipe = r;
          break;
        }
      }

      if (recipe == null) {
        MineTweakerAPI.getLogger()
            .logWarning("No Cooking Iron Plate recipe for " + getRecipeInfo() + " found.");
      } else {
        list.remove(recipe);
      }
    }
Exemple #18
0
 private void logPanRecipes() {
   for (IPanRecipe recipe : RecipeRegisterManager.panRecipe.getRecipeList()) {
     ItemStack jpoutput = recipe.getOutputJP();
     String o = "mods.amt.Pan.addRecipe(" + getItemDeclaration(recipe.getOutput());
     if (jpoutput != null) {
       o += ", " + getItemDeclaration(jpoutput);
     }
     o +=
         ", "
             + getItemDeclaration(recipe.getInput())
             + ", \""
             + recipe.getTex()
             + "\", \""
             + recipe.getDisplayName()
             + "\");";
     MineTweakerAPI.logCommand(o);
   }
 }
Exemple #19
0
 private void logPlateRecipes() {
   for (IPlateRecipe recipe : RecipeRegisterManager.plateRecipe.getRecipeList()) {
     String o =
         "mods.amt.Plate.addRecipe("
             + getItemDeclaration(recipe.getOutput())
             + ", "
             + getItemDeclaration(recipe.getInput())
             + ", "
             + recipe.cookingTime()
             + ", ";
     if (recipe.useOvenRecipe()) {
       o += "true";
     } else {
       o += "false";
     }
     MineTweakerAPI.logCommand(o + ");");
   }
 }
Exemple #20
0
 @Override
 public void apply() {
   Map<Block, IFactoryFruit> fruits = MFRRegistry.getFruits();
   for (IBlock partial : fruit.block.getBlocks()) {
     Block block = ((MCBlockDefinition) partial.getDefinition()).getInternalBlock();
     if (fruits != null && fruits.containsKey(block)) {
       IFactoryFruit existingFruit = fruits.get(block);
       if (existingFruit instanceof TweakerFruitPartial) {
         TweakerFruitPartial existingFruitPartial = (TweakerFruitPartial) existingFruit;
         if (!existingFruitPartial.fruits.contains(fruit)) {
           existingFruitPartial.fruits.add(fruit);
         }
       } else {
         MineTweakerAPI.logError("A non-MineTweaker fruit already exists for this ID");
       }
     } else {
       TweakerFruitPartial factoryFruit = new TweakerFruitPartial(block);
       MFRRegistry.registerFruit(factoryFruit);
     }
   }
 }
Exemple #21
0
 @ZenMethod
 public static void addFruit(IBlockPattern block, IBlock replacement, WeightedItemStack[] drops) {
   TweakerFruit fruit = new TweakerFruit(block, replacement, drops);
   MineTweakerAPI.apply(new AddFruitAction(fruit));
 }
 @Override
 public void setMaxDamage(int damage) {
   MineTweakerAPI.apply(new SetStackmaxDamageAction(stack, damage));
 }
 @Override
 public void setBlockHardness(float hardness) {
   MineTweakerAPI.apply(new SetBlockHardnessAction(stack, hardness));
 }
 /**
  * Adds an implosion compressor recipe with a single output.
  *
  * @param output recipe output
  * @param input primary input
  * @param tnt amount of TNT needed
  */
 @ZenMethod
 public static void addRecipe(IItemStack output, IItemStack input, int tnt) {
   MineTweakerAPI.apply(new AddRecipeAction(output, null, input, tnt));
 }
Exemple #25
0
 @ZenMethod
 public static void removeLog(IBlockPattern block) {
   MineTweakerAPI.apply(new RemoveLogAction(block));
 }
Exemple #26
0
 private void logBoth(IPlayer player, String s) {
   MineTweakerAPI.logCommand(s);
   if (player != null) player.sendChat(s);
 }
 public GasBracketHandler() {
   symbolAny = MineTweakerAPI.getJavaStaticFieldSymbol(IngredientAny.class, "INSTANCE");
   method = MineTweakerAPI.getJavaMethod(GasBracketHandler.class, "getGas", String.class);
 }
 @Override
 public void setDisplayName(String name) {
   MineTweakerAPI.apply(new SetTranslationAction(getName() + ".name", name));
 }
 @Override
 public void setMaxStackSize(int size) {
   MineTweakerAPI.apply(new SetStackSizeAction((ItemStack) getInternal(), size));
 }
Exemple #30
0
 @Override
 public void execute(String[] arguments, IPlayer player) {
   if (arguments.length > 0) {
     if (arguments[0].equalsIgnoreCase("charge")) {
       logBoth(player, "Battery:");
       for (IChargeItem i : ChargeItemManager.chargeItem.getChargeItemList()) {
         String s = getItemDeclaration(i.getItem());
         if (i.returnItem() != null) {
           s += " --> " + getItemDeclaration(i.returnItem());
         }
         s += " --- " + i.getItem().getDisplayName() + " (" + i.chargeAmount() + ")";
         logBoth(player, s);
       }
       logBoth(player, "Ice Maker:");
       for (IChargeIce i : RecipeRegisterManager.iceRecipe.getChargeItemList()) {
         logBoth(
             player,
             getItemDeclaration(i.getItem())
                 + " --- "
                 + i.getItem().getDisplayName()
                 + " ("
                 + i.chargeAmount()
                 + ")");
       }
     } else if (arguments[0].equalsIgnoreCase("choco")) {
       logBoth(player, "Chocolate Recipes:");
       logChocolateRecipes(player);
       /*
       for (Map.Entry<Object, ItemStack> entry: RecipeRegisterManager.chocoRecipe.getRecipeList().entrySet()) {
           String input = "";
           if (entry.getKey() instanceof String) {
               input = "<ore:" + (String) entry.getKey() + ">";
           } else {
               input = getItemDeclaration((ItemStack) entry.getKey());
           }
           player.sendChat(input + " ---> " + getItemDeclaration(entry.getValue()));
           MineTweakerAPI.logCommand("mods.amt.Pan.addChocolateRecipe(" + getItemDeclaration(entry.getValue()) + ", " + input + ");");
       }
       */
     } else if (arguments[0].equalsIgnoreCase("heat")) {
       logBoth(player, "Pan:");
       for (ItemStack i : RecipeRegisterManager.panRecipe.getHeatSourceList()) {
         logBoth(player, getItemDeclaration(i) + " -- " + i.getDisplayName());
       }
       logBoth(player, "Plate:");
       for (ItemStack i : RecipeRegisterManager.plateRecipe.getHeatSourceList()) {
         logBoth(player, getItemDeclaration(i) + " -- " + i.getDisplayName());
       }
     } else if (arguments[0].equalsIgnoreCase("recipes")) {
       MineTweakerAPI.logCommand("Barrel brewing recipes:");
       logBarrelRecipes(null);
       MineTweakerAPI.logCommand("Chocolate fondue recipes:");
       logChocolateRecipes(null);
       MineTweakerAPI.logCommand("Evaporator recipes:");
       logEvaporatorRecipes();
       MineTweakerAPI.logCommand("Ice Maker recipes:");
       logIceRecipes();
       MineTweakerAPI.logCommand("Pan recipes:");
       logPanRecipes();
       MineTweakerAPI.logCommand("Plate recipes:");
       logPlateRecipes();
       MineTweakerAPI.logCommand("Processor recipes:");
       logProcessorRecipes();
       MineTweakerAPI.logCommand("Teamaker recipes:");
       logTeaRecipes();
       player.sendChat("AMT recipes have been written to the MineTweaker log.");
     } else if (arguments[0].equalsIgnoreCase("slag")) {
       for (int l = 1; l <= 5; l++) {
         logBoth(player, "Tier " + l + ":");
         for (ItemStack i : RecipeRegisterManager.slagLoot.getLootList(l)) {
           logBoth(player, getItemDeclaration(i) + " -- " + i.getDisplayName());
         }
       }
     } else {
       player.sendChat("Unknown subcommand: " + arguments[0]);
     }
   } else {
     player.sendChat("Please use a subcommand.");
   }
 }