Finish porting all recipes to json, cleanup a lot of old code
This commit is contained in:
parent
2a5708b328
commit
9db1978410
17 changed files with 76 additions and 1132 deletions
|
@ -41,8 +41,7 @@ import techreborn.blockentity.fusionReactor.FusionControlComputerBlockEntity;
|
|||
import techreborn.client.GuiHandler;
|
||||
import techreborn.events.ModRegistry;
|
||||
import techreborn.init.*;
|
||||
import techreborn.init.recipes.FluidGeneratorRecipes;
|
||||
import techreborn.init.recipes.FusionReactorRecipes;
|
||||
import techreborn.init.FluidGeneratorRecipes;
|
||||
import techreborn.packets.ClientboundPackets;
|
||||
import techreborn.packets.ServerboundPackets;
|
||||
import techreborn.utils.BehaviorDispenseScrapbox;
|
||||
|
@ -76,7 +75,6 @@ public class TechReborn implements ModInitializer {
|
|||
WorldGenerator.initBiomeFeatures();
|
||||
GuiHandler.register();
|
||||
FluidGeneratorRecipes.init();
|
||||
FusionReactorRecipes.init();
|
||||
//Force loads the block entities at the right time
|
||||
TRBlockEntities.THERMAL_GEN.toString();
|
||||
|
||||
|
@ -88,15 +86,6 @@ public class TechReborn implements ModInitializer {
|
|||
|
||||
Torus.genSizeMap(FusionControlComputerBlockEntity.maxCoilSize);
|
||||
|
||||
CommandRegistry.INSTANCE.register(false, dispatcher -> dispatcher.register(CommandManager.literal("recipe").executes(context -> {
|
||||
try {
|
||||
RecipeTemplate.generateFromInv(context.getSource().getPlayer());
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
})));
|
||||
|
||||
LOGGER.info("TechReborn setup done!");
|
||||
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IC2Helper {
|
||||
|
||||
public void initDuplicates();
|
||||
|
||||
public boolean extractSap(ItemUsageContext context, List<ItemStack> stacks);
|
||||
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import techreborn.api.recipe.IRecipeCompact;
|
||||
|
||||
public final class TechRebornAPI {
|
||||
|
||||
/**
|
||||
* Use this to get the instance of IRecipeCompat
|
||||
*/
|
||||
public static IRecipeCompact recipeCompact;
|
||||
|
||||
public static IC2Helper ic2Helper;
|
||||
|
||||
/**
|
||||
* Use this to get an item from Tech Reborn, @see <a href=
|
||||
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModItems.java">
|
||||
* ModItems.java</a> for the full list
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Item getItem(String name) {
|
||||
try {
|
||||
Object e = Class.forName("techreborn.init.TRContent").getField(name).get(null);
|
||||
return e instanceof Item ? (Item) e : null;
|
||||
} catch (NoSuchFieldException e1) {
|
||||
e1.printStackTrace();
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to get an ingredient item from Tech Reborn, @see <a href=
|
||||
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModItems.java">
|
||||
* ModItems.java</a> for the full list
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Item getIngredient(String name) {
|
||||
try {
|
||||
Object e = Class.forName("techreborn.init.TRContent").getField(name).get(null);
|
||||
return e instanceof Item ? (Item) e : null;
|
||||
} catch (NoSuchFieldException e1) {
|
||||
e1.printStackTrace();
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to get an block from techrebonrn, @see <a href=
|
||||
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModBlocks.java">
|
||||
* ModBlocks.java</a> for the full list
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Block getBlock(String name) {
|
||||
try {
|
||||
Object e = Class.forName("techreborn.init.ModBlocks").getField(name).get(null);
|
||||
return e instanceof Block ? (Block) e : null;
|
||||
} catch (NoSuchFieldException e1) {
|
||||
e1.printStackTrace();
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.api.recipe;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IRecipeCompact {
|
||||
|
||||
ImmutableList<ItemStack> getItems(String name);
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.api.recipe.recipeConfig;
|
||||
|
||||
public class ConfigItem {
|
||||
|
||||
String localName;
|
||||
|
||||
String itemName;
|
||||
|
||||
int meta;
|
||||
|
||||
int stackSize;
|
||||
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setMeta(int meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public int getStackSize() {
|
||||
return stackSize;
|
||||
}
|
||||
|
||||
public void setStackSize(int stackSize) {
|
||||
this.stackSize = stackSize;
|
||||
}
|
||||
|
||||
public String getLocalName() {
|
||||
return localName;
|
||||
}
|
||||
|
||||
public void setLocalName(String localName) {
|
||||
this.localName = localName;
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.api.recipe.recipeConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RecipeConfig {
|
||||
|
||||
ArrayList<ConfigItem> inputs;
|
||||
|
||||
ArrayList<ConfigItem> outputs;
|
||||
|
||||
Boolean enabled;
|
||||
|
||||
String machine;
|
||||
|
||||
public ArrayList<ConfigItem> getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
public void setInputs(ArrayList<ConfigItem> inputs) {
|
||||
this.inputs = inputs;
|
||||
}
|
||||
|
||||
public ArrayList<ConfigItem> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
public void setOutputs(ArrayList<ConfigItem> outputs) {
|
||||
this.outputs = outputs;
|
||||
}
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getMachine() {
|
||||
return machine;
|
||||
}
|
||||
|
||||
public void setMachine(String machine) {
|
||||
this.machine = machine;
|
||||
}
|
||||
|
||||
public void addInputs(ConfigItem item) {
|
||||
if (inputs == null) {
|
||||
inputs = new ArrayList<>();
|
||||
}
|
||||
inputs.add(item);
|
||||
}
|
||||
|
||||
public void addOutputs(ConfigItem item) {
|
||||
if (outputs == null) {
|
||||
outputs = new ArrayList<>();
|
||||
}
|
||||
outputs.add(item);
|
||||
}
|
||||
}
|
|
@ -129,8 +129,5 @@ public class ConfigTechReborn {
|
|||
|
||||
@ConfigRegistry(config = "world", category = "loot", key = "enableEndLoot", comment = "When true TechReborn will add ingots, machine frames and circuits to The End loot chests.")
|
||||
public static boolean enableEndLoot = true;
|
||||
|
||||
@ConfigRegistry(config = "world", category = "village", key = "enableRubberTreePlantation", comment = "When true TechReborn will add Rubber tree farm to villages.")
|
||||
public static boolean enableRubberTreePlantation = true;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.init.recipes;
|
||||
package techreborn.init;
|
||||
|
||||
|
||||
import net.minecraft.fluid.Fluid;
|
||||
|
@ -33,7 +33,7 @@ import techreborn.init.ModFluids;
|
|||
/**
|
||||
* Created by Prospector
|
||||
*/
|
||||
public class FluidGeneratorRecipes extends RecipeMethods {
|
||||
public class FluidGeneratorRecipes {
|
||||
public static void init() {
|
||||
register(EFluidGenerator.DIESEL, ModFluids.NITROFUEL.getFluid(), 24);
|
||||
register(EFluidGenerator.DIESEL, ModFluids.NITROCOAL_FUEL.getFluid(), 48);
|
|
@ -1,172 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.init;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
|
||||
public class OreDict {
|
||||
|
||||
private static final ImmutableList<String> plateGenIgnores = ImmutableList.of(
|
||||
"hot", //Hot ingots
|
||||
"mixed_metal", //Mixed metal has own version of plate
|
||||
"iridium_alloy" //Iridium alloy is plate itself
|
||||
);
|
||||
|
||||
/**
|
||||
* Register blocks and items
|
||||
*/
|
||||
public static void init() {
|
||||
if(TechRebornAPI.ic2Helper != null){
|
||||
TechRebornAPI.ic2Helper.initDuplicates();
|
||||
}
|
||||
// Blocks
|
||||
// OreUtil.registerOre("fenceIron", TRContent.REFINED_IRON_FENCE);
|
||||
// OreUtil.registerOre("woodRubber", TRContent.RUBBER_LOG);
|
||||
// OreUtil.registerOre("logWood", TRContent.RUBBER_LOG);
|
||||
// OreUtil.registerOre("logRubber", TRContent.RUBBER_LOG);
|
||||
// OreUtil.registerOre("plankWood", TRContent.RUBBER_PLANKS);
|
||||
// OreUtil.registerOre("plankRubber", TRContent.RUBBER_PLANKS);
|
||||
// OreUtil.registerOre("glassReinforced", TRContent.REINFORCED_GLASS);
|
||||
// OreUtil.registerOre("treeSapling", TRContent.RUBBER_SAPLING);
|
||||
// OreUtil.registerOre("saplingRubber", TRContent.RUBBER_SAPLING);
|
||||
// OreUtil.registerOre("slabWood", TRContent.RUBBER_LOG_SLAB_HALF);
|
||||
// OreUtil.registerOre("stairWood", TRContent.RUBBER_LOG_STAIR);
|
||||
// OreUtil.registerOre("treeLeaves", TRContent.RUBBER_LEAVES);
|
||||
// OreUtil.registerOre("leavesRubber", TRContent.RUBBER_LEAVES);
|
||||
//
|
||||
// // Parts
|
||||
// OreUtil.registerOre("circuitBasic", TRContent.Parts.ELECTRONIC_CIRCUIT.getStack());
|
||||
// OreUtil.registerOre("circuitAdvanced", TRContent.Parts.ADVANCED_CIRCUIT.getStack());
|
||||
// OreUtil.registerOre("circuitElite", TRContent.Parts.INDUSTRIAL_CIRCUIT.getStack());
|
||||
// OreUtil.registerOre("circuitStorage", TRContent.Parts.DATA_STORAGE_CHIP.getStack());
|
||||
// OreUtil.registerOre("circuitMaster", TRContent.Parts.ENERGY_FLOW_CHIP.getStack());
|
||||
// OreUtil.registerOre("craftingDiamondGrinder", TRContent.Parts.DIAMOND_GRINDING_HEAD.getStack());
|
||||
// OreUtil.registerOre("craftingTungstenGrinder", TRContent.Parts.TUNGSTEN_GRINDING_HEAD.getStack());
|
||||
// OreUtil.registerOre("craftingSuperconductor", TRContent.Parts.SUPERCONDUCTOR.getStack());
|
||||
// OreUtil.registerOre("materialResin", TRContent.Parts.SAP.getStack());
|
||||
// OreUtil.registerOre("materialRubber", TRContent.Parts.RUBBER.getStack());
|
||||
// OreUtil.registerOre("itemRubber", TRContent.Parts.RUBBER.getStack());
|
||||
//
|
||||
// // Frames
|
||||
// OreUtil.registerOre("machineBasic", new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
|
||||
// OreUtil.registerOre("machineBlockBasic", new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
|
||||
// OreUtil.registerOre("machineBlockAdvanced", new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
|
||||
// OreUtil.registerOre("machineBlockElite", new ItemStack(TRContent.MachineBlocks.INDUSTRIAL.getFrame()));
|
||||
//
|
||||
// // Tools&Armor
|
||||
// OreUtil.registerOre("reBattery", TRContent.RED_CELL_BATTERY);
|
||||
// OreUtil.registerOre("lapotronCrystal", TRContent.LAPOTRON_CRYSTAL);
|
||||
// OreUtil.registerOre("energyCrystal", TRContent.ENERGY_CRYSTAL);
|
||||
// OreUtil.registerOre("drillBasic", TRContent.BASIC_DRILL);
|
||||
// OreUtil.registerOre("drillDiamond", TRContent.ADVANCED_DRILL);
|
||||
//
|
||||
// // Misc
|
||||
// OreUtil.registerOre("industrialTnt", Blocks.TNT);
|
||||
// OreUtil.registerOre("craftingPiston", Blocks.PISTON);
|
||||
// OreUtil.registerOre("craftingPiston", Blocks.STICKY_PISTON);
|
||||
// OreUtil.registerOre("crafterWood", Blocks.CRAFTING_TABLE);
|
||||
// OreUtil.registerOre("craftingIndustrialDiamond", Items.DIAMOND);
|
||||
// OreUtil.registerOre("fertilizer", new ItemStack(Items.DYE, 1, 15));
|
||||
// OreUtil.registerOre("insulatedGoldCableItem", TRContent.Cables.INSULATED_GOLD.asItem());
|
||||
// OreUtil.registerOre("pulpWood", TRContent.Dusts.SAW.getStack());
|
||||
|
||||
//OreUtil.registerOre("uran235", nothing);
|
||||
//OreUtil.registerOre("uran238", nothing);
|
||||
//OreUtil.registerOre("smallUran235", nothing);
|
||||
//
|
||||
// for (Ores ore : TRContent.Ores.values()) {
|
||||
// OreUtil.registerOre("ore" + StringUtils.toFirstCapital(ore.name), new ItemStack(ore.block));
|
||||
// }
|
||||
//
|
||||
// for (Dusts dust : TRContent.Dusts.values()) {
|
||||
// OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "dust_" + dust.name), dust.getStack());
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// OreUtil.registerOre("blockSilver", BlockStorage.getStorageBlockByName("silver"));
|
||||
// OreUtil.registerOre("blockAluminum", BlockStorage.getStorageBlockByName("aluminum"));
|
||||
// OreUtil.registerOre("blockAluminium", BlockStorage.getStorageBlockByName("aluminum"));
|
||||
// OreUtil.registerOre("blockTitanium", BlockStorage.getStorageBlockByName("titanium"));
|
||||
// OreUtil.registerOre("blockChrome", BlockStorage.getStorageBlockByName("chrome"));
|
||||
// OreUtil.registerOre("blockSteel", BlockStorage.getStorageBlockByName("steel"));
|
||||
// OreUtil.registerOre("blockBrass", BlockStorage.getStorageBlockByName("brass"));
|
||||
// OreUtil.registerOre("blockLead", BlockStorage.getStorageBlockByName("lead"));
|
||||
// OreUtil.registerOre("blockElectrum", BlockStorage.getStorageBlockByName("electrum"));
|
||||
// OreUtil.registerOre("blockZinc", BlockStorage.getStorageBlockByName("zinc"));
|
||||
// OreUtil.registerOre("blockPlatinum", BlockStorage.getStorageBlockByName("platinum"));
|
||||
// OreUtil.registerOre("blockTungsten", BlockStorage.getStorageBlockByName("tungsten"));
|
||||
// OreUtil.registerOre("blockNickel", BlockStorage.getStorageBlockByName("nickel"));
|
||||
// OreUtil.registerOre("blockInvar", BlockStorage.getStorageBlockByName("invar"));
|
||||
// OreUtil.registerOre("blockIridium", BlockStorage.getStorageBlockByName("iridium"));
|
||||
// OreUtil.registerOre("blockBronze", BlockStorage.getStorageBlockByName("bronze"));
|
||||
// OreUtil.registerOre("blockCopper", BlockStorage2.getStorageBlockByName("copper", 1));
|
||||
// OreUtil.registerOre("blockTin", BlockStorage2.getStorageBlockByName("tin", 1));
|
||||
// OreUtil.registerOre("blockTungstensteel", BlockStorage2.getStorageBlockByName("tungstensteel", 1));
|
||||
// OreUtil.registerOre("blockRuby", BlockStorage2.getStorageBlockByName("ruby", 1));
|
||||
// OreUtil.registerOre("blockSapphire", BlockStorage2.getStorageBlockByName("sapphire", 1));
|
||||
// OreUtil.registerOre("blockPeridot", BlockStorage2.getStorageBlockByName("peridot", 1));
|
||||
// OreUtil.registerOre("blockYellowGarnet", BlockStorage2.getStorageBlockByName("yellowGarnet", 1));
|
||||
// OreUtil.registerOre("blockRedGarnet", BlockStorage2.getStorageBlockByName("redGarnet", 1));
|
||||
|
||||
// TODO: fix recipe
|
||||
// for (String type : ItemGems.types) {
|
||||
// OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "gem_" + type), ItemGems.getGemByName(type));
|
||||
// boolean ignoreIt = false;
|
||||
// for (String ignore : plateGenIgnores)
|
||||
// if (type.startsWith(ignore))
|
||||
// ignoreIt = true;
|
||||
// if (!ignoreIt)
|
||||
// ItemPlates.registerType(type);
|
||||
// }
|
||||
|
||||
// for (String type : ItemIngots.types) {
|
||||
// OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "ingot_" + type), ItemIngots.getIngotByName(type));
|
||||
// boolean ignoreIt = false;
|
||||
// for (String ignore : plateGenIgnores)
|
||||
// if (type.startsWith(ignore))
|
||||
// ignoreIt = true;
|
||||
// if (!ignoreIt)
|
||||
// ItemPlates.registerType(type);
|
||||
// }
|
||||
|
||||
// for (String type : ItemPlates.types) {
|
||||
// OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "plate_" + type), ItemPlates.getPlateByName(type));
|
||||
// }
|
||||
|
||||
|
||||
//
|
||||
// for (String type : ItemDustsSmall.types) {
|
||||
// OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "dust_small_" + type), ItemDustsSmall.getSmallDustByName(type));
|
||||
// }
|
||||
|
||||
// for (String type : ItemNuggets.types) {
|
||||
// OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "nugget_" + type), ItemNuggets.getNuggetByName(type));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,336 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.init;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
import com.mojang.datafixers.types.JsonOps;
|
||||
import net.minecraft.container.Container;
|
||||
import net.minecraft.datafixers.NbtOps;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.recipe.CraftingRecipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import techreborn.items.ItemDynamicCell;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RecipeTemplate {
|
||||
|
||||
public static void generateFromInv(PlayerEntity playerEntity) throws IOException {
|
||||
|
||||
if(playerEntity.inventory.getInvStack(0).isEmpty()){
|
||||
playerEntity.sendMessage(new LiteralText("no machine in first slot"));
|
||||
auto(playerEntity);
|
||||
return;
|
||||
}
|
||||
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
List<ItemStack> outputs = new ArrayList<>();
|
||||
Identifier type = Registry.ITEM.getId(playerEntity.inventory.getInvStack(0).getItem());
|
||||
|
||||
for (int i = 1; i < playerEntity.inventory.getInvSize(); i++) {
|
||||
ItemStack stack = playerEntity.inventory.getInvStack(i);
|
||||
if(!stack.isEmpty()){
|
||||
if(i < 9){
|
||||
outputs.add(stack);
|
||||
} else {
|
||||
inputs.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File file = generate(type,false, 20, 400, inputs, outputs);
|
||||
|
||||
playerEntity.sendMessage(new LiteralText("done: " + file.getAbsolutePath()));
|
||||
|
||||
}
|
||||
|
||||
public static void auto(PlayerEntity playerEntity) throws IOException {
|
||||
List<Item> items = Registry.ITEM.stream().collect(Collectors.toList());
|
||||
|
||||
|
||||
Map<String, Map<String, Item>> map = new HashMap<>();
|
||||
List<String> names = new ArrayList<>();
|
||||
|
||||
|
||||
for(Item item : items){
|
||||
Identifier identifier = Registry.ITEM.getId(item);
|
||||
String path = identifier.getPath();
|
||||
|
||||
if(path.contains("_")){
|
||||
String name = path.substring(0, path.lastIndexOf('_')).replace("_storage", "");
|
||||
String type = path.substring(path.lastIndexOf('_') + 1);
|
||||
|
||||
Map<String, Item> typeMap = map.computeIfAbsent(type, s -> new HashMap<>());
|
||||
|
||||
typeMap.put(name, item);
|
||||
|
||||
if (!names.contains(name)) {
|
||||
names.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
boolean compressor = false;
|
||||
boolean grinder = false;
|
||||
boolean sawmill = false;
|
||||
|
||||
if(compressor){
|
||||
//Compressor
|
||||
for(String name : names){
|
||||
ItemStack plateStack = ItemStack.EMPTY;
|
||||
if(map.get("plate").containsKey(name)){
|
||||
Item plate = map.get("plate").get(name);
|
||||
plateStack = new ItemStack(plate);
|
||||
}
|
||||
|
||||
if(plateStack.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(map.get("ingot").containsKey(name)){
|
||||
ItemStack ingotStack = new ItemStack(map.get("ingot").get(name));
|
||||
generate(new Identifier("techreborn", "compressor"), true, 10, 300, Collections.singletonList(ingotStack), Collections.singletonList(plateStack));
|
||||
}
|
||||
|
||||
if(map.get("dust").containsKey(name)){
|
||||
ItemStack dust = new ItemStack(map.get("dust").get(name));
|
||||
generate(new Identifier("techreborn", "compressor"), true, 10, 250, Collections.singletonList(dust), Collections.singletonList(plateStack));
|
||||
}
|
||||
|
||||
if(map.get("block").containsKey(name)){
|
||||
ItemStack blockStack = new ItemStack(map.get("block").get(name));
|
||||
|
||||
ItemStack morePlates = plateStack.copy();
|
||||
morePlates.setCount(9);
|
||||
|
||||
generate(new Identifier("techreborn", "compressor"), true, 10, 300, Collections.singletonList(blockStack), Collections.singletonList(morePlates));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(grinder){
|
||||
String[] highTeirNames = new String[]{"tungsten", "titanium", "aluminium", "iridium", "saltpeter", "coal", "diamond", "emerald", "redstone", "quartz"};
|
||||
|
||||
String[] types = new String[]{"ore", "gem", "ingot"};
|
||||
|
||||
//Grinder
|
||||
for(String name : names){
|
||||
for(String type : types){
|
||||
ItemStack inputStack = ItemStack.EMPTY;
|
||||
if(map.get(type).containsKey(name)){
|
||||
Item ore = map.get(type).get(name);
|
||||
inputStack = new ItemStack(ore);
|
||||
}
|
||||
|
||||
if(inputStack.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean ore = type.equals("ore");
|
||||
|
||||
if (ore && Arrays.asList(highTeirNames).contains(name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack dustStack = ItemStack.EMPTY;
|
||||
if(map.get("dust").containsKey(name)){
|
||||
Item dust = map.get("dust").get(name);
|
||||
dustStack = new ItemStack(dust);
|
||||
}
|
||||
|
||||
if(dustStack.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ore){
|
||||
dustStack.setCount(2);
|
||||
}
|
||||
|
||||
generate(new Identifier("techreborn", "grinder"), true, ore ? 270 : 200, ore ? 31 : 22, Collections.singletonList(inputStack), Collections.singletonList(dustStack));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(sawmill){
|
||||
|
||||
CraftingInventory inventory = new CraftingInventory(new Container(null, 0) {
|
||||
@Override
|
||||
public boolean canUse(PlayerEntity var1) {
|
||||
return true;
|
||||
}
|
||||
}, 1, 1);
|
||||
|
||||
for(String name : names){
|
||||
ItemStack inputStack = ItemStack.EMPTY;
|
||||
if(map.get("log").containsKey(name)){
|
||||
Item ore = map.get("log").get(name);
|
||||
inputStack = new ItemStack(ore);
|
||||
}
|
||||
|
||||
if(inputStack.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
inventory.setInvStack(0, inputStack.copy());
|
||||
|
||||
List<CraftingRecipe> recipes = playerEntity.world.getRecipeManager().getAllMatches(RecipeType.CRAFTING, inventory, playerEntity.world);
|
||||
CraftingRecipe recipe = recipes.get(0);
|
||||
|
||||
ItemStack output = recipe.getOutput();
|
||||
|
||||
if(output.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
addRecipe(inputStack, output);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void addRecipe(ItemStack log, ItemStack plank) throws IOException {
|
||||
plank.setCount(4);
|
||||
register(log, Fluids.WATER, 100, 128, plank, TRContent.Dusts.SAW.getStack(3), new ItemStack(Items.PAPER));
|
||||
}
|
||||
|
||||
static void register(ItemStack input1, Fluid fluid, int ticks, int euPerTick, ItemStack... outputs) throws IOException {
|
||||
Identifier sawmill = new Identifier("techreborn:industrial_sawmill");
|
||||
generate(sawmill, true, euPerTick, ticks, Collections.singletonList(input1), Arrays.asList(outputs));
|
||||
}
|
||||
|
||||
public static File generate(Identifier type, boolean auto, int power, int time, List<ItemStack> inputs, List<ItemStack> outputs) throws IOException {
|
||||
JsonObject object = new JsonObject();
|
||||
object.addProperty("power", power);
|
||||
object.addProperty("time", time);
|
||||
|
||||
{
|
||||
JsonArray ingredients = new JsonArray();
|
||||
|
||||
Function<ItemStack, JsonObject> toIngredient = stack -> {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
if(stack.getItem() == TRContent.CELL && TRContent.CELL.getFluid(stack) != Fluids.EMPTY){
|
||||
jsonObject.addProperty("fluid", Registry.FLUID.getId(TRContent.CELL.getFluid(stack)).toString());
|
||||
jsonObject.addProperty("holder", "techreborn:cell");
|
||||
} else {
|
||||
jsonObject.addProperty("item", Registry.ITEM.getId(stack.getItem()).toString());
|
||||
if(stack.getCount() > 1){
|
||||
jsonObject.addProperty("count", stack.getCount());
|
||||
}
|
||||
if(stack.getItem() instanceof ItemDynamicCell){
|
||||
if(((ItemDynamicCell) stack.getItem()).getFluid(stack) == Fluids.EMPTY){
|
||||
jsonObject.addProperty("nbt", "empty");
|
||||
} else {
|
||||
JsonElement jsonElement = Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, stack.getTag());
|
||||
jsonObject.add("nbt", jsonElement);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return jsonObject;
|
||||
};
|
||||
inputs.stream().peek(Validate::notNull).forEach(stack -> ingredients.add(toIngredient.apply(stack)));
|
||||
|
||||
object.add("ingredients", ingredients);
|
||||
}
|
||||
|
||||
{
|
||||
JsonArray results = new JsonArray();
|
||||
|
||||
Function<ItemStack, JsonObject> toResult = stack -> {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("item", Registry.ITEM.getId(stack.getItem()).toString());
|
||||
if(stack.getCount() > 1){
|
||||
jsonObject.addProperty("count", stack.getCount());
|
||||
}
|
||||
if(stack.hasTag()){
|
||||
jsonObject.add("tag", Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, stack.getTag()));
|
||||
}
|
||||
return jsonObject;
|
||||
};
|
||||
outputs.forEach(stack -> results.add(toResult.apply(stack)));
|
||||
|
||||
object.add("results", results);
|
||||
}
|
||||
|
||||
return generate(type, auto, object, outputs.get(0));
|
||||
}
|
||||
|
||||
public static File generate(Identifier type, boolean auto, JsonObject object, ItemStack namingStack) throws IOException {
|
||||
|
||||
object.addProperty("type", type.toString());
|
||||
|
||||
String json = new GsonBuilder().setPrettyPrinting().create().toJson(object);
|
||||
|
||||
File dir = new File("C:\\Users\\mark\\Documents\\Modding\\1.14\\TechReborn\\");
|
||||
System.out.println(dir.getAbsolutePath());
|
||||
File file = null;
|
||||
|
||||
int i = 0;
|
||||
while (file == null || file.exists()){
|
||||
String name = Registry.ITEM.getId(namingStack.getItem()).getPath();
|
||||
if(namingStack.getItem() == TRContent.CELL){
|
||||
name = Registry.FLUID.getId(TRContent.CELL.getFluid(namingStack)).getPath();
|
||||
if(name.equals("empty")){
|
||||
name = "empty_cell";
|
||||
}
|
||||
}
|
||||
|
||||
String extraPath = auto ? "/auto/" : "/";
|
||||
|
||||
file = new File(dir, "src/main/resources/data/techreborn/recipes/" + type.getPath() + extraPath + name + (i == 0 ? "" : "_" + i) + ".json");
|
||||
i ++;
|
||||
}
|
||||
|
||||
FileUtils.writeStringToFile(file, json, StandardCharsets.UTF_8);
|
||||
|
||||
return file;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.init.recipes;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
public class FusionReactorRecipes extends RecipeMethods {
|
||||
public static void init() {
|
||||
|
||||
// FusionReactorRecipeHelper
|
||||
// .registerRecipe(new FusionReactorRecipe(ItemDynamicCell.getCellWithFluid(ModFluids.HELIUM_3.getFluid()),
|
||||
// ItemDynamicCell.getCellWithFluid(ModFluids.DEUTERIUM.getFluid()),
|
||||
// ItemDynamicCell.getCellWithFluid(ModFluids.HELIUMPLASMA.getFluid()), 40000000, 32768, 1024));
|
||||
//
|
||||
// FusionReactorRecipeHelper.registerRecipe(
|
||||
// new FusionReactorRecipe(ItemDynamicCell.getCellWithFluid(ModFluids.WOLFRAMIUM.getFluid()),
|
||||
// ItemDynamicCell.getCellWithFluid(ModFluids.BERYLIUM.getFluid()),
|
||||
// TRContent.Dusts.PLATINUM.getStack(), 80000000, -2048, 1024));
|
||||
// FusionReactorRecipeHelper.registerRecipe(
|
||||
// new FusionReactorRecipe(ItemDynamicCell.getCellWithFluid(ModFluids.WOLFRAMIUM.getFluid()),
|
||||
// ItemDynamicCell.getCellWithFluid(ModFluids.LITHIUM.getFluid()),
|
||||
// new ItemStack(TRContent.Ores.IRIDIUM.asItem()), 90000000, -2048, 1024));
|
||||
}
|
||||
}
|
|
@ -1,207 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.init.recipes;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.items.ItemDynamicCell;
|
||||
|
||||
/**
|
||||
* Created by Prospector
|
||||
*/
|
||||
public abstract class RecipeMethods {
|
||||
public static ItemStack getMaterial(String name, int count, Type type) {
|
||||
name = name.toLowerCase();
|
||||
if(type == Type.CELL){
|
||||
|
||||
Fluid fluid = Registry.FLUID.get(new Identifier("techreborn", name.toLowerCase()));
|
||||
if(name.equals("water")){
|
||||
fluid = Fluids.WATER;
|
||||
}
|
||||
if(name.equals("lava")){
|
||||
fluid = Fluids.LAVA;
|
||||
}
|
||||
|
||||
if(fluid == Fluids.EMPTY){
|
||||
throw new RuntimeException("could not find fluid " + name);
|
||||
}
|
||||
return ItemDynamicCell.getCellWithFluid(fluid, count);
|
||||
}
|
||||
|
||||
if(type == Type.INGOT){
|
||||
return find(name + "_ingot", count);
|
||||
}
|
||||
|
||||
if(type == Type.DUST){
|
||||
return find(name + "_dust", count);
|
||||
}
|
||||
|
||||
if(type == Type.PLATE){
|
||||
return find(name + "_plate", count);
|
||||
}
|
||||
|
||||
if(type == Type.NUGGET){
|
||||
return find(name + "_nugget", count);
|
||||
}
|
||||
|
||||
if(type == Type.SMALL_DUST){
|
||||
return find(name + "_small_dust", count);
|
||||
}
|
||||
|
||||
if(type == Type.ORE){
|
||||
return find(name + "_ore", count);
|
||||
}
|
||||
|
||||
if(type == Type.PART){
|
||||
return find(name, count);
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException(type.name());
|
||||
}
|
||||
|
||||
private static ItemStack find(String path, int count){
|
||||
Identifier identifier = new Identifier(path);
|
||||
Item item = Registry.ITEM.get(identifier);
|
||||
if(item != Items.AIR){
|
||||
return new ItemStack(item, count);
|
||||
}
|
||||
|
||||
identifier = new Identifier("techreborn", path);
|
||||
item = Registry.ITEM.get(identifier);
|
||||
if(item != Items.AIR){
|
||||
return new ItemStack(item, count);
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Could not find" + path);
|
||||
}
|
||||
|
||||
static Object getMaterialObjectFromType(String name, Type type) {
|
||||
Object object = null;
|
||||
if (type == Type.DUST) {
|
||||
object = "dust" + StringUtils.toFirstCapital(name);
|
||||
} else if (type == Type.SMALL_DUST) {
|
||||
object = "smallDust" + StringUtils.toFirstCapital(name);
|
||||
} else if (type == Type.INGOT) {
|
||||
object = "ingot" + StringUtils.toFirstCapital(name);
|
||||
} else if (type == Type.GEM) {
|
||||
object = "gem" + StringUtils.toFirstCapital(name);
|
||||
} else if (type == Type.PLATE) {
|
||||
object = "plate" + StringUtils.toFirstCapital(name);
|
||||
} else if (type == Type.NUGGET) {
|
||||
object = "nugget" + StringUtils.toFirstCapital(name);
|
||||
}else if (type == Type.ORE) {
|
||||
object = "ore" + StringUtils.toFirstCapital(name);
|
||||
}
|
||||
if (object != null) {
|
||||
if (object instanceof String) {
|
||||
throw new UnsupportedOperationException("Use tags");
|
||||
} else {
|
||||
return object;
|
||||
}
|
||||
}
|
||||
return getMaterial(name, type);
|
||||
}
|
||||
|
||||
public static ItemStack getMaterial(String name, Type type) {
|
||||
return getMaterial(name, 1, type);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ItemStack getOre(String name, int count) {
|
||||
if(name.equals("dustRedstone")){
|
||||
return new ItemStack(Items.REDSTONE, count);
|
||||
}
|
||||
if(name.startsWith("dust")){
|
||||
return getMaterial(name.replace("dust", ""), count, Type.DUST);
|
||||
}
|
||||
return getMaterial(name, count, Type.ORE);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ItemStack getOre(String name) {
|
||||
return getOre(name, 1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean oresExist(String... names) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getStack(Item item) {
|
||||
return getStack(item, 1);
|
||||
}
|
||||
|
||||
public static ItemStack getStack(Item item, int count) {
|
||||
return new ItemStack(item, count);
|
||||
}
|
||||
|
||||
|
||||
public static ItemStack getStack(Item item, boolean wildcard) {
|
||||
return getStack(item, 1, wildcard);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ItemStack getStack(Item item, int count, boolean wildcard) {
|
||||
return new ItemStack(item, count);
|
||||
}
|
||||
|
||||
public static ItemStack getStack(Block block) {
|
||||
return getStack(block, 1);
|
||||
}
|
||||
|
||||
public static ItemStack getStack(Block block, int count) {
|
||||
return new ItemStack(block, count);
|
||||
}
|
||||
|
||||
public static ItemStack getStack(Block block, boolean wildcard) {
|
||||
return getStack(block, 1, true);
|
||||
}
|
||||
|
||||
public static ItemStack getStack(Block block, int count, boolean wildcard) {
|
||||
throw new UnsupportedOperationException("Use tags");
|
||||
}
|
||||
|
||||
|
||||
public static Ingredient getCell(String name, int count){
|
||||
throw new UnsupportedOperationException("fix me");
|
||||
//return new IngredientCell(ItemCells.getCellByName(name, count));
|
||||
}
|
||||
|
||||
public static Ingredient getCell(String name){
|
||||
return getCell(name, 1);
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
DUST, SMALL_DUST, INGOT, NUGGET, PLATE, GEM, CELL, PART, CABLE, MACHINE_FRAME, MACHINE_CASING, UPGRADE, ORE
|
||||
}
|
||||
}
|
|
@ -39,7 +39,7 @@ import reborncore.common.powerSystem.PowerSystem;
|
|||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
|
@ -54,21 +54,6 @@ public class ItemElectricTreetap extends Item implements IEnergyItemInfo, ItemDu
|
|||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
}
|
||||
|
||||
// Item
|
||||
@Override
|
||||
public ActionResult useOnBlock(ItemUsageContext context) {
|
||||
ItemPowerManager capEnergy = new ItemPowerManager(context.getStack());
|
||||
if(TechRebornAPI.ic2Helper != null && capEnergy.getEnergyStored() >= cost){
|
||||
if(TechRebornAPI.ic2Helper.extractSap(context, null) && !context.getWorld().isClient){
|
||||
capEnergy.useEnergy(cost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, context.getPlayer());
|
||||
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
|
|
@ -96,6 +96,7 @@ public class ReiPlugin implements REIPluginEntry {
|
|||
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.INDUSTRIAL_SAWMILL, 3));
|
||||
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.SCRAPBOX));
|
||||
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.VACUUM_FREEZER, 1));
|
||||
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.FUSION_REACTOR, 2));
|
||||
recipeHelper.registerCategory(new RollingMachineCategory(ModRecipes.ROLLING_MACHINE));
|
||||
}
|
||||
|
||||
|
@ -120,6 +121,7 @@ public class ReiPlugin implements REIPluginEntry {
|
|||
recipeHelper.registerWorkingStations(ModRecipes.INDUSTRIAL_SAWMILL.getName(), new ItemStack(Machine.INDUSTRIAL_SAWMILL.asItem()));
|
||||
recipeHelper.registerWorkingStations(ModRecipes.VACUUM_FREEZER.getName(), new ItemStack(Machine.VACUUM_FREEZER.asItem()));
|
||||
recipeHelper.registerWorkingStations(ModRecipes.ROLLING_MACHINE.getName(), new ItemStack(Machine.ROLLING_MACHINE.asItem()));
|
||||
recipeHelper.registerWorkingStations(ModRecipes.FUSION_REACTOR.getName(), new ItemStack(Machine.FUSION_CONTROL_COMPUTER.asItem()));
|
||||
}
|
||||
|
||||
private <R extends RebornRecipe> void registerMachineRecipe(RecipeHelper recipeHelper, RebornRecipeType<R> recipeType){
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"type": "techreborn:fusion_reactor",
|
||||
"power": 16384,
|
||||
"time": 2048,
|
||||
"start-power": 1,
|
||||
"min-size": 1,
|
||||
"ingredients": [
|
||||
{
|
||||
"fluid": "techreborn:tritium",
|
||||
"holder": "techreborn:cell"
|
||||
},
|
||||
{
|
||||
"fluid": "techreborn:deuterium",
|
||||
"holder": "techreborn:cell"
|
||||
}
|
||||
],
|
||||
"results": [
|
||||
{
|
||||
"item": "techreborn:cell",
|
||||
"nbt":{
|
||||
"fluid": "techreborn:heliumplasma"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"type": "techreborn:fusion_reactor",
|
||||
"power": -2048,
|
||||
"time": 1024,
|
||||
"start-power": 90000000,
|
||||
"min-size": 1,
|
||||
"ingredients": [
|
||||
{
|
||||
"fluid": "techreborn:wolframium",
|
||||
"holder": "techreborn:cell"
|
||||
},
|
||||
{
|
||||
"fluid": "techreborn:lithium",
|
||||
"holder": "techreborn:cell"
|
||||
}
|
||||
],
|
||||
"results": [
|
||||
{
|
||||
"item": "techreborn:iridium_ore"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"type": "techreborn:fusion_reactor",
|
||||
"power": -2048,
|
||||
"time": 1024,
|
||||
"start-power": 80000000,
|
||||
"min-size": 1,
|
||||
"ingredients": [
|
||||
{
|
||||
"fluid": "techreborn:wolframium",
|
||||
"holder": "techreborn:cell"
|
||||
},
|
||||
{
|
||||
"fluid": "techreborn:beryllium",
|
||||
"holder": "techreborn:cell"
|
||||
}
|
||||
],
|
||||
"results": [
|
||||
{
|
||||
"item": "techreborn:platinum_dust"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Reference in a new issue