From 9b9a54ce4c1b471bdbc79e03a39829e7a7a6142f Mon Sep 17 00:00:00 2001 From: Techlone Date: Thu, 11 Feb 2016 21:33:16 +0500 Subject: [PATCH 01/12] The same structure of folders with MineTweaker --- .../java/gttweaker/mods/gregtech/{ => machines}/AlloySmelter.java | 0 .../gttweaker/mods/gregtech/{ => machines}/Amplifabricator.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/ArcFurnace.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Assembler.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Autoclave.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Blastfurnace.java | 0 src/main/java/gttweaker/mods/gregtech/{ => machines}/Brewery.java | 0 src/main/java/gttweaker/mods/gregtech/{ => machines}/Canner.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Centrifuge.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/ChemicalBath.java | 0 .../gttweaker/mods/gregtech/{ => machines}/ChemicalReactor.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/CuttingSaw.java | 0 .../gttweaker/mods/gregtech/{ => machines}/DistillationTower.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Distillery.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Electrolyzer.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Extruder.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Fermenter.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/FluidCanner.java | 0 .../gttweaker/mods/gregtech/{ => machines}/FluidExtractor.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/FluidHeater.java | 0 .../gttweaker/mods/gregtech/{ => machines}/FluidSolidifier.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/ForgeHammer.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/FormingPress.java | 0 src/main/java/gttweaker/mods/gregtech/{ => machines}/Fuels.java | 0 .../gttweaker/mods/gregtech/{ => machines}/FusionReactor.java | 0 .../mods/gregtech/{ => machines}/ImplosionCompressor.java | 0 src/main/java/gttweaker/mods/gregtech/{ => machines}/Lathe.java | 0 src/main/java/gttweaker/mods/gregtech/{ => machines}/Mixer.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/OilCracker.java | 0 src/main/java/gttweaker/mods/gregtech/{ => machines}/Packer.java | 0 .../gttweaker/mods/gregtech/{ => machines}/PlasmaArcFurnace.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/PlateBender.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Polarizer.java | 0 .../gttweaker/mods/gregtech/{ => machines}/PrecisionLaser.java | 0 src/main/java/gttweaker/mods/gregtech/{ => machines}/Printer.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Pulverizer.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/PyrolyseOven.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Separator.java | 0 src/main/java/gttweaker/mods/gregtech/{ => machines}/Sifter.java | 0 src/main/java/gttweaker/mods/gregtech/{ => machines}/Slicer.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Unpacker.java | 0 .../gttweaker/mods/gregtech/{ => machines}/VacuumFreezer.java | 0 .../java/gttweaker/mods/gregtech/{ => machines}/Wiremill.java | 0 43 files changed, 0 insertions(+), 0 deletions(-) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/AlloySmelter.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Amplifabricator.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/ArcFurnace.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Assembler.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Autoclave.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Blastfurnace.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Brewery.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Canner.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Centrifuge.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/ChemicalBath.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/ChemicalReactor.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/CuttingSaw.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/DistillationTower.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Distillery.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Electrolyzer.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Extruder.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Fermenter.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/FluidCanner.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/FluidExtractor.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/FluidHeater.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/FluidSolidifier.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/ForgeHammer.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/FormingPress.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Fuels.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/FusionReactor.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/ImplosionCompressor.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Lathe.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Mixer.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/OilCracker.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Packer.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/PlasmaArcFurnace.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/PlateBender.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Polarizer.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/PrecisionLaser.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Printer.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Pulverizer.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/PyrolyseOven.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Separator.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Sifter.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Slicer.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Unpacker.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/VacuumFreezer.java (100%) rename src/main/java/gttweaker/mods/gregtech/{ => machines}/Wiremill.java (100%) diff --git a/src/main/java/gttweaker/mods/gregtech/AlloySmelter.java b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/AlloySmelter.java rename to src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java diff --git a/src/main/java/gttweaker/mods/gregtech/Amplifabricator.java b/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Amplifabricator.java rename to src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java diff --git a/src/main/java/gttweaker/mods/gregtech/ArcFurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/ArcFurnace.java rename to src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java diff --git a/src/main/java/gttweaker/mods/gregtech/Assembler.java b/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Assembler.java rename to src/main/java/gttweaker/mods/gregtech/machines/Assembler.java diff --git a/src/main/java/gttweaker/mods/gregtech/Autoclave.java b/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Autoclave.java rename to src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java diff --git a/src/main/java/gttweaker/mods/gregtech/Blastfurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Blastfurnace.java rename to src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java diff --git a/src/main/java/gttweaker/mods/gregtech/Brewery.java b/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Brewery.java rename to src/main/java/gttweaker/mods/gregtech/machines/Brewery.java diff --git a/src/main/java/gttweaker/mods/gregtech/Canner.java b/src/main/java/gttweaker/mods/gregtech/machines/Canner.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Canner.java rename to src/main/java/gttweaker/mods/gregtech/machines/Canner.java diff --git a/src/main/java/gttweaker/mods/gregtech/Centrifuge.java b/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Centrifuge.java rename to src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java diff --git a/src/main/java/gttweaker/mods/gregtech/ChemicalBath.java b/src/main/java/gttweaker/mods/gregtech/machines/ChemicalBath.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/ChemicalBath.java rename to src/main/java/gttweaker/mods/gregtech/machines/ChemicalBath.java diff --git a/src/main/java/gttweaker/mods/gregtech/ChemicalReactor.java b/src/main/java/gttweaker/mods/gregtech/machines/ChemicalReactor.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/ChemicalReactor.java rename to src/main/java/gttweaker/mods/gregtech/machines/ChemicalReactor.java diff --git a/src/main/java/gttweaker/mods/gregtech/CuttingSaw.java b/src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/CuttingSaw.java rename to src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java diff --git a/src/main/java/gttweaker/mods/gregtech/DistillationTower.java b/src/main/java/gttweaker/mods/gregtech/machines/DistillationTower.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/DistillationTower.java rename to src/main/java/gttweaker/mods/gregtech/machines/DistillationTower.java diff --git a/src/main/java/gttweaker/mods/gregtech/Distillery.java b/src/main/java/gttweaker/mods/gregtech/machines/Distillery.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Distillery.java rename to src/main/java/gttweaker/mods/gregtech/machines/Distillery.java diff --git a/src/main/java/gttweaker/mods/gregtech/Electrolyzer.java b/src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Electrolyzer.java rename to src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java diff --git a/src/main/java/gttweaker/mods/gregtech/Extruder.java b/src/main/java/gttweaker/mods/gregtech/machines/Extruder.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Extruder.java rename to src/main/java/gttweaker/mods/gregtech/machines/Extruder.java diff --git a/src/main/java/gttweaker/mods/gregtech/Fermenter.java b/src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Fermenter.java rename to src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java diff --git a/src/main/java/gttweaker/mods/gregtech/FluidCanner.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/FluidCanner.java rename to src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java diff --git a/src/main/java/gttweaker/mods/gregtech/FluidExtractor.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidExtractor.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/FluidExtractor.java rename to src/main/java/gttweaker/mods/gregtech/machines/FluidExtractor.java diff --git a/src/main/java/gttweaker/mods/gregtech/FluidHeater.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/FluidHeater.java rename to src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java diff --git a/src/main/java/gttweaker/mods/gregtech/FluidSolidifier.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidSolidifier.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/FluidSolidifier.java rename to src/main/java/gttweaker/mods/gregtech/machines/FluidSolidifier.java diff --git a/src/main/java/gttweaker/mods/gregtech/ForgeHammer.java b/src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/ForgeHammer.java rename to src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java diff --git a/src/main/java/gttweaker/mods/gregtech/FormingPress.java b/src/main/java/gttweaker/mods/gregtech/machines/FormingPress.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/FormingPress.java rename to src/main/java/gttweaker/mods/gregtech/machines/FormingPress.java diff --git a/src/main/java/gttweaker/mods/gregtech/Fuels.java b/src/main/java/gttweaker/mods/gregtech/machines/Fuels.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Fuels.java rename to src/main/java/gttweaker/mods/gregtech/machines/Fuels.java diff --git a/src/main/java/gttweaker/mods/gregtech/FusionReactor.java b/src/main/java/gttweaker/mods/gregtech/machines/FusionReactor.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/FusionReactor.java rename to src/main/java/gttweaker/mods/gregtech/machines/FusionReactor.java diff --git a/src/main/java/gttweaker/mods/gregtech/ImplosionCompressor.java b/src/main/java/gttweaker/mods/gregtech/machines/ImplosionCompressor.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/ImplosionCompressor.java rename to src/main/java/gttweaker/mods/gregtech/machines/ImplosionCompressor.java diff --git a/src/main/java/gttweaker/mods/gregtech/Lathe.java b/src/main/java/gttweaker/mods/gregtech/machines/Lathe.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Lathe.java rename to src/main/java/gttweaker/mods/gregtech/machines/Lathe.java diff --git a/src/main/java/gttweaker/mods/gregtech/Mixer.java b/src/main/java/gttweaker/mods/gregtech/machines/Mixer.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Mixer.java rename to src/main/java/gttweaker/mods/gregtech/machines/Mixer.java diff --git a/src/main/java/gttweaker/mods/gregtech/OilCracker.java b/src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/OilCracker.java rename to src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java diff --git a/src/main/java/gttweaker/mods/gregtech/Packer.java b/src/main/java/gttweaker/mods/gregtech/machines/Packer.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Packer.java rename to src/main/java/gttweaker/mods/gregtech/machines/Packer.java diff --git a/src/main/java/gttweaker/mods/gregtech/PlasmaArcFurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/PlasmaArcFurnace.java rename to src/main/java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java diff --git a/src/main/java/gttweaker/mods/gregtech/PlateBender.java b/src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/PlateBender.java rename to src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java diff --git a/src/main/java/gttweaker/mods/gregtech/Polarizer.java b/src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Polarizer.java rename to src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java diff --git a/src/main/java/gttweaker/mods/gregtech/PrecisionLaser.java b/src/main/java/gttweaker/mods/gregtech/machines/PrecisionLaser.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/PrecisionLaser.java rename to src/main/java/gttweaker/mods/gregtech/machines/PrecisionLaser.java diff --git a/src/main/java/gttweaker/mods/gregtech/Printer.java b/src/main/java/gttweaker/mods/gregtech/machines/Printer.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Printer.java rename to src/main/java/gttweaker/mods/gregtech/machines/Printer.java diff --git a/src/main/java/gttweaker/mods/gregtech/Pulverizer.java b/src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Pulverizer.java rename to src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java diff --git a/src/main/java/gttweaker/mods/gregtech/PyrolyseOven.java b/src/main/java/gttweaker/mods/gregtech/machines/PyrolyseOven.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/PyrolyseOven.java rename to src/main/java/gttweaker/mods/gregtech/machines/PyrolyseOven.java diff --git a/src/main/java/gttweaker/mods/gregtech/Separator.java b/src/main/java/gttweaker/mods/gregtech/machines/Separator.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Separator.java rename to src/main/java/gttweaker/mods/gregtech/machines/Separator.java diff --git a/src/main/java/gttweaker/mods/gregtech/Sifter.java b/src/main/java/gttweaker/mods/gregtech/machines/Sifter.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Sifter.java rename to src/main/java/gttweaker/mods/gregtech/machines/Sifter.java diff --git a/src/main/java/gttweaker/mods/gregtech/Slicer.java b/src/main/java/gttweaker/mods/gregtech/machines/Slicer.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Slicer.java rename to src/main/java/gttweaker/mods/gregtech/machines/Slicer.java diff --git a/src/main/java/gttweaker/mods/gregtech/Unpacker.java b/src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Unpacker.java rename to src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java diff --git a/src/main/java/gttweaker/mods/gregtech/VacuumFreezer.java b/src/main/java/gttweaker/mods/gregtech/machines/VacuumFreezer.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/VacuumFreezer.java rename to src/main/java/gttweaker/mods/gregtech/machines/VacuumFreezer.java diff --git a/src/main/java/gttweaker/mods/gregtech/Wiremill.java b/src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java similarity index 100% rename from src/main/java/gttweaker/mods/gregtech/Wiremill.java rename to src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java From 981eb18e335e7172158bac96c0023e416bce7ce3 Mon Sep 17 00:00:00 2001 From: Techlone Date: Thu, 11 Feb 2016 21:34:58 +0500 Subject: [PATCH 02/12] Packages fix --- src/main/java/gttweaker/GTTweaker.java | 2 +- .../java/gttweaker/mods/gregtech/machines/AlloySmelter.java | 2 +- .../java/gttweaker/mods/gregtech/machines/Amplifabricator.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Assembler.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java | 2 +- .../java/gttweaker/mods/gregtech/machines/Blastfurnace.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Brewery.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Canner.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java | 2 +- .../java/gttweaker/mods/gregtech/machines/ChemicalBath.java | 2 +- .../java/gttweaker/mods/gregtech/machines/ChemicalReactor.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java | 2 +- .../gttweaker/mods/gregtech/machines/DistillationTower.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Distillery.java | 2 +- .../java/gttweaker/mods/gregtech/machines/Electrolyzer.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Extruder.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java | 2 +- .../java/gttweaker/mods/gregtech/machines/FluidExtractor.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java | 2 +- .../java/gttweaker/mods/gregtech/machines/FluidSolidifier.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java | 2 +- .../java/gttweaker/mods/gregtech/machines/FormingPress.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Fuels.java | 2 +- .../java/gttweaker/mods/gregtech/machines/FusionReactor.java | 2 +- .../gttweaker/mods/gregtech/machines/ImplosionCompressor.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Lathe.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Mixer.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Packer.java | 2 +- .../java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java | 2 +- .../java/gttweaker/mods/gregtech/machines/PrecisionLaser.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Printer.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java | 2 +- .../java/gttweaker/mods/gregtech/machines/PyrolyseOven.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Separator.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Sifter.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Slicer.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java | 2 +- .../java/gttweaker/mods/gregtech/machines/VacuumFreezer.java | 2 +- src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java | 2 +- 44 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/main/java/gttweaker/GTTweaker.java b/src/main/java/gttweaker/GTTweaker.java index 3e52d54..b01f268 100644 --- a/src/main/java/gttweaker/GTTweaker.java +++ b/src/main/java/gttweaker/GTTweaker.java @@ -3,7 +3,7 @@ import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; -import gttweaker.mods.gregtech.*; +import gttweaker.mods.gregtech.machines.*; import minetweaker.MineTweakerAPI; import gregtech.api.*; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java index d4d2966..2372a97 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java b/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java index 2d7445b..3990ecb 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java index 01ef424..7d17457 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java b/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java index f356507..dc40282 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java b/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java index 00b2d21..2691db9 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java index c1cf25d..ccd7907 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java b/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java index 5344059..ce2ac46 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Canner.java b/src/main/java/gttweaker/mods/gregtech/machines/Canner.java index 29174bc..a6883dc 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Canner.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Canner.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java b/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java index 0d5c751..bcff12d 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ChemicalBath.java b/src/main/java/gttweaker/mods/gregtech/machines/ChemicalBath.java index ec27e02..2792da8 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ChemicalBath.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ChemicalBath.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ChemicalReactor.java b/src/main/java/gttweaker/mods/gregtech/machines/ChemicalReactor.java index 760dbe1..bd10110 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ChemicalReactor.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ChemicalReactor.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java b/src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java index d096b97..d629097 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/DistillationTower.java b/src/main/java/gttweaker/mods/gregtech/machines/DistillationTower.java index 7209f85..e38b95f 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/DistillationTower.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/DistillationTower.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Distillery.java b/src/main/java/gttweaker/mods/gregtech/machines/Distillery.java index f974316..90734a3 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Distillery.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Distillery.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java b/src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java index fb309fd..b7d775c 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Extruder.java b/src/main/java/gttweaker/mods/gregtech/machines/Extruder.java index 56b56ed..623fa20 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Extruder.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Extruder.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java b/src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java index 7bc8839..12b6f17 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java index e4805c0..d51506c 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FluidExtractor.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidExtractor.java index 84f4d13..7621e61 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FluidExtractor.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FluidExtractor.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java index 616b9e0..6cd5e57 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FluidSolidifier.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidSolidifier.java index 70e999d..ccd730e 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FluidSolidifier.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FluidSolidifier.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java b/src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java index 465b0c7..75a9e4d 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FormingPress.java b/src/main/java/gttweaker/mods/gregtech/machines/FormingPress.java index d0b8332..ed76b2d 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FormingPress.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FormingPress.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Fuels.java b/src/main/java/gttweaker/mods/gregtech/machines/Fuels.java index 4a832a7..3d84049 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Fuels.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Fuels.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FusionReactor.java b/src/main/java/gttweaker/mods/gregtech/machines/FusionReactor.java index 5421f8d..8e3f986 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FusionReactor.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FusionReactor.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ImplosionCompressor.java b/src/main/java/gttweaker/mods/gregtech/machines/ImplosionCompressor.java index 81ebb03..3e9c1d6 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ImplosionCompressor.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ImplosionCompressor.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Lathe.java b/src/main/java/gttweaker/mods/gregtech/machines/Lathe.java index cbdfcaa..23c9aa3 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Lathe.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Lathe.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Mixer.java b/src/main/java/gttweaker/mods/gregtech/machines/Mixer.java index e4d9996..760ad63 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Mixer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Mixer.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java b/src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java index 8064dc2..9f073f5 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Packer.java b/src/main/java/gttweaker/mods/gregtech/machines/Packer.java index ce09d46..c480884 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Packer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Packer.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java index a7638e0..d8d08dc 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java b/src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java index 09b1817..9534659 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java b/src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java index 4dd708f..dec2936 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/PrecisionLaser.java b/src/main/java/gttweaker/mods/gregtech/machines/PrecisionLaser.java index 3e52d71..0f23a9a 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/PrecisionLaser.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/PrecisionLaser.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Printer.java b/src/main/java/gttweaker/mods/gregtech/machines/Printer.java index 32965a1..0532897 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Printer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Printer.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java b/src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java index 7869cc5..da9c427 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/PyrolyseOven.java b/src/main/java/gttweaker/mods/gregtech/machines/PyrolyseOven.java index 959d442..93901b6 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/PyrolyseOven.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/PyrolyseOven.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Separator.java b/src/main/java/gttweaker/mods/gregtech/machines/Separator.java index 349fc26..f122576 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Separator.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Separator.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Sifter.java b/src/main/java/gttweaker/mods/gregtech/machines/Sifter.java index 2000fc7..4a32d54 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Sifter.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Sifter.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Slicer.java b/src/main/java/gttweaker/mods/gregtech/machines/Slicer.java index eacc8c6..bee7945 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Slicer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Slicer.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java b/src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java index 0ae7f27..0416f58 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/VacuumFreezer.java b/src/main/java/gttweaker/mods/gregtech/machines/VacuumFreezer.java index b8bbfb5..4fc032e 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/VacuumFreezer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/VacuumFreezer.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java b/src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java index 708f9dd..5a1388a 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech; +package gttweaker.mods.gregtech.machines; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; From 8c9c9fdc38d470db8c7802bd4ebeaa89225304e4 Mon Sep 17 00:00:00 2001 From: Techlone Date: Thu, 11 Feb 2016 22:00:07 +0500 Subject: [PATCH 03/12] Fuels back --- src/main/java/gttweaker/GTTweaker.java | 1 + src/main/java/gttweaker/mods/gregtech/{machines => }/Fuels.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename src/main/java/gttweaker/mods/gregtech/{machines => }/Fuels.java (99%) diff --git a/src/main/java/gttweaker/GTTweaker.java b/src/main/java/gttweaker/GTTweaker.java index b01f268..011dbb9 100644 --- a/src/main/java/gttweaker/GTTweaker.java +++ b/src/main/java/gttweaker/GTTweaker.java @@ -3,6 +3,7 @@ import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; +import gttweaker.mods.gregtech.Fuels; import gttweaker.mods.gregtech.machines.*; import minetweaker.MineTweakerAPI; import gregtech.api.*; diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Fuels.java b/src/main/java/gttweaker/mods/gregtech/Fuels.java similarity index 99% rename from src/main/java/gttweaker/mods/gregtech/machines/Fuels.java rename to src/main/java/gttweaker/mods/gregtech/Fuels.java index 3d84049..4a832a7 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Fuels.java +++ b/src/main/java/gttweaker/mods/gregtech/Fuels.java @@ -1,4 +1,4 @@ -package gttweaker.mods.gregtech.machines; +package gttweaker.mods.gregtech; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; From 1697a1d6f22a71c22d05ded91b69d10262162e4c Mon Sep 17 00:00:00 2001 From: Techlone Date: Fri, 12 Feb 2016 04:50:55 +0500 Subject: [PATCH 04/12] Ignore IDEA. Starting of OreDict support. Added basic action class. AlloySmelter need a testing. --- .gitignore | 1 + .../gregtech/AddMultipleRecipeAction.java | 102 ++++++++++++++++++ .../mods/gregtech/machines/AlloySmelter.java | 84 +++------------ .../util/exception/EmptyOreDictException.java | 19 ++++ 4 files changed, 139 insertions(+), 67 deletions(-) create mode 100644 src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java create mode 100644 src/main/java/gttweaker/util/exception/EmptyOreDictException.java diff --git a/.gitignore b/.gitignore index c6ec652..5e727cd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ eclipse/ out/ *.txt .gradle/ +.idea/ GTTweaker.iml GTTweaker.ipr GTTweaker.iws diff --git a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java new file mode 100644 index 0000000..29592c0 --- /dev/null +++ b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java @@ -0,0 +1,102 @@ +package gttweaker.mods.gregtech; + +import gttweaker.util.exception.EmptyOreDictException; +import minetweaker.OneWayAction; +import minetweaker.api.item.IIngredient; +import minetweaker.api.minecraft.MineTweakerMC; +import minetweaker.api.oredict.IOreDictEntry; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Techlone + */ +public abstract class AddMultipleRecipeAction extends OneWayAction { + private static void extendBySingle(Object singleArg, List> recipesData) { + for (List recipeData : recipesData) { + if (singleArg instanceof IIngredient) { + recipeData.add(MineTweakerMC.getItemStack((IIngredient) singleArg)); + } else { + recipeData.add(singleArg); + } + } + } + + private static void extendByPlural(IOreDictEntry oreDictArg, List> recipesData) { + List> oldData = fullCopy(recipesData); + recipesData.clear(); + for (Object singleArg : oreDictArg.getItems()) { + List> tmp = fullCopy(oldData); + extendBySingle(singleArg, tmp); + recipesData.addAll(tmp); + } + } + + private static List> fullCopy(List> recipesData) { + List> result = new ArrayList>(recipesData.size()); + for (List recipeData : recipesData) { + result.add(new ArrayList(recipeData)); + } + return result; + } + + protected String description; + private List> recipesData; + + public AddMultipleRecipeAction(String description, Object... recipeArgs) throws EmptyOreDictException { + this(recipeArgs); + this.description = description; + } + + protected AddMultipleRecipeAction(Object... recipeArgs) throws EmptyOreDictException { + recipesData = new ArrayList>(recipeArgs.length); + recipesData.add(new ArrayList()); + + for (Object recipeArg : recipeArgs) { + if (recipeArg instanceof IOreDictEntry) { + if (((IOreDictEntry) recipeArg).getItems().size() == 0) { + throw new EmptyOreDictException((IOreDictEntry) recipeArg); + } + extendByPlural((IOreDictEntry) recipeArg, recipesData); + } else { + extendBySingle(recipeArg, recipesData); + } + } + } + + protected abstract void applySingleRecipe(Object... recipeArgs); + + @Override + public void apply() { + for (List recipeData : recipesData) { + applySingleRecipe(recipeData.toArray()); + } + } + + @Override + public String describe() { + return this.description; + } + + @Override + public Object getOverrideKey() { + return null; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + AddMultipleRecipeAction that = (AddMultipleRecipeAction) o; + + return recipesData != null ? recipesData.equals(that.recipesData) : that.recipesData == null; + + } + + @Override + public int hashCode() { + return recipesData != null ? recipesData.hashCode() : 0; + } +} diff --git a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java index 2372a97..015a119 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java @@ -1,11 +1,14 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; +import gttweaker.util.exception.EmptyOreDictException; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -31,84 +34,31 @@ public class AlloySmelter { */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); + try { + MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); + } catch (EmptyOreDictException e) { + MineTweakerAPI.logError(e.toString()); + } } // ###################### // ### Action classes ### // ###################### - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IIngredient input1; - private final IIngredient input2; - private final int duration; - private final int euPerTick; + private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) { - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; + public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) throws EmptyOreDictException { + super("Adding alloy smelter recipe for " + output, input1, input2, output, duration, euPerTick); } @Override - public void apply() { + protected void applySingleRecipe(Object... args) { RA.addAlloySmelterRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding alloy smelter recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 53 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 53 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + (ItemStack) args[0], + (ItemStack) args[1], + (ItemStack) args[2], + (Integer) args[3], + (Integer) args[4]); } } } diff --git a/src/main/java/gttweaker/util/exception/EmptyOreDictException.java b/src/main/java/gttweaker/util/exception/EmptyOreDictException.java new file mode 100644 index 0000000..c19ea67 --- /dev/null +++ b/src/main/java/gttweaker/util/exception/EmptyOreDictException.java @@ -0,0 +1,19 @@ +package gttweaker.util.exception; + +import minetweaker.api.oredict.IOreDictEntry; + +/** + * Created by Techlone + */ +public class EmptyOreDictException extends Exception { + public IOreDictEntry emptyOreDict; + + public EmptyOreDictException(IOreDictEntry oreDict) { + emptyOreDict = oreDict; + } + + @Override + public String toString() { + return "Ore dictionary " + emptyOreDict + " is empty. Can not to add recipe without items."; + } +} From 390efcd28ebe2e4ea3198d87e150229512e9fc6c Mon Sep 17 00:00:00 2001 From: Techlone Date: Fri, 19 Feb 2016 23:11:58 +0500 Subject: [PATCH 05/12] Support of ore dict. Included ArcFurnace. --- .../gregtech/AddMultipleRecipeAction.java | 80 +++++++++++----- .../mods/gregtech/machines/AlloySmelter.java | 12 +-- .../mods/gregtech/machines/ArcFurnace.java | 93 +++---------------- .../exception/AnyIngredientException.java | 11 +++ .../exception/EmptyIngredientException.java | 19 ++++ .../util/exception/EmptyOreDictException.java | 19 ---- .../exception/OutOfStackSizeException.java | 20 ++++ 7 files changed, 123 insertions(+), 131 deletions(-) create mode 100644 src/main/java/gttweaker/util/exception/AnyIngredientException.java create mode 100644 src/main/java/gttweaker/util/exception/EmptyIngredientException.java delete mode 100644 src/main/java/gttweaker/util/exception/EmptyOreDictException.java create mode 100644 src/main/java/gttweaker/util/exception/OutOfStackSizeException.java diff --git a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java index 29592c0..4ca7415 100644 --- a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java +++ b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java @@ -1,13 +1,17 @@ package gttweaker.mods.gregtech; -import gttweaker.util.exception.EmptyOreDictException; +import gttweaker.util.exception.AnyIngredientException; +import gttweaker.util.exception.EmptyIngredientException; +import gttweaker.util.exception.OutOfStackSizeException; +import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.liquid.ILiquidStack; import minetweaker.api.minecraft.MineTweakerMC; -import minetweaker.api.oredict.IOreDictEntry; +import net.minecraft.item.ItemStack; -import java.util.ArrayList; -import java.util.List; +import java.util.*; /** * Created by Techlone @@ -15,19 +19,15 @@ public abstract class AddMultipleRecipeAction extends OneWayAction { private static void extendBySingle(Object singleArg, List> recipesData) { for (List recipeData : recipesData) { - if (singleArg instanceof IIngredient) { - recipeData.add(MineTweakerMC.getItemStack((IIngredient) singleArg)); - } else { - recipeData.add(singleArg); - } + recipeData.add(singleArg); } } - private static void extendByPlural(IOreDictEntry oreDictArg, List> recipesData) { - List> oldData = fullCopy(recipesData); + private static void extendByPlural(List args, List> recipesData) { + List> originData = fullCopy(recipesData); recipesData.clear(); - for (Object singleArg : oreDictArg.getItems()) { - List> tmp = fullCopy(oldData); + for (Object singleArg : args) { + List> tmp = fullCopy(originData); extendBySingle(singleArg, tmp); recipesData.addAll(tmp); } @@ -44,28 +44,58 @@ private static List> fullCopy(List> recipesData) { protected String description; private List> recipesData; - public AddMultipleRecipeAction(String description, Object... recipeArgs) throws EmptyOreDictException { - this(recipeArgs); + protected AddMultipleRecipeAction(String description, Object... recipeArgs) { this.description = description; - } - protected AddMultipleRecipeAction(Object... recipeArgs) throws EmptyOreDictException { recipesData = new ArrayList>(recipeArgs.length); recipesData.add(new ArrayList()); - for (Object recipeArg : recipeArgs) { - if (recipeArg instanceof IOreDictEntry) { - if (((IOreDictEntry) recipeArg).getItems().size() == 0) { - throw new EmptyOreDictException((IOreDictEntry) recipeArg); + try { + for (Object recipeArg : recipeArgs) { + addArgument(recipeArg); + } + } catch (Exception e) { + MineTweakerAPI.logError(e.toString()); + } + } + + protected void addArgument(Object recipeArg) { + if (recipeArg == null) { + throw new NullPointerException("Null argument at '" + description + "'"); + } + if (recipeArg instanceof ILiquidStack) { + extendBySingle(MineTweakerMC.getLiquidStack((ILiquidStack) recipeArg), recipesData); + } else if (recipeArg instanceof ILiquidStack[]) { + extendBySingle(MineTweakerMC.getLiquidStacks((ILiquidStack[]) recipeArg), recipesData); + } else if (recipeArg instanceof IItemStack[]) { + extendBySingle(MineTweakerMC.getItemStacks((IItemStack[]) recipeArg), recipesData); + } else if (recipeArg instanceof IIngredient) { + IIngredient ingredientArg = (IIngredient) recipeArg; + List items = ingredientArg.getItems(); + if (items == null) { + throw new AnyIngredientException(); + } + if (items.size() == 0) { + throw new EmptyIngredientException(ingredientArg); + } + List itemStackList = Arrays.asList(MineTweakerMC.getItemStacks(items)); + int amount = ingredientArg.getAmount(); + if (amount < 0) { + throw new RuntimeException("Negative amount for ingredient " + ingredientArg); + } + for (ItemStack stack : itemStackList) { + if (amount > stack.getMaxStackSize()) { + throw new OutOfStackSizeException(ingredientArg, amount); } - extendByPlural((IOreDictEntry) recipeArg, recipesData); - } else { - extendBySingle(recipeArg, recipesData); + stack.stackSize = amount; } + extendByPlural(itemStackList, recipesData); + } else { + extendBySingle(recipeArg, recipesData); } } - protected abstract void applySingleRecipe(Object... recipeArgs); + protected abstract void applySingleRecipe(Object[] recipeArgs); @Override public void apply() { diff --git a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java index 015a119..251ca49 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java @@ -1,13 +1,11 @@ package gttweaker.mods.gregtech.machines; import gttweaker.mods.gregtech.AddMultipleRecipeAction; -import gttweaker.util.exception.EmptyOreDictException; +import gttweaker.util.exception.EmptyIngredientException; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import net.minecraft.item.ItemStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -34,11 +32,7 @@ public class AlloySmelter { */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { - try { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } catch (EmptyOreDictException e) { - MineTweakerAPI.logError(e.toString()); - } + MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); } // ###################### @@ -47,7 +41,7 @@ public static void addRecipe(IItemStack output, IIngredient input1, IIngredient private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) throws EmptyOreDictException { + public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) { super("Adding alloy smelter recipe for " + output, input1, input2, output, duration, euPerTick); } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java index 7d17457..265d60a 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java @@ -1,12 +1,13 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -32,12 +33,12 @@ public class ArcFurnace { * @param euPerTick eu consumption per tick */ @ZenMethod - public static void addRecipe(IItemStack[]outputs, IIngredient input, ILiquidStack fluidInput, int[] outChances, int durationTicks, int euPerTick) { + public static void addRecipe(IItemStack[] outputs, IIngredient input, ILiquidStack fluidInput, int[] outChances, int durationTicks, int euPerTick) { if (outputs.length < 1) { MineTweakerAPI.logError("Arc Furnace must have at least 1 output"); - } else if(outputs.length!=outChances.length){ + } else if (outputs.length != outChances.length) { MineTweakerAPI.logError("Number of Outputs does not equal number of Chances"); - }else { + } else { MineTweakerAPI.apply(new AddRecipeAction(outputs, input, fluidInput, outChances, durationTicks, euPerTick)); } } @@ -45,85 +46,21 @@ public static void addRecipe(IItemStack[]outputs, IIngredient input, ILiquidStac // ###################### // ### Action classes ### // ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack[] output; - private final IIngredient input; - private final ILiquidStack fluidInput; - private final int[] chances; - private final int duration; - private final int euPerTick; + private static class AddRecipeAction extends AddMultipleRecipeAction { public AddRecipeAction(IItemStack[] output, IIngredient input, ILiquidStack fluidInput, int[] outChances, int duration, int euPerTick) { - - this.output = output; - this.input = input; - this.fluidInput = fluidInput; - this.chances = outChances; - this.duration = duration; - this.euPerTick = euPerTick; + super("Adding Arc Furnace recipe for " + input, input, fluidInput, output, outChances, duration, euPerTick); } @Override - public void apply() { + public void applySingleRecipe(Object... args) { RA.addSimpleArcFurnaceRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getItemStacks(output), - chances, - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Arc Furnace recipe for " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 6; - hash = 11 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 11 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 11 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 11 * hash + this.duration; - hash = 11 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.chances != other.chances){ - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + (ItemStack) args[0], + (FluidStack) args[1], + (ItemStack[]) args[2], + (int[]) args[3], + (Integer) args[4], + (Integer) args[5]); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/util/exception/AnyIngredientException.java b/src/main/java/gttweaker/util/exception/AnyIngredientException.java new file mode 100644 index 0000000..656a3a2 --- /dev/null +++ b/src/main/java/gttweaker/util/exception/AnyIngredientException.java @@ -0,0 +1,11 @@ +package gttweaker.util.exception; + +/** + * Created by Techlone + */ +public class AnyIngredientException extends RuntimeException { + @Override + public String toString() { + return "Can't add 'any' ingredient."; + } +} diff --git a/src/main/java/gttweaker/util/exception/EmptyIngredientException.java b/src/main/java/gttweaker/util/exception/EmptyIngredientException.java new file mode 100644 index 0000000..0f05056 --- /dev/null +++ b/src/main/java/gttweaker/util/exception/EmptyIngredientException.java @@ -0,0 +1,19 @@ +package gttweaker.util.exception; + +import minetweaker.api.item.IIngredient; + +/** + * Created by Techlone + */ +public class EmptyIngredientException extends RuntimeException { + public IIngredient ingredient; + + public EmptyIngredientException(IIngredient ingredient) { + this.ingredient = ingredient; + } + + @Override + public String toString() { + return "Ingredient '" + ingredient + "' is empty. Can't add recipe without items."; + } +} diff --git a/src/main/java/gttweaker/util/exception/EmptyOreDictException.java b/src/main/java/gttweaker/util/exception/EmptyOreDictException.java deleted file mode 100644 index c19ea67..0000000 --- a/src/main/java/gttweaker/util/exception/EmptyOreDictException.java +++ /dev/null @@ -1,19 +0,0 @@ -package gttweaker.util.exception; - -import minetweaker.api.oredict.IOreDictEntry; - -/** - * Created by Techlone - */ -public class EmptyOreDictException extends Exception { - public IOreDictEntry emptyOreDict; - - public EmptyOreDictException(IOreDictEntry oreDict) { - emptyOreDict = oreDict; - } - - @Override - public String toString() { - return "Ore dictionary " + emptyOreDict + " is empty. Can not to add recipe without items."; - } -} diff --git a/src/main/java/gttweaker/util/exception/OutOfStackSizeException.java b/src/main/java/gttweaker/util/exception/OutOfStackSizeException.java new file mode 100644 index 0000000..adbef96 --- /dev/null +++ b/src/main/java/gttweaker/util/exception/OutOfStackSizeException.java @@ -0,0 +1,20 @@ +package gttweaker.util.exception; + +import minetweaker.api.item.IIngredient; + +/** + * Created by Techlone + */ +public class OutOfStackSizeException extends RuntimeException { + private IIngredient ingredient; + private int amount; + + public OutOfStackSizeException(IIngredient ingredient, int amount) { + this.ingredient = ingredient; + this.amount = amount; + } + @Override + public String toString() { + return "Impossible add ingredient '" + ingredient + "' with amount " + amount; + } +} From 13fb599c688f63fc3e1831afc74ed151c8c9b570 Mon Sep 17 00:00:00 2001 From: Techlone Date: Sat, 20 Feb 2016 20:59:32 +0500 Subject: [PATCH 06/12] Ore dict: Amplifabricator; Assembler; Autoclave --- .../gregtech/AddMultipleRecipeAction.java | 6 +- .../mods/gregtech/machines/AlloySmelter.java | 4 +- .../gregtech/machines/Amplifabricator.java | 65 +-------- .../mods/gregtech/machines/ArcFurnace.java | 3 +- .../mods/gregtech/machines/Assembler.java | 138 ++++-------------- .../mods/gregtech/machines/Autoclave.java | 97 +++--------- 6 files changed, 59 insertions(+), 254 deletions(-) diff --git a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java index 4ca7415..bc73dc1 100644 --- a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java +++ b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java @@ -41,7 +41,7 @@ private static List> fullCopy(List> recipesData) { return result; } - protected String description; + private String description; private List> recipesData; protected AddMultipleRecipeAction(String description, Object... recipeArgs) { @@ -59,7 +59,7 @@ protected AddMultipleRecipeAction(String description, Object... recipeArgs) { } } - protected void addArgument(Object recipeArg) { + private void addArgument(Object recipeArg) { if (recipeArg == null) { throw new NullPointerException("Null argument at '" + description + "'"); } @@ -95,7 +95,7 @@ protected void addArgument(Object recipeArg) { } } - protected abstract void applySingleRecipe(Object[] recipeArgs); + protected abstract void applySingleRecipe(Object[] args); @Override public void apply() { diff --git a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java index 251ca49..2898d30 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java @@ -1,7 +1,6 @@ package gttweaker.mods.gregtech.machines; import gttweaker.mods.gregtech.AddMultipleRecipeAction; -import gttweaker.util.exception.EmptyIngredientException; import minetweaker.MineTweakerAPI; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; @@ -40,13 +39,12 @@ public static void addRecipe(IItemStack output, IIngredient input1, IIngredient // ###################### private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) { super("Adding alloy smelter recipe for " + output, input1, input2, output, duration, euPerTick); } @Override - protected void applySingleRecipe(Object... args) { + protected void applySingleRecipe(Object[] args) { RA.addAlloySmelterRecipe( (ItemStack) args[0], (ItemStack) args[1], diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java b/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java index 3990ecb..5997b3b 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java @@ -1,11 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -37,65 +36,17 @@ public static void addRecipe(IIngredient input, int duration, int amount) { // ### Action classes ### // ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IIngredient input; - private final int duration; - private final int amount; - + private static class AddRecipeAction extends AddMultipleRecipeAction { public AddRecipeAction(IIngredient input, int duration, int amount) { - - this.input = input; - this.duration = duration; - this.amount = amount; + super("Adding Amplifabricator recipe for " + input, input, duration, amount); } @Override - public void apply() { + protected void applySingleRecipe(Object[] args) { RA.addAmplifier( - MineTweakerMC.getItemStack(input), - duration, - amount); - } - - @Override - public String describe() { - return "Adding Amplifabricator recipe for " + input ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 1; - hash = 12 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 12 * hash + this.duration; - hash = 12 * hash + this.amount; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.amount != other.amount) { - return false; - } - return true; + (ItemStack) args[0], + (Integer) args[1], + (Integer) args[2]); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java index 265d60a..b834de6 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java @@ -47,13 +47,12 @@ public static void addRecipe(IItemStack[] outputs, IIngredient input, ILiquidSta // ### Action classes ### // ###################### private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack[] output, IIngredient input, ILiquidStack fluidInput, int[] outChances, int duration, int euPerTick) { super("Adding Arc Furnace recipe for " + input, input, fluidInput, output, outChances, duration, euPerTick); } @Override - public void applySingleRecipe(Object... args) { + public void applySingleRecipe(Object[] args) { RA.addSimpleArcFurnaceRecipe( (ItemStack) args[0], (FluidStack) args[1], diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java b/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java index dc40282..dde5b89 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java @@ -1,12 +1,13 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -37,132 +38,45 @@ public class Assembler { public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, ILiquidStack fluidInput1, int durationTicks, int euPerTick) { MineTweakerAPI.apply(new AddFluidRecipeAction(output, input1, input2, fluidInput1, durationTicks, euPerTick)); } + @ZenMethod public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); } + // ###################### // ### Action classes ### // ###################### - - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input1; - private final IIngredient input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) { - - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addAssemblerRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding assembler recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - } - - private static class AddFluidRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input1; - private final IIngredient input2; - private final ILiquidStack fluidInput1; - private final int duration; - private final int euPerTick; - - public AddFluidRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, ILiquidStack fluidInput1, int duration, int euPerTick) { - - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.fluidInput1 = fluidInput1; - this.duration = duration; - this.euPerTick = euPerTick; + private static class AddRecipeAction extends AddMultipleRecipeAction { + public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) { + super("Adding assembler recipe for " + output, input1, input2, output, duration, euPerTick); } @Override - public void apply() { + protected void applySingleRecipe(Object[] args) { RA.addAssemblerRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getLiquidStack(fluidInput1), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding assembler recipe with fluid Support for " + output; - } - - @Override - public Object getOverrideKey() { - return null; + (ItemStack) args[0], + (ItemStack) args[1], + (ItemStack) args[2], + (Integer) args[3], + (Integer) args[4]); } + } - @Override - public int hashCode() { - int hash = 7; - hash = 77 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 77 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 77 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 77 * hash + (this.fluidInput1 != null ? this.fluidInput1.hashCode() : 0); - hash = 77 * hash + this.duration; - hash = 77 * hash + this.euPerTick; - return hash; + private static class AddFluidRecipeAction extends AddMultipleRecipeAction { + public AddFluidRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, ILiquidStack fluidInput1, int duration, int euPerTick) { + super("Adding assembler recipe with fluid Support for " + output, input1, input2, fluidInput1, output, duration, euPerTick); } @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddFluidRecipeAction other = (AddFluidRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.fluidInput1 != other.fluidInput1 && (this.fluidInput1 == null || !this.fluidInput1.equals(other.fluidInput1))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + protected void applySingleRecipe(Object[] args) { + RA.addAssemblerRecipe( + (ItemStack) args[0], + (ItemStack) args[1], + (FluidStack) args[2], + (ItemStack) args[3], + (Integer) args[4], + (Integer) args[5]); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java b/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java index 2691db9..caaa842 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java @@ -1,17 +1,19 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; + /** * Provides access to the Autoclave recipes. * @@ -23,94 +25,35 @@ public class Autoclave { /** * Adds an Autoclave recipe. * - * @param output primary output - * @param input primary input - * @param fluidInput primary fluidInput - * @param chances chances + * @param output primary output + * @param input primary input + * @param fluidInput primary fluidInput + * @param chances chances * @param durationTicks assembling duration, in ticks - * @param euPerTick eu consumption per tick + * @param euPerTick eu consumption per tick */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, ILiquidStack fluidInput, int chances, int durationTicks, int euPerTick) { MineTweakerAPI.apply(new AddRecipeAction(output, input, fluidInput, chances, durationTicks, euPerTick)); } + // ###################### // ### Action classes ### // ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input; - private final ILiquidStack fluidInput; - private final int chances; - private final int duration; - private final int euPerTick; - + private static class AddRecipeAction extends AddMultipleRecipeAction { public AddRecipeAction(IItemStack output, IIngredient input, ILiquidStack fluidInput, int chances, int duration, int euPerTick) { - - this.output = output; - this.input = input; - this.fluidInput = fluidInput; - this.chances = chances; - this.duration = duration; - this.euPerTick = euPerTick; + super("Adding Autoclave recipe for " + output, input, fluidInput, output, chances, duration, euPerTick); } + @Override - public void apply() { + protected void applySingleRecipe(Object[] args) { RA.addAutoclaveRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getItemStack(output), - chances, - duration, - euPerTick); - } - @Override - public String describe() { - return "Adding Autoclave recipe for " + output; - } - @Override - public Object getOverrideKey() { - return null; - } - @Override - public int hashCode() { - int hash = 7; - hash = 22 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 22 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 22 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 22 * hash + this.duration; - hash = 22 * hash + this.euPerTick; - return hash; - } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.chances != other.chances) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + (ItemStack) args[0], + (FluidStack) args[1], + (ItemStack) args[2], + (Integer) args[3], + (Integer) args[4], + (Integer) args[5]); } } } From 31a7896ef92b67782a498acb5ca91a82636c364c Mon Sep 17 00:00:00 2001 From: Techlone Date: Sat, 5 Mar 2016 18:10:06 +0500 Subject: [PATCH 07/12] Support for array of IIngredient --- .../gregtech/AddMultipleRecipeAction.java | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java index bc73dc1..60e948e 100644 --- a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java +++ b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java @@ -67,34 +67,43 @@ private void addArgument(Object recipeArg) { extendBySingle(MineTweakerMC.getLiquidStack((ILiquidStack) recipeArg), recipesData); } else if (recipeArg instanceof ILiquidStack[]) { extendBySingle(MineTweakerMC.getLiquidStacks((ILiquidStack[]) recipeArg), recipesData); + } else if (recipeArg instanceof IItemStack) { + extendBySingle(MineTweakerMC.getItemStack((IItemStack) recipeArg), recipesData); } else if (recipeArg instanceof IItemStack[]) { extendBySingle(MineTweakerMC.getItemStacks((IItemStack[]) recipeArg), recipesData); } else if (recipeArg instanceof IIngredient) { - IIngredient ingredientArg = (IIngredient) recipeArg; - List items = ingredientArg.getItems(); - if (items == null) { - throw new AnyIngredientException(); + extendByPlural(getItemStacks((IIngredient) recipeArg), recipesData); + } else if (recipeArg instanceof IIngredient[]) { + for (IIngredient recipeSubArg : (IIngredient[]) recipeArg) { + extendByPlural(getItemStacks(recipeSubArg), recipesData); } - if (items.size() == 0) { - throw new EmptyIngredientException(ingredientArg); - } - List itemStackList = Arrays.asList(MineTweakerMC.getItemStacks(items)); - int amount = ingredientArg.getAmount(); - if (amount < 0) { - throw new RuntimeException("Negative amount for ingredient " + ingredientArg); - } - for (ItemStack stack : itemStackList) { - if (amount > stack.getMaxStackSize()) { - throw new OutOfStackSizeException(ingredientArg, amount); - } - stack.stackSize = amount; - } - extendByPlural(itemStackList, recipesData); } else { extendBySingle(recipeArg, recipesData); } } + private List getItemStacks(IIngredient ingredientArg) { + List items = ingredientArg.getItems(); + if (items == null) { + throw new AnyIngredientException(); + } + if (items.size() == 0) { + throw new EmptyIngredientException(ingredientArg); + } + List itemStackList = Arrays.asList(MineTweakerMC.getItemStacks(items)); + int amount = ingredientArg.getAmount(); + if (amount < 0) { + throw new RuntimeException("Negative amount for ingredient " + ingredientArg); + } + for (ItemStack stack : itemStackList) { + if (amount > stack.getMaxStackSize()) { + throw new OutOfStackSizeException(ingredientArg, amount); + } + stack.stackSize = amount; + } + return itemStackList; + } + protected abstract void applySingleRecipe(Object[] args); @Override From 266ba6605a3e65009dc99a61e244cc45348e6cc4 Mon Sep 17 00:00:00 2001 From: Techlone Date: Sat, 5 Mar 2016 18:33:39 +0500 Subject: [PATCH 08/12] Cancel previous changes. Allow null arguments. --- .../mods/gregtech/AddMultipleRecipeAction.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java index 60e948e..aeb123d 100644 --- a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java +++ b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java @@ -23,7 +23,7 @@ private static void extendBySingle(Object singleArg, List> recipesD } } - private static void extendByPlural(List args, List> recipesData) { + private static void extendByMultiple(List args, List> recipesData) { List> originData = fullCopy(recipesData); recipesData.clear(); for (Object singleArg : args) { @@ -60,9 +60,6 @@ protected AddMultipleRecipeAction(String description, Object... recipeArgs) { } private void addArgument(Object recipeArg) { - if (recipeArg == null) { - throw new NullPointerException("Null argument at '" + description + "'"); - } if (recipeArg instanceof ILiquidStack) { extendBySingle(MineTweakerMC.getLiquidStack((ILiquidStack) recipeArg), recipesData); } else if (recipeArg instanceof ILiquidStack[]) { @@ -72,11 +69,7 @@ private void addArgument(Object recipeArg) { } else if (recipeArg instanceof IItemStack[]) { extendBySingle(MineTweakerMC.getItemStacks((IItemStack[]) recipeArg), recipesData); } else if (recipeArg instanceof IIngredient) { - extendByPlural(getItemStacks((IIngredient) recipeArg), recipesData); - } else if (recipeArg instanceof IIngredient[]) { - for (IIngredient recipeSubArg : (IIngredient[]) recipeArg) { - extendByPlural(getItemStacks(recipeSubArg), recipesData); - } + extendByMultiple(getItemStacks((IIngredient) recipeArg), recipesData); } else { extendBySingle(recipeArg, recipesData); } From 794fd4ad747ff1a3bd73e7457c1b8b88b1190bf7 Mon Sep 17 00:00:00 2001 From: Techlone Date: Sat, 5 Mar 2016 19:39:02 +0500 Subject: [PATCH 09/12] Ore dict: BlastFurnace; Brewery; Canner --- .../mods/gregtech/machines/Blastfurnace.java | 148 ++++-------------- .../mods/gregtech/machines/Brewery.java | 89 ++--------- .../mods/gregtech/machines/Canner.java | 87 ++-------- 3 files changed, 62 insertions(+), 262 deletions(-) diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java index ccd7907..071b358 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java @@ -1,12 +1,13 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -55,131 +56,50 @@ public static void addRecipe(IItemStack[] output, IIngredient[] input, int durat // ### Action classes ### // ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack[] output; - private final IIngredient[] input; - private final int duration; - private final int euPerTick; - private final int heat; - + private static class AddRecipeAction extends AddMultipleRecipeAction { public AddRecipeAction(IItemStack[] output, IIngredient[] input, int duration, int euPerTick, int heat) { - - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - this.heat = heat; + super("Adding Blast furnace recipe for " + output, + input[0], input.length > 1 ? input[1] : null, + output[0], output.length > 1 ? output[1] : null, + duration, euPerTick, heat); } @Override - public void apply() { + protected void applySingleRecipe(Object[] args) { RA.addBlastRecipe( - MineTweakerMC.getItemStack(input[0]), - input.length > 1 ? MineTweakerMC.getItemStack(input[1]) : null, - MineTweakerMC.getLiquidStack(null), - MineTweakerMC.getLiquidStack(null), - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - duration, - euPerTick, - heat); - } - - @Override - public String describe() { - return "Adding Blast furnace recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; + (ItemStack) args[0], + (ItemStack) args[1], + null, + null, + (ItemStack) args[2], + (ItemStack) args[3], + (Integer) args[4], + (Integer) args[5], + (Integer) args[6]); } } - private static class AddFluidRecipeAction extends OneWayAction { - - private final IItemStack[] output; - private final ILiquidStack fluidInput; - private final IIngredient[] input; - private final int duration; - private final int euPerTick; - private final int heat; - + private static class AddFluidRecipeAction extends AddMultipleRecipeAction { public AddFluidRecipeAction(IItemStack[] output, ILiquidStack fluidInput, IIngredient[] input, int duration, int euPerTick, int heat) { - - this.output = output; - this.fluidInput = fluidInput; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - this.heat = heat; + super("Adding Blast furnace recipe for " + output, + input[0], input.length > 1 ? input[1] : null, + fluidInput, + output[0], output.length > 1 ? output[1] : null, + duration, euPerTick, heat); } @Override - public void apply() { + protected void applySingleRecipe(Object[] args) { RA.addBlastRecipe( - MineTweakerMC.getItemStack(input[0]), - input.length > 1 ? MineTweakerMC.getItemStack(input[1]) : null, - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getLiquidStack(null), - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - duration, - euPerTick, - heat); - } - - @Override - public String describe() { - return "Adding Blast furnace recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 4; - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 67 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 67 * hash + this.duration; - hash = 67 * hash + this.euPerTick; - hash = 67 * hash + this.heat; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddFluidRecipeAction other = (AddFluidRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - if (this.heat != other.heat) { - return false; - } - return true; + (ItemStack) args[0], + (ItemStack) args[1], + (FluidStack) args[2], + null, + (ItemStack) args[3], + (ItemStack) args[4], + (Integer) args[5], + (Integer) args[6], + (Integer) args[7]); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java b/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java index ce2ac46..d12a3b8 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java @@ -1,12 +1,12 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; -import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -24,88 +24,33 @@ public class Brewery { /** * Adds a Brewing Machine recipe. * - * @param fluidOutput primary fluid output - * @param Ingredient primary input - * @param fluidInput primary fluid input - * @param Hidden hidden true or false + * @param output primary fluid output + * @param ingredient primary ingredient + * @param input primary fluid ingredient + * @param hidden hidden true or false * */ @ZenMethod - public static void addRecipe(ILiquidStack fluidOutput, IIngredient Ingredient, ILiquidStack fluidInput, boolean Hidden) { - MineTweakerAPI.apply(new AddRecipeAction(fluidOutput, Ingredient, fluidInput, Hidden)); + public static void addRecipe(ILiquidStack output, IIngredient ingredient, ILiquidStack input, boolean hidden) { + MineTweakerAPI.apply(new AddRecipeAction(output, ingredient, input, hidden)); } // ###################### // ### Action classes ### // ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IIngredient Ingredient; - private final ILiquidStack fluidOutput; - private final ILiquidStack fluidInput; - private final boolean Hidden; - - public AddRecipeAction(ILiquidStack fluidOutput, IIngredient Ingredient, ILiquidStack fluidInput, boolean Hidden) { - - this.Ingredient = Ingredient; - this.fluidOutput = fluidOutput; - this.fluidInput = fluidInput; - this.Hidden = Hidden; + private static class AddRecipeAction extends AddMultipleRecipeAction { + public AddRecipeAction(ILiquidStack output, IIngredient ingredient, ILiquidStack input, boolean hidden) { + super("Adding Brewery recipe for " + output, ingredient, input, output, hidden); } @Override - public void apply() { + protected void applySingleRecipe(Object[] args) { RA.addBrewingRecipe( - MineTweakerMC.getItemStack(Ingredient), - MineTweakerMC.getLiquidStack(fluidOutput).getFluid(), - MineTweakerMC.getLiquidStack(fluidInput).getFluid(), - Hidden); - - } - - @Override - public String describe() { - return "Adding Brewery recipe for " + fluidOutput ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 9; - hash = 8 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 8 * hash + (this.Ingredient != null ? this.Ingredient.hashCode() : 0); - hash = 8 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.Ingredient != other.Ingredient && (this.Ingredient == null || !this.Ingredient.equals(other.Ingredient))) { - - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.Hidden != other.Hidden) { - return false; - } - return true; + (ItemStack) args[0], + ((FluidStack) args[1]).getFluid(), + ((FluidStack) args[2]).getFluid(), + (Boolean) args[3]); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Canner.java b/src/main/java/gttweaker/mods/gregtech/machines/Canner.java index a6883dc..d38bea0 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Canner.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Canner.java @@ -1,11 +1,11 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -56,85 +56,20 @@ public static void addRecipe(IItemStack[] output, IIngredient input1, IIngredien // ### Action classes ### // ###################### - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IIngredient input1; - private final IIngredient input2; - private final int duration; - private final int euPerTick; - + private static class AddRecipeAction extends AddMultipleRecipeAction { public AddRecipeAction(IItemStack output1, IItemStack output2, IIngredient input1, IIngredient input2, int duration, int euPerTick) { - - this.output1 = output1; - this.output2 = output2; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; + super("Adding canner recipe for " + output1, input1, input2, output1, output2, duration, euPerTick); } @Override - public void apply() { + protected void applySingleRecipe(Object[] args) { RA.addCannerRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding canner recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 79 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 79 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 79 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + (ItemStack) args[0], + (ItemStack) args[1], + (ItemStack) args[2], + (ItemStack) args[3], + (Integer) args[4], + (Integer) args[5]); } } } From e106b2ad3311b99ccafd2843e185c21a2d184cec Mon Sep 17 00:00:00 2001 From: Techlone Date: Sat, 5 Mar 2016 22:37:42 +0500 Subject: [PATCH 10/12] Removing hardcoded indexing. Ore dict: Centrifuge --- .../mods/gregtech/machines/AlloySmelter.java | 12 +- .../gregtech/machines/Amplifabricator.java | 8 +- .../mods/gregtech/machines/ArcFurnace.java | 14 +- .../mods/gregtech/machines/Assembler.java | 26 +- .../mods/gregtech/machines/Autoclave.java | 14 +- .../mods/gregtech/machines/Blastfurnace.java | 37 +-- .../mods/gregtech/machines/Brewery.java | 9 +- .../mods/gregtech/machines/Canner.java | 14 +- .../mods/gregtech/machines/Centrifuge.java | 223 +++++------------- 9 files changed, 130 insertions(+), 227 deletions(-) diff --git a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java index 2898d30..cc022d5 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java @@ -45,12 +45,14 @@ public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2 @Override protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addAlloySmelterRecipe( - (ItemStack) args[0], - (ItemStack) args[1], - (ItemStack) args[2], - (Integer) args[3], - (Integer) args[4]); + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (Integer) args[i++], + (Integer) args[i++] + ); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java b/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java index 5997b3b..e6edc8c 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java @@ -43,10 +43,12 @@ public AddRecipeAction(IIngredient input, int duration, int amount) { @Override protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addAmplifier( - (ItemStack) args[0], - (Integer) args[1], - (Integer) args[2]); + (ItemStack) args[i++], + (Integer) args[i++], + (Integer) args[i++] + ); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java index b834de6..3ebbbd2 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java @@ -53,13 +53,15 @@ public AddRecipeAction(IItemStack[] output, IIngredient input, ILiquidStack flui @Override public void applySingleRecipe(Object[] args) { + int i = 0; RA.addSimpleArcFurnaceRecipe( - (ItemStack) args[0], - (FluidStack) args[1], - (ItemStack[]) args[2], - (int[]) args[3], - (Integer) args[4], - (Integer) args[5]); + (ItemStack) args[i++], + (FluidStack) args[i++], + (ItemStack[]) args[i++], + (int[]) args[i++], + (Integer) args[i++], + (Integer) args[i++] + ); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java b/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java index dde5b89..1a7ca4a 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java @@ -54,12 +54,14 @@ public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2 @Override protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addAssemblerRecipe( - (ItemStack) args[0], - (ItemStack) args[1], - (ItemStack) args[2], - (Integer) args[3], - (Integer) args[4]); + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (Integer) args[i++], + (Integer) args[i++] + ); } } @@ -70,13 +72,15 @@ public AddFluidRecipeAction(IItemStack output, IIngredient input1, IIngredient i @Override protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addAssemblerRecipe( - (ItemStack) args[0], - (ItemStack) args[1], - (FluidStack) args[2], - (ItemStack) args[3], - (Integer) args[4], - (Integer) args[5]); + (ItemStack) args[i++], + (ItemStack) args[i++], + (FluidStack) args[i++], + (ItemStack) args[i++], + (Integer) args[i++], + (Integer) args[i++] + ); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java b/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java index caaa842..b03749a 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java @@ -47,13 +47,15 @@ public AddRecipeAction(IItemStack output, IIngredient input, ILiquidStack fluidI @Override protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addAutoclaveRecipe( - (ItemStack) args[0], - (FluidStack) args[1], - (ItemStack) args[2], - (Integer) args[3], - (Integer) args[4], - (Integer) args[5]); + (ItemStack) args[i++], + (FluidStack) args[i++], + (ItemStack) args[i++], + (Integer) args[i++], + (Integer) args[i++], + (Integer) args[i++] + ); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java index 071b358..f79c512 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java @@ -66,16 +66,17 @@ public AddRecipeAction(IItemStack[] output, IIngredient[] input, int duration, i @Override protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addBlastRecipe( - (ItemStack) args[0], - (ItemStack) args[1], - null, - null, - (ItemStack) args[2], - (ItemStack) args[3], - (Integer) args[4], - (Integer) args[5], - (Integer) args[6]); + (ItemStack) args[i++], + (ItemStack) args[i++], + null, null, + (ItemStack) args[i++], + (ItemStack) args[i++], + (Integer) args[i++], + (Integer) args[i++], + (Integer) args[i++] + ); } } @@ -90,16 +91,18 @@ public AddFluidRecipeAction(IItemStack[] output, ILiquidStack fluidInput, IIngre @Override protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addBlastRecipe( - (ItemStack) args[0], - (ItemStack) args[1], - (FluidStack) args[2], + (ItemStack) args[i++], + (ItemStack) args[i++], + (FluidStack) args[i++], null, - (ItemStack) args[3], - (ItemStack) args[4], - (Integer) args[5], - (Integer) args[6], - (Integer) args[7]); + (ItemStack) args[i++], + (ItemStack) args[i++], + (Integer) args[i++], + (Integer) args[i++], + (Integer) args[i++] + ); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java b/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java index d12a3b8..30f67fa 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java @@ -46,11 +46,12 @@ public AddRecipeAction(ILiquidStack output, IIngredient ingredient, ILiquidStack @Override protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addBrewingRecipe( - (ItemStack) args[0], - ((FluidStack) args[1]).getFluid(), - ((FluidStack) args[2]).getFluid(), - (Boolean) args[3]); + (ItemStack) args[i++], + ((FluidStack) args[i++]).getFluid(), + ((FluidStack) args[i++]).getFluid(), + (Boolean) args[i++]); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Canner.java b/src/main/java/gttweaker/mods/gregtech/machines/Canner.java index d38bea0..b96323b 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Canner.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Canner.java @@ -63,13 +63,15 @@ public AddRecipeAction(IItemStack output1, IItemStack output2, IIngredient input @Override protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addCannerRecipe( - (ItemStack) args[0], - (ItemStack) args[1], - (ItemStack) args[2], - (ItemStack) args[3], - (Integer) args[4], - (Integer) args[5]); + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (Integer) args[i++], + (Integer) args[i++] + ); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java b/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java index bcff12d..910d923 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java @@ -1,17 +1,16 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import java.util.Arrays; - import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; @@ -28,8 +27,8 @@ public class Centrifuge { * * @param outputs array with 1-6 outputs * @param fluidOutput primary fluid output - * @param input primary input - * @param cells Cell input + * @param input1 primary input + * @param input2 Cell input * @param fluidInput primary fluid input * @param chances chance 1-6 * @param durationTicks reaction time, in ticks @@ -37,13 +36,13 @@ public class Centrifuge { * */ @ZenMethod - public static void addRecipe(IItemStack[] outputs, ILiquidStack fluidOutput, IIngredient input, IIngredient cells, ILiquidStack fluidInput, int[] chances, int durationTicks, int euPerTick) { + public static void addRecipe(IItemStack[] outputs, ILiquidStack fluidOutput, IIngredient input1, IIngredient input2, ILiquidStack fluidInput, int[] chances, int durationTicks, int euPerTick) { if (outputs.length < 1) { MineTweakerAPI.logError("Centrifuge must have at least 1 output"); } else if(outputs.length!=chances.length){ MineTweakerAPI.logError("Number of Outputs does not equal number of Chances"); }else { - MineTweakerAPI.apply(new AddFluidRecipeAction(outputs, fluidOutput, input, cells, fluidInput, chances, durationTicks, euPerTick)); + MineTweakerAPI.apply(new AddFluidRecipeAction(outputs, fluidOutput, input1, input2, fluidInput, chances, durationTicks, euPerTick)); } } @@ -70,179 +69,65 @@ public static void addRecipe(IItemStack[] outputs, IIngredient input, int cells, // ### Action classes ### // ###################### - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] output; - private final IIngredient input; - private final int cells; - private final int duration; - + private static class AddRecipeAction extends AddMultipleRecipeAction { public AddRecipeAction(IItemStack[] output, IIngredient input, int cells, int duration) { - - this.output = output; - this.input = input; - this.cells = cells; - this.duration = duration; + super("Adding centrifuge recipe with input " + input, input, cells, output[0], + output.length > 1 ? output[1] : null, + output.length > 2 ? output[2] : null, + output.length > 3 ? output[3] : null, + output.length > 4 ? output[4] : null, + output.length > 5 ? output[5] : null, + duration + ); } @Override - public void apply() { + protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addCentrifugeRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, - output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, - duration); - } - - @Override - public String describe() { - return "Adding centrifuge recipe with input " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 59 * hash + Arrays.deepHashCode(this.output); - hash = 59 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 59 * hash + this.cells; - hash = 59 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; + (ItemStack) args[i++], + (Integer) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (Integer) args[i++] + ); } } - private static class AddFluidRecipeAction extends OneWayAction { - - private final IItemStack[] outputs; - private final ILiquidStack fluidOutput; - private final IIngredient input; - private final IIngredient cells; - private final ILiquidStack fluidInput; - private final int [] chances; - private final int duration; - private final int euPerTick; - - public AddFluidRecipeAction(IItemStack[] outputs, ILiquidStack fluidOutput, IIngredient input, IIngredient cells, ILiquidStack fluidInput, int[] chances, int duration, int euPerTick) { - - this.outputs = outputs; - this.fluidOutput = fluidOutput; - this.input = input; - this.cells = cells; - this.fluidInput = fluidInput; - this.chances = chances; - this.duration = duration; - this.euPerTick = euPerTick; + private static class AddFluidRecipeAction extends AddMultipleRecipeAction { + public AddFluidRecipeAction(IItemStack[] output, ILiquidStack fluidOutput, IIngredient input1, IIngredient input2, ILiquidStack fluidInput, int[] chances, int duration, int euPerTick) { + super("Adding Centrifuge recipe with Fluids for " + input1, input1, input2, fluidOutput, fluidInput, output[0], + output.length > 1 ? output[1] : null, + output.length > 2 ? output[2] : null, + output.length > 3 ? output[3] : null, + output.length > 4 ? output[4] : null, + output.length > 5 ? output[5] : null, + chances, duration, euPerTick + ); } @Override - public void apply() { + protected void applySingleRecipe(Object[] args) { + int i = 0; RA.addCentrifugeRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(cells), - MineTweakerMC.getLiquidStack(fluidOutput), - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getItemStack(outputs[0]), - outputs.length > 1 ? MineTweakerMC.getItemStack(outputs[1]) : null, - outputs.length > 2 ? MineTweakerMC.getItemStack(outputs[2]) : null, - outputs.length > 3 ? MineTweakerMC.getItemStack(outputs[3]) : null, - outputs.length > 4 ? MineTweakerMC.getItemStack(outputs[4]) : null, - outputs.length > 5 ? MineTweakerMC.getItemStack(outputs[5]) : null, - chances, - duration, - euPerTick); - - } - - @Override - public String describe() { - return "Adding Centrifuge recipe with Fluids for " + input ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 6; - hash = 55 * hash + (this.outputs != null ? this.outputs.hashCode() : 0); - hash = 55 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 55 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 55 * hash + (this.cells != null ? this.cells.hashCode() : 0); - hash = 55 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 55 * hash + this.duration; - hash = 55 * hash + this.euPerTick; - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddFluidRecipeAction other = (AddFluidRecipeAction) obj; - if (this.outputs != other.outputs && (this.outputs == null || !this.outputs.equals(other.outputs))) { - return false; - } - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells && (this.cells == null || !this.cells.equals(other.cells))) { - return false; - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.chances != other.chances) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + (ItemStack) args[i++], + (ItemStack) args[i++], + (FluidStack) args[i++], + (FluidStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (ItemStack) args[i++], + (int[]) args[i++], + (Integer) args[i++], + (Integer) args[i++] + ); } } } \ No newline at end of file From 4bf022e4594f31a2da62c220c47a46f3946dd3f0 Mon Sep 17 00:00:00 2001 From: Techlone Date: Tue, 8 Mar 2016 00:17:31 +0500 Subject: [PATCH 11/12] Arguments iterator --- .../gregtech/AddMultipleRecipeAction.java | 74 ++++++++++++++----- src/main/java/gttweaker/util/ArrayHelper.java | 10 +++ 2 files changed, 65 insertions(+), 19 deletions(-) create mode 100644 src/main/java/gttweaker/util/ArrayHelper.java diff --git a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java index aeb123d..582403c 100644 --- a/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java +++ b/src/main/java/gttweaker/mods/gregtech/AddMultipleRecipeAction.java @@ -10,6 +10,7 @@ import minetweaker.api.liquid.ILiquidStack; import minetweaker.api.minecraft.MineTweakerMC; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import java.util.*; @@ -43,21 +44,7 @@ private static List> fullCopy(List> recipesData) { private String description; private List> recipesData; - - protected AddMultipleRecipeAction(String description, Object... recipeArgs) { - this.description = description; - - recipesData = new ArrayList>(recipeArgs.length); - recipesData.add(new ArrayList()); - - try { - for (Object recipeArg : recipeArgs) { - addArgument(recipeArg); - } - } catch (Exception e) { - MineTweakerAPI.logError(e.toString()); - } - } + private int aid; // argument index, equate to zero before applySingleRecipe call private void addArgument(Object recipeArg) { if (recipeArg instanceof ILiquidStack) { @@ -97,12 +84,63 @@ private List getItemStacks(IIngredient ingredientArg) { return itemStackList; } - protected abstract void applySingleRecipe(Object[] args); + protected AddMultipleRecipeAction(String description, Object... recipeArgs) { + this.description = description; + + recipesData = new ArrayList>(recipeArgs.length); + recipesData.add(new ArrayList()); + + try { + for (Object recipeArg : recipeArgs) { + addArgument(recipeArg); + } + } catch (Exception e) { + MineTweakerAPI.logError(e.toString()); + } + } + + protected abstract void applySingleRecipe(ArgIterator i); + + protected static class ArgIterator { + private Iterator iterator; + + public ArgIterator(List args) { + this.iterator = args.iterator(); + } + + public ItemStack nextItem() { + return (ItemStack) iterator.next(); + } + + public ItemStack[] nextItemArr() { + return (ItemStack[]) iterator.next(); + } + + public FluidStack nextFluid() { + return (FluidStack) iterator.next(); + } + + public FluidStack[] nextFluidArr() { + return (FluidStack[]) iterator.next(); + } + + public int nextInt() { + return (Integer) iterator.next(); + } + + public int[] nextIntArr() { + return (int[]) iterator.next(); + } + + public boolean nextBool() { + return (Boolean) iterator.next(); + } + } @Override public void apply() { for (List recipeData : recipesData) { - applySingleRecipe(recipeData.toArray()); + applySingleRecipe(new ArgIterator(recipeData)); } } @@ -122,9 +160,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; AddMultipleRecipeAction that = (AddMultipleRecipeAction) o; - return recipesData != null ? recipesData.equals(that.recipesData) : that.recipesData == null; - } @Override diff --git a/src/main/java/gttweaker/util/ArrayHelper.java b/src/main/java/gttweaker/util/ArrayHelper.java new file mode 100644 index 0000000..32cb7f7 --- /dev/null +++ b/src/main/java/gttweaker/util/ArrayHelper.java @@ -0,0 +1,10 @@ +package gttweaker.util; + +/** + * @author Techlone + */ +public class ArrayHelper { + public static T itemOrNull(T[] array, int i) { + return array.length > i ? array[i] : null; + } +} From 19dcfbaba95a20588edc98c6620aa7781ea4eae6 Mon Sep 17 00:00:00 2001 From: Techlone Date: Tue, 8 Mar 2016 00:17:51 +0500 Subject: [PATCH 12/12] Ore dict support --- .../java/gttweaker/mods/gregtech/Fuels.java | 99 ++------ .../mods/gregtech/machines/AlloySmelter.java | 38 +-- .../gregtech/machines/Amplifabricator.java | 36 +-- .../mods/gregtech/machines/ArcFurnace.java | 31 +-- .../mods/gregtech/machines/Assembler.java | 60 ++--- .../mods/gregtech/machines/Autoclave.java | 31 +-- .../mods/gregtech/machines/Blastfurnace.java | 76 +----- .../mods/gregtech/machines/Brewery.java | 38 +-- .../mods/gregtech/machines/Canner.java | 92 +++---- .../mods/gregtech/machines/Centrifuge.java | 101 ++------ .../mods/gregtech/machines/ChemicalBath.java | 101 +------- .../gregtech/machines/ChemicalReactor.java | 176 +------------- .../mods/gregtech/machines/CuttingSaw.java | 114 ++------- .../gregtech/machines/DistillationTower.java | 111 +-------- .../mods/gregtech/machines/Distillery.java | 103 +------- .../mods/gregtech/machines/Electrolyzer.java | 228 ++---------------- .../mods/gregtech/machines/Extruder.java | 97 +------- .../mods/gregtech/machines/Fermenter.java | 92 +------ .../mods/gregtech/machines/FluidCanner.java | 95 +------- .../gregtech/machines/FluidExtractor.java | 98 +------- .../mods/gregtech/machines/FluidHeater.java | 95 +------- .../gregtech/machines/FluidSolidifier.java | 97 +------- .../mods/gregtech/machines/ForgeHammer.java | 86 +------ .../mods/gregtech/machines/FormingPress.java | 81 +------ .../mods/gregtech/machines/FusionReactor.java | 106 +------- .../machines/ImplosionCompressor.java | 93 +------ .../mods/gregtech/machines/Lathe.java | 104 ++------ .../mods/gregtech/machines/Mixer.java | 200 ++------------- .../mods/gregtech/machines/OilCracker.java | 89 +------ .../mods/gregtech/machines/Packer.java | 81 +------ .../gregtech/machines/PlasmaArcFurnace.java | 106 +------- .../mods/gregtech/machines/PlateBender.java | 86 +------ .../mods/gregtech/machines/Polarizer.java | 74 +----- .../gregtech/machines/PrecisionLaser.java | 79 +----- .../mods/gregtech/machines/Printer.java | 98 +------- .../mods/gregtech/machines/Pulverizer.java | 90 +------ .../mods/gregtech/machines/PyrolyseOven.java | 101 +------- .../mods/gregtech/machines/Separator.java | 89 +------ .../mods/gregtech/machines/Sifter.java | 99 +------- .../mods/gregtech/machines/Slicer.java | 80 +----- .../mods/gregtech/machines/Unpacker.java | 79 +----- .../mods/gregtech/machines/VacuumFreezer.java | 72 +----- .../mods/gregtech/machines/Wiremill.java | 79 +----- 43 files changed, 467 insertions(+), 3514 deletions(-) diff --git a/src/main/java/gttweaker/mods/gregtech/Fuels.java b/src/main/java/gttweaker/mods/gregtech/Fuels.java index 4a832a7..6b3de15 100644 --- a/src/main/java/gttweaker/mods/gregtech/Fuels.java +++ b/src/main/java/gttweaker/mods/gregtech/Fuels.java @@ -1,11 +1,9 @@ package gttweaker.mods.gregtech; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -24,8 +22,8 @@ public class Fuels { * Adds a Diesel Engine fuel. If the given item does not contain any liquid, * it will generate the equivalent of 1000 millibuckets. * - * @param output output item (optional, can be null) - * @param input input item + * @param output output item (optional, can be null) + * @param input input item * @param euPerMillibucket eu production per millibucket */ @ZenMethod @@ -37,8 +35,8 @@ public static void addDieselFuel(IItemStack output, IIngredient input, int euPer * Adds a Gas Turbine fuel. If the given item does not contain any liquid, * it will generate the equivalent of 1000 millibuckets. * - * @param output output item (optional, can be null) - * @param input input item + * @param output output item (optional, can be null) + * @param input input item * @param euPerMillibucket eu production per millibucket */ @ZenMethod @@ -50,8 +48,8 @@ public static void addGasTurbineFuel(IItemStack output, IIngredient input, int e * Adds a Thermal Generator fuel. If the given item does not contain any * liquid, it will generate the equivalent of 1000 millibuckets. * - * @param output output item (optional, can be null) - * @param input input item + * @param output output item (optional, can be null) + * @param input input item * @param euPerMillibucket eu production per millibucket */ @ZenMethod @@ -63,8 +61,8 @@ public static void addThermalGeneratorFuel(IItemStack output, IIngredient input, * Adds a Dense Fluid Generator fuel. If the given item does not contain any * liquid, it will generate the equivalent of 1000 millibuckets. * - * @param output output item (optional, can be null) - * @param input input item + * @param output output item (optional, can be null) + * @param input input item * @param euPerMillibucket eu production per millibucket */ @ZenMethod @@ -76,8 +74,8 @@ public static void addDenseFluidFuel(IItemStack output, IIngredient input, int e * Adds a Plasma Generator fuel. If the given item does not contain any * liquid, it will generate the equivalent of 1000 millibuckets. * - * @param output output item (optional, can be null) - * @param input input item + * @param output output item (optional, can be null) + * @param input input item * @param euPerMillibucket eu production per millibucket */ @ZenMethod @@ -89,8 +87,8 @@ public static void addPlasmaGeneratorFuel(IItemStack output, IIngredient input, * Adds a Magic Generator fuel. If the given item does not contain any liquid, * it will generate the equivalent of 1000 millibuckets. * - * @param output output item (optional, can be null) - * @param input input item + * @param output output item (optional, can be null) + * @param input input item * @param euPerMillibucket eu production per millibucket */ @ZenMethod @@ -102,79 +100,16 @@ public static void addMagicGeneratorFuel(IItemStack output, IIngredient input, i // ### Action classes ### // ###################### - private static class AddRecipeAction extends OneWayAction { - private static final String[] GENERATORS = { - "diesel", - "gas turbine", - "thermal", - "dense fluid", - "plasma", - "magic" - }; - - private final IItemStack output; - private final IIngredient input; - private final int euPerMillibucket; - private final int type; + private static class AddRecipeAction extends AddMultipleRecipeAction { + private static final String[] GENERATORS = {"diesel", "gas turbine", "thermal", "dense fluid", "plasma", "magic"}; public AddRecipeAction(IItemStack output, IIngredient input, int euPerMillibucket, int type) { - this.output = output; - this.input = input; - this.euPerMillibucket = euPerMillibucket; - this.type = type; - } - - @Override - public void apply() { - RA.addFuel( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - euPerMillibucket, - type); - } - - @Override - public String describe() { - return "Adding " + GENERATORS[type] + " fuel " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 59 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 59 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 59 * hash + this.euPerMillibucket; - hash = 59 * hash + this.type; - return hash; + super("Adding " + GENERATORS[type] + " fuel " + input, input, output, euPerMillibucket, type); } @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.euPerMillibucket != other.euPerMillibucket) { - return false; - } - if (this.type != other.type) { - return false; - } - return true; + protected void applySingleRecipe(ArgIterator i) { + RA.addFuel(i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java index cc022d5..5a70ae7 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/AlloySmelter.java @@ -5,7 +5,6 @@ import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import net.minecraft.item.ItemStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -23,36 +22,19 @@ public class AlloySmelter { /** * Adds an alloy smelter recipe. * - * @param output alloy smelter output - * @param input1 primary input - * @param input2 secondary input + * @param output alloy smelter output + * @param input1 primary input + * @param input2 secondary input * @param durationTicks smelting time, in ticks - * @param euPerTick eu consumption per tick + * @param euPerTick eu consumption per tick */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) { - super("Adding alloy smelter recipe for " + output, input1, input2, output, duration, euPerTick); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addAlloySmelterRecipe( - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (Integer) args[i++], - (Integer) args[i++] - ); - } + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding alloy smelter recipe for " + output, input1, input2, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addAlloySmelterRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); + } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java b/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java index e6edc8c..b02b241 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Amplifabricator.java @@ -4,7 +4,6 @@ import minetweaker.MineTweakerAPI; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; -import net.minecraft.item.ItemStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -22,33 +21,16 @@ public class Amplifabricator { /** * Adds a Amplifabricator recipe. * - * @param input primary Input - * @param duration reaction time, in ticks - * @param amount amount in mb of Liquid UU Output - * + * @param input primary Input + * @param duration reaction time, in ticks */ @ZenMethod - public static void addRecipe(IIngredient input, int duration, int amount) { - MineTweakerAPI.apply(new AddRecipeAction(input, duration, amount)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IIngredient input, int duration, int amount) { - super("Adding Amplifabricator recipe for " + input, input, duration, amount); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addAmplifier( - (ItemStack) args[i++], - (Integer) args[i++], - (Integer) args[i++] - ); - } + public static void addRecipe(IIngredient input, int duration, int amount) { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Amplifabricator recipe for " + input, input, duration, amount) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addAmplifier(i.nextItem(), i.nextInt(), i.nextInt()); + } + }); } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java index 3ebbbd2..ddd7fe1 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ArcFurnace.java @@ -6,8 +6,6 @@ import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -39,29 +37,12 @@ public static void addRecipe(IItemStack[] outputs, IIngredient input, ILiquidSta } else if (outputs.length != outChances.length) { MineTweakerAPI.logError("Number of Outputs does not equal number of Chances"); } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, fluidInput, outChances, durationTicks, euPerTick)); - } - } - -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack[] output, IIngredient input, ILiquidStack fluidInput, int[] outChances, int duration, int euPerTick) { - super("Adding Arc Furnace recipe for " + input, input, fluidInput, output, outChances, duration, euPerTick); - } - - @Override - public void applySingleRecipe(Object[] args) { - int i = 0; - RA.addSimpleArcFurnaceRecipe( - (ItemStack) args[i++], - (FluidStack) args[i++], - (ItemStack[]) args[i++], - (int[]) args[i++], - (Integer) args[i++], - (Integer) args[i++] - ); + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Arc Furnace recipe for " + input, input, fluidInput, outputs, outChances, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addSimpleArcFurnaceRecipe(i.nextItem(), i.nextFluid(), i.nextItemArr(), i.nextIntArr(), i.nextInt(), i.nextInt()); + } + }); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java b/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java index 1a7ca4a..9901411 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Assembler.java @@ -6,8 +6,6 @@ import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -30,57 +28,27 @@ public class Assembler { * @param output recipe output * @param input1 primary input * @param input2 secondary input (optional, can be null) - * @param fluidInput1 primary fluidInput + * @param fluidInput primary fluidInput * @param durationTicks assembling duration, in ticks * @param euPerTick eu consumption per tick */ @ZenMethod - public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, ILiquidStack fluidInput1, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddFluidRecipeAction(output, input1, input2, fluidInput1, durationTicks, euPerTick)); + public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, ILiquidStack fluidInput, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding assembler recipe with fluid Support for " + output, input1, input2, fluidInput, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addAssemblerRecipe(i.nextItem(), i.nextItem(), i.nextFluid(), i.nextItem(), i.nextInt(), i.nextInt()); + } + }); } @ZenMethod public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } - -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) { - super("Adding assembler recipe for " + output, input1, input2, output, duration, euPerTick); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addAssemblerRecipe( - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (Integer) args[i++], - (Integer) args[i++] - ); - } - } - - private static class AddFluidRecipeAction extends AddMultipleRecipeAction { - public AddFluidRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, ILiquidStack fluidInput1, int duration, int euPerTick) { - super("Adding assembler recipe with fluid Support for " + output, input1, input2, fluidInput1, output, duration, euPerTick); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addAssemblerRecipe( - (ItemStack) args[i++], - (ItemStack) args[i++], - (FluidStack) args[i++], - (ItemStack) args[i++], - (Integer) args[i++], - (Integer) args[i++] - ); - } + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding assembler recipe for " + output, input1, input2, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addAssemblerRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); + } + }); } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java b/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java index b03749a..68a17f7 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Autoclave.java @@ -6,8 +6,6 @@ import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -34,28 +32,11 @@ public class Autoclave { */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, ILiquidStack fluidInput, int chances, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, fluidInput, chances, durationTicks, euPerTick)); - } - -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack output, IIngredient input, ILiquidStack fluidInput, int chances, int duration, int euPerTick) { - super("Adding Autoclave recipe for " + output, input, fluidInput, output, chances, duration, euPerTick); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addAutoclaveRecipe( - (ItemStack) args[i++], - (FluidStack) args[i++], - (ItemStack) args[i++], - (Integer) args[i++], - (Integer) args[i++], - (Integer) args[i++] - ); - } + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Autoclave recipe for " + output, input, fluidInput, output, chances, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addAutoclaveRecipe(i.nextItem(), i.nextFluid(), i.nextItem(), i.nextInt(), i.nextInt(), i.nextInt()); + } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java index f79c512..0c150ca 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Blastfurnace.java @@ -6,13 +6,12 @@ import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; +import static gttweaker.util.ArrayHelper.itemOrNull; /** * Provides access to the Blast Furnace recipes. @@ -31,78 +30,23 @@ public class Blastfurnace { * @param durationTicks reaction time, in ticks * @param euPerTick eu consumption per tick * @param heat heat in Kelvin - * */ - @ZenMethod - public static void addRecipe(IItemStack[]output, ILiquidStack fluidInput, IIngredient[] input, int durationTicks, int euPerTick, int heat) { + public static void addRecipe(IItemStack[] output, ILiquidStack fluidInput, IIngredient[] input, int durationTicks, int euPerTick, int heat) { if (output.length == 0) { MineTweakerAPI.logError("Blast furnace recipe requires at least 1 input"); } else { - MineTweakerAPI.apply(new AddFluidRecipeAction(output, fluidInput, input, durationTicks, euPerTick, heat)); + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Blast furnace recipe for " + output, input[0], itemOrNull(input, 1), fluidInput, output[0], itemOrNull(output, 1), durationTicks, euPerTick, heat) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addBlastRecipe(i.nextItem(), i.nextItem(), i.nextFluid(), null, i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt(), i.nextInt()); + } + }); } } + @ZenMethod public static void addRecipe(IItemStack[] output, IIngredient[] input, int durationTicks, int euPerTick, int heat) { - if (output.length == 0) { - MineTweakerAPI.logError("Blast furnace recipe requires at least 1 input"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick, heat)); - } - - } - -// ###################### -// ### Action classes ### -// ###################### - - private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack[] output, IIngredient[] input, int duration, int euPerTick, int heat) { - super("Adding Blast furnace recipe for " + output, - input[0], input.length > 1 ? input[1] : null, - output[0], output.length > 1 ? output[1] : null, - duration, euPerTick, heat); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addBlastRecipe( - (ItemStack) args[i++], - (ItemStack) args[i++], - null, null, - (ItemStack) args[i++], - (ItemStack) args[i++], - (Integer) args[i++], - (Integer) args[i++], - (Integer) args[i++] - ); - } - } - - private static class AddFluidRecipeAction extends AddMultipleRecipeAction { - public AddFluidRecipeAction(IItemStack[] output, ILiquidStack fluidInput, IIngredient[] input, int duration, int euPerTick, int heat) { - super("Adding Blast furnace recipe for " + output, - input[0], input.length > 1 ? input[1] : null, - fluidInput, - output[0], output.length > 1 ? output[1] : null, - duration, euPerTick, heat); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addBlastRecipe( - (ItemStack) args[i++], - (ItemStack) args[i++], - (FluidStack) args[i++], - null, - (ItemStack) args[i++], - (ItemStack) args[i++], - (Integer) args[i++], - (Integer) args[i++], - (Integer) args[i++] - ); - } + addRecipe(output, null, input, durationTicks, euPerTick, heat); } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java b/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java index 30f67fa..7523ecb 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Brewery.java @@ -5,8 +5,6 @@ import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.liquid.ILiquidStack; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -24,34 +22,18 @@ public class Brewery { /** * Adds a Brewing Machine recipe. * - * @param output primary fluid output - * @param ingredient primary ingredient - * @param input primary fluid ingredient - * @param hidden hidden true or false - * + * @param output primary fluid output + * @param ingredient primary ingredient + * @param input primary fluid ingredient + * @param hidden hidden true or false */ @ZenMethod public static void addRecipe(ILiquidStack output, IIngredient ingredient, ILiquidStack input, boolean hidden) { - MineTweakerAPI.apply(new AddRecipeAction(output, ingredient, input, hidden)); - } - -// ###################### -// ### Action classes ### -// ###################### - - private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(ILiquidStack output, IIngredient ingredient, ILiquidStack input, boolean hidden) { - super("Adding Brewery recipe for " + output, ingredient, input, output, hidden); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addBrewingRecipe( - (ItemStack) args[i++], - ((FluidStack) args[i++]).getFluid(), - ((FluidStack) args[i++]).getFluid(), - (Boolean) args[i++]); - } + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Brewery recipe for " + output, ingredient, input, output, hidden) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addBrewingRecipe(i.nextItem(), i.nextFluid().getFluid(), i.nextFluid().getFluid(), i.nextBool()); + } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Canner.java b/src/main/java/gttweaker/mods/gregtech/machines/Canner.java index b96323b..f688067 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Canner.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Canner.java @@ -5,7 +5,6 @@ import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import net.minecraft.item.ItemStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -14,64 +13,47 @@ /** * Provider access to the Canner recipes. - * + * * @author Stan Hebben */ @ZenClass("mods.gregtech.Canner") @ModOnly(MOD_ID) public class Canner { - /** - * Adds a canner recipe with a single output. - * - * @param output crafting output - * @param input1 primary input - * @param input2 secondary input (optional - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input1, input2, durationTicks, euPerTick)); - } + /** + * Adds a canner recipe with a single output. + * + * @param output crafting output + * @param input1 primary input + * @param input2 secondary input (optional + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { + addRecipe(new IItemStack[]{output}, input1, input2, durationTicks, euPerTick); + } - /** - * Adds a canner recipe with multiple outputs. - * - * @param output array with 1 or 2 outputs - * @param input1 primary inputs - * @param input2 secondary inputs - * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick - */ - @ZenMethod - public static void addRecipe(IItemStack[] output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { - if (output.length == 0) { - MineTweakerAPI.logError("canner requires at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input1, input2, durationTicks, euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack output1, IItemStack output2, IIngredient input1, IIngredient input2, int duration, int euPerTick) { - super("Adding canner recipe for " + output1, input1, input2, output1, output2, duration, euPerTick); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addCannerRecipe( - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (Integer) args[i++], - (Integer) args[i++] - ); - } - } + /** + * Adds a canner recipe with multiple outputs. + * + * @param output array with 1 or 2 outputs + * @param input1 primary inputs + * @param input2 secondary inputs + * @param durationTicks crafting duration, in ticks + * @param euPerTick eu consumption per tick + */ + @ZenMethod + public static void addRecipe(IItemStack[] output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { + if (output.length == 0) { + MineTweakerAPI.logError("canner requires at least 1 output"); + } else { + IItemStack output1 = output.length > 1 ? output[1] : null; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding canner recipe for " + output1, output[0], output1, input1, input2, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addCannerRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); + } + }); + } + } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java b/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java index 910d923..0ab94b9 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Centrifuge.java @@ -6,13 +6,12 @@ import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; +import static gttweaker.util.ArrayHelper.itemOrNull; /** * Provides access to the Centrifuge recipes. @@ -33,101 +32,43 @@ public class Centrifuge { * @param chances chance 1-6 * @param durationTicks reaction time, in ticks * @param euPerTick eu consumption per tick - * */ @ZenMethod public static void addRecipe(IItemStack[] outputs, ILiquidStack fluidOutput, IIngredient input1, IIngredient input2, ILiquidStack fluidInput, int[] chances, int durationTicks, int euPerTick) { if (outputs.length < 1) { MineTweakerAPI.logError("Centrifuge must have at least 1 output"); - } else if(outputs.length!=chances.length){ + } else if (outputs.length != chances.length) { MineTweakerAPI.logError("Number of Outputs does not equal number of Chances"); - }else { - MineTweakerAPI.apply(new AddFluidRecipeAction(outputs, fluidOutput, input1, input2, fluidInput, chances, durationTicks, euPerTick)); + } else { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Centrifuge recipe with Fluids for " + input1, input1, input2, fluidOutput, fluidInput, outputs[0], + itemOrNull(outputs, 1), itemOrNull(outputs, 2), itemOrNull(outputs, 3), itemOrNull(outputs, 4), itemOrNull(outputs, 5), chances, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addCentrifugeRecipe(i.nextItem(), i.nextItem(), i.nextFluid(), i.nextFluid(), i.nextItem(), i.nextItem(), + i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextIntArr(), i.nextInt(), i.nextInt()); + } + }); } } @ZenMethod public static void addRecipeFuelCan(IItemStack[] outputs, IIngredient input, int numCans, int duration) { - if (outputs.length < 1) { - MineTweakerAPI.logError("centrifuge must have at least 1 output"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, -numCans, duration)); - } + addRecipe(outputs, input, -numCans, duration); } @ZenMethod public static void addRecipe(IItemStack[] outputs, IIngredient input, int cells, int durationTicks) { if (outputs.length < 1) { - MineTweakerAPI.logError("centrifuge must have at least 1 output"); + MineTweakerAPI.logError("Centrifuge must have at least 1 output"); } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, cells, durationTicks)); - } - } - - -// ###################### -// ### Action classes ### -// ###################### - - private static class AddRecipeAction extends AddMultipleRecipeAction { - public AddRecipeAction(IItemStack[] output, IIngredient input, int cells, int duration) { - super("Adding centrifuge recipe with input " + input, input, cells, output[0], - output.length > 1 ? output[1] : null, - output.length > 2 ? output[2] : null, - output.length > 3 ? output[3] : null, - output.length > 4 ? output[4] : null, - output.length > 5 ? output[5] : null, - duration - ); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addCentrifugeRecipe( - (ItemStack) args[i++], - (Integer) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (Integer) args[i++] - ); - } - } - - private static class AddFluidRecipeAction extends AddMultipleRecipeAction { - public AddFluidRecipeAction(IItemStack[] output, ILiquidStack fluidOutput, IIngredient input1, IIngredient input2, ILiquidStack fluidInput, int[] chances, int duration, int euPerTick) { - super("Adding Centrifuge recipe with Fluids for " + input1, input1, input2, fluidOutput, fluidInput, output[0], - output.length > 1 ? output[1] : null, - output.length > 2 ? output[2] : null, - output.length > 3 ? output[3] : null, - output.length > 4 ? output[4] : null, - output.length > 5 ? output[5] : null, - chances, duration, euPerTick - ); - } - - @Override - protected void applySingleRecipe(Object[] args) { - int i = 0; - RA.addCentrifugeRecipe( - (ItemStack) args[i++], - (ItemStack) args[i++], - (FluidStack) args[i++], - (FluidStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (ItemStack) args[i++], - (int[]) args[i++], - (Integer) args[i++], - (Integer) args[i++] - ); + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding centrifuge recipe with input " + input, input, cells, outputs[0], + itemOrNull(outputs, 1), itemOrNull(outputs, 2), itemOrNull(outputs, 3), itemOrNull(outputs, 4), itemOrNull(outputs, 5), durationTicks) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addCentrifugeRecipe(i.nextItem(), i.nextInt(), i.nextItem(), i.nextItem(), + i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt()); + } + }); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ChemicalBath.java b/src/main/java/gttweaker/mods/gregtech/machines/ChemicalBath.java index 2792da8..6820c3c 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ChemicalBath.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ChemicalBath.java @@ -1,17 +1,17 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; +import static gttweaker.util.ArrayHelper.itemOrNull; /** * Provides access to the Chemical Bath recipes. @@ -36,96 +36,13 @@ public static void addRecipe(IItemStack[] output, IIngredient input, ILiquidStac if (output.length == 0) { MineTweakerAPI.logError("chemical bath requires at least 1 output"); } else { - MineTweakerAPI.apply(new AddRecipeAction(output, input, fluidInput, chances, durationTicks, euPerTick)); - } - } - -// ###################### -// ### Action classes ### -// ###################### - - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack[] output; - private final IIngredient input; - private final ILiquidStack fluidInput; - private final int[] chances; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] output, IIngredient input, ILiquidStack fluidInput, int[] chances, int duration, int euPerTick) { - - this.output = output; - this.input = input; - this.fluidInput = fluidInput; - this.chances = chances; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addChemicalBathRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - chances, - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Chemical Bath recipe for " + input ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 9; - hash = 8 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 8 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 8 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 8 * hash + this.duration; - hash = 8 * hash + this.euPerTick; - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.chances != other.chances) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Chemical Bath recipe for " + input, input, fluidInput, output[0], + itemOrNull(output, 1), itemOrNull(output, 2), chances, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addChemicalBathRecipe(i.nextItem(), i.nextFluid(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextIntArr(), i.nextInt(), i.nextInt()); + } + }); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ChemicalReactor.java b/src/main/java/gttweaker/mods/gregtech/machines/ChemicalReactor.java index bd10110..7e928dc 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ChemicalReactor.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ChemicalReactor.java @@ -1,12 +1,11 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -25,175 +24,24 @@ public class ChemicalReactor { * Adds a Chemical Reactor recipe. * * @param output recipe output - * @param fluidOutput1 primary fluidInput + * @param fluidOutput primary fluidInput * @param input1 primary input * @param input2 secondary input - * @param fluidInput1 primary fluidInput + * @param fluidInput primary fluidInput * @param durationTicks reaction time, in ticks */ @ZenMethod - public static void addRecipe(IItemStack output, ILiquidStack fluidOutput1, IIngredient input1, IIngredient input2, ILiquidStack fluidInput1, int durationTicks) { - MineTweakerAPI.apply(new AddFluidRecipeAction(output, fluidOutput1, input1, input2, fluidInput1, durationTicks)); - } - - @ZenMethod - public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks)); - } - -// ###################### -// ### Action classes ### -// ###################### - - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input1; - private final IIngredient input2; - private final int duration; - - public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration) { - - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - } - - @Override - public void apply() { - RA.addChemicalRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration); - } - - @Override - public String describe() { - return "Adding Chemical Reactor recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 11 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 11 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 11 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 11 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; + public static void addRecipe(IItemStack output, ILiquidStack fluidOutput, IIngredient input1, IIngredient input2, ILiquidStack fluidInput, int durationTicks) { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Chemical Reactor recipe for " + output, input1, input2, fluidInput, fluidOutput, output, durationTicks) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addChemicalRecipe(i.nextItem(), i.nextItem(), i.nextFluid(), i.nextFluid(), i.nextItem(), i.nextInt()); } - if (this.duration != other.duration) { - return false; - } - return true; - } + }); } - private static class AddFluidRecipeAction extends OneWayAction { - - private final IItemStack output; - private final ILiquidStack fluidOutput1; - private final IIngredient input1; - private final IIngredient input2; - private final ILiquidStack fluidInput1; - private final int duration; - - public AddFluidRecipeAction(IItemStack output, ILiquidStack fluidOutput1, IIngredient input1, IIngredient input2, ILiquidStack fluidInput1, int duration) { - - this.output = output; - this.fluidOutput1 = fluidOutput1; - this.input1 = input1; - this.input2 = input2; - this.fluidInput1 = fluidInput1; - this.duration = duration; - } - - @Override - public void apply() { - RA.addChemicalRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getLiquidStack(fluidInput1), - MineTweakerMC.getLiquidStack(fluidOutput1), - MineTweakerMC.getItemStack(output), - duration); - } - - @Override - public String describe() { - return "Adding Chemical Reactor recipe with Liquid support for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 12 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 12 * hash + (this.fluidOutput1 != null ? this.fluidOutput1.hashCode() : 0); - hash = 12 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 12 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 12 * hash + (this.fluidInput1 != null ? this.fluidInput1.hashCode() : 0); - hash = 12 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddFluidRecipeAction other = (AddFluidRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.fluidOutput1 != other.fluidOutput1 && (this.fluidOutput1 == null || !this.fluidOutput1.equals(other.fluidOutput1))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.fluidInput1 != other.fluidInput1 && (this.fluidInput1 == null || !this.fluidInput1.equals(other.fluidInput1))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - return true; - } + @ZenMethod + public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks) { + addRecipe(output, null, input1, input2, null, durationTicks); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java b/src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java index d629097..0b41485 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/CuttingSaw.java @@ -1,17 +1,17 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; +import static gttweaker.util.ArrayHelper.itemOrNull; /** * Provides access to the Saw recipes. @@ -34,7 +34,21 @@ public class CuttingSaw { */ @ZenMethod public static void addRecipe(IItemStack output1, IItemStack output2, IIngredient input, ILiquidStack lubricant, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output1, output2, input, lubricant, durationTicks, euPerTick)); + if (lubricant == null) { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Cutting Saw recipe for " + input, input, output1, output2, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addCutterRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); + } + }); + } else { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Cutting Saw recipe for " + input, input, lubricant, output1, output2, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addCutterRecipe(i.nextItem(), i.nextFluid(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); + } + }); + } } @ZenMethod @@ -42,99 +56,7 @@ public static void addRecipe(IItemStack[] output, IIngredient input, ILiquidStac if (output.length == 0) { MineTweakerAPI.logError("canner requires at least 1 output"); } else { - MineTweakerAPI.apply(new AddRecipeAction(output[0], output.length > 1 ? output[1] : null, input, lubricant, durationTicks, euPerTick)); - } - } - -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output1; - private final IItemStack output2; - private final IIngredient input; - private final ILiquidStack lubricant; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IIngredient input, ILiquidStack lubricant, int duration, int euPerTick1) { - - this.output1 = output1; - this.output2 = output2; - this.input = input; - this.lubricant = lubricant; - this.duration = duration; - this.euPerTick = euPerTick1; - } - - @Override - public void apply() { - if (lubricant == null) { - RA.addCutterRecipe(MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - - } else { - RA.addCutterRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getLiquidStack(lubricant), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - } - - @Override - public String describe() { - return "Adding Cutting Saw recipe for " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 99 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 99 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 99 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 99 * hash + (this.lubricant != null ? this.lubricant.hashCode() : 0); - hash = 99 * hash + this.duration; - hash = 99 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.lubricant != other.lubricant && (this.lubricant == null || !this.lubricant.equals(other.lubricant))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + addRecipe(output[0], itemOrNull(output, 1), input, lubricant, durationTicks, euPerTick); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/DistillationTower.java b/src/main/java/gttweaker/mods/gregtech/machines/DistillationTower.java index e38b95f..46a5214 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/DistillationTower.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/DistillationTower.java @@ -1,18 +1,13 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; -import net.minecraftforge.fluids.FluidStack; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import java.util.Arrays; - import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; @@ -28,103 +23,23 @@ public class DistillationTower { /** * Adds an Distillation Tower recipe. * - * @param fluidInput Fluid Input - * @param fluidOutput Up to 6 Fluid Outputs - * @param itemOutput Item output Slot - * @param durationTicks duration, in ticks - * @param euPerTick eu consumption per tick + * @param fluidInput Fluid Input + * @param fluidOutput Up to 6 Fluid Outputs + * @param itemOutput Item output Slot + * @param durationTicks duration, in ticks + * @param euPerTick eu consumption per tick */ @ZenMethod public static void addRecipe(ILiquidStack[] fluidOutput, IItemStack itemOutput, ILiquidStack fluidInput, int durationTicks, int euPerTick) { if (fluidOutput.length < 1) { MineTweakerAPI.logError("Distillation Twower must have at least 1 Fluid output"); - }else { - MineTweakerAPI.apply(new AddRecipeAction(fluidOutput, itemOutput, fluidInput, durationTicks, euPerTick)); - } - } - -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final FluidStack[] fluidOutput; - private final IItemStack itemOutput; - private final ILiquidStack fluidInput; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(ILiquidStack[] fluidOutput, IItemStack itemOutput, ILiquidStack fluidInput, int duration, int euPerTick) { - - this.fluidOutput = new FluidStack[fluidOutput.length]; - this.itemOutput = itemOutput; - this.fluidInput = fluidInput; - this.duration = duration; - this.euPerTick = euPerTick; - - for(int i =0;i< fluidOutput.length;i++){ - this.fluidOutput[i]=MineTweakerMC.getLiquidStack(fluidOutput[i]); - } - - } - - - @Override - public void apply() { - RA.addDistillationTowerRecipe( - MineTweakerMC.getLiquidStack(fluidInput), - this.fluidOutput, - MineTweakerMC.getItemStack(itemOutput), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Distillation Tower recipe for " + fluidInput.getDisplayName(); - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 1; - hash = 9 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 9 * hash + Arrays.deepHashCode(this.fluidOutput); - hash = 9 * hash + (this.itemOutput != null ? this.itemOutput.hashCode() : 0); - hash = 9 * hash + this.duration; - hash = 9 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (!Arrays.deepEquals(this.fluidOutput, other.fluidOutput)) { - return false; - } - if (this.itemOutput != other.itemOutput && (this.itemOutput == null || !this.itemOutput.equals(other.itemOutput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + } else { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Distillation Tower recipe for " + fluidInput.getDisplayName(), fluidInput, fluidOutput, itemOutput, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addDistillationTowerRecipe(i.nextFluid(), i.nextFluidArr(), i.nextItem(), i.nextInt(), i.nextInt()); + } + }); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Distillery.java b/src/main/java/gttweaker/mods/gregtech/machines/Distillery.java index 90734a3..24ef246 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Distillery.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Distillery.java @@ -1,12 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -25,102 +23,19 @@ public class Distillery { * Adds a Distillery recipe. * * @param fluidOutput Fluid output - * @param Circuit Circuit + * @param circuit Circuit * @param fluidInput fluidInput * @param durationTicks reaction time, in ticks * @param euPerTick eu consumption per tick - * @param Hidden hidden - * + * @param hidden hidden */ @ZenMethod - public static void addRecipe(ILiquidStack fluidOutput, IItemStack Circuit, ILiquidStack fluidInput, int durationTicks, int euPerTick, boolean Hidden) { - MineTweakerAPI.apply(new AddRecipeAction(fluidOutput, Circuit, fluidInput, durationTicks, euPerTick, Hidden)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - - private final ILiquidStack fluidOutput; - private final IItemStack Circuit; - private final ILiquidStack fluidInput; - private final int duration; - private final int euPerTick; - private final boolean Hidden; - - public AddRecipeAction(ILiquidStack fluidOutput, IItemStack Circuit, ILiquidStack fluidInput, int duration, int euPerTick, boolean Hidden) { - - this.fluidOutput = fluidOutput; - this.Circuit = Circuit; - this.fluidInput = fluidInput; - this.duration = duration; - this.euPerTick = euPerTick; - this.Hidden = Hidden; - } - - @Override - public void apply() { - RA.addDistilleryRecipe( - MineTweakerMC.getItemStack(Circuit), - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getLiquidStack(fluidOutput), - duration, - euPerTick, - Hidden); - } - - @Override - public String describe() { - return "Adding Distillery recipe for " + fluidOutput ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 9; - hash = 8 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 8 * hash + (this.Circuit != null ? this.Circuit.hashCode() : 0); - hash = 8 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 8 * hash + this.duration; - hash = 8 * hash + this.euPerTick; - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.Circuit != other.Circuit && (this.Circuit == null || !this.Circuit.equals(other.Circuit))) { - - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - if (this.Hidden != other.Hidden) { - return false; + public static void addRecipe(ILiquidStack fluidOutput, IItemStack circuit, ILiquidStack fluidInput, int durationTicks, int euPerTick, boolean hidden) { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Distillery recipe for " + fluidOutput, circuit, fluidInput, fluidOutput, durationTicks, euPerTick, hidden) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addDistilleryRecipe(i.nextItem(), i.nextFluid(), i.nextFluid(), i.nextInt(), i.nextInt(), i.nextBool()); } - return true; - } + }); } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java b/src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java index b7d775c..c6dcbc2 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Electrolyzer.java @@ -1,19 +1,17 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import java.util.Arrays; - import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; +import static gttweaker.util.ArrayHelper.itemOrNull; /** * Provides access to the Electrolyzer recipes. @@ -26,7 +24,7 @@ public class Electrolyzer { /** * Adds a Electrolyzer recipe. * - * @param output output 1-6 + * @param outputs output 1-6 * @param fluidOutput primary fluid output * @param input primary input * @param cells Cell input @@ -34,213 +32,39 @@ public class Electrolyzer { * @param chances chance 1-6 * @param durationTicks reaction time, in ticks * @param euPerTick eu consumption per tick - * */ @ZenMethod - public static void addRecipe(IItemStack[] output, ILiquidStack fluidOutput, IIngredient input, IIngredient cells, ILiquidStack fluidInput, int[] chances, int durationTicks, int euPerTick) { - if (output.length < 1) { + public static void addRecipe(IItemStack[] outputs, ILiquidStack fluidOutput, IIngredient input, IIngredient cells, ILiquidStack fluidInput, int[] chances, int durationTicks, int euPerTick) { + if (outputs.length < 1) { MineTweakerAPI.logError("Electrolyzer must have at least 1 output"); - } else if(output.length!=chances.length){ + } else if (outputs.length != chances.length) { MineTweakerAPI.logError("Number of Outputs does not equal number of Chances"); - }else { - MineTweakerAPI.apply(new AddFluidRecipeAction(output, fluidOutput, input, cells, fluidInput, chances, durationTicks, euPerTick)); + } else { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Electrolyzer recipe with Liquid support for " + input, input, cells, fluidInput, fluidOutput, outputs[0], + itemOrNull(outputs, 1), itemOrNull(outputs, 2), itemOrNull(outputs, 3), itemOrNull(outputs, 4), itemOrNull(outputs, 5), chances, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addElectrolyzerRecipe(i.nextItem(), i.nextItem(), i.nextFluid(), i.nextFluid(), i.nextItem(), i.nextItem(), + i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextIntArr(), i.nextInt(), i.nextInt()); + } + }); } } @ZenMethod - public static void addRecipe(IItemStack[] output, IIngredient input, int cells, int durationTicks, int euPerTick) { - if (output.length == 0) { + public static void addRecipe(IItemStack[] outputs, IIngredient input, int cells, int durationTicks, int euPerTick) { + if (outputs.length == 0) { MineTweakerAPI.logError("Electrolyzer recipe requires at least 1 input"); } else { - MineTweakerAPI.apply(new AddRecipeAction(output, input, cells, durationTicks, euPerTick)); - } - - } - -// ###################### -// ### Action classes ### -// ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack[] output; - private final IIngredient input; - private final int cells; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] output, IIngredient input, int cells, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.cells = cells; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addElectrolyzerRecipe( - MineTweakerMC.getItemStack(input), - cells, - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, - output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, - duration, - cells); - } - - @Override - public String describe() { - return "Adding electrolyzer recipe with input " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + Arrays.deepHashCode(this.output); - hash = 97 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 97 * hash + this.cells; - hash = 97 * hash + this.duration; - hash = 97 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.cells != other.cells) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } - - private static class AddFluidRecipeAction extends OneWayAction { - - private final IItemStack [] output; - private final ILiquidStack fluidOutput; - private final IIngredient input; - private final IIngredient cells; - private final ILiquidStack fluidInput; - private final int [] chances; - private final int duration; - private final int euPerTick; - - public AddFluidRecipeAction(IItemStack [] output, ILiquidStack fluidOutput, IIngredient input, IIngredient cells, ILiquidStack fluidInput, int [] chances, int duration, int euPerTick) { - - this.output = output; - this.fluidOutput = fluidOutput; - this.input = input; - this.cells = cells; - this.fluidInput = fluidInput; - this.chances = chances; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addElectrolyzerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(cells), - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getLiquidStack(fluidOutput), - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - output.length > 3 ? MineTweakerMC.getItemStack(output[3]) : null, - output.length > 4 ? MineTweakerMC.getItemStack(output[4]) : null, - output.length > 5 ? MineTweakerMC.getItemStack(output[5]) : null, - chances, - duration, - euPerTick); - - } - - @Override - public String describe() { - return "Adding Electrolyzer recipe with Liquid support for " + input ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 8; - hash = 44 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 44 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 44 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 44 * hash + (this.cells != null ? this.cells.hashCode() : 0); - hash = 44 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 44 * hash + (this.chances != null ? this.chances.hashCode() : 0); - hash = 44 * hash + this.duration; - hash = 44 * hash + this.euPerTick; - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddFluidRecipeAction other = (AddFluidRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - - } - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - - } - if (this.cells != other.cells && (this.cells == null || !this.cells.equals(other.cells))) { - - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.chances != other.chances) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding electrolyzer recipe with input " + input, input, cells, outputs[0], + itemOrNull(outputs, 1), itemOrNull(outputs, 2), itemOrNull(outputs, 3), itemOrNull(outputs, 4), itemOrNull(outputs, 5), durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addElectrolyzerRecipe(i.nextItem(), i.nextInt(), i.nextItem(), i.nextItem(), i.nextItem(), + i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt() + ); + } + }); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Extruder.java b/src/main/java/gttweaker/mods/gregtech/machines/Extruder.java index 623fa20..33c3dee 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Extruder.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Extruder.java @@ -1,12 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -24,92 +22,19 @@ public class Extruder { /** * Adds an extruder recipe. * - * @param output recipe output - * @param input recipe input - * @param shape shape (set stack size to 0 to prevent the shape from being consumed) + * @param output recipe output + * @param input recipe input + * @param shape shape (set stack size to 0 to prevent the shape from being consumed) * @param durationTicks extruding time, in ticks - * @param euPerTick eu consumption per tick + * @param euPerTick eu consumption per tick */ @ZenMethod - public static void addRecipe(IItemStack output, IIngredient input, IIngredient shape, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, shape, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IIngredient input; - private final IIngredient shape; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IIngredient input, IIngredient shape, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.shape = shape; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addExtruderRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(shape), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding extruder recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 67 * hash + (this.shape != null ? this.shape.hashCode() : 0); - hash = 67 * hash + this.duration; - hash = 67 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.shape != other.shape && (this.shape == null || !this.shape.equals(other.shape))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + public static void addRecipe(IItemStack output, IIngredient input, IItemStack shape, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding extruder recipe for " + output, input, shape, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addExtruderRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java b/src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java index 12b6f17..4f87b7d 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Fermenter.java @@ -1,10 +1,9 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -22,87 +21,18 @@ public class Fermenter { /** * Adds a Fermenter recipe. * - * @param fluidOutput primary fluidOutput - * @param fluidInput primary fluidInput - * @param duration reaction time, in ticks - * @param Hidden hidden - * + * @param fluidOutput primary fluidOutput + * @param fluidInput primary fluidInput + * @param duration reaction time, in ticks + * @param hidden hidden */ @ZenMethod - public static void addRecipe(ILiquidStack fluidOutput, ILiquidStack fluidInput, int duration, boolean Hidden) { - MineTweakerAPI.apply(new AddRecipeAction(fluidOutput, fluidInput, duration, Hidden)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - - private final ILiquidStack fluidOutput; - private final ILiquidStack fluidInput; - private final int duration; - private final boolean Hidden; - - public AddRecipeAction(ILiquidStack fluidOutput, ILiquidStack fluidInput, int duration, boolean Hidden) { - - this.fluidOutput = fluidOutput; - this.fluidInput = fluidInput; - this.duration = duration; - this.Hidden = Hidden; - } - - @Override - public void apply() { - RA.addFermentingRecipe( - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getLiquidStack(fluidOutput), - duration, - Hidden); - - } - - @Override - public String describe() { - return "Adding Fermenter recipe for " + fluidOutput ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 2; - hash = 12 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 12 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 12 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.Hidden != other.Hidden) { - return false; + public static void addRecipe(ILiquidStack fluidOutput, ILiquidStack fluidInput, int duration, boolean hidden) { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Fermenter recipe for " + fluidOutput, fluidInput, fluidOutput, duration, hidden) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addFermentingRecipe(i.nextFluid(), i.nextFluid(), i.nextInt(), i.nextBool()); } - return true; - } + }); } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java index d51506c..3c708a6 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FluidCanner.java @@ -1,12 +1,11 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -24,92 +23,18 @@ public class FluidCanner { /** * Adds a Fluid Canner recipe. * - * @param output output Slot - * @param input input Slot - * @param fluidOutput fluid Output Slot - * @param fluidInput fluid Input Slot - * + * @param output output Slot + * @param input input Slot + * @param fluidOutput fluid Output Slot + * @param fluidInput fluid Input Slot */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, ILiquidStack fluidOutput, ILiquidStack fluidInput) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, fluidOutput, fluidInput)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input; - private final ILiquidStack fluidOutput; - private final ILiquidStack fluidInput; - - - public AddRecipeAction(IItemStack output, IIngredient input, ILiquidStack fluidOutput, ILiquidStack fluidInput) { - - this.output = output; - this.input = input; - this.fluidOutput = fluidOutput; - this.fluidInput = fluidInput; - - } - - @Override - public void apply() { - RA.addFluidCannerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getLiquidStack(fluidOutput)); - - } - - @Override - public String describe() { - return "Adding Fluid Canner recipe for " + input ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 91 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 91 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 91 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 91 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - - } - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Fluid Canner recipe for " + input, input, fluidOutput, fluidInput) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addFluidCannerRecipe(i.nextItem(), i.nextItem(), i.nextFluid(), i.nextFluid()); } - return true; - } + }); } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FluidExtractor.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidExtractor.java index 7621e61..59a9495 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FluidExtractor.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FluidExtractor.java @@ -1,12 +1,11 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -30,99 +29,14 @@ public class FluidExtractor { * @param durationTicks reaction time, in ticks * @param euPerTick eu consumption per tick * @param chance chance output slot - * */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, ILiquidStack fluidOutput, int durationTicks, int euPerTick, int chance) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, fluidOutput, durationTicks, euPerTick, chance)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input; - private final ILiquidStack fluidOutput; - private final int duration; - private final int euPerTick; - private final int chance; - - public AddRecipeAction(IItemStack output, IIngredient input, ILiquidStack fluidOutput, int duration, int euPerTick, int chance) { - - this.output = output; - this.input = input; - this.fluidOutput = fluidOutput; - this.duration = duration; - this.euPerTick = euPerTick; - this.chance = chance; - } - - @Override - public void apply() { - RA.addFluidExtractionRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - MineTweakerMC.getLiquidStack(fluidOutput), - duration, - euPerTick, - chance); - - } - - @Override - public String describe() { - return "Adding Fluid Extractor recipe for " + input ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 94 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 94 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 94 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 94 * hash + this.duration; - hash = 94 * hash + this.euPerTick; - hash = 94 * hash + this.chance; - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - - } - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - if (this.chance != other.chance) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Fluid Extractor recipe for " + input, input, output, fluidOutput, durationTicks, euPerTick, chance) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addFluidExtractionRecipe(i.nextItem(), i.nextItem(), i.nextFluid(), i.nextInt(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java index 6cd5e57..08b26ca 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FluidHeater.java @@ -1,12 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -25,95 +23,18 @@ public class FluidHeater { * Adds a Fluid Heater recipe. * * @param fluidOutput Fluid output - * @param Circuit Circuit + * @param circuit Circuit * @param fluidInput fluid input * @param durationTicks reaction time, in ticks * @param euPerTick eu consumption per tick - * */ @ZenMethod - public static void addRecipe(ILiquidStack fluidOutput, IItemStack Circuit, ILiquidStack fluidInput, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(fluidOutput, Circuit, fluidInput, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - - private final ILiquidStack fluidOutput; - private final IItemStack Circuit; - private final ILiquidStack fluidInput; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(ILiquidStack fluidOutput, IItemStack Circuit, ILiquidStack fluidInput, int duration, int euPerTick) { - - this.fluidOutput = fluidOutput; - this.Circuit = Circuit; - this.fluidInput = fluidInput; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addFluidHeaterRecipe( - MineTweakerMC.getItemStack(Circuit), - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getLiquidStack(fluidOutput), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Fluid Heater recipe for " + fluidOutput ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 44 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 44 * hash + (this.Circuit != null ? this.Circuit.hashCode() : 0); - hash = 44 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 44 * hash + this.duration; - hash = 44 * hash + this.euPerTick; - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.Circuit != other.Circuit && (this.Circuit == null || !this.Circuit.equals(other.Circuit))) { - - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + public static void addRecipe(ILiquidStack fluidOutput, IItemStack circuit, ILiquidStack fluidInput, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Fluid Heater recipe for " + fluidOutput, circuit, fluidInput, fluidOutput, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addFluidHeaterRecipe(i.nextItem(), i.nextFluid(), i.nextFluid(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FluidSolidifier.java b/src/main/java/gttweaker/mods/gregtech/machines/FluidSolidifier.java index ccd730e..92ebb3b 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FluidSolidifier.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FluidSolidifier.java @@ -1,12 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -25,97 +23,18 @@ public class FluidSolidifier { * Adds a Fluid Solidifier recipe. * * @param output output Slot - * @param Mold mold Slot + * @param mold mold Slot * @param fluidInput fluidInput * @param durationTicks reaction time, in ticks * @param euPerTick eu consumption per tick - * */ @ZenMethod - public static void addRecipe(IItemStack output, IItemStack Mold, ILiquidStack fluidInput, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, Mold, fluidInput, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IItemStack Mold; - private final ILiquidStack fluidInput; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IItemStack Mold, ILiquidStack fluidInput, int duration, int euPerTick) { - - this.output = output; - this.Mold = Mold; - this.fluidInput = fluidInput; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addFluidSolidifierRecipe( - MineTweakerMC.getItemStack(Mold), - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - - } - - @Override - public String describe() { - return "Adding Fluid Solidifier recipe for " + output ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 94 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 94 * hash + (this.Mold != null ? this.Mold.hashCode() : 0); - hash = 94 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 94 * hash + this.duration; - hash = 94 * hash + this.euPerTick; - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; + public static void addRecipe(IItemStack output, IItemStack mold, ILiquidStack fluidInput, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Fluid Solidifier recipe for " + output, mold, fluidInput, mold, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addFluidSolidifierRecipe(i.nextItem(), i.nextFluid(), i.nextItem(), i.nextInt(), i.nextInt()); } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.Mold != other.Mold && (this.Mold == null || !this.Mold.equals(other.Mold))) { - - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - - return true; - } + }); } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java b/src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java index 75a9e4d..1d64c6a 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ForgeHammer.java @@ -1,12 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -24,84 +22,18 @@ public class ForgeHammer { /** * Add a Forge Hammer recipe. * - * @param output recipe output - * @param input recipe input + * @param output recipe output + * @param input recipe input * @param durationTicks forging duration, in ticks - * @param euPerTick eu consumption per tick + * @param euPerTick eu consumption per tick */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IIngredient input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IIngredient input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addForgeHammerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding forge hammer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 97 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 97 * hash + this.duration; - hash = 97 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding forge hammer recipe for " + output, input, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addForgeHammerRecipe(i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FormingPress.java b/src/main/java/gttweaker/mods/gregtech/machines/FormingPress.java index ed76b2d..0f7f6ab 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FormingPress.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FormingPress.java @@ -1,11 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -19,7 +18,7 @@ */ @ZenClass("mods.gregtech.FormingPress") @ModOnly(MOD_ID) -public class FormingPress{ +public class FormingPress { /** * Adds a Forming Press recipe. * @@ -31,77 +30,11 @@ public class FormingPress{ */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input1; - private final IIngredient input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) { - - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - @Override - public void apply() { - RA.addFormingPressRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - @Override - public String describe() {return "Adding Forming Press recipe for " + output;} - - @Override - public Object getOverrideKey() {return null;} - - @Override - public int hashCode() { - int hash = 3; - hash = 39 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 39 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 39 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 39 * hash + this.duration; - hash = 39 * hash + this.euPerTick; - return hash; - } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Forming Press recipe for " + output, input1, input2, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addFormingPressRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/FusionReactor.java b/src/main/java/gttweaker/mods/gregtech/machines/FusionReactor.java index 8e3f986..47d017e 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/FusionReactor.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/FusionReactor.java @@ -1,10 +1,9 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -22,101 +21,20 @@ public class FusionReactor { /** * Adds a Mixer recipe. * - * @param fluidOutput primary fluid Output - * @param fluidInput1 primary fluid Input - * @param fluidInput2 secondary fluid Input - * @param durationTicks reaction time, in ticks - * @param euPerTick eu consumption per tick - * @param startEU Starting at ... EU + * @param fluidOutput primary fluid Output + * @param fluidInput1 primary fluid Input + * @param fluidInput2 secondary fluid Input + * @param durationTicks reaction time, in ticks + * @param euPerTick eu consumption per tick + * @param startEU Starting at ... EU */ @ZenMethod public static void addRecipe(ILiquidStack fluidOutput, ILiquidStack fluidInput1, ILiquidStack fluidInput2, int durationTicks, int euPerTick, int startEU) { - MineTweakerAPI.apply(new AddRecipeAction(fluidOutput, fluidInput1, fluidInput2, durationTicks, euPerTick, startEU)); - } - - // ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final ILiquidStack fluidOutput; - private final ILiquidStack fluidInput1; - private final ILiquidStack fluidInput2; - private final int duration; - private final int euPerTick; - private final int startEU; - - public AddRecipeAction(ILiquidStack fluidOutput, ILiquidStack fluidInput1, ILiquidStack fluidInput2, int duration, int euPerTick, int StartEU) { - - this.fluidOutput = fluidOutput; - this.fluidInput1 = fluidInput1; - this.fluidInput2 = fluidInput2; - this.duration = duration; - this.euPerTick = euPerTick; - this.startEU = StartEU; - } - - @Override - public void apply() { - RA.addFusionReactorRecipe( - MineTweakerMC.getLiquidStack(fluidInput2), - MineTweakerMC.getLiquidStack(fluidInput1), - MineTweakerMC.getLiquidStack(fluidOutput), - duration, - euPerTick, - startEU); - } - - @Override - public String describe() { - return "Adding Fusion Reactor recipe for " + fluidOutput; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 1; - hash = 99 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 99 * hash + (this.fluidInput1 != null ? this.fluidInput1.hashCode() : 0); - hash = 99 * hash + (this.fluidInput2 != null ? this.fluidInput2.hashCode() : 0); - hash = 99 * hash + this.duration; - hash = 99 * hash + this.euPerTick; - hash = 99 * hash + this.startEU; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.fluidInput1 != other.fluidInput1 && (this.fluidInput1 == null || !this.fluidInput1.equals(other.fluidInput1))) { - return false; - } - if (this.fluidInput2 != other.fluidInput2 && (this.fluidInput2 == null || !this.fluidInput2.equals(other.fluidInput2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - if (this.startEU != other.startEU) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Fusion Reactor recipe for " + fluidOutput, fluidInput1, fluidInput2, fluidOutput, durationTicks, euPerTick, startEU) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addFusionReactorRecipe(i.nextFluid(), i.nextFluid(), i.nextFluid(), i.nextInt(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/ImplosionCompressor.java b/src/main/java/gttweaker/mods/gregtech/machines/ImplosionCompressor.java index 3e9c1d6..7474952 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/ImplosionCompressor.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/ImplosionCompressor.java @@ -1,17 +1,16 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; +import static gttweaker.util.ArrayHelper.itemOrNull; /** * Provides access to the Implosion Compressor recipes. @@ -25,98 +24,32 @@ public class ImplosionCompressor { * Adds an implosion compressor recipe with a single output. * * @param output recipe output - * @param input primary input - * @param tnt amount of TNT needed + * @param input primary input + * @param tnt amount of TNT needed */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, int tnt) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, tnt)); + addRecipe(new IItemStack[]{output, null}, input, tnt); } /** * 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 + * @param input primary input + * @param tnt amount of TNT needed */ @ZenMethod public static void addRecipe(IItemStack[] output, IIngredient 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)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IIngredient input1; - private final int tnt; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IIngredient input1, int tnt) { - this.output1 = output1; - this.output2 = output2; - this.input1 = input1; - this.tnt = tnt; - } - - @Override - public void apply() { - RA.addImplosionRecipe( - MineTweakerMC.getItemStack(input1), - tnt, - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2)); - } - - @Override - public String describe() { - return "Adding Implosion compressor recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 97 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 97 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 97 * hash + this.tnt; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.tnt != other.tnt) { - return false; - } - return true; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Implosion compressor recipe for " + output[0], input, tnt, output[0], itemOrNull(output, 1)) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addImplosionRecipe(i.nextItem(), i.nextInt(), i.nextItem(), i.nextItem()); + } + }); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Lathe.java b/src/main/java/gttweaker/mods/gregtech/machines/Lathe.java index 23c9aa3..7c6dd7d 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Lathe.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Lathe.java @@ -1,17 +1,16 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; +import static gttweaker.util.ArrayHelper.itemOrNull; /** * Access point for Lathe recipes. @@ -24,108 +23,35 @@ public class Lathe { /** * Adds a lathe recipe with a single output. * - * @param output recipe output - * @param input recipe input + * @param output recipe output + * @param input recipe input * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick + * @param euPerTick eu consumption per tick */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, durationTicks, euPerTick)); + addRecipe(new IItemStack[]{output, null}, input, durationTicks, euPerTick); } /** * Adds a lathe recipe with 1 or 2 outputs. * - * @param outputs array with 1-2 outputs - * @param input recipe input + * @param outputs array with 1-2 outputs + * @param input recipe input * @param durationTicks crafting duration, in ticks - * @param euPerTick eu consumption per tick + * @param euPerTick eu consumption per tick */ @ZenMethod public static void addRecipe(IItemStack[] outputs, IIngredient input, int durationTicks, int euPerTick) { if (outputs.length == 0) { MineTweakerAPI.logError("Lathe recipe requires at least 1 input"); } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs[0], outputs.length > 1 ? outputs[1] : null, input, durationTicks, euPerTick)); - } - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output1; - private final IItemStack output2; - private final IIngredient input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IIngredient input, int duration, int euPerTick) { - this.output1 = output1; - this.output2 = output2; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addLatheRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding lathe recipe for " + output1; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 53 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 53 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 53 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 53 * hash + this.duration; - hash = 53 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding lathe recipe for " + outputs[0], input, outputs[0], itemOrNull(outputs, 1), durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addLatheRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); + } + }); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Mixer.java b/src/main/java/gttweaker/mods/gregtech/machines/Mixer.java index 760ad63..bf10c14 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Mixer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Mixer.java @@ -1,23 +1,23 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; +import static gttweaker.util.ArrayHelper.itemOrNull; /** -* Provides access to the Mixer recipes. -* -* @author DreamMasterXXL -*/ + * Provides access to the Mixer recipes. + * + * @author DreamMasterXXL + */ @ZenClass("mods.gregtech.Mixer") @ModOnly(MOD_ID) public class Mixer { @@ -36,190 +36,18 @@ public static void addRecipe(IItemStack output, ILiquidStack fluidOutput, IIngre if (input.length == 0) { MineTweakerAPI.logError("Lathe recipe requires at least 1 input"); } else { - MineTweakerAPI.apply(new AddFluidRecipeAction(output, fluidOutput, input, fluidInput, durationTicks, euPerTick)); + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Mixer recipe for " + output, input[0], itemOrNull(input, 1), + itemOrNull(input, 2), itemOrNull(input, 3), fluidInput, fluidOutput, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addMixerRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextFluid(), i.nextFluid(), i.nextItem(), i.nextInt(), i.nextInt()); + } + }); } } @ZenMethod public static void addRecipe(IItemStack output, IIngredient[] input, int durationTicks, int euPerTick) { - if (input.length == 0) { - MineTweakerAPI.logError("Lathe recipe requires at least 1 input"); - } else { - MineTweakerAPI.apply(new AddRecipeAction(output, null, input, null, durationTicks, euPerTick)); - } - } - -// ###################### -// ### Action classes ### -// ###################### - private static class AddFluidRecipeAction extends OneWayAction { - - private final IItemStack output; - private final ILiquidStack fluidOutput; - private final IIngredient[] input; - private final ILiquidStack fluidInput; - private final int duration; - private final int euPerTick; - - public AddFluidRecipeAction(IItemStack output, ILiquidStack fluidOutput, IIngredient[] input, ILiquidStack fluidInput, int duration, int euPerTick) { - - this.output = output; - this.fluidOutput = fluidOutput; - this.input = input; - this.fluidInput = fluidInput; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addMixerRecipe( - MineTweakerMC.getItemStack(input[0]), - input.length > 1 ? MineTweakerMC.getItemStack(input[1]) : null, - input.length > 2 ? MineTweakerMC.getItemStack(input[2]) : null, - input.length > 3 ? MineTweakerMC.getItemStack(input[3]) : null, - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getLiquidStack(fluidOutput), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Mixer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 6; - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 67 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 67 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 67 * hash + this.duration; - hash = 67 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddFluidRecipeAction other = (AddFluidRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } - } - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final ILiquidStack fluidOutput; - private final IIngredient[] input; - private final ILiquidStack fluidInput; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, ILiquidStack fluidOutput, IIngredient[] input, ILiquidStack fluidInput, int duration, int euPerTick) { - - this.output = output; - this.fluidOutput = fluidOutput; - this.input = input; - this.fluidInput = fluidInput; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addMixerRecipe( - MineTweakerMC.getItemStack(input[0]), - input.length > 1 ? MineTweakerMC.getItemStack(input[1]) : null, - input.length > 2 ? MineTweakerMC.getItemStack(input[2]) : null, - input.length > 3 ? MineTweakerMC.getItemStack(input[3]) : null, - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getLiquidStack(fluidOutput), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Mixer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 1; - hash = 17 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 17 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 17 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 17 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 17 * hash + this.duration; - hash = 17 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; - } + addRecipe(output, null, input, null, durationTicks, euPerTick); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java b/src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java index 9f073f5..fc381e4 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/OilCracker.java @@ -1,11 +1,9 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; -import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -23,86 +21,19 @@ public class OilCracker { /** * Adds a Pyrolyse Oven recipe. * - * @param fluidOutput recipe Fluid output - * @param fluidInput recipe Fluid input - * @param durationTicks reaction time, in ticks - * @param euPerTick eu consumption per tick + * @param fluidOutput recipe Fluid output + * @param fluidInput recipe Fluid input + * @param durationTicks reaction time, in ticks + * @param euPerTick eu consumption per tick */ @ZenMethod public static void addRecipe(ILiquidStack fluidOutput, ILiquidStack fluidInput, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(fluidOutput, fluidInput, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - private static class AddRecipeAction extends OneWayAction { - - private final ILiquidStack fluidOutput; - private final ILiquidStack fluidInput; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(ILiquidStack fluidOutput, ILiquidStack fluidInput, int duration, int euPerTick) { - - this.fluidOutput = fluidOutput; - this.fluidInput = fluidInput; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addCrackingRecipe( - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getLiquidStack(fluidOutput), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding OilCracker recipe for " + fluidOutput; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 4; - hash = 43 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 43 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 43 * hash + this.duration; - hash = 43 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding OilCracker recipe for " + fluidOutput, fluidInput, fluidInput, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addCrackingRecipe(i.nextFluid(), i.nextFluid(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Packer.java b/src/main/java/gttweaker/mods/gregtech/machines/Packer.java index c480884..a163207 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Packer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Packer.java @@ -1,11 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -19,7 +18,7 @@ */ @ZenClass("mods.gregtech.Packer") @ModOnly(MOD_ID) -public class Packer{ +public class Packer { /** * Adds a Packer recipe. * @@ -31,77 +30,11 @@ public class Packer{ */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input1; - private final IIngredient input2; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) { - - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - @Override - public void apply() { - RA.addBoxingRecipe( - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - @Override - public String describe() {return "Adding Packer recipe for " + output;} - - @Override - public Object getOverrideKey() {return null;} - - @Override - public int hashCode() { - int hash = 1; - hash = 39 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 39 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 39 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 39 * hash + this.duration; - hash = 39 * hash + this.euPerTick; - return hash; - } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Packer recipe for " + output, input1, input2, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addBoxingRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java b/src/main/java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java index d8d08dc..b5f57b7 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/PlasmaArcFurnace.java @@ -1,12 +1,11 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -36,102 +35,15 @@ public class PlasmaArcFurnace { public static void addRecipe(IItemStack[] outputs, ILiquidStack fluidOutput, IIngredient input, ILiquidStack fluidInput, int[] outChances, int durationTicks, int euPerTick) { if (outputs.length < 1) { MineTweakerAPI.logError("Plasma Arc Furnace must have at least 1 output"); - } else if(outputs.length!=outChances.length){ + } else if (outputs.length != outChances.length) { MineTweakerAPI.logError("Number of Outputs does not equal number of Chances"); - }else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, fluidOutput, input, fluidInput, outChances, durationTicks, euPerTick)); - } - } - -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack[] output; - private final ILiquidStack fluidOutput; - private final IIngredient input; - private final ILiquidStack fluidInput; - private final int[] chances; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] output, ILiquidStack fluidOutput, IIngredient input, ILiquidStack fluidInput, int[] outChances, int duration, int euPerTick) { - - this.output = output; - this.input = input; - this.fluidInput = fluidInput; - this.fluidOutput = fluidOutput; - this.chances = outChances; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addPlasmaArcFurnaceRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getLiquidStack(fluidInput), - MineTweakerMC.getItemStacks(output), - MineTweakerMC.getLiquidStack(fluidOutput), - chances, - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Plasma Arc Furnace recipe for " + input; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 9 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 9 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 9 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 9 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 9 * hash + this.duration; - hash = 9 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.chances != other.chances){ - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + } else { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Plasma Arc Furnace recipe for " + input, input, fluidInput, outputs, fluidOutput, outChances, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addPlasmaArcFurnaceRecipe(i.nextItem(), i.nextFluid(), i.nextItemArr(), i.nextIntArr(), i.nextInt(), i.nextInt()); + } + }); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java b/src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java index 9534659..5df03a5 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/PlateBender.java @@ -1,12 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -24,84 +22,18 @@ public class PlateBender { /** * Adds a plate bender recipe. * - * @param output recipe output - * @param input recipe input + * @param output recipe output + * @param input recipe input * @param durationTicks bending time, in ticks - * @param euPerTick eu consumption per tick + * @param euPerTick eu consumption per tick */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IIngredient input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IIngredient input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addBenderRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding plate bender recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 79 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 79 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 79 * hash + this.duration; - hash = 79 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding plate bender recipe for " + output, input, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addBenderRecipe(i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java b/src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java index dec2936..62b7d67 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Polarizer.java @@ -1,11 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -19,7 +18,7 @@ */ @ZenClass("mods.gregtech.Polarizer") @ModOnly(MOD_ID) -public class Polarizer{ +public class Polarizer { /** * Adds a Polarizer recipe. * @@ -30,70 +29,11 @@ public class Polarizer{ */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IIngredient input, int duration, int euPerTick) { - - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - @Override - public void apply() { - RA.addPolarizerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - @Override - public String describe() {return "Adding Polarizer recipe for " + output;} - - @Override - public Object getOverrideKey() {return null;} - - @Override - public int hashCode() { - int hash = 8; - hash = 39 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 39 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 39 * hash + this.duration; - hash = 39 * hash + this.euPerTick; - return hash; - } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Polarizer recipe for " + output, input, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addPolarizerRecipe(i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/PrecisionLaser.java b/src/main/java/gttweaker/mods/gregtech/machines/PrecisionLaser.java index 0f23a9a..2883af6 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/PrecisionLaser.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/PrecisionLaser.java @@ -1,11 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -19,7 +18,7 @@ */ @ZenClass("mods.gregtech.PrecisionLaser") @ModOnly(MOD_ID) -public class PrecisionLaser{ +public class PrecisionLaser { /** * Adds a Laser Engraver recipe. * @@ -31,75 +30,11 @@ public class PrecisionLaser{ */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input1, input2, durationTicks, euPerTick)); - } -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input1; - private final IIngredient input2; - private final int duration; - private final int euPerTick; - public AddRecipeAction(IItemStack output, IIngredient input1, IIngredient input2, int duration, int euPerTick) { - - this.output = output; - this.input1 = input1; - this.input2 = input2; - this.duration = duration; - this.euPerTick = euPerTick; - } - @Override - public void apply() { - RA.addLaserEngraverRecipe( - MineTweakerMC.getItemStack(input2), - MineTweakerMC.getItemStack(input1), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - @Override - public String describe() {return "Adding Precision Laser recipe for " + output;} - @Override - public Object getOverrideKey() {return null;} - @Override - public int hashCode() { - int hash = 4; - hash = 45 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 45 * hash + (this.input1 != null ? this.input1.hashCode() : 0); - hash = 45 * hash + (this.input2 != null ? this.input2.hashCode() : 0); - hash = 45 * hash + this.duration; - hash = 45 * hash + this.euPerTick; - return hash; - } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input1 != other.input1 && (this.input1 == null || !this.input1.equals(other.input1))) { - return false; - } - if (this.input2 != other.input2 && (this.input2 == null || !this.input2.equals(other.input2))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Precision Laser recipe for " + output, input1, input2, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addLaserEngraverRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Printer.java b/src/main/java/gttweaker/mods/gregtech/machines/Printer.java index 0532897..ba785a1 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Printer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Printer.java @@ -1,12 +1,11 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -26,99 +25,18 @@ public class Printer { * * @param output recipe output * @param input primary input - * @param DataStick Data Stick + * @param dataStick Data Stick * @param ink ink fluidInput * @param durationTicks reaction time, in ticks * @param euPerTick eu consumption per tick */ @ZenMethod - public static void addRecipe(IItemStack output, IIngredient input, IItemStack DataStick, ILiquidStack ink, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, DataStick, ink, durationTicks, euPerTick)); - } - -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final IIngredient input; - private final IItemStack DataStick; - private final ILiquidStack ink; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IIngredient input, IItemStack DataStick, ILiquidStack ink, int duration, int euPerTick) { - - this.output = output; - this.input = input; - this.DataStick = DataStick; - this.ink = ink; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addPrinterRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getLiquidStack(ink), - MineTweakerMC.getItemStack(DataStick), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Printer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 66 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 66 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 66 * hash + (this.DataStick != null ? this.DataStick.hashCode() : 0); - hash = 66 * hash + (this.ink != null ? this.ink.hashCode() : 0); - hash = 66 * hash + this.duration; - hash = 66 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.DataStick != other.DataStick && (this.DataStick == null || !this.DataStick.equals(other.DataStick))) { - return false; - } - if (this.ink != other.ink && (this.ink == null || !this.ink.equals(other.ink))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + public static void addRecipe(IItemStack output, IIngredient input, IItemStack dataStick, ILiquidStack ink, int durationTicks, int euPerTick) { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Printer recipe for " + output, input, ink, dataStick, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addPrinterRecipe(i.nextItem(), i.nextFluid(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java b/src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java index da9c427..d90a43e 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Pulverizer.java @@ -1,16 +1,13 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import java.util.Arrays; - import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; @@ -38,85 +35,12 @@ public static void addRecipe(IItemStack[] outputs, IIngredient input, int[] outC } else if (outputs.length != outChances.length) { MineTweakerAPI.logError("Number of Outputs does not equal number of Chances"); } else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, outChances, durationTicks, euPerTick)); - } - } - -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack[] output; - private final IIngredient input; - private final int[] chances; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] output, IIngredient input, int[] outChances, int duration, int euPerTick1) { - - this.output = output; - this.input = input; - this.chances = outChances; - this.duration = duration; - this.euPerTick = euPerTick1; - } - - @Override - public void apply() { - RA.addPulveriserRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStacks(output), - chances, - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Pulverizer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 8; - hash = 71 * hash + Arrays.deepHashCode(this.output); - hash = 71 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 71 * hash + this.duration; - hash = 71 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.chances != other.chances) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Pulverizer recipe for " + input, input, outputs, outChances, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addPulveriserRecipe(i.nextItem(), i.nextItemArr(), i.nextIntArr(), i.nextInt(), i.nextInt()); + } + }); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/PyrolyseOven.java b/src/main/java/gttweaker/mods/gregtech/machines/PyrolyseOven.java index 93901b6..c9f91c8 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/PyrolyseOven.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/PyrolyseOven.java @@ -1,12 +1,11 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -34,100 +33,12 @@ public class PyrolyseOven { */ @ZenMethod public static void addRecipe(IItemStack output, ILiquidStack fluidOutput, int circuit, IIngredient input, ILiquidStack fluidInput, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, fluidOutput, circuit, input, fluidInput, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output; - private final ILiquidStack fluidOutput; - private final int circuit; - private final IIngredient input; - private final ILiquidStack fluidInput; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, ILiquidStack fluidOutput, int circuit, IIngredient input, ILiquidStack fluidInput, int duration, int euPerTick) { - - this.output = output; - this.fluidOutput = fluidOutput; - this.circuit = circuit; - this.input = input; - this.fluidInput = fluidInput; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addPyrolyseRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getLiquidStack(fluidInput), - circuit, - MineTweakerMC.getItemStack(output), - MineTweakerMC.getLiquidStack(fluidOutput), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Pyrolyse Oven recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 98 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 98 * hash + (this.fluidOutput != null ? this.fluidOutput.hashCode() : 0); - hash = 98 * hash + this.circuit; - hash = 98 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 98 * hash + (this.fluidInput != null ? this.fluidInput.hashCode() : 0); - hash = 98 * hash + this.duration; - hash = 98 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.fluidOutput != other.fluidOutput && (this.fluidOutput == null || !this.fluidOutput.equals(other.fluidOutput))) { - return false; - } - if (this.circuit != other.circuit) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.fluidInput != other.fluidInput && (this.fluidInput == null || !this.fluidInput.equals(other.fluidInput))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Pyrolyse Oven recipe for " + output, input, fluidInput, circuit, output, fluidOutput, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addPyrolyseRecipe(i.nextItem(), i.nextFluid(), i.nextInt(), i.nextItem(), i.nextFluid(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Separator.java b/src/main/java/gttweaker/mods/gregtech/machines/Separator.java index f122576..1e8442d 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Separator.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Separator.java @@ -1,16 +1,16 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; +import static gttweaker.util.ArrayHelper.itemOrNull; /** * Provides access to the Separator recipes. @@ -19,7 +19,7 @@ */ @ZenClass("mods.gregtech.Separator") @ModOnly(MOD_ID) -public class Separator{ +public class Separator { /** * Adds a Separator recipe. * @@ -33,82 +33,15 @@ public class Separator{ public static void addRecipe(IItemStack[] output, IIngredient input, int[] outChances, int durationTicks, int euPerTick) { if (output.length < 1) { MineTweakerAPI.logError("Seperator must have at least 1 output"); - } else if(output.length!=outChances.length){ + } else if (output.length != outChances.length) { MineTweakerAPI.logError("Number of Outputs does not equal number of Chances"); - }else { - MineTweakerAPI.apply(new AddRecipeAction(output, input, outChances, durationTicks, euPerTick)); - } - } -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack[] output; - private final IIngredient input; - private final int[] chances; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] output, IIngredient input, int[] outChances, int duration, int euPerTick) { - - this.output = output; - this.input = input; - this.chances = outChances; - this.duration = duration; - this.euPerTick = euPerTick; - } - @Override - public void apply() { - RA.addElectromagneticSeparatorRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output[0]), - output.length > 1 ? MineTweakerMC.getItemStack(output[1]) : null, - output.length > 2 ? MineTweakerMC.getItemStack(output[2]) : null, - chances, - duration, - euPerTick); - } - @Override - public String describe() {return "Adding Separator recipe for " + input;} - - @Override - public Object getOverrideKey() {return null;} - - @Override - public int hashCode() { - int hash = 3; - hash = 39 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 39 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 39 * hash + this.duration; - hash = 39 * hash + this.euPerTick; - return hash; - } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.chances != other.chances) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + } else { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Separator recipe for " + input, input, output[0], itemOrNull(output, 1), itemOrNull(output, 2), outChances, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addElectromagneticSeparatorRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextIntArr(), i.nextInt(), i.nextInt()); + } + }); } } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Sifter.java b/src/main/java/gttweaker/mods/gregtech/machines/Sifter.java index 4a32d54..a371a58 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Sifter.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Sifter.java @@ -1,16 +1,13 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; -import java.util.Arrays; - import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; @@ -30,98 +27,20 @@ public class Sifter { * @param outChances chances of 1-9 output * @param durationTicks reaction time, in ticks * @param euPerTick eu consumption per tick - * */ @ZenMethod public static void addRecipe(IItemStack[] outputs, IIngredient input, int[] outChances, int durationTicks, int euPerTick) { if (outputs.length < 1) { MineTweakerAPI.logError("Sifter must have at least 1 output"); - } else if(outputs.length!=outChances.length){ + } else if (outputs.length != outChances.length) { MineTweakerAPI.logError("Number of Outputs does not equal number of Chances"); - }else { - MineTweakerAPI.apply(new AddRecipeAction(outputs, input, outChances, durationTicks, euPerTick)); - } - } - -// ###################### -// ### Action classes ### -// ###################### - - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack[] output; - private final IIngredient input; - private final int[] chances; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack[] output, IIngredient input, int[] outChances, int duration, int euPerTick) { - - this.output = output; - this.input = input; - this.chances = outChances; - this.duration = duration; - this.euPerTick = euPerTick; - - - } - - @Override - public void apply() { - RA.addSifterRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStacks(output), - chances, - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding Sifter recipe for " + input ; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 1; - hash = 76 * hash + Arrays.deepHashCode(this.output); - hash = 76 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 76 * hash + this.duration; - hash = 76 * hash + this.euPerTick; - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (!Arrays.deepEquals(this.output, other.output)) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.chances != other.chances) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; - } - return true; + } else { + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Sifter recipe for " + input, input, outputs, outChances, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addSifterRecipe(i.nextItem(), i.nextItemArr(), i.nextIntArr(), i.nextInt(), i.nextInt()); + } + }); } } } \ No newline at end of file diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Slicer.java b/src/main/java/gttweaker/mods/gregtech/machines/Slicer.java index bee7945..fe834c4 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Slicer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Slicer.java @@ -1,16 +1,16 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import static gregtech.api.enums.GT_Values.MOD_ID; import static gregtech.api.enums.GT_Values.RA; + /** * Provides access to the Slicer recipes. * @@ -30,77 +30,11 @@ public class Slicer { */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, IItemStack blade, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, blade, durationTicks, euPerTick)); - } -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IIngredient input; - private final IItemStack blade; - private final int duration; - private final int euPerTick; - public AddRecipeAction(IItemStack output, IIngredient input, IItemStack blade, int duration, int euPerTick) { - - this.output = output; - this.input = input; - this.blade = blade; - this.duration = duration; - this.euPerTick = euPerTick; - } - @Override - public void apply() { - RA.addSlicerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(blade), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - @Override - public String describe() { - return "Adding Slicer recipe for " + output; - } - @Override - public Object getOverrideKey() { - return null; - } - @Override - public int hashCode() { - int hash = 7; - hash = 37 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 37 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 37 * hash + (this.blade != null ? this.blade.hashCode() : 0); - hash = 37 * hash + this.duration; - hash = 37 * hash + this.euPerTick; - return hash; - } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.blade != other.blade && (this.blade == null || !this.blade.equals(other.blade))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Slicer recipe for " + output, input, blade, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addSlicerRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java b/src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java index 0416f58..e6070d3 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Unpacker.java @@ -1,5 +1,6 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; @@ -19,7 +20,7 @@ */ @ZenClass("mods.gregtech.Unpacker") @ModOnly(MOD_ID) -public class Unpacker{ +public class Unpacker { /** * Adds a Unpacker recipe. * @@ -31,77 +32,11 @@ public class Unpacker{ */ @ZenMethod public static void addRecipe(IItemStack output1, IItemStack output2, IIngredient input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output1, output2, input, durationTicks, euPerTick)); - } -// ###################### -// ### Action classes ### -// ###################### - private static class AddRecipeAction extends OneWayAction { - - private final IItemStack output1; - private final IItemStack output2; - private final IIngredient input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output1, IItemStack output2, IIngredient input, int duration, int euPerTick) { - - this.output1 = output1; - this.output2 = output2; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - @Override - public void apply() { - RA.addUnboxingRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output1), - MineTweakerMC.getItemStack(output2), - duration, - euPerTick); - } - @Override - public String describe() {return "Adding Unpacker recipe for " + input;} - - @Override - public Object getOverrideKey() {return null;} - - @Override - public int hashCode() { - int hash = 9; - hash = 39 * hash + (this.output1 != null ? this.output1.hashCode() : 0); - hash = 39 * hash + (this.output2 != null ? this.output2.hashCode() : 0); - hash = 39 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 39 * hash + this.duration; - hash = 39 * hash + this.euPerTick; - return hash; - } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output1 != other.output1 && (this.output1 == null || !this.output1.equals(other.output1))) { - return false; - } - if (this.output2 != other.output2 && (this.output2 == null || !this.output2.equals(other.output2))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Unpacker recipe for " + input, input, output1, output2, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addUnboxingRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/VacuumFreezer.java b/src/main/java/gttweaker/mods/gregtech/machines/VacuumFreezer.java index 4fc032e..6b6a036 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/VacuumFreezer.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/VacuumFreezer.java @@ -1,11 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -29,70 +28,11 @@ public class VacuumFreezer { */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, int durationTicks) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IIngredient input; - private final int duration; - - public AddRecipeAction(IItemStack output, IIngredient input, int duration) { - this.output = output; - this.input = input; - this.duration = duration; - } - - @Override - public void apply() { - RA.addVacuumFreezerRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration); - } - - @Override - public String describe() { - return "Adding vacuum freezer recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 67 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 67 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 67 * hash + this.duration; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding vacuum freezer recipe for " + output, input, output, durationTicks) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addVacuumFreezerRecipe(i.nextItem(), i.nextItem(), i.nextInt()); } - return true; - } + }); } } diff --git a/src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java b/src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java index 5a1388a..7036891 100644 --- a/src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java +++ b/src/main/java/gttweaker/mods/gregtech/machines/Wiremill.java @@ -1,11 +1,10 @@ package gttweaker.mods.gregtech.machines; +import gttweaker.mods.gregtech.AddMultipleRecipeAction; import minetweaker.MineTweakerAPI; -import minetweaker.OneWayAction; import minetweaker.annotations.ModOnly; import minetweaker.api.item.IIngredient; import minetweaker.api.item.IItemStack; -import minetweaker.api.minecraft.MineTweakerMC; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; @@ -30,77 +29,11 @@ public class Wiremill { */ @ZenMethod public static void addRecipe(IItemStack output, IIngredient input, int durationTicks, int euPerTick) { - MineTweakerAPI.apply(new AddRecipeAction(output, input, durationTicks, euPerTick)); - } - - // ###################### - // ### Action classes ### - // ###################### - - private static class AddRecipeAction extends OneWayAction { - private final IItemStack output; - private final IIngredient input; - private final int duration; - private final int euPerTick; - - public AddRecipeAction(IItemStack output, IIngredient input, int duration, int euPerTick) { - this.output = output; - this.input = input; - this.duration = duration; - this.euPerTick = euPerTick; - } - - @Override - public void apply() { - RA.addWiremillRecipe( - MineTweakerMC.getItemStack(input), - MineTweakerMC.getItemStack(output), - duration, - euPerTick); - } - - @Override - public String describe() { - return "Adding wiremill recipe for " + output; - } - - @Override - public Object getOverrideKey() { - return null; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 37 * hash + (this.output != null ? this.output.hashCode() : 0); - hash = 37 * hash + (this.input != null ? this.input.hashCode() : 0); - hash = 37 * hash + this.duration; - hash = 37 * hash + this.euPerTick; - return hash; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final AddRecipeAction other = (AddRecipeAction) obj; - if (this.output != other.output && (this.output == null || !this.output.equals(other.output))) { - return false; - } - if (this.input != other.input && (this.input == null || !this.input.equals(other.input))) { - return false; - } - if (this.duration != other.duration) { - return false; - } - if (this.euPerTick != other.euPerTick) { - return false; + MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding wiremill recipe for " + output, input, output, durationTicks, euPerTick) { + @Override + protected void applySingleRecipe(ArgIterator i) { + RA.addWiremillRecipe(i.nextItem(), i.nextItem(), i.nextInt(), i.nextInt()); } - return true; - } + }); } }