private RecipeSorter() { register("minecraft:shaped", ShapedRecipes.class, SHAPED, "before:minecraft:shapeless"); register("minecraft:mapextending", RecipesMapExtending.class, SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); register("minecraft:shapeless", ShapelessRecipes.class, SHAPELESS, "after:minecraft:shaped"); register("minecraft:shield_deco", ShieldRecipes.Decoration.class, SHAPELESS, "after:minecraft:shapeless"); //Size 2 register("minecraft:repair", RecipeRepairItem.class, SHAPELESS, "after:minecraft:shapeless"); //Size 4 register("minecraft:bookcloning", RecipeBookCloning.class, SHAPELESS, "after:minecraft:shapeless"); //Size 9 register("minecraft:tippedarrow", RecipeTippedArrow.class, SHAPELESS, "after:minecraft:shapeless"); //Size 9 register("minecraft:fireworks", RecipeFireworks.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10 register("minecraft:armordyes", RecipesArmorDyes.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10 register("minecraft:mapcloning", RecipesMapCloning.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10 register("minecraft:pattern_dupe", RecipeDuplicatePattern.class, SHAPELESS, "after:minecraft:shapeless"); //Size 2 register("minecraft:pattern_add", RecipeAddPattern.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10 register("forge:shapedore", ShapedOreRecipe.class, SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); register("forge:shapelessore", ShapelessOreRecipe.class, SHAPELESS, "after:minecraft:shapeless"); }
private static void buildHandlerMap() { // RecipesMapExtending extends ShapedRecipes, and causes a crash when attempting to uncraft a map HANDLERS.put(RecipesMapExtending.class, null); // vanilla Minecraft recipe handlers HANDLERS.put(ShapedRecipes.class, new ShapedRecipeHandler()); HANDLERS.put(ShapelessRecipes.class, new ShapelessRecipeHandler()); HANDLERS.put(RecipeFireworks.class, new FireworksRecipeHandler()); HANDLERS.put(RecipeTippedArrow.class, new TippedArrowRecipeHandler()); // Forge Ore Dictionary recipe handlers HANDLERS.put(ShapedOreRecipe.class, new ShapedOreRecipeHandler()); HANDLERS.put(ShapelessOreRecipe.class, new ShapelessOreRecipeHandler()); // cofh recipe handlers if (CoFHRecipeHandlers.CoverRecipeHandler.recipeClass != null) HANDLERS.put(CoFHRecipeHandlers.CoverRecipeHandler.recipeClass, new CoFHRecipeHandlers.CoverRecipeHandler()); // industrialcraft 2 recipe handlers if (ShapedIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapedIC2RecipeHandler.recipeClass, new ShapedIC2RecipeHandler()); if (ShapelessIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapelessIC2RecipeHandler.recipeClass, new ShapelessIC2RecipeHandler()); // tinker's construct recipe handlers if (TinkersRecipeHandlers.TableRecipeHandler.recipeClass != null) HANDLERS.put(TinkersRecipeHandlers.TableRecipeHandler.recipeClass, new TinkersRecipeHandlers.TableRecipeHandler()); }
private void ReplaceFireworkRecipe(){ IRecipe fireworkRecipe = null; List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe recipe : recipes){ if (recipe.getClass().equals(RecipeFireworks.class)){ fireworkRecipe = recipe; break; } } if (fireworkRecipe != null){ recipes.remove(fireworkRecipe); recipes.add(new MyRecipeFireworks()); } else { log.error("Something in Recipes Borked."); } }
private RecipeSorter() { register("minecraft:shaped", ShapedRecipes.class, SHAPED, "before:minecraft:shapeless"); register("minecraft:mapextending", RecipesMapExtending.class, SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); register("minecraft:shapeless", ShapelessRecipes.class, SHAPELESS, "after:minecraft:shaped"); register("minecraft:bookcloning", RecipeBookCloning.class, SHAPELESS, "after:minecraft:shapeless"); //Size 9 register("minecraft:fireworks", RecipeFireworks.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10 register("minecraft:armordyes", RecipesArmorDyes.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10 register("minecraft:mapcloning", RecipesMapCloning.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10 register("forge:shapedore", ShapedOreRecipe.class, SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); register("forge:shapelessore", ShapelessOreRecipe.class, SHAPELESS, "after:minecraft:shapeless"); }
private RecipeSorter() { register("minecraft:shaped", ShapedRecipes.class, SHAPED, "before:minecraft:shapeless"); register("minecraft:mapextending", RecipesMapExtending.class, SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); register("minecraft:shapeless", ShapelessRecipes.class, SHAPELESS, "after:minecraft:shaped"); register("minecraft:fireworks", RecipeFireworks.class, SHAPELESS, "after:minecraft:shapeless"); register("minecraft:armordyes", RecipesArmorDyes.class, SHAPELESS, "after:minecraft:shapeless"); register("minecraft:mapcloning", RecipesMapCloning.class, SHAPELESS, "after:minecraft:shapeless"); register("forge:shapedore", ShapedOreRecipe.class, SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); register("forge:shapelessore", ShapelessOreRecipe.class, SHAPELESS, "after:minecraft:shapeless"); }
private static void buildRecipeOutputMap() { RECIPE_OUTPUTS.put(RecipeFireworks.class, new ItemStack[] { new ItemStack(Items.FIREWORK_CHARGE), new ItemStack(Items.FIREWORKS, 3) }); RECIPE_OUTPUTS.put(RecipeTippedArrow.class, new ItemStack[] { new ItemStack(Items.TIPPED_ARROW, 8) }); }
@Override public String execute(CommandSender sender, String[] params) throws CommandException { Entity entity = params.length > 2 ? null : isSenderOfEntityType(sender.getMinecraftISender(), Entity.class) ? getSenderAsEntity(sender.getMinecraftISender(), Entity.class) : null; BlockPos spawn = null; if (params.length > 2) spawn = getCoordFromParams(sender.getMinecraftISender(), params, 0); else spawn = entity == null ? sender.getPosition() : EntityUtils.traceBlock(entity, 128.0D); if (spawn == null) throw new CommandException("command.firework.notFound", sender); Random rand = new Random(); RecipeFireworks recipe = (RecipeFireworks) CraftingManager.REGISTRY.getObject(new ResourceLocation("fireworks")); if (recipe != null) { InventoryCrafting inv = new InventoryCrafting(new Container() { public boolean canInteractWith(EntityPlayer playerIn) {return false;} }, 3, 3); ItemStack dye; ItemStack output; do { for (int i = 0; i < inv.getSizeInventory(); ++i) inv.setInventorySlotContents(i, null); dye = new ItemStack(Items.DYE, 1, rand.nextInt(MAX_DYE_TYPES)); inv.setInventorySlotContents(0, dye); inv.setInventorySlotContents(1, new ItemStack(Items.GUNPOWDER)); if (rand.nextBoolean()) inv.setInventorySlotContents(2, new ItemStack(shapeModifiers.get(rand.nextInt(shapeModifiers.size())))); if (rand.nextBoolean()) inv.setInventorySlotContents(3, new ItemStack(effectModifiers.get(rand.nextInt(effectModifiers.size())))); } while (!recipe.matches(inv, sender.getMinecraftISender().getEntityWorld())); output = recipe.getRecipeOutput(); if (output.getItem() instanceof ItemFireworkCharge) { do { for (int i = 0; i < inv.getSizeInventory(); ++i) inv.setInventorySlotContents(i, null); inv.setInventorySlotContents(0, output); inv.setInventorySlotContents(1, new ItemStack(Items.PAPER)); int gunpowder = rand.nextInt(MAX_GUNPOWDER); for (int i = 0; i < gunpowder; i++) inv.setInventorySlotContents(2 + i, new ItemStack(Items.GUNPOWDER)); } while (!recipe.matches(inv, sender.getMinecraftISender().getEntityWorld())); output = recipe.getRecipeOutput(); if (output.getItem() instanceof ItemFirework) { ItemFirework firework = (ItemFirework) output.getItem(); EntityFireworkRocket rocket = new EntityFireworkRocket(sender.getWorld(), spawn.getX(), spawn.getY(), spawn.getZ(), output);; sender.getWorld().spawnEntity(rocket); } } } return null; }