necauqua

Custom Recipes MinecraftPlugin object

Feb 28th, 2014
7,137
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 3.04 KB | None | 0 0
  1. object MinecraftPlugin extends IPlugin with ICustomRecipe with IRecipeSubtypes{
  2.  
  3.   val modID: String = "minecraft"
  4.  
  5.   def getMachineRecipes: JCollection[ICustomRecipe] = Seq(this)
  6.  
  7.   def getMachineIDs: JCollection[String] = Seq("wb", "bench", "workbench", "furnace")
  8.  
  9.   def getSubtypes: JCollection[String] = Seq("shaped", "shapeless", null)
  10.  
  11.   def addRecipe(machine: String, subtype: String, recipe: JsonObject) = machine match{
  12.     case "wb" | "bench" | "workbench" => addWorkbenchRecipe(subtype, recipe)
  13.     case "furnace" => addFurnaceRecipe(recipe)
  14.   }
  15.  
  16.   def removeRecipes() = {
  17.     //TODO Save all custom recipes in the list and remove it here
  18.   }
  19.  
  20.   @throws[AddRecipeException]
  21.   def check(json: JsonObject, tag: String, recipeType: String) = {
  22.     if(!json.has(tag))
  23.       throw new AddRecipeException("%s recipe don't have %s tag! JSON: %s", recipeType.capitalize, tag, json.toString)
  24.   }
  25.  
  26.   private def addWorkbenchRecipe(subtype: String, recipe: JsonObject) = subtype match{
  27.     case "shapeless" =>
  28.       check(recipe, "input", "shapeless")
  29.       check(recipe, "output", "shapeless")
  30.       val output: JsonItemStack = RecipeParser.decodeItemStack(recipe.get("output"))
  31.       if(output == null)
  32.         throw new AddRecipeException("Shapeless recipe output tag is invalid! JSON: %s", recipe.get("output").toString)
  33.       if(output.isOredict)
  34.         throw new AddRecipeException("Shapeless output can't be oredict! JSON: %s", recipe.get("output").toString)
  35.       val inputs: Array[Object] = RecipeParser.decodeItemStackArray(recipe.get("input"))
  36.         .map(jis => if(jis.isOredict) jis.getItemName else jis.toItemStack)
  37.       //TODO Add recipes to reload list
  38.       GameRegistry.addRecipe(new ShapelessOreRecipe(output.toItemStack, inputs:_*))
  39.     case "shaped" => //TODO Decode and add a shaped recipes
  40.   }
  41.  
  42.   private def addFurnaceRecipe(recipe: JsonObject) = { //TODO Find a way to remove recipe for reloading
  43.     check(recipe, "input", "furnace")
  44.     check(recipe, "output", "furnace")
  45.     val in: JsonItemStack = RecipeParser.decodeItemStack(recipe.get("input"))
  46.     val out: JsonItemStack = RecipeParser.decodeItemStack(recipe.get("output"))
  47.     if(in == null)
  48.       throw new AddRecipeException("Furnace recipe input tag is invalid! JSON: %s", recipe.get("output").toString)
  49.     if(out == null)
  50.       throw new AddRecipeException("Furnace recipe output tag is invalid! JSON: %s", recipe.get("output").toString)
  51.     if(in.isOredict) //TODO Furnace recipe CAN be oredict, just add recipe for each type of ore
  52.       throw new AddRecipeException("Furnace input can't be oredict! JSON: %s", recipe.get("output").toString)
  53.     if(out.isOredict)
  54.       throw new AddRecipeException("Furnace output can't be oredict! JSON: %s", recipe.get("output").toString)
  55.     val xp: Float =
  56.       if(recipe.has("xp") && recipe.get("xp").isJsonPrimitive && recipe.getAsJsonPrimitive("xp").isNumber)
  57.         recipe.getAsJsonPrimitive("xp").getAsFloat
  58.       else 0.0F
  59.     FurnaceRecipes.smelting().func_151394_a(in.toItemStack, out.toItemStack, xp)
  60.   }
  61. }
Advertisement
Comments
  • Vartotir
    222 days
    # CSS 0.85 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. 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.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. 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).
  • User was banned
Add Comment
Please, Sign In to add comment