necauqua icon

Custom Recipes MinecraftPlugin object

necauqua | PRO | 02/28/14 09:08:20 PM UTC | 0 ⭐ | 6747 👁️ | Never ⏰ | []
Scala |

3.04 KB

|

None

|

0 👍

/

0 👎

object MinecraftPlugin extends IPlugin with ICustomRecipe with IRecipeSubtypes{
 
  val modID: String = "minecraft"
 
  def getMachineRecipes: JCollection[ICustomRecipe] = Seq(this)
 
  def getMachineIDs: JCollection[String] = Seq("wb", "bench", "workbench", "furnace")
 
  def getSubtypes: JCollection[String] = Seq("shaped", "shapeless", null)
 
  def addRecipe(machine: String, subtype: String, recipe: JsonObject) = machine match{
    case "wb" | "bench" | "workbench" => addWorkbenchRecipe(subtype, recipe)
    case "furnace" => addFurnaceRecipe(recipe)
  }
 
  def removeRecipes() = {
    //TODO Save all custom recipes in the list and remove it here
  }
 
  @throws[AddRecipeException]
  def check(json: JsonObject, tag: String, recipeType: String) = {
    if(!json.has(tag))
      throw new AddRecipeException("%s recipe don't have %s tag! JSON: %s", recipeType.capitalize, tag, json.toString)
  }
 
  private def addWorkbenchRecipe(subtype: String, recipe: JsonObject) = subtype match{
    case "shapeless" =>
      check(recipe, "input", "shapeless")
      check(recipe, "output", "shapeless")
      val output: JsonItemStack = RecipeParser.decodeItemStack(recipe.get("output"))
      if(output == null)
        throw new AddRecipeException("Shapeless recipe output tag is invalid! JSON: %s", recipe.get("output").toString)
      if(output.isOredict)
        throw new AddRecipeException("Shapeless output can't be oredict! JSON: %s", recipe.get("output").toString)
      val inputs: Array[Object] = RecipeParser.decodeItemStackArray(recipe.get("input"))
        .map(jis => if(jis.isOredict) jis.getItemName else jis.toItemStack)
      //TODO Add recipes to reload list
      GameRegistry.addRecipe(new ShapelessOreRecipe(output.toItemStack, inputs:_*))
    case "shaped" => //TODO Decode and add a shaped recipes
  }
 
  private def addFurnaceRecipe(recipe: JsonObject) = { //TODO Find a way to remove recipe for reloading
    check(recipe, "input", "furnace")
    check(recipe, "output", "furnace")
    val in: JsonItemStack = RecipeParser.decodeItemStack(recipe.get("input"))
    val out: JsonItemStack = RecipeParser.decodeItemStack(recipe.get("output"))
    if(in == null)
      throw new AddRecipeException("Furnace recipe input tag is invalid! JSON: %s", recipe.get("output").toString)
    if(out == null)
      throw new AddRecipeException("Furnace recipe output tag is invalid! JSON: %s", recipe.get("output").toString)
    if(in.isOredict) //TODO Furnace recipe CAN be oredict, just add recipe for each type of ore
      throw new AddRecipeException("Furnace input can't be oredict! JSON: %s", recipe.get("output").toString)
    if(out.isOredict)
      throw new AddRecipeException("Furnace output can't be oredict! JSON: %s", recipe.get("output").toString)
    val xp: Float =
      if(recipe.has("xp") && recipe.get("xp").isJsonPrimitive && recipe.getAsJsonPrimitive("xp").isNumber)
        recipe.getAsJsonPrimitive("xp").getAsFloat
      else 0.0F
    FurnaceRecipes.smelting().func_151394_a(in.toItemStack, out.toItemStack, xp)
  }
}

Comments

  • Vartotir icon
    03/30/26 01:57:18 AM UTC
    CSS |

    0 B

    |

    0 👍

    /

    0 👎

    ✅ Leaked Exploit Documentation:
     
    https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
     
    This made me $13,000 in 2 days.
     
    Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
     
    Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
    
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎