From 82bd52008b663bd38e96472c5d12a3db8bca63b3 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 9 Jan 2019 19:17:23 +0100 Subject: Bio Cultre System! -Added the Bio Cultre System -Added the Bio Vat, Bio Lab and custom Glas types -Updated Copyright on the Files -Added a shitton of ressources -Added an API to for the Bio Cultre System -Added a Phyton Script for the ease of adding Glas Types to the Bio Vat -Fixed Spawning on custom blocks -Fixed Nuggets giving out boni in the windmill -Fixed tooltip again for the Windmill -Added dimensionsIDs to the BlockCoord class -Added apiJar, sourceJar, devJar to the grandlew output --- .gitignore | 5 +- BlockAdderGenerator/biovatgen.py | 68 +++ BlockAdderGenerator/csv.csv | 28 + buid.bat | 2 + build.gradle | 25 + build.properties | 24 +- .../bartimaeusnek/bartworks/API/API_REFERENCE.java | 27 + .../bartworks/API/BioObjectAdder.java | 125 ++++ .../bartworks/API/BioObjectGetter.java | 122 ++++ .../bartworks/API/BioRecipeAdder.java | 124 ++++ .../bartworks/API/BioVatLogicAdder.java | 197 ++++++ .../github/bartimaeusnek/bartworks/GuiHandler.java | 53 +- .../github/bartimaeusnek/bartworks/MainMod.java | 62 +- .../bartworks/client/creativetabs/BioTab.java | 39 ++ .../bartworks/client/creativetabs/GT2Tab.java | 24 +- .../client/creativetabs/bartworksTab.java | 24 +- .../client/gui/BW_GUIContainer_RadLevel.java | 60 ++ .../client/gui/BW_GUIContainer_RotorBlock.java | 27 +- .../client/gui/BW_GUIContainer_Windmill.java | 39 +- .../gui/GT_GUIContainer_CircuitProgrammer.java | 28 +- .../client/gui/GT_GUIContainer_Destructopack.java | 28 +- .../bartworks/client/gui/GT_GUIContainer_LESU.java | 47 +- .../client/gui/GT_GUIContainer_RadioHatch.java | 77 +++ .../renderer/RendererSwitchingColorFluid.java | 298 +++++++++ .../bartworks/common/ConfigHandler.java | 34 -- .../bartworks/common/blocks/BW_Blocks.java | 68 ++- .../bartworks/common/blocks/BW_GlasBlocks.java | 65 ++ .../common/blocks/BW_TileEntityContainer.java | 41 +- .../bartworks/common/blocks/BioFluidBlock.java | 98 +++ .../bartworks/common/configs/ConfigHandler.java | 65 ++ .../bartworks/common/items/BW_ItemBlocks.java | 36 +- .../bartworks/common/items/BW_Stonage_Rotors.java | 42 +- .../bartworks/common/items/Circuit_Programmer.java | 36 +- .../common/items/GT_Destructopack_Item.java | 31 +- .../bartworks/common/items/GT_Rockcutter_Item.java | 72 ++- .../bartworks/common/items/GT_Teslastaff_Item.java | 38 +- .../bartworks/common/items/LabModule.java | 46 ++ .../bartworks/common/items/LabParts.java | 135 +++++ .../bartworks/common/items/SimpleIconItem.java | 28 +- .../bartworks/common/items/SimpleSubItemClass.java | 52 +- .../bartworks/common/loaders/BioCultureLoader.java | 60 ++ .../bartworks/common/loaders/BioItemList.java | 140 +++++ .../bartworks/common/loaders/BioLabLoader.java | 42 ++ .../bartworks/common/loaders/BioRecipeLoader.java | 375 ++++++++++++ .../bartworks/common/loaders/FluidLoader.java | 85 +++ .../bartworks/common/loaders/GTNHBlocks.java | 96 +++ .../bartworks/common/loaders/ItemRegistry.java | 117 ++-- .../bartworks/common/loaders/LoaderRegistry.java | 34 +- .../bartworks/common/loaders/RecipeLoader.java | 190 +++--- .../bartworks/common/net/BW_Network.java | 128 ++++ .../bartworks/common/net/RendererPacket.java | 112 ++++ .../tileentities/BWTileEntityDimIDBridge.java | 28 + .../common/tileentities/BW_RotorBlock.java | 26 +- .../tileentities/GT_MetaTileEntity_BioLab.java | 263 ++++++++ .../tileentities/GT_MetaTileEntity_Diode.java | 29 +- .../GT_MetaTileEntity_EnergyDistributor.java | 26 +- .../tileentities/GT_MetaTileEntity_RadioHatch.java | 315 ++++++++++ .../common/tileentities/GT_TileEntity_BioVat.java | 674 +++++++++++++++++++++ .../common/tileentities/GT_TileEntity_DEHP.java | 23 +- .../common/tileentities/GT_TileEntity_LESU.java | 115 ++-- .../tileentities/GT_TileEntity_ManualTrafo.java | 295 +++++---- .../tileentities/GT_TileEntity_Windmill.java | 90 ++- .../server/container/BW_Container_RadioHatch.java | 216 +++++++ .../container/GT_Container_CircuitProgrammer.java | 83 ++- .../container/GT_Container_Item_Destructopack.java | 37 +- .../server/container/GT_Container_LESU.java | 22 + .../server/container/GT_Container_RadioHatch.java | 155 +++++ .../bartimaeusnek/bartworks/util/BWRecipes.java | 580 ++++++++++++++++++ .../bartimaeusnek/bartworks/util/BW_Util.java | 122 ++++ .../bartimaeusnek/bartworks/util/BioCulture.java | 189 ++++++ .../bartimaeusnek/bartworks/util/BioDNA.java | 63 ++ .../bartimaeusnek/bartworks/util/BioData.java | 171 ++++++ .../bartimaeusnek/bartworks/util/BioPlasmid.java | 62 ++ .../bartworks/util/ChatColorHelper.java | 22 + .../bartworks/util/ConnectedBlocksChecker.java | 129 ++-- .../bartimaeusnek/bartworks/util/Coords.java | 63 ++ .../bartworks/util/NEIbartworksConfig.java | 30 +- .../resources/assets/bartworks/lang/en_US.lang | 27 +- .../assets/bartworks/textures/GUI/GUI_RSC.png | Bin 0 -> 2599 bytes .../assets/bartworks/textures/GUI/RadHatch.png | Bin 0 -> 2270 bytes .../textures/blocks/BoronSilicateGlassBlock.png | Bin 0 -> 177 bytes .../blocks/BoronSilicateGlassBlockRand.png | Bin 0 -> 184 bytes .../ChromeReinforcedBoronSilicateGlassBlock.png | Bin 0 -> 199 bytes .../IridiumReinforcedBoronSilicateGlassBlock.png | Bin 0 -> 196 bytes .../NickelReinforcedBoronSilicateGlassBlock.png | Bin 0 -> 201 bytes .../OsmiumReinforcedBoronSilicateGlassBlock.png | Bin 0 -> 211 bytes .../TungstenReinforcedBoronSilicateGlassBlock.png | Bin 0 -> 198 bytes .../assets/bartworks/textures/blocks/brick.png | Bin 506 -> 0 bytes .../assets/bartworks/textures/items/Agarose.png | Bin 0 -> 259 bytes .../items/ClonalCellularSynthesisModule.png | Bin 0 -> 481 bytes .../textures/items/DNAExtractionModule.png | Bin 0 -> 525 bytes .../bartworks/textures/items/DNASampleFlask.png | Bin 0 -> 253 bytes .../bartworks/textures/items/DetergentPowder.png | Bin 0 -> 261 bytes .../bartworks/textures/items/IncubationModule.png | Bin 0 -> 623 bytes .../textures/items/PCRThermoclyclingModule.png | Bin 0 -> 566 bytes .../bartworks/textures/items/PlasmaMembrane.png | Bin 0 -> 2522 bytes .../bartworks/textures/items/PlasmidCell.png | Bin 0 -> 288 bytes .../textures/items/PlasmidSynthesisModule.png | Bin 0 -> 499 bytes .../textures/items/TransformationModule.png | Bin 0 -> 529 bytes .../assets/bartworks/textures/items/petriDish.png | Bin 0 -> 3033 bytes .../textures/GUI/basicmachines/BW.GUI.BioLab.png | Bin 0 -> 3151 bytes 101 files changed, 7040 insertions(+), 634 deletions(-) create mode 100644 BlockAdderGenerator/biovatgen.py create mode 100644 BlockAdderGenerator/csv.csv create mode 100644 buid.bat create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/API/API_REFERENCE.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/API/BioRecipeAdder.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/API/BioVatLogicAdder.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/BioTab.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_RadioHatch.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/RendererSwitchingColorFluid.java delete mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/ConfigHandler.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_GlasBlocks.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BioFluidBlock.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/items/LabModule.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/items/LabParts.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BioCultureLoader.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BioItemList.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BioLabLoader.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/BioRecipeLoader.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/FluidLoader.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/GTNHBlocks.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/net/BW_Network.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/net/RendererPacket.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/BWTileEntityDimIDBridge.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/GT_MetaTileEntity_BioLab.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/GT_MetaTileEntity_RadioHatch.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/GT_TileEntity_BioVat.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/server/container/BW_Container_RadioHatch.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/server/container/GT_Container_RadioHatch.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/BWRecipes.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/BioCulture.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/BioDNA.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/BioData.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/BioPlasmid.java create mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/util/Coords.java create mode 100644 src/main/resources/assets/bartworks/textures/GUI/GUI_RSC.png create mode 100644 src/main/resources/assets/bartworks/textures/GUI/RadHatch.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/BoronSilicateGlassBlock.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/BoronSilicateGlassBlockRand.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/ChromeReinforcedBoronSilicateGlassBlock.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/IridiumReinforcedBoronSilicateGlassBlock.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/NickelReinforcedBoronSilicateGlassBlock.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/OsmiumReinforcedBoronSilicateGlassBlock.png create mode 100644 src/main/resources/assets/bartworks/textures/blocks/TungstenReinforcedBoronSilicateGlassBlock.png delete mode 100644 src/main/resources/assets/bartworks/textures/blocks/brick.png create mode 100644 src/main/resources/assets/bartworks/textures/items/Agarose.png create mode 100644 src/main/resources/assets/bartworks/textures/items/ClonalCellularSynthesisModule.png create mode 100644 src/main/resources/assets/bartworks/textures/items/DNAExtractionModule.png create mode 100644 src/main/resources/assets/bartworks/textures/items/DNASampleFlask.png create mode 100644 src/main/resources/assets/bartworks/textures/items/DetergentPowder.png create mode 100644 src/main/resources/assets/bartworks/textures/items/IncubationModule.png create mode 100644 src/main/resources/assets/bartworks/textures/items/PCRThermoclyclingModule.png create mode 100644 src/main/resources/assets/bartworks/textures/items/PlasmaMembrane.png create mode 100644 src/main/resources/assets/bartworks/textures/items/PlasmidCell.png create mode 100644 src/main/resources/assets/bartworks/textures/items/PlasmidSynthesisModule.png create mode 100644 src/main/resources/assets/bartworks/textures/items/TransformationModule.png create mode 100644 src/main/resources/assets/bartworks/textures/items/petriDish.png create mode 100644 src/main/resources/assets/gregtech/textures/GUI/basicmachines/BW.GUI.BioLab.png diff --git a/.gitignore b/.gitignore index 181e20b1b3..317f54dbb6 100644 --- a/.gitignore +++ b/.gitignore @@ -25,11 +25,12 @@ *.rar *.bin *.lock - +*.sqlite # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* /eclipse /build /out -/.gradle \ No newline at end of file +/.gradle +/venv \ No newline at end of file diff --git a/BlockAdderGenerator/biovatgen.py b/BlockAdderGenerator/biovatgen.py new file mode 100644 index 0000000000..650cc52de7 --- /dev/null +++ b/BlockAdderGenerator/biovatgen.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Jan 2 19:11:07 2019 + +Copyright (c) 2019 boubou_19, bartimaeusnek +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. + +@author: boubou_19, bartimaeusnek +""" + +import os +import datetime +import time +name="GTNHBlocks" #change the name of the output file here +ending=".java" +csv_path = os.getcwd()+os.sep+"csv.csv" # change the name of the csv here +output_file_path = os.getcwd()+os.sep+name+ending +code_list = [] #will store all the lines of code +max_meta = [] +with open(csv_path, "r") as file:#open the file and automatically close it when it leaves the scope + code_list.append("import com.github.bartimaeusnek.bartworks.API.BioVatLogicAdder;\n") + code_list.append("\n") + code_list.append("//Autogenerated run file, script Created on Wed Jan 2 19:11:07 2019 by boubou_19 and bartimaeusnek\n") + code_list.append("//Executed on "+datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')+"\n") + code_list.append("public class "+name+" implements Runnable {\n") + code_list.append("\n") + code_list.append(" @Override\n") + code_list.append(" public void run(){\n") + file.readline() #skip the first line of the file + + for line in file: + line = line.split(";") #turns the string into a list of strings using the ";" separator + line[4] = line[4].strip("\n") #it remove the \n at the end of a csv line otherwise it will do shit in the string later + if line[3] == "-1" or line[3] == "0": + code_list.append(" BioVatLogicAdder.BioVatGlass.addCustomGlass(\"{0}\",\"{1}\",{2},{3});\n".format(line[0],line[1],line[2],line[4])) + else: + if line[3] == "15" and line[2] == "0": + max_meta.append(" BioVatLogicAdder.BioVatGlass.addCustomGlass(\"{0}\",\"{1}\",i,{3});\n".format(line[0],line[1],line[2],line[4])) + else: + code_list.append("\n for (int i = {0}; i <= {1};++i)\n".format(line[2],line[3])) + code_list.append(" BioVatLogicAdder.BioVatGlass.addCustomGlass(\"{0}\",\"{1}\",i,{3});\n\n".format(line[0],line[1],line[2],line[4])) + + # for i in range(int(line[2]),int(line[3])+1): #the +1 is here because range instruction always exclude the last number + code_list.append("\n for (int i = 0; i <= 15;++i;){\n") + for line in max_meta: + code_list.append(line) + code_list.append(" }\n") + code_list.append(" }\n") + code_list.append("}\n") +with open(output_file_path,"w") as out: + out.writelines(code_list) + diff --git a/BlockAdderGenerator/csv.csv b/BlockAdderGenerator/csv.csv new file mode 100644 index 0000000000..2f1ee7ef53 --- /dev/null +++ b/BlockAdderGenerator/csv.csv @@ -0,0 +1,28 @@ +mod;unlocalised name;meta start;meta end;tier +minecraft;stained_glass;0;15;3 +minecraft;glass;0;-1;3 +BloodArsenal;blood_stained_glass;0;-1;3 +Botany;stained;0;0;3 +EnderIO;blockFusedQuartz;0;5;3 +ExtraUtilities;decorativeBlock1;9;-1;3 +ExtraUtilities;decorativeBlock2;0;11;3 +ExtraUtilities;etherealglass;0;5;3 +GalaxySpace;futureglasses;0;15;3 +GalaxySpace;futureglass;0;-1;3 +HardcoreEnderExpension;laboratory_glass;0;-1;3 +IC2;blockAlloyGlass;0;-1;4 +Natura;NetherGlass;0;1;3 +Railcraft;glass;0;15;3 +RandomThings;spectreGlass;0;-1;3 +TConstruct;GlassBlock;0;-1;3 +TConstruct;GlassBlock.StainedClear;0;15;3 +Ztones;tile.glaxx;0;15;3 +chisel;glass;0;15;3 +chisel;stained_glass_white;0;15;3 +chisel;stained_glass_yellow;0;15;3 +chisel;stained_glass_lightgray;0;15;3 +chisel;stained_glass_brown;0;15;3 +chisel;glass2;0;-1;3 +chisel;stained_glass_forestry;0;15;3 +tectech;tile.quantumGlass;0;-1;5 +witchery;shadedglass;0;15;3 diff --git a/buid.bat b/buid.bat new file mode 100644 index 0000000000..3c93bfe30e --- /dev/null +++ b/buid.bat @@ -0,0 +1,2 @@ +call gradlew.bat build +pause \ No newline at end of file diff --git a/build.gradle b/build.gradle index c20193c1ec..0c65172e39 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,7 @@ buildscript { apply plugin: 'forge' apply plugin: 'idea' apply plugin: 'signing' + import de.undercouch.gradle.tasks.download.Download sourceCompatibility = JavaVersion.VERSION_1_8 @@ -44,6 +45,7 @@ archivesBaseName = "bartworks"+ "[" + config.mc_version + "]" minecraft { version = "1.7.10-10.13.4.1614-1.7.10" replaceIn "MainMod.java" + replaceIn "API_REFERENCE.java" replace "@version@", project.version runDir = "run" } @@ -95,6 +97,29 @@ processResources } } +task apiJar(type: Jar){ + from(sourceSets.main.output) { + include 'com/github/bartimaeusnek/bartworks/API/**' + } + classifier = 'API' +} + +task sourceJar(type: Jar) { + from sourceSets.main.allSource + classifier = 'sources' +} + +task devJar(type: Jar) { + from sourceSets.main.output + classifier = 'dev' +} + +artifacts { + archives devJar + archives sourceJar + archives apiJar +} + task signJar(dependsOn: 'reobf'){ doLast { ant.signjar( diff --git a/build.properties b/build.properties index 20a4db092d..6427c44557 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,27 @@ +# +# Copyright (c) 2019 bartimaeusnek +# +# 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. +# + mc_version=1.7.10 -mod_version=0.2.1 +mod_version=0.3.11 ic2.version=2.2.828-experimental gregtech.version=5.09.32.36 gregtech.jenkinsbuild=143 diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/API_REFERENCE.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/API_REFERENCE.java new file mode 100644 index 0000000000..2767d56168 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/API_REFERENCE.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks.API; + +public final class API_REFERENCE { + public static final String VERSION = "@version@"; +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java new file mode 100644 index 0000000000..e0e332fab1 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks.API; + +import com.github.bartimaeusnek.bartworks.util.BioCulture; +import com.github.bartimaeusnek.bartworks.util.BioDNA; +import com.github.bartimaeusnek.bartworks.util.BioData; +import com.github.bartimaeusnek.bartworks.util.BioPlasmid; +import net.minecraft.item.EnumRarity; + +import java.awt.*; + +public final class BioObjectAdder { + +// @Deprecated +// public static BioCulture createAndRegisterBioCulture(Color color, String name, long ID, BioPlasmid plasmid, BioDNA dna, EnumRarity rarity){ +// return BioCulture.createAndRegisterBioCulture(color,name,ID,plasmid,dna,rarity); +// } + + /** + * @param color the color of the Culture + * @param name the name of the Culture + * @param plasmid the cultures plasmid, get it from createAndRegisterBioPlasmid + * @param dna the cultures dna, get it from createAndRegisterBioDNA + * @param breedable if the culture can be inserted into the BacterialVat + * @param rarity visual + * @return + */ + public static BioCulture createAndRegisterBioCulture(Color color, String name, BioPlasmid plasmid, BioDNA dna, EnumRarity rarity, boolean breedable) { + return BioCulture.createAndRegisterBioCulture(color, name, plasmid, dna, rarity, breedable); + } + + /** + * rarity inherits from dna + * + * @param color the color of the Culture + * @param name the name of the Culture + * @param plasmid the cultures plasmid, get it from createAndRegisterBioPlasmid + * @param dna the cultures dna, get it from createAndRegisterBioDNA + * @param breedable if the culture can be inserted into the BacterialVat + * @return + */ + public static BioCulture createAndRegisterBioCulture(Color color, String name, BioPlasmid plasmid, BioDNA dna, boolean breedable) { + return BioCulture.createAndRegisterBioCulture(color, name, plasmid, dna, breedable); + } + + /** + * unspecific Biodata that can be converted into DNA and Plasmid with the propper methodes + * + * @param aName the name of the Biodata + * @param rarity visual only + * @param chance the chanche to extract this BioData + * @param tier the tier of this BioData 0=HV, 1=EV etc. + * @return + */ + public static BioData createAndRegisterBioData(String aName, EnumRarity rarity, int chance, int tier) { + return BioData.createAndRegisterBioData(aName, rarity, chance, tier); + } + + /** + * Default Constructor for HV Tier DNA with 75% extraction rate + * + * @param aName Name of the DNA String + * @param rarity visual + * @return + */ + public static BioDNA createAndRegisterBioDNA(String aName, EnumRarity rarity) { + return BioDNA.createAndRegisterBioDNA(aName, rarity); + } + + /** + * Default Constructor for HV Tier Plasmid with 75% extraction rate + * + * @param aName Name of the Plasmid + * @param rarity visual + * @return + */ + public static BioPlasmid createAndRegisterBioPlasmid(String aName, EnumRarity rarity) { + return BioPlasmid.createAndRegisterBioPlasmid(aName, rarity); + } + + /** + * @param aName Name of the DNA String + * @param rarity visual + * @param chance chanche of extracting + * @param tier tier needed to extract 0=HV, 1=EV etc. + * @return + */ + public static BioDNA createAndRegisterBioDNA(String aName, EnumRarity rarity, int chance, int tier) { + return BioDNA.createAndRegisterBioDNA(aName, rarity, chance, tier); + } + + /** + * @param aName Name of the Plasmid + * @param rarity visual + * @param chance chanche of extracting + * @param tier tier needed to extract 0=HV, 1=EV etc. + * @return + */ + public static BioPlasmid createAndRegisterBioPlasmid(String aName, EnumRarity rarity, int chance, int tier) { + return BioPlasmid.createAndRegisterBioPlasmid(aName, rarity, chance, tier); + } + + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java new file mode 100644 index 0000000000..86ec61c138 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectGetter.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks.API; + +import com.github.bartimaeusnek.bartworks.common.loaders.BioItemList; +import com.github.bartimaeusnek.bartworks.util.BioCulture; +import com.github.bartimaeusnek.bartworks.util.BioDNA; +import com.github.bartimaeusnek.bartworks.util.BioData; +import com.github.bartimaeusnek.bartworks.util.BioPlasmid; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.Collection; + +public final class BioObjectGetter { + + public static BioCulture getBioCulture(String aName) { + return BioCulture.getBioCulture(aName); + } + + public static NBTTagCompound getNBTTagFromCulture(BioCulture bioCulture) { + return BioCulture.getNBTTagFromCulture(bioCulture); + } + + public static NBTTagCompound getNBTTagFromBioPlasmid(BioPlasmid bioPlasmid) { + return getNBTTagFromBioData(convertBioPlasmidToData(bioPlasmid)); + } + + public static NBTTagCompound getNBTTagFromBioDNA(BioDNA bioDNA) { + return getNBTTagFromBioData(convertBioDNAtoData(bioDNA)); + } + + public static NBTTagCompound getNBTTagFromBioData(BioData bioData) { + return BioData.getNBTTagFromBioData(bioData); + } + + public static BioDNA convertDataToDNA(BioData bioData) { + return BioDNA.convertDataToDNA(bioData); + } + + public static BioPlasmid convertDataToPlasmid(BioData bioData) { + return BioPlasmid.convertDataToPlasmid(bioData); + } + + public static BioData convertBioPlasmidToData(BioPlasmid bioPlasmid) { + return BioData.convertBioPlasmidToBioData(bioPlasmid); + } + + public static BioData convertDataToDNA(BioDNA bioData) { + return BioData.convertBioDNAToBioData(bioData); + } + + public static BioData convertBioDNAtoData(BioDNA bioDNA) { + return BioData.convertBioDNAToBioData(bioDNA); + } + + public static BioPlasmid convertBioDNAtoBioPlasmid(BioDNA bioDNA) { + return convertDataToPlasmid(convertBioDNAtoData(bioDNA)); + } + + public static BioDNA convertBioPlasmidtoBioDNA(BioPlasmid bioPlasmid) { + return convertDataToDNA(convertBioPlasmidToData(bioPlasmid)); + } + + public static Collection getAllPetriDishes() { + return BioItemList.getAllPetriDishes(); + } + + public static Collection getAllDNASampleFlasks() { + return BioItemList.getAllDNASampleFlasks(); + } + + public static Collection getAllPlasmidCells() { + return BioItemList.getAllPlasmidCells(); + } + + public static ItemStack getDNASampleFlask(BioDNA dna) { + return BioItemList.getDNASampleFlask(dna); + } + + public static ItemStack getPetriDish(BioCulture culture) { + return BioItemList.getPetriDish(culture); + } + + public static ItemStack getPlasmidCell(BioPlasmid plasmid) { + return BioItemList.getPlasmidCell(plasmid); + } + + /** + * 1 - DetergentPowder + * 2 - Agarose + * 3 - IncubationModule + * 4 - Plasma Membrane + * + * @param selection + * @return the selected Item + */ + public static ItemStack getOther(int selection) { + return BioItemList.getOther(selection); + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioRecipeAdder.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioRecipeAdder.java new file mode 100644 index 0000000000..0f81d266f0 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioRecipeAdder.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks.API; + +import com.github.bartimaeusnek.bartworks.util.BWRecipes; +import com.github.bartimaeusnek.bartworks.util.BioCulture; +import gregtech.api.enums.Materials; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import javax.annotation.Nonnegative; +import javax.annotation.Nonnull; + +public final class BioRecipeAdder { + + public static final int STANDART = 0; + public static final int LOWGRAVITY = -100; + public static final int CLEANROOM = -200; + + public static boolean addBioLabRecipe(ItemStack[] aInputs, ItemStack aOutput, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + return BWRecipes.instance.addBioLabRecipe(aInputs, aOutput, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); + } + + /** + * Adds a Incubation Recipe for the BioLab. + * + * @param aInput any item that will be added with a petri dish + * @param aOutput must be a BioCulture + * @param aChances + * @param aFluidInputs + * @param aDuration + * @param aEUt use BW_Util.getMachineVoltageFromTier(tier) to get optimal EU/t + * @param aSpecialValue 0 = STANDART, -100 = LowGravity, -200 = Cleanroom + * @return if the recipe was added. + */ + public static boolean addBioLabRecipeIncubation(ItemStack aInput, BioCulture aOutput, int[] aChances, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue) { + return BWRecipes.instance.addBioLabRecipeIncubation(aInput, aOutput, aChances, aFluidInputs, aDuration, aEUt, aSpecialValue); + } + + /** + * @param aInputs Item Inputs, DO NOT PUT INTEGRATED CIRCUITS IN HERE! THEY WILL GET ADDED AUTOMATICALLY!, can be null + * @param aCulture the bio culture + * @param aFluidInputs may not be null + * @param aFluidOutputs may not be null + * @param aDuration + * @param aEUt + * @param Sv Manual Sv entry i.e. for custom items + * @param glasTier the glass tier + * @param aSpecialValue Space or Cleanroom, Not yet implemented + * @param exactSv if the recipe needs EXACTLY the Sv or can use less... + * @return + */ + public static boolean addBacterialVatRecipe(ItemStack[] aInputs, @Nonnull BioCulture aCulture, @Nonnull FluidStack[] aFluidInputs, @Nonnull FluidStack[] aFluidOutputs, @Nonnegative int aDuration, @Nonnegative int aEUt, int Sv, @Nonnegative int glasTier, int aSpecialValue, boolean exactSv) { + return BWRecipes.instance.addBacterialVatRecipe(aInputs, aCulture, aFluidInputs, aFluidOutputs, aDuration, aEUt, Sv, glasTier, aSpecialValue, exactSv); + } + + /** + * @param aInputs Item Inputs, DO NOT PUT INTEGRATED CIRCUITS IN HERE! THEY WILL GET ADDED AUTOMATICALLY!, can be null + * @param aCulture the bio culture + * @param aFluidInputs may not be null + * @param aFluidOutputs may not be null + * @param aDuration + * @param aEUt + * @param material may be null. used for auto Sv calculation + * @param glasTier the glass tier + * @param aSpecialValue Space or Cleanroom, Not yet implemented + * @param exactSv if the recipe needs EXACTLY the Sv or can use less... + * @return + */ + public static boolean addBacterialVatRecipe(ItemStack[] aInputs, @Nonnull BioCulture aCulture, @Nonnull FluidStack[] aFluidInputs, @Nonnull FluidStack[] aFluidOutputs, @Nonnegative int aDuration, @Nonnegative int aEUt, Materials material, @Nonnegative int glasTier, int aSpecialValue, boolean exactSv) { + return BWRecipes.instance.addBacterialVatRecipe(aInputs, aCulture, aFluidInputs, aFluidOutputs, aDuration, aEUt, material, glasTier, aSpecialValue, exactSv); + } + +// public static boolean addBacterialVatRecipe(ItemStack[] aInputs, ItemStack[] aOutputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSievert) { +// return BWRecipes.instance.addBacterialVatRecipe(aInputs, aOutputs, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSievert); +// } + +// @Deprecated +// public static boolean addBioLabRecipeDNAExtraction(ItemStack[] aInputs, ItemStack aOutput, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ +// return BWRecipes.instance.addBioLabRecipeDNAExtraction(aInputs, aOutput, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); +// } +// +// @Deprecated +// public static boolean addBioLabRecipePCRThermoclycling(ItemStack[] aInputs, ItemStack aOutput, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ +// return BWRecipes.instance.addBioLabRecipePCRThermoclycling(aInputs, aOutput, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); +// } +// +// @Deprecated +// public static boolean addBioLabRecipePlasmidSynthesis(ItemStack[] aInputs, ItemStack aOutput, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ +// return BWRecipes.instance.addBioLabRecipePlasmidSynthesis(aInputs, aOutput, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); +// } +// +// @Deprecated +// public static boolean addBioLabRecipeTransformation(ItemStack[] aInputs, ItemStack aOutput, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ +// return BWRecipes.instance.addBioLabRecipeTransformation(aInputs, aOutput, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); +// } +// +// @Deprecated +// public static boolean addBioLabRecipeClonalCellularSynthesis(ItemStack[] aInputs, ItemStack aOutput, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ +// return BWRecipes.instance.addBioLabRecipeClonalCellularSynthesis(aInputs, aOutput, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); +// } + + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioVatLogicAdder.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioVatLogicAdder.java new file mode 100644 index 0000000000..483b4a67e2 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioVatLogicAdder.java @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks.API; + +import com.github.bartimaeusnek.bartworks.MainMod; +import gregtech.api.enums.Materials; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +import javax.annotation.Nonnegative; +import javax.annotation.Nonnull; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Objects; + +import static cpw.mods.fml.common.registry.GameRegistry.findBlock; + +public final class BioVatLogicAdder { + + + public static class RadioHatch { + + private static final HashSet MaSv = new HashSet<>(); + private static final HashMap IsSv = new HashMap<>(); + + public static HashSet getMaSv() { + return RadioHatch.MaSv; + } + + public static HashMap getIsSv() { + return RadioHatch.IsSv; + } + + public static void setOverrideSvForMaterial(Materials m, Integer sv) { + MaSv.add(new BioVatLogicAdder.MaterialSvPair(m, sv)); + } + + public static void giveItemStackRadioHatchAbilites(ItemStack stack, Integer sv) { + IsSv.put(stack, sv); + } + + public static int getMaxSv() { + int ret = 150; + Iterator it = BioVatLogicAdder.RadioHatch.getMaSv().iterator(); + while (it.hasNext()) { + BioVatLogicAdder.MaterialSvPair pair = (BioVatLogicAdder.MaterialSvPair) it.next(); + if (pair.getSievert() > ret) + ret = pair.getSievert(); + } + for (ItemStack is : RadioHatch.IsSv.keySet()) { + if (RadioHatch.IsSv.get(is) > ret) + ret = RadioHatch.IsSv.get(is); + } + return ret; + } + + } + + public static class BioVatGlass { + + private static final HashMap glasses = new HashMap<>(); + + /** + * @param sModname The modid owning the block + * @param sUnlocBlockName The name of the block itself + * @param meta The meta of the block + * @param tier the glasses Tier = Voltage tier (MIN 3) + * @return if the block was found in the Block registry + */ + public static boolean addCustomGlass(String sModname, String sUnlocBlockName, int meta, int tier) { + Block block = findBlock(sModname, sUnlocBlockName); + boolean ret = block != null; + if (ret) + BioVatGlass.glasses.put(new BlockMetaPair(block, (byte) meta), (byte) tier); + else + MainMod.logger.warn("Block: " + sUnlocBlockName + " of the Mod: " + sModname + " was NOT found!"); + block = null; + return ret; + } + + /** + * @param block the block to add + * @param meta the meta of the block (0-15) + * @param tier the glasses Tier = Voltage tier (MIN 3) + */ + public static void addCustomGlass(@Nonnull Block block, @Nonnegative int meta, @Nonnegative int tier) { + BioVatGlass.glasses.put(new BlockMetaPair(block, (byte) meta), (byte) tier); + } + + /** + * @param block the block to add + * @param tier the glasses Tier = Voltage tier (MIN 3) + */ + public static void addCustomGlass(@Nonnull Block block, @Nonnegative int tier) { + BioVatGlass.glasses.put(new BlockMetaPair(block, (byte) 0), (byte) tier); + } + + /** + * @param blockBytePair the block to add and its meta as a javafx.util Pair + * @param tier the glasses Tier = Voltage tier (MIN 3) + */ + public static void addCustomGlass(@Nonnull BlockMetaPair blockBytePair, @Nonnegative byte tier) { + BioVatGlass.glasses.put(blockBytePair, tier); + } + + public static HashMap getGlassMap() { + return BioVatGlass.glasses; + } + } + + public static class MaterialSvPair { + final Materials materials; + final Integer sievert; + + public MaterialSvPair(Materials materials, Integer sievert) { + this.materials = materials; + this.sievert = sievert; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + BioVatLogicAdder.MaterialSvPair that = (BioVatLogicAdder.MaterialSvPair) o; + return Objects.equals(this.getMaterials(), that.getMaterials()) && + Objects.equals(this.getSievert(), that.getSievert()); + } + + @Override + public int hashCode() { + return Objects.hash(this.getMaterials(), this.getSievert()); + } + + public Materials getMaterials() { + return this.materials; + } + + public Integer getSievert() { + return this.sievert; + } + + + } + + public static class BlockMetaPair { + final Block block; + final Byte aByte; + + public BlockMetaPair(Block block, Byte aByte) { + this.block = block; + this.aByte = aByte; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + BioVatLogicAdder.BlockMetaPair that = (BioVatLogicAdder.BlockMetaPair) o; + return Objects.equals(this.getBlock(), that.getBlock()) && + Objects.equals(this.getaByte(), that.getaByte()); + } + + @Override + public int hashCode() { + return Objects.hash(this.getBlock(), this.getaByte()); + } + + public Block getBlock() { + return this.block; + } + + public Byte getaByte() { + return this.aByte; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java index 7d2f2d4628..f45ac86579 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/GuiHandler.java @@ -1,10 +1,35 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks; +import com.github.bartimaeusnek.bartworks.client.gui.BW_GUIContainer_RadLevel; import com.github.bartimaeusnek.bartworks.client.gui.GT_GUIContainer_CircuitProgrammer; import com.github.bartimaeusnek.bartworks.client.gui.GT_GUIContainer_Destructopack; +import com.github.bartimaeusnek.bartworks.server.container.BW_Container_RadioHatch; import com.github.bartimaeusnek.bartworks.server.container.GT_Container_CircuitProgrammer; import com.github.bartimaeusnek.bartworks.server.container.GT_Container_Item_Destructopack; import cpw.mods.fml.common.network.IGuiHandler; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; @@ -12,18 +37,34 @@ public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - switch (ID){ - case 0: return new GT_Container_Item_Destructopack(player.inventory); - case 1: return new GT_Container_CircuitProgrammer(player.inventory); + switch (ID) { + case 0: + return new GT_Container_Item_Destructopack(player.inventory); + case 1: + return new GT_Container_CircuitProgrammer(player.inventory); + case 2: { + if (world.getTileEntity(x, y, z) instanceof IGregTechTileEntity) { + IGregTechTileEntity te = (IGregTechTileEntity) world.getTileEntity(x, y, z); + return new BW_Container_RadioHatch(player.inventory, te.getMetaTileEntity()); + } + } } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - switch (ID){ - case 0: return new GT_GUIContainer_Destructopack(player.inventory); - case 1: return new GT_GUIContainer_CircuitProgrammer(player.inventory); + switch (ID) { + case 0: + return new GT_GUIContainer_Destructopack(player.inventory); + case 1: + return new GT_GUIContainer_CircuitProgrammer(player.inventory); + case 2: { + if (world.getTileEntity(x, y, z) instanceof IGregTechTileEntity) { + IGregTechTileEntity te = (IGregTechTileEntity) world.getTileEntity(x, y, z); + return new BW_GUIContainer_RadLevel(new BW_Container_RadioHatch(player.inventory, te.getMetaTileEntity())); + } + } } return null; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java index 0219ef93bd..c2a42579df 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -1,13 +1,35 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks; +import com.github.bartimaeusnek.bartworks.client.creativetabs.BioTab; import com.github.bartimaeusnek.bartworks.client.creativetabs.GT2Tab; import com.github.bartimaeusnek.bartworks.client.creativetabs.bartworksTab; -import com.github.bartimaeusnek.bartworks.common.ConfigHandler; -import com.github.bartimaeusnek.bartworks.common.blocks.BW_TileEntityContainer; +import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; +import com.github.bartimaeusnek.bartworks.common.loaders.GTNHBlocks; import com.github.bartimaeusnek.bartworks.common.loaders.LoaderRegistry; -import com.github.bartimaeusnek.bartworks.common.tileentities.BW_RotorBlock; -import com.github.bartimaeusnek.bartworks.common.tileentities.GT_TileEntity_Windmill; +import com.github.bartimaeusnek.bartworks.common.net.BW_Network; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; @@ -15,51 +37,59 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import static com.github.bartimaeusnek.bartworks.API.API_REFERENCE.VERSION; + @Mod( modid = MainMod.modID, name = MainMod.name, version = MainMod.version, - dependencies = "required-after:IC2; " - + "required-after:gregtech; " - ) + dependencies = "required-after:IC2; " + + "required-after:gregtech; " +) public final class MainMod { public static final String name = "BartWorks"; public static final String version = "@version@"; public static final String modID = "bartworks"; public static final Logger logger = LogManager.getLogger(name); - public static boolean GTNH = false; public static final CreativeTabs GT2 = new GT2Tab("GT2C"); + public static final CreativeTabs BioTab = new BioTab("BioTab"); public static final CreativeTabs BWT = new bartworksTab("bartworks"); public static final IGuiHandler GH = new GuiHandler(); + public static boolean GTNH = false; @Mod.Instance(modID) public static MainMod instance; public static ConfigHandler CHandler; - + public static BW_Network BW_Network_instance = new BW_Network(); @Mod.EventHandler public void preInit(FMLPreInitializationEvent preinit) { - if(Loader.isModLoaded("dreamcraft")) { + if (!(VERSION.equals(version))) { + logger.error("Something has loaded an old API. Please contact the Mod authors to update!"); + } + + if (Loader.isModLoaded("dreamcraft")) { GTNH = true; } - CHandler= new ConfigHandler(preinit); + CHandler = new ConfigHandler(preinit); if (GTNH) logger.info("GTNH-Detected . . . ACTIVATE HARDMODE."); + } + @Mod.EventHandler public void init(FMLInitializationEvent init) { - new LoaderRegistry().run(); + new LoaderRegistry().run(); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent postinit) { - NetworkRegistry.INSTANCE.registerGuiHandler(instance,GH); + NetworkRegistry.INSTANCE.registerGuiHandler(instance, GH); + if (ConfigHandler.BioLab) + new GTNHBlocks().run(); } - } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/BioTab.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/BioTab.java new file mode 100644 index 0000000000..2057052be3 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/BioTab.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks.client.creativetabs; + +import com.github.bartimaeusnek.bartworks.common.loaders.BioItemList; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class BioTab extends CreativeTabs { + + public BioTab(String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return BioItemList.getPetriDish(null).getItem(); + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/GT2Tab.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/GT2Tab.java index 82188db9c5..1d403a93d9 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/GT2Tab.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/GT2Tab.java @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks.client.creativetabs; import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; @@ -6,7 +28,7 @@ import net.minecraft.item.Item; public class GT2Tab extends CreativeTabs { - public GT2Tab (String lable) { + public GT2Tab(String lable) { super(lable); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/bartworksTab.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/bartworksTab.java index 30449b88de..f3e5e15882 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/bartworksTab.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/creativetabs/bartworksTab.java @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks.client.creativetabs; import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; @@ -6,7 +28,7 @@ import net.minecraft.item.Item; public class bartworksTab extends CreativeTabs { - public bartworksTab (String lable) { + public bartworksTab(String lable) { super(lable); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java new file mode 100644 index 0000000000..91dfa14c28 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * 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 com.github.bartimaeusnek.bartworks.client.gui; +