From b7e141e0043f68111eca1c425326350cd6e9ada5 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Mon, 12 Jun 2017 20:33:30 +0100 Subject: [PATCH] More config changes --- src/main/java/techreborn/Core.java | 4 +- src/main/java/techreborn/blocks/BlockOre.java | 20 ++- .../compat/jei/TechRebornJeiPlugin.java | 4 +- .../techreborn/config/ConfigTechReborn.java | 130 ++---------------- .../java/techreborn/events/OreUnifier.java | 86 ------------ src/main/java/techreborn/init/ModRecipes.java | 15 +- .../items/ItemFrequencyTransmitter.java | 29 ++-- .../items/tools/ItemCloakingDevice.java | 12 +- .../techreborn/items/tools/ItemNanosaber.java | 5 +- .../tiles/transformers/TileHVTransformer.java | 3 +- .../tiles/transformers/TileLVTransformer.java | 3 +- .../tiles/transformers/TileMVTransformer.java | 3 +- .../tiles/transformers/TileTransformer.java | 8 +- 13 files changed, 68 insertions(+), 254 deletions(-) delete mode 100644 src/main/java/techreborn/events/OreUnifier.java diff --git a/src/main/java/techreborn/Core.java b/src/main/java/techreborn/Core.java index 00348b897..9a01cee7f 100644 --- a/src/main/java/techreborn/Core.java +++ b/src/main/java/techreborn/Core.java @@ -53,7 +53,6 @@ import techreborn.config.ConfigTechReborn; import techreborn.dispenser.BehaviorDispenseScrapbox; import techreborn.entities.EntityNukePrimed; import techreborn.events.BlockBreakHandler; -import techreborn.events.OreUnifier; import techreborn.events.TRTickHandler; import techreborn.init.*; import techreborn.lib.ModInfo; @@ -169,10 +168,9 @@ public class Core { MinecraftForge.EVENT_BUS.register(IDSUManager.INSTANCE); MinecraftForge.EVENT_BUS.register(new MultiblockServerTickHandler()); MinecraftForge.EVENT_BUS.register(new TRTickHandler()); - MinecraftForge.EVENT_BUS.register(new OreUnifier()); //MinecraftForge.EVENT_BUS.register(worldGen.retroGen); // Scrapbox - if (config.ScrapboxDispenser) { + if (BehaviorDispenseScrapbox.dispenseScrapboxes) { BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(ModItems.SCRAP_BOX, new BehaviorDispenseScrapbox()); } logHelper.info("Initialization Complete"); diff --git a/src/main/java/techreborn/blocks/BlockOre.java b/src/main/java/techreborn/blocks/BlockOre.java index 4ff3e3385..870046956 100644 --- a/src/main/java/techreborn/blocks/BlockOre.java +++ b/src/main/java/techreborn/blocks/BlockOre.java @@ -42,23 +42,29 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import reborncore.common.blocks.PropertyString; +import reborncore.common.registration.RebornRegistry; +import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.ArrayUtils; import reborncore.common.util.OreDrop; import reborncore.common.util.OreDropSet; import reborncore.common.util.StringUtils; import techreborn.client.TechRebornCreativeTabMisc; -import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; import techreborn.items.ItemDusts; import techreborn.items.ItemGems; +import techreborn.lib.ModInfo; import techreborn.world.config.IOreNameProvider; import java.util.ArrayList; import java.util.List; import java.util.Random; +@RebornRegistry(modID = ModInfo.MOD_ID) public class BlockOre extends Block implements IOreNameProvider { + @ConfigRegistry(category = "blocks", key = "secondaryDropChance", comment = "Secondary Gem drop chance") + public static double secondaryDropChance = 0.5; + public static final String[] ores = new String[] { "galena", "iridium", "ruby", "sapphire", "bauxite", "pyrite", "cinnabar", "sphalerite", "tungsten", "sheldonite", "peridot", "sodalite", @@ -112,7 +118,7 @@ public class BlockOre extends Block implements IOreNameProvider { // Ruby if (variant.equalsIgnoreCase("Ruby")) { OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby"), - ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); + secondaryDropChance); OreDrop redGarnet = new OreDrop(ItemGems.getGemByName("red_garnet"), 0.02); OreDropSet set = new OreDropSet(ruby); return set.drop(fortune, random); @@ -121,7 +127,7 @@ public class BlockOre extends Block implements IOreNameProvider { // Sapphire if (variant.equalsIgnoreCase("Sapphire")) { OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire"), - ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); + secondaryDropChance); OreDrop peridot = new OreDrop(ItemGems.getGemByName("peridot"), 0.03); OreDropSet set = new OreDropSet(sapphire, peridot); return set.drop(fortune, random); @@ -130,7 +136,7 @@ public class BlockOre extends Block implements IOreNameProvider { // Pyrite if (variant.equalsIgnoreCase("Pyrite")) { OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite"), - ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); + secondaryDropChance); OreDropSet set = new OreDropSet(pyriteDust); return set.drop(fortune, random); } @@ -138,7 +144,7 @@ public class BlockOre extends Block implements IOreNameProvider { // Sodalite if (variant.equalsIgnoreCase("Sodalite")) { OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6), - ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); + secondaryDropChance); OreDrop aluminum = new OreDrop(ItemDusts.getDustByName("aluminum"), 0.50); OreDropSet set = new OreDropSet(sodalite, aluminum); return set.drop(fortune, random); @@ -147,7 +153,7 @@ public class BlockOre extends Block implements IOreNameProvider { // Cinnabar if (variant.equalsIgnoreCase("Cinnabar")) { OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar"), - ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); + secondaryDropChance); OreDrop redstone = new OreDrop(new ItemStack(Items.REDSTONE), 0.25); OreDropSet set = new OreDropSet(cinnabar, redstone); return set.drop(fortune, random); @@ -156,7 +162,7 @@ public class BlockOre extends Block implements IOreNameProvider { // Sphalerite 1, 1/8 yellow garnet if (variant.equalsIgnoreCase("Sphalerite")) { OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite"), - ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel); + secondaryDropChance); OreDrop yellowGarnet = new OreDrop(ItemGems.getGemByName("yellowGarnet"), 0.125); OreDropSet set = new OreDropSet(sphalerite, yellowGarnet); return set.drop(fortune, random); diff --git a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java index 74330ef32..7f0efd832 100644 --- a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java +++ b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java @@ -79,7 +79,7 @@ import techreborn.compat.jei.scrapbox.ScrapboxRecipeCategory; import techreborn.compat.jei.scrapbox.ScrapboxRecipeHandler; import techreborn.compat.jei.vacuumFreezer.VacuumFreezerRecipeCategory; import techreborn.compat.jei.vacuumFreezer.VacuumFreezerRecipeHandler; -import techreborn.config.ConfigTechReborn; +import techreborn.dispenser.BehaviorDispenseScrapbox; import techreborn.init.IC2Duplicates; import techreborn.init.ModBlocks; import techreborn.init.ModFluids; @@ -226,7 +226,7 @@ public class TechRebornJeiPlugin extends BlankModPlugin { registry.addDescription(ItemParts.getPartByName("rubberSap"), I18n.translateToLocal("techreborn.desc.rubberSap")); - if (!ConfigTechReborn.ScrapboxDispenser) { + if (!BehaviorDispenseScrapbox.dispenseScrapboxes) { registry.addDescription(new ItemStack(ModItems.SCRAP_BOX), I18n.translateToLocal("techreborn.desc.scrapBoxNoDispenser")); } else { diff --git a/src/main/java/techreborn/config/ConfigTechReborn.java b/src/main/java/techreborn/config/ConfigTechReborn.java index 4a547a516..d72c1dcfa 100644 --- a/src/main/java/techreborn/config/ConfigTechReborn.java +++ b/src/main/java/techreborn/config/ConfigTechReborn.java @@ -25,9 +25,13 @@ package techreborn.config; import net.minecraftforge.common.config.Configuration; +import reborncore.common.registration.RebornRegistry; +import reborncore.common.registration.impl.ConfigRegistry; +import techreborn.lib.ModInfo; import java.io.File; +@RebornRegistry(modID = ModInfo.MOD_ID) public class ConfigTechReborn { public static String CATEGORY_WORLD = "world"; public static String CATEGORY_POWER = "power"; @@ -37,24 +41,8 @@ public class ConfigTechReborn { public static String CATEGORY_INTEGRATION = "Integration"; public static String CATEGORY_FEATURES = "Features"; - public static double FortuneSecondaryOreMultiplierPerLevel; - public static boolean RubberSaplingLoot; - public static boolean TinIngotsLoot; - public static boolean CopperIngotsLoot; - public static boolean SteelIngotsLoot; - public static boolean UninsulatedElectocutionSound; - public static boolean UninsulatedElectocutionParticle; - public static boolean UninsulatedElectocutionDamage; - public static boolean ScrapboxDispenser; - public static boolean disableRailcraftSteelNuggetRecipe; - // Power - - public static int LVTransformerMaxInput; - public static int LVTransformerMaxOutput; - public static int MVTransformerMaxInput; - public static int MVTransformerMaxOutput; - public static int HVTransformerMaxInput; - public static int HVTransformerMaxOutput; + @ConfigRegistry(config = "recipes", category = "railcraft", key = "disableRailcraftNugget", comment = "When true TechReborn will remove Railcrafts Iron Nugget to steel nuggert recipe.") + public static boolean disableRailcraftSteelNuggetRecipe = false; // Charge public static int IronDrillCharge; public static int DiamondDrillCharge; @@ -74,20 +62,9 @@ public class ConfigTechReborn { public static int CentrifugeCharge; public static int ThermalGeneratorCharge; - public static boolean FreqTransmitterChat; - public static boolean FreqTransmitterTooltip; - public static boolean NanosaberChat; - // EU/T - public static int CloakingDeviceEUTick; // Crafting - public static boolean ExpensiveMacerator; - public static boolean ExpensiveDrill; - public static boolean ExpensiveDiamondDrill; - public static boolean ExpensiveSolar; - public static boolean ExpensiveWatermill; - public static boolean ExpensiveWindmill; - public static boolean REMOVE_DUPLICATES; - public static boolean ExpensiveQuarry; + @ConfigRegistry(config = "recipes", category = "ic2", key = "deduplicate", comment = "Changes a lot of reipes and hides blocks to intrgrade TechReborn into IC2") + public static boolean REMOVE_DUPLICATES = false; // Client public static boolean ShowChargeHud; @@ -125,38 +102,6 @@ public class ConfigTechReborn { } public static void Configs() { - RubberSaplingLoot = config - .get(CATEGORY_WORLD, "Rubber Sapling Loot", true, "Allow Rubber Saplings to generate in loot chests") - .getBoolean(true); - - CopperIngotsLoot = config - .get(CATEGORY_WORLD, "Copper Ingots Loot", true, "Allow Copper Ingots to generate in loot chests") - .getBoolean(true); - - TinIngotsLoot = config - .get(CATEGORY_WORLD, "Tin Ingots Loot", true, "Allow Tin Ingots to generate in loot chests") - .getBoolean(true); - - SteelIngotsLoot = config - .get(CATEGORY_WORLD, "Steel Ingots Loot", true, "Allow Steel Ingots to generate in loot chests") - .getBoolean(true); - - FortuneSecondaryOreMultiplierPerLevel = config.get(CATEGORY_WORLD, "FortuneSecondaryOreMultiplierPerLevel", 0.5, - "FortuneSecondaryOreMultiplierPerLevel").getDouble(); - - //Transformers - LVTransformerMaxInput = config.get(CATEGORY_POWER, "LV Transformer Max Input", 128, "Set the max input for the LV Trasnformer") - .getInt(); - LVTransformerMaxOutput = config.get(CATEGORY_POWER, "LV Transformer Max Output", 32, "Set the max output for the LV Trasnformer") - .getInt(); - MVTransformerMaxInput = config.get(CATEGORY_POWER, "MV Transformer Max Input", 512, "Set the max input for the MV Trasnformer") - .getInt(); - MVTransformerMaxOutput = config.get(CATEGORY_POWER, "MV Transformer Max Output", 128, "Set the max output for the MV Trasnformer") - .getInt(); - HVTransformerMaxInput = config.get(CATEGORY_POWER, "HV Transformer Max Input", 2048, "Set the max input for the HV Trasnformer") - .getInt(); - HVTransformerMaxOutput = config.get(CATEGORY_POWER, "HV Transformer Max Output", 512, "Set the max output for the HV Trasnformer") - .getInt(); // Charge IronDrillCharge = config @@ -219,71 +164,12 @@ public class ConfigTechReborn { ThermalGeneratorCharge = config.get(CATEGORY_POWER, "ThermalGenerator MaxCharge", 1000000, "Set the max charge for the ThermalGenerator").getInt(); - //Features - FreqTransmitterChat = config - .get(CATEGORY_FEATURES, "Frequency Transmitter Chat messages", true, "Allow Frequency Transmitter chat messages") - .getBoolean(true); - - FreqTransmitterTooltip = config - .get(CATEGORY_FEATURES, "Frequency Transmitter tooltips", true, "Allow Frequency Transmitter to display tooltip info") - .getBoolean(true); - - NanosaberChat = config - .get(CATEGORY_FEATURES, "Nanosaber Chat messages", true, "Allow Nanosaber chat messages") - .getBoolean(true); enableGemArmorAndTools = config.get(CATEGORY_FEATURES, "Gem tools and armor", true, "Should the gem tools and armor be added to the game").getBoolean(true); - // Crafting - ExpensiveMacerator = config - .get(CATEGORY_CRAFTING, "Expensive Macerator", true, "Allow TechReborn to change the Macerator recipe") - .getBoolean(true); - - ExpensiveDrill = config - .get(CATEGORY_CRAFTING, "Expensive Drill", true, "Allow TechReborn to change the Drill recipe") - .getBoolean(true); - - ExpensiveDiamondDrill = config.get(CATEGORY_CRAFTING, "Expensive DiamondDrill", true, - "Allow TechReborn to change the DiamondDrill recipe").getBoolean(true); - - ExpensiveSolar = config.get(CATEGORY_CRAFTING, "Expensive Solarpanels", true, - "Allow TechReborn to change the Solarpanels recipe").getBoolean(true); - - ExpensiveWatermill = config - .get(CATEGORY_CRAFTING, "Expensive Watermill", true, "Allow TechReborn to change the Watermill recipe") - .getBoolean(true); - - ExpensiveWindmill = config - .get(CATEGORY_CRAFTING, "Expensive Windmill", true, "Allow TechReborn to change the Windmill recipe") - .getBoolean(true); - - REMOVE_DUPLICATES = config - .get(CATEGORY_CRAFTING, "Remove Duplicates when IC2 is installed", false, "This attempts to fully integrate TR with ic2 recipes (Beta)") - .getBoolean(false); - - ExpensiveQuarry = config - .get(CATEGORY_CRAFTING, "Expensive Buildcraft quarry", true, "Change the buildcraft quarry recipe to require the diamond drill") - .getBoolean(true); - - disableRailcraftSteelNuggetRecipe = config.get(CATEGORY_CRAFTING, "Disable Railcraft's Steel nugget recipe", false, "When true TechReborn will remove Railcrafts Iron Nugget to steel nuggert recipe.").getBoolean(false); - ShowChargeHud = config.get(CATEGORY_POWER, "Show Charge hud", true, "Show Charge hud (ClientSideOnly)") .getBoolean(true); - UninsulatedElectocutionDamage = config.get(CATEGORY_WORLD, "Uninsulated Electrocution Damage", true, - "Damage entities on contact with uninsulated cables").getBoolean(true); - UninsulatedElectocutionSound = config.get(CATEGORY_WORLD, "Uninsulated Electrocution Sound", true, - "Play sound on contact with uninsulated cables").getBoolean(true); - UninsulatedElectocutionParticle = config.get(CATEGORY_WORLD, "Uninsulated Electrocution Particle", true, - "Spawn particles on contact with uninsulated cables").getBoolean(true); - - ScrapboxDispenser = config - .get(CATEGORY_WORLD, "Scrapboxes in Dispenser", true, "Allow scrapboxes to be opened via dispenser") - .getBoolean(true); - - ExpensiveWatermill = config - .get(CATEGORY_CRAFTING, "Expensive Watermill", true, "Allow TechReborn to change the Watermill recipe") - .getBoolean(true); if (config.hasChanged()) { config.save(); diff --git a/src/main/java/techreborn/events/OreUnifier.java b/src/main/java/techreborn/events/OreUnifier.java deleted file mode 100644 index bd5e07e06..000000000 --- a/src/main/java/techreborn/events/OreUnifier.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2017 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.events; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumHand; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.oredict.OreDictionary; -import reborncore.common.registration.RebornRegistry; -import reborncore.common.registration.impl.ConfigRegistry; -import reborncore.common.util.ItemUtils; -import techreborn.lib.ModInfo; - -import java.util.HashMap; - -@RebornRegistry(modID = ModInfo.MOD_ID) -public class OreUnifier { - - @ConfigRegistry(config = "misc", category = "general", key = "OreUnifier", comment = "Convert any ore itemstacks into Tech Reborn ores") - public static boolean oreUnifier = false; - - public static HashMap oreHash = new HashMap<>(); - - public static void registerOre(String name, ItemStack ore) { - oreHash.put(name, ore); - OreDictionary.registerOre(name, ore); - } - - public static void registerOre(String name, Item ore) { - registerOre(name, new ItemStack(ore)); - } - - public static void registerOre(String name, Block ore) { - registerOre(name, new ItemStack(ore)); - } - - @SubscribeEvent - public void itemTick(TickEvent.PlayerTickEvent event) { - if (oreUnifier && !event.player.world.isRemote - && event.player.world.getTotalWorldTime() % 10 == 0) { - if (event.player.getHeldItem(EnumHand.MAIN_HAND) != ItemStack.EMPTY) { - int[] oreIds = OreDictionary.getOreIDs(event.player.getHeldItem(EnumHand.MAIN_HAND)); - for (int id : oreIds) { - String oreName = OreDictionary.getOreName(id); - if (oreHash.containsKey(oreName)) { - if (ItemUtils.isItemEqual(event.player.getHeldItem(EnumHand.MAIN_HAND), oreHash.get(oreName), - true, true, true) - && !ItemUtils.isItemEqual(event.player.getHeldItem(EnumHand.MAIN_HAND), - oreHash.get(oreName), true, true, false)) { - ItemStack stack = oreHash.get(oreName).copy(); - stack.setCount(event.player.getHeldItem(EnumHand.MAIN_HAND).getCount()); - stack.setTagCompound(event.player.getHeldItem(EnumHand.MAIN_HAND).getTagCompound()); - event.player.inventory.setInventorySlotContents(event.player.inventory.currentItem, stack); - } - } - } - } - } - } - -} diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index b78c12f0e..a59d2a7ec 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -34,6 +34,8 @@ import net.minecraftforge.fluids.UniversalBucket; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.oredict.OreDictionary; import reborncore.api.recipe.RecipeHandler; +import reborncore.common.registration.RebornRegistry; +import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.CraftingHelper; import reborncore.common.util.ItemUtils; import reborncore.common.util.OreUtil; @@ -48,6 +50,7 @@ import techreborn.compat.CompatManager; import techreborn.config.ConfigTechReborn; import techreborn.init.recipes.*; import techreborn.items.*; +import techreborn.lib.ModInfo; import java.util.Iterator; import java.util.Map; @@ -57,8 +60,14 @@ import static techreborn.utils.OreDictUtils.getDictOreOrEmpty; import static techreborn.utils.OreDictUtils.isDictPrefixed; import static techreborn.utils.OreDictUtils.joinDictName; +@RebornRegistry(modID = ModInfo.MOD_ID) public class ModRecipes { - public static ConfigTechReborn config; + + @ConfigRegistry(config = "recipes", category = "changes", key = "expesive_macerator", comment = "Enable the expensive macertor recipe") + public static boolean expensiveMacerator = false; + + @ConfigRegistry(config = "recipes", category = "changes", key = "expesive_solar", comment = "Enable the expensive solar panel recipe") + public static boolean expensiveSolar = false; public static void init() { //Gonna rescan to make sure we have an uptodate list @@ -936,13 +945,13 @@ public class ModRecipes { ItemCells.getCellByName("empty"), ItemCells.getCellByName("nitrogenDioxide", 2), 1240, 30)); - if (ConfigTechReborn.ExpensiveMacerator && !IC2Duplicates.deduplicate()) + if (expensiveMacerator && !IC2Duplicates.deduplicate()) CraftingHelper .addShapedOreRecipe(getOre("ic2Macerator"), "FDF", "DMD", "FCF", 'F', Items.FLINT, 'D', Items.DIAMOND, 'M', "machineBlockBasic", 'C', "circuitBasic"); - if (ConfigTechReborn.ExpensiveSolar && !IC2Duplicates.deduplicate()) + if (expensiveSolar && !IC2Duplicates.deduplicate()) CraftingHelper .addShapedOreRecipe(IC2Duplicates.SOLAR_PANEL.getStackBasedOnConfig(), "PPP", "SZS", "CGC", 'P', "paneGlass", 'S', "platelazurite", 'Z', diff --git a/src/main/java/techreborn/items/ItemFrequencyTransmitter.java b/src/main/java/techreborn/items/ItemFrequencyTransmitter.java index c6961db64..6a3d5cde8 100644 --- a/src/main/java/techreborn/items/ItemFrequencyTransmitter.java +++ b/src/main/java/techreborn/items/ItemFrequencyTransmitter.java @@ -42,7 +42,6 @@ import reborncore.client.hud.StackInfoElement; import reborncore.common.util.ChatUtils; import reborncore.common.util.Color; import techreborn.client.TechRebornCreativeTabMisc; -import techreborn.config.ConfigTechReborn; import techreborn.init.ModItems; import techreborn.lib.MessageIDs; @@ -80,7 +79,7 @@ public class ItemFrequencyTransmitter extends ItemTRNoDestroy { stack.getTagCompound().setInteger("z", pos.getZ()); stack.getTagCompound().setInteger("dim", world.provider.getDimension()); - if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat) { + if (!world.isRemote) { ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString( TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " X: " + TextFormatting.GOLD + pos.getX() + @@ -101,7 +100,7 @@ public class ItemFrequencyTransmitter extends ItemTRNoDestroy { ItemStack stack = player.getHeldItem(hand); if (player.isSneaking()) { stack.setTagCompound(null); - if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat) { + if (!world.isRemote) { ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString( TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.coordsHaveBeen") + " " + TextFormatting.GOLD + I18n.translateToLocal("techreborn.message.cleared"))); @@ -112,21 +111,19 @@ public class ItemFrequencyTransmitter extends ItemTRNoDestroy { } public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { - if (ConfigTechReborn.FreqTransmitterTooltip) { - if (stack.hasTagCompound() && stack.getTagCompound() != null && stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z") && stack.getTagCompound().hasKey("dim")) { - int x = stack.getTagCompound().getInteger("x"); - int y = stack.getTagCompound().getInteger("y"); - int z = stack.getTagCompound().getInteger("z"); - int dim = stack.getTagCompound().getInteger("dim"); + if (stack.hasTagCompound() && stack.getTagCompound() != null && stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z") && stack.getTagCompound().hasKey("dim")) { + int x = stack.getTagCompound().getInteger("x"); + int y = stack.getTagCompound().getInteger("y"); + int z = stack.getTagCompound().getInteger("z"); + int dim = stack.getTagCompound().getInteger("dim"); - list.add(TextFormatting.GRAY + "X: " + TextFormatting.GOLD + x); - list.add(TextFormatting.GRAY + "Y: " + TextFormatting.GOLD + y); - list.add(TextFormatting.GRAY + "Z: " + TextFormatting.GOLD + z); - list.add(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName()); + list.add(TextFormatting.GRAY + "X: " + TextFormatting.GOLD + x); + list.add(TextFormatting.GRAY + "Y: " + TextFormatting.GOLD + y); + list.add(TextFormatting.GRAY + "Z: " + TextFormatting.GOLD + z); + list.add(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName()); - } else { - list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.noCoordsSet")); - } + } else { + list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.noCoordsSet")); } } diff --git a/src/main/java/techreborn/items/tools/ItemCloakingDevice.java b/src/main/java/techreborn/items/tools/ItemCloakingDevice.java index 8a4a6ce52..6d42809ac 100644 --- a/src/main/java/techreborn/items/tools/ItemCloakingDevice.java +++ b/src/main/java/techreborn/items/tools/ItemCloakingDevice.java @@ -35,12 +35,20 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import reborncore.api.power.IEnergyItemInfo; import reborncore.common.powerSystem.PoweredItem; +import reborncore.common.registration.RebornRegistry; +import reborncore.common.registration.impl.ConfigRegistry; import techreborn.client.TechRebornCreativeTab; import techreborn.config.ConfigTechReborn; import techreborn.init.ModItems; import techreborn.items.ItemTRNoDestroy; +import techreborn.lib.ModInfo; +@RebornRegistry(modID = ModInfo.MOD_ID) public class ItemCloakingDevice extends ItemTRNoDestroy implements IEnergyItemInfo { + + @ConfigRegistry(config = "items", category = "cloacking_device", key = "ClockingDeviceEnergyUsage", comment = "Cloacking device energy usesage (Value in EU)") + public static int usage = 10; + public static int MaxCharge = ConfigTechReborn.CloakingDeviceCharge; public static int Limit = 100; public static boolean isActive; @@ -54,8 +62,8 @@ public class ItemCloakingDevice extends ItemTRNoDestroy implements IEnergyItemIn @Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { - if (PoweredItem.canUseEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack)) { - PoweredItem.useEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack); + if (PoweredItem.canUseEnergy(usage, itemStack)) { + PoweredItem.useEnergy(usage, itemStack); player.setInvisible(true); } else { if (!player.isPotionActive(MobEffects.INVISIBILITY)) { diff --git a/src/main/java/techreborn/items/tools/ItemNanosaber.java b/src/main/java/techreborn/items/tools/ItemNanosaber.java index 2c67e32bf..af7e106c6 100644 --- a/src/main/java/techreborn/items/tools/ItemNanosaber.java +++ b/src/main/java/techreborn/items/tools/ItemNanosaber.java @@ -48,7 +48,6 @@ import reborncore.api.power.IEnergyItemInfo; import reborncore.common.powerSystem.PoweredItem; import reborncore.common.util.ChatUtils; import techreborn.client.TechRebornCreativeTab; -import techreborn.config.ConfigTechReborn; import techreborn.init.ModItems; import techreborn.lib.MessageIDs; @@ -160,7 +159,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo { stack.setTagCompound(new NBTTagCompound()); } stack.getTagCompound().setBoolean("isActive", true); - if (world.isRemote && ConfigTechReborn.NanosaberChat) { + if (world.isRemote) { ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString( TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " " + TextFormatting.GOLD + I18n @@ -168,7 +167,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo { } } else { stack.getTagCompound().setBoolean("isActive", false); - if (world.isRemote && ConfigTechReborn.NanosaberChat) { + if (world.isRemote) { ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString( TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " " + TextFormatting.GOLD + I18n diff --git a/src/main/java/techreborn/tiles/transformers/TileHVTransformer.java b/src/main/java/techreborn/tiles/transformers/TileHVTransformer.java index 5772b24a3..785d96b6d 100644 --- a/src/main/java/techreborn/tiles/transformers/TileHVTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileHVTransformer.java @@ -25,7 +25,6 @@ package techreborn.tiles.transformers; import reborncore.api.power.EnumPowerTier; -import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; /** @@ -34,7 +33,7 @@ import techreborn.init.ModBlocks; public class TileHVTransformer extends TileTransformer { public TileHVTransformer() { - super("HVTransformer", ModBlocks.HV_TRANSFORMER, EnumPowerTier.EXTREME, ConfigTechReborn.HVTransformerMaxInput, ConfigTechReborn.HVTransformerMaxOutput, ConfigTechReborn.HVTransformerMaxInput * 2); + super("HVTransformer", ModBlocks.HV_TRANSFORMER, EnumPowerTier.EXTREME); } } diff --git a/src/main/java/techreborn/tiles/transformers/TileLVTransformer.java b/src/main/java/techreborn/tiles/transformers/TileLVTransformer.java index 7dd0cf23f..1a5e2fec0 100644 --- a/src/main/java/techreborn/tiles/transformers/TileLVTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileLVTransformer.java @@ -25,7 +25,6 @@ package techreborn.tiles.transformers; import reborncore.api.power.EnumPowerTier; -import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; /** @@ -34,7 +33,7 @@ import techreborn.init.ModBlocks; public class TileLVTransformer extends TileTransformer { public TileLVTransformer() { - super("LVTransformer", ModBlocks.LV_TRANSFORMER, EnumPowerTier.LOW, ConfigTechReborn.LVTransformerMaxInput, ConfigTechReborn.LVTransformerMaxOutput, ConfigTechReborn.LVTransformerMaxInput * 2); + super("LVTransformer", ModBlocks.LV_TRANSFORMER, EnumPowerTier.LOW); } } diff --git a/src/main/java/techreborn/tiles/transformers/TileMVTransformer.java b/src/main/java/techreborn/tiles/transformers/TileMVTransformer.java index 8565f2b3d..be840cfc1 100644 --- a/src/main/java/techreborn/tiles/transformers/TileMVTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileMVTransformer.java @@ -25,7 +25,6 @@ package techreborn.tiles.transformers; import reborncore.api.power.EnumPowerTier; -import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; /** @@ -34,7 +33,7 @@ import techreborn.init.ModBlocks; public class TileMVTransformer extends TileTransformer { public TileMVTransformer() { - super("MVTransformer", ModBlocks.MV_TRANSFORMER, EnumPowerTier.HIGH, ConfigTechReborn.MVTransformerMaxInput, ConfigTechReborn.MVTransformerMaxOutput, ConfigTechReborn.LVTransformerMaxInput * 2); + super("MVTransformer", ModBlocks.MV_TRANSFORMER, EnumPowerTier.HIGH); } @Override diff --git a/src/main/java/techreborn/tiles/transformers/TileTransformer.java b/src/main/java/techreborn/tiles/transformers/TileTransformer.java index 875d249f4..ad5818ad9 100644 --- a/src/main/java/techreborn/tiles/transformers/TileTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileTransformer.java @@ -46,14 +46,14 @@ public class TileTransformer extends TilePowerAcceptor implements IWrenchable, I public int maxOutput; public int maxStorage; - public TileTransformer(String name, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) { + public TileTransformer(String name, Block wrenchDrop, EnumPowerTier tier) { super(1); this.wrenchDrop = wrenchDrop; this.tier = tier; this.name = name; - this.maxInput = maxInput; - this.maxOutput = maxOuput; - this.maxStorage = maxStorage; + this.maxInput = tier.getMaxInput(); + this.maxOutput = tier.getMaxOutput(); + this.maxStorage = tier.getMaxInput() * 2; } @Override