From 1923a3888441833df111fbae97852be956ce865f Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Fri, 22 Sep 2017 15:14:59 +0300 Subject: [PATCH] Empowered configuration of Empowerer and Display Stand --- .../mod/config/values/ConfigIntValues.java | 15 ++++++++++++- .../mod/items/ItemLeafBlower.java | 12 ++++++----- .../mod/items/ItemPotionRing.java | 21 +++++++++---------- .../mod/recipe/EmpowererHandler.java | 14 +++++++------ .../mod/tile/TileEntityDisplayStand.java | 4 +++- 5 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java index 286ec9321..0a153977b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigIntValues.java @@ -71,6 +71,10 @@ public enum ConfigIntValues{ LIQUID_BANNING_RING_ENERGY_TRANSFER("Ring of Liquid Banning: Energy Transfer Rate", ConfigCategories.TOOL_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Ring of Liquid Banning can receive per tick"), LIQUID_BANNING_RING_ENERGY_USE("Ring of Liquid Banning: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 150, 1, 1000000000, "Base amount of energy used by Ring of Liquid Banning to remove liquid block"), + POTION_RINGS_ENERGY_USE("Potion Rings: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 325, 1, 1000000000, "Amount of energy used by Potion Rings placed on Display Stand"), + ADVANCED_POTION_RINGS_ENERGY_USE("Advanced Potion Rings: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 325, 1, 1000000000, "Amount of energy used by Advanced Potion Rings placed on Display Stand"), + LEAF_BLOWER_ENERGY_USE("Leaf Blower: Energy Use", ConfigCategories.TOOL_ENERGY_VALUES, 60, 1, 1000000000, "Amount of energy used by Leaf Blower placed on Display Stand"), + ATOMIC_RECONSTRUCTOR_ENERGY_CAPACITY("Atomic Reconstructor: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 300000, 1000, 1000000000, "Amount of energy Atomic Reconstructor can store"), ATOMIC_RECONSTRUCTOR_ENERGY_RECEIVE("Atomic Reconstructor: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 5000, 1, 1000000000, "Amount of energy Atomic Reconstructor can receive per tick"), ATOMIC_RECONSTRUCTOR_ENERGY_USE("Atomic Reconstructor: Energy Use", ConfigCategories.MACHINE_ENERGY_VALUES, 1000, 1, 1000000000, "Base amount of energy used by Atomic Reconstructor to perform action"), @@ -102,7 +106,16 @@ public enum ConfigIntValues{ LENS_DISENCHANTING_ENERGY_USE("Lens of Disenchanting: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 250000, 1, 1000000000, "Amount of energy used by Atomic Reconstructor with Lens of Disenchanting to perform action"), LENS_MINER_ENERGY_USE("Lens of Miner: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 60000, 1, 1000000000, "Amount of energy used by Atomic Reconstructor with Lens of Miner to mine ore"), LENS_MINER_NETHER_ORES_ENERGY_USE("Lens of Miner: Energy Use For Nether Ores", ConfigCategories.MACHINE_RECIPE_COSTS, 70000, 1, 1000000000, "Amount of energy used by Atomic Reconstructor with Lens of Miner to mine nether ore"), - LENS_DISRUPTION_ENERGY_USE("Lens of Disruption: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 150000, 1, 1000000000, "What?!... Is it 11?"); + LENS_DISRUPTION_ENERGY_USE("Lens of Disruption: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 150000, 1, 1000000000, "What?!... Is it 11?"), + + DISPLAY_STAND_ENERGY_CAPACITY("Display Stand: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 80000, 1000, 1000000000, "Amount of energy Display Stand can store"), + DISPLAY_STAND_ENERGY_RECEIVE("Display Stand: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 1000, 1, 1000000000, "Amount of energy Display Stand can receive per tick"), + EMPOWERER_CANOLA_ENERGY_COST("Empowerer: Empowered Canola Seed Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 1000, 1, 1000000000, "Amount of energy (per Display Stand) used by Empowerer to create Empowered Canola Seed"), + EMPOWERER_CANOLA_CREATION_TIME("Empowerer: Empowered Canola Seed Creation Time", ConfigCategories.MACHINE_RECIPE_COSTS, 30, 1, 72000, "Time (in ticks) required to create Empowered Canola Seed in Empowerer"), + EMPOWERER_CRYSTAL_ENERGY_COST("Empowerer: Empowered Crystal Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 5000, 1, 1000000000, "Amount of energy (per Display Stand) used by Empowerer to create Empowered Crystal"), + EMPOWERER_CRYSTAL_CREATION_TIME("Empowerer: Empowered Crystal Creation Time", ConfigCategories.MACHINE_RECIPE_COSTS, 50, 1, 72000, "Time (in ticks) required to create Empowered Crystal in Empowerer"), + EMPOWERER_BLOCK_ENERGY_COST("Empowerer: Empowered Crystal Block Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 50000, 1, 1000000000, "Amount of energy (per Display Stand) used by Empowerer to create Empowered Crystal Block"), + EMPOWERER_BLOCK_CREATION_TIME("Empowerer: Empowered Crystal Block Creation Time", ConfigCategories.MACHINE_RECIPE_COSTS, 500, 1, 72000, "Time (in ticks) required to create Empowered Crystal Block in Empowerer"); public final String name; public final String category; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java index 9a7396e5f..b6f5bd0e6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java @@ -10,7 +10,11 @@ package de.ellpeck.actuallyadditions.mod.items; +import java.util.ArrayList; +import java.util.Collections; + import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; @@ -31,9 +35,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; -import java.util.ArrayList; -import java.util.Collections; - public class ItemLeafBlower extends ItemBase implements IDisplayStandItem{ private final boolean isAdvanced; @@ -107,7 +108,8 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem{ BlockPos pos = new BlockPos(x+reachX, y+reachY, z+reachZ); Block block = world.getBlockState(pos).getBlock(); - if(block != null && ((block instanceof BlockBush || block instanceof IShearable) && (this.isAdvanced || !block.isLeaves(world.getBlockState(pos), world, pos)))){ + if((block instanceof BlockBush || block instanceof IShearable) && + (this.isAdvanced || !block.isLeaves(world.getBlockState(pos), world, pos))){ breakPositions.add(pos); } } @@ -139,6 +141,6 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem{ @Override public int getUsePerTick(ItemStack stack, TileEntity tile, int elapsedTicks){ - return 60; + return ConfigIntValues.LEAF_BLOWER_ENERGY_USE.getValue(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java index 93c35ab72..7b19957b5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java @@ -10,15 +10,16 @@ package de.ellpeck.actuallyadditions.mod.items; +import java.util.Collections; +import java.util.List; +import javax.annotation.Nullable; + import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.metalists.ThePotionRings; -import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import de.ellpeck.actuallyadditions.mod.util.Util; +import de.ellpeck.actuallyadditions.mod.util.*; import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; @@ -38,10 +39,6 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; -import java.util.Collections; -import java.util.List; - public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDisplayStandItem{ public static final ThePotionRings[] ALL_RINGS = ThePotionRings.values(); @@ -189,7 +186,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi boolean advanced = ((ItemPotionRing)stack.getItem()).isAdvanced; int range = advanced ? 48 : 16; List entities = tile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(tile.getPos().getX()-range, tile.getPos().getY()-range, tile.getPos().getZ()-range, tile.getPos().getX()+range, tile.getPos().getY()+range, tile.getPos().getZ()+range)); - if(entities != null && !entities.isEmpty()){ + if(!entities.isEmpty()){ if(advanced){ //Give all entities the effect for(EntityLivingBase entity : entities){ @@ -226,7 +223,9 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi @Override public int getUsePerTick(ItemStack stack, TileEntity tile, int elapsedTicks){ - return 325; + return (StackUtil.isValid(stack) && ((ItemPotionRing) stack.getItem()).isAdvanced) ? + ConfigIntValues.ADVANCED_POTION_RINGS_ENERGY_USE.getValue() : + ConfigIntValues.POTION_RINGS_ENERGY_USE.getValue(); } private boolean effectEntity(EntityLivingBase thePlayer, ItemStack stack, boolean canUseBasic){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java index f962cf885..0877c7dac 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java @@ -10,9 +10,13 @@ package de.ellpeck.actuallyadditions.mod.recipe; +import java.util.ArrayList; +import java.util.List; + import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; @@ -22,9 +26,6 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import java.util.ArrayList; -import java.util.List; - public final class EmpowererHandler{ public static final ArrayList MAIN_PAGE_RECIPES = new ArrayList(); @@ -44,7 +45,8 @@ public final class EmpowererHandler{ } ItemStack seed = new ItemStack(InitItems.itemCanolaSeed); - ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal()), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.EMPOWERED_CANOLA_SEED.ordinal()), seed, seed, seed, seed, 1000, 30, new float[]{1F, 91F/255F, 76F/255F}); + ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal()), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.EMPOWERED_CANOLA_SEED.ordinal()), seed, seed, seed, seed, + ConfigIntValues.EMPOWERER_CANOLA_ENERGY_COST.getValue(), ConfigIntValues.EMPOWERER_CANOLA_CREATION_TIME.getValue(), new float[]{1F, 91F / 255F, 76F / 255F}); recipeEmpoweredCanolaSeed = RecipeUtil.lastEmpowererRecipe(); } @@ -53,9 +55,9 @@ public final class EmpowererHandler{ List dyes = OreDictionary.getOres(dye); for(ItemStack dyeStack : dyes){ - ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitItems.itemCrystal, 1, type.ordinal()), new ItemStack(InitItems.itemCrystalEmpowered, 1, type.ordinal()), dyeStack, modifier1, modifier2, modifier3, 5000, 50, color); + ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitItems.itemCrystal, 1, type.ordinal()), new ItemStack(InitItems.itemCrystalEmpowered, 1, type.ordinal()), dyeStack, modifier1, modifier2, modifier3, ConfigIntValues.EMPOWERER_CRYSTAL_ENERGY_COST.getValue(), ConfigIntValues.EMPOWERER_CRYSTAL_CREATION_TIME.getValue(), color); MAIN_PAGE_RECIPES.add(RecipeUtil.lastEmpowererRecipe()); - ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitBlocks.blockCrystal, 1, type.ordinal()), new ItemStack(InitBlocks.blockCrystalEmpowered, 1, type.ordinal()), dyeStack, modifier1, modifier2, modifier3, 50000, 500, color); + ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitBlocks.blockCrystal, 1, type.ordinal()), new ItemStack(InitBlocks.blockCrystalEmpowered, 1, type.ordinal()), dyeStack, modifier1, modifier2, modifier3, ConfigIntValues.EMPOWERER_BLOCK_ENERGY_COST.getValue(), ConfigIntValues.EMPOWERER_BLOCK_CREATION_TIME.getValue(), color); MAIN_PAGE_RECIPES.add(RecipeUtil.lastEmpowererRecipe()); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java index be8f88021..5316ceffd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.api.misc.IDisplayStandItem; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; import net.minecraft.item.Item; @@ -22,11 +23,12 @@ import net.minecraftforge.energy.IEnergyStorage; public class TileEntityDisplayStand extends TileEntityInventoryBase implements IEnergyDisplay{ - public final CustomEnergyStorage storage = new CustomEnergyStorage(80000, 1000, 0); + public final CustomEnergyStorage storage; private int oldEnergy; public TileEntityDisplayStand(){ super(1, "displayStand"); + this.storage = new CustomEnergyStorage(ConfigIntValues.DISPLAY_STAND_ENERGY_CAPACITY.getValue(), ConfigIntValues.DISPLAY_STAND_ENERGY_RECEIVE.getValue(), 0); } @Override