diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-07-19 22:36:32 +0200 |
---|---|---|
committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-07-19 22:36:32 +0200 |
commit | 49eb3ab050b92c84267f64cbf8f46a9251be960c (patch) | |
tree | 99db60e5e1d2f6c74775fc89b8bc446019ae788e /src/main/java | |
parent | 4371ae568f86f4cae59bfb488d04051ce49db6e3 (diff) | |
download | GT5-Unofficial-49eb3ab050b92c84267f64cbf8f46a9251be960c.tar.gz GT5-Unofficial-49eb3ab050b92c84267f64cbf8f46a9251be960c.tar.bz2 GT5-Unofficial-49eb3ab050b92c84267f64cbf8f46a9251be960c.zip |
added config changing command
+made the bio vat bonus config dependant
+version increase
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Former-commit-id: 40c59e4af03241615320fa70be0a6ac3ce08de95
Diffstat (limited to 'src/main/java')
4 files changed, 88 insertions, 1 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/commands/ChangeConfig.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/commands/ChangeConfig.java new file mode 100644 index 0000000000..ec85e7e1d4 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/commands/ChangeConfig.java @@ -0,0 +1,82 @@ +/* + * 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.common.commands; + +import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; + +import java.lang.reflect.Field; + +public class ChangeConfig extends CommandBase { + @Override + public String getCommandName() { + return "bwcfg"; + } + + @Override + public String getCommandUsage(ICommandSender p_71518_1_) { + return "bwcfg <NameOfVariable> <newValue>"; + } + + @Override + public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) { + try{ + Field f = ConfigHandler.class.getField(p_71515_2_[0]); + Class c = f.getType(); + if (c.equals(int.class)) { + int l; + try { + l = Integer.parseInt(p_71515_2_[1]); + } catch (NumberFormatException e) { + p_71515_1_.addChatMessage(new ChatComponentText("you need to enter a number!")); + return; + } + f.setInt(null, Integer.parseInt(p_71515_2_[1])); + } + else if (c.equals(long.class)) { + long l; + try{ + l = Long.parseLong(p_71515_2_[1]); + }catch (NumberFormatException e){ + p_71515_1_.addChatMessage(new ChatComponentText("you need to enter a number!")); + return; + } + f.setLong(null, l); + } + else if (c.equals(boolean.class)){ + if (p_71515_2_[1].equalsIgnoreCase("true") || p_71515_2_[1].equalsIgnoreCase("1") ) + f.setBoolean(null,true); + else if (p_71515_2_[1].equalsIgnoreCase("false") || p_71515_2_[1].equalsIgnoreCase("0") ) + f.setBoolean(null,false); + else { + p_71515_1_.addChatMessage(new ChatComponentText("booleans need to be set to true or false")); + return; + } + } + }catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java index 95cde7ddcc..d0e57cae15 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java @@ -43,6 +43,7 @@ public class ConfigHandler { public static int landerType = 3; public static int ross128bRuinChance = 512; public static int creativeScannerID; + public static int bioVatMaxParallelBonus = 1000; public static long energyPerCell = 1000000L; @@ -75,6 +76,7 @@ public class ConfigHandler { ConfigHandler.DEHPDirectSteam = ConfigHandler.c.get("Multiblocks", "DEHP Direct Steam Mode", false, "This switch enables the Direct Steam Mode of the DEHP. If enabled it will take in Waterand output steam. If disabled it will Input IC2Coolant and output hot coolant").getBoolean(false); ConfigHandler.megaMachinesMax = ConfigHandler.c.get("Multiblocks", "Mega Machines Maximum Recipes per Operation", 256, "This changes the Maximum Recipes per Operation to the specified Valure").getInt(256); ConfigHandler.mbWaterperSec = ConfigHandler.c.get("Singleblocks", "mL Water per Sec for the StirlingPump", 150).getInt(150); + ConfigHandler.bioVatMaxParallelBonus = ConfigHandler.c.get("Multiblocks","BioVat Maximum Bonus on Recipes", 1000,"This are the maximum parallel Operations the BioVat can do, when the output is half full.").getInt(1000); if (ConfigHandler.IDOffset == 0) { ConfigHandler.IDOffset = 12600; ConfigHandler.c.get("System", "ID Offset", 12600, "ID Offset for this mod. This Mod uses " + ConfigHandler.IDU + " IDs. DO NOT CHANGE IF YOU DONT KNOW WHAT THIS IS").set(12600); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java index 1d4f0fe71f..1a8b555478 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java @@ -24,6 +24,7 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.multis; import com.github.bartimaeusnek.bartworks.API.BioVatLogicAdder; import com.github.bartimaeusnek.bartworks.MainMod; +import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.bartworks.common.items.LabParts; import com.github.bartimaeusnek.bartworks.common.loaders.FluidLoader; import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; @@ -149,7 +150,7 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_MultiBlockBase { } private int calcMod(double x) { - int ret = (int) Math.ceil(100D*(-(((2*x/this.getOutputCapacity())-1)*(2*x/this.getOutputCapacity()-1D))+1D)); + int ret = (int) Math.ceil(ConfigHandler.bioVatMaxParallelBonus*(-(((2D*x/(double)this.getOutputCapacity())-1D)*(2D*x/(double)this.getOutputCapacity()-1D))+1D)); return ret <= 0 ? 1 : ret > 100 ? 100 : ret;//(int) Math.ceil((-0.00000025D * x * (x - this.getOutputCapacity()))); } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java index 4ae8b0a85e..d0a13b9af0 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java @@ -22,6 +22,7 @@ package com.github.bartimaeusnek.crossmod; +import com.github.bartimaeusnek.bartworks.common.commands.ChangeConfig; import com.github.bartimaeusnek.bartworks.common.commands.SummonRuin; import com.github.bartimaeusnek.crossmod.GTpp.loader.RadioHatchCompat; import com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy; @@ -90,6 +91,7 @@ public class BartWorksCrossmod { @Mod.EventHandler public void onFMLServerStart(FMLServerStartingEvent event) { event.registerServerCommand(new SummonRuin()); + event.registerServerCommand(new ChangeConfig()); if (Loader.isModLoaded("miscutils")) for (Object s : RadioHatchCompat.TranslateSet){ StringTranslate.inject(new ReaderInputStream(new StringReader((String) s))); |