From f8c7f3bbb2d4ce07486dce6b2b70745e3999ae09 Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Fri, 22 Sep 2017 12:43:16 +0300 Subject: [PATCH] Reconstructed configuration for Atomic Reconstructor and Lenses --- .../mod/blocks/BlockAtomicReconstructor.java | 10 +-- .../mod/booklet/InitBooklet.java | 12 +-- .../mod/config/ConfigCategories.java | 2 + .../mod/config/values/ConfigIntValues.java | 35 +++++++- .../mod/items/lens/LensColor.java | 30 +++---- .../mod/items/lens/LensDeath.java | 7 +- .../mod/items/lens/LensDetonation.java | 12 +-- .../mod/items/lens/LensDisenchanting.java | 18 ++-- .../mod/items/lens/LensDisruption.java | 13 ++- .../mod/items/lens/LensEvenMoarDeath.java | 3 +- .../mod/items/lens/LensMining.java | 16 ++-- .../mod/items/lens/LensRecipeHandler.java | 83 ++++++++++++------- .../mod/misc/apiimpl/MethodHandler.java | 16 ++-- .../tile/TileEntityAtomicReconstructor.java | 6 +- .../actuallyadditions/mod/util/StackUtil.java | 9 +- 15 files changed, 172 insertions(+), 100 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java index e02579879..cb5699c47 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java @@ -10,6 +10,8 @@ package de.ellpeck.actuallyadditions.mod.blocks; +import java.util.List; + import de.ellpeck.actuallyadditions.api.lens.ILensItem; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase; @@ -47,8 +49,6 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; - public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay{ public static final int NAME_FLAVOR_AMOUNTS_1 = 12; @@ -209,7 +209,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud tooltip.add(StringUtil.localize(base+"1."+this.toPick1)+" "+StringUtil.localize(base+"2."+this.toPick2)); } } - + @Override public boolean hasComparatorInputOverride(IBlockState state){ return true; @@ -222,6 +222,6 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud if (t instanceof TileEntityAtomicReconstructor) { i = ((TileEntityAtomicReconstructor) t).getEnergy(); } - return MathHelper.clamp(i / 20000, 0, 15); + return MathHelper.clamp(i / (ConfigIntValues.ATOMIC_RECONSTRUCTOR_ENERGY_CAPACITY.getValue() / 15), 0, 15); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index 05efbb78a..46916bac1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -10,6 +10,8 @@ package de.ellpeck.actuallyadditions.mod.booklet; +import java.util.*; + import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; @@ -25,14 +27,13 @@ import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntry; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllItems; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials; import de.ellpeck.actuallyadditions.mod.booklet.page.*; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.crafting.*; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.gen.OreGen; import de.ellpeck.actuallyadditions.mod.gen.WorldGenLushCaves; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats; -import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting; -import de.ellpeck.actuallyadditions.mod.items.lens.LensMining; import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals; import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods; @@ -49,7 +50,6 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; -import java.util.*; public final class InitBooklet{ @@ -136,7 +136,7 @@ public final class InitBooklet{ chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM"), new PageLinkButton(2, "https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF")).setImportant(); new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3)); ArrayList crystalPages = new ArrayList(); - crystalPages.addAll(Arrays.asList(new PageTextOnly(1).addTextReplacement("", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "page_atomic_reconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setWildcard())); + crystalPages.addAll(Arrays.asList(new PageTextOnly(1).addTextReplacement("", ConfigIntValues.ATOMIC_RECONSTRUCTOR_ENERGY_USE.getValue()), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "page_atomic_reconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setWildcard())); for(int i = 0; i < LensRecipeHandler.MAIN_PAGE_RECIPES.size(); i++){ crystalPages.add(new PageReconstructor(7+i, LensRecipeHandler.MAIN_PAGE_RECIPES.get(i)).setNoText()); } @@ -188,8 +188,8 @@ public final class InitBooklet{ new BookletChapter("lensDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemDamageLens), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeDamageLens).setNoText()); new BookletChapter("lensMoreDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemMoreDamageLens), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLensMoreDeath).setNoText()); new BookletChapter("lensDetonation", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemExplosionLens), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeExplosionLens).setNoText()); - new BookletChapter("lensDisenchanting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemDisenchantingLens), new PageTextOnly(1).addTextReplacement("", LensDisenchanting.ENERGY_USE), new PageCrafting(2, ItemCrafting.recipeDisenchantingLens).setNoText()).setSpecial(); - new BookletChapter("lensMining", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemMiningLens), new PageTextOnly(1).addTextReplacement("", LensMining.ENERGY_USE), new PageCrafting(2, ItemCrafting.recipeMiningLens).setNoText()).setImportant(); + new BookletChapter("lensDisenchanting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemDisenchantingLens), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.LENS_DISENCHANTING_ENERGY_USE.getValue()), new PageCrafting(2, ItemCrafting.recipeDisenchantingLens).setNoText()).setSpecial(); + new BookletChapter("lensMining", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(InitItems.itemMiningLens), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.LENS_MINER_ENERGY_USE.getValue()), new PageCrafting(2, ItemCrafting.recipeMiningLens).setNoText()).setImportant(); //Laser Relays chaptersIntroduction[8] = new BookletChapter("laserIntro", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(InitItems.itemLaserWrench), new PageTextOnly(1), new PageTextOnly(2).addTextReplacement("", TileEntityLaserRelay.MAX_DISTANCE), new PageCrafting(3, ItemCrafting.recipeLaserWrench)).setImportant(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java index fc9972c03..1ba41d3e2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java @@ -19,6 +19,8 @@ public enum ConfigCategories{ MOB_DROPS("Mob Drops", "Everything regarding Item drops from mobs"), WORLD_GEN("World Gen", "Everything regarding World Generation"), TOOL_ENERGY_VALUES("Tool Energy Values", "Energy values for various tools"), + MACHINE_ENERGY_VALUES("Machine Energy Values", "Energy values for various machines"), + MACHINE_RECIPE_COSTS("Machine Energy Values.Machine Recipe Costs", "Energy cost of various machine recipes"), OTHER("Other", "Everything else"); public final String name; 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 95a987319..286ec9321 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 @@ -69,7 +69,40 @@ public enum ConfigIntValues{ LIQUID_BANNING_RING_ENERGY_CAPACITY("Ring of Liquid Banning: Energy Capacity", ConfigCategories.TOOL_ENERGY_VALUES, 800000, 1000, 1000000000, "Amount of energy Ring of Liquid Banning can store"), 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"); + 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"), + + 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"), + ATOMIC_RECONSTRUCTOR_RESTONIA_CRYSTAL_COST("Atomic Reconstructor: Restonia Crystal Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 40, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Restonia Crystal"), + ATOMIC_RECONSTRUCTOR_PALIS_CRYSTAL_COST("Atomic Reconstructor: Palis Crystal Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 40, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Palis Crystal"), + ATOMIC_RECONSTRUCTOR_DIAMATINE_CRYSTAL_COST("Atomic Reconstructor: Diamatine Crystal Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 60, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Diamatine Crystal"), + ATOMIC_RECONSTRUCTOR_EMERADIC_CRYSTAL_COST("Atomic Reconstructor: Emeradic Crystal Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 100, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Emeradic Crystal"), + ATOMIC_RECONSTRUCTOR_VOID_CRYSTAL_COST("Atomic Reconstructor: Void Crystal Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 60, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Void Crystal"), + ATOMIC_RECONSTRUCTOR_ENORI_CRYSTAL_COST("Atomic Reconstructor: Enori Crystal Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 80, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Enori Crystal"), + ATOMIC_RECONSTRUCTOR_RESTONIA_BLOCK_COST("Atomic Reconstructor: Restonia Crystal Block Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 400, 1, 10000000, "Amount of energy used by Atomic Reconstructor to create Restonia Crystal Block"), + ATOMIC_RECONSTRUCTOR_PALIS_BLOCK_COST("Atomic Reconstructor: Palis Crystal Block Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 400, 1, 10000000, "Amount of energy used by Atomic Reconstructor to create Palis Crystal Block"), + ATOMIC_RECONSTRUCTOR_DIAMATINE_BLOCK_COST("Atomic Reconstructor: Diamatine Crystal Block Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 600, 1, 10000000, "Amount of energy used by Atomic Reconstructor to create Diamatine Crystal Block"), + ATOMIC_RECONSTRUCTOR_EMERADIC_BLOCK_COST("Atomic Reconstructor: Emeradic Crystal Block Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 1000, 1, 10000000, "Amount of energy used by Atomic Reconstructor to create Emeradic Crystal Block"), + ATOMIC_RECONSTRUCTOR_VOID_BLOCK_COST("Atomic Reconstructor: Void Crystal Block Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 600, 1, 10000000, "Amount of energy used by Atomic Reconstructor to create Void Crystal Block"), + ATOMIC_RECONSTRUCTOR_ENORI_BLOCK_COST("Atomic Reconstructor: Enori Crystal Block Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 800, 1, 10000000, "Amount of energy used by Atomic Reconstructor to create Enori Crystal Block"), + ATOMIC_RECONSTRUCTOR_LENS_COST("Atomic Reconstructor: Lens Conversion Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 5000, 1, 1000000, "Amount of energy used by Atomic Reconstructor to change type of Lens"), + ATOMIC_RECONSTRUCTOR_LASER_RELAY_COST("Atomic Reconstructor: Laser Relay Conversion Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 2000, 1, 1000000, "Amount of energy used by Atomic Reconstructor to change type of Laser Relay"), + ATOMIC_RECONSTRUCTOR_SOUL_SAND_COST("Atomic Reconstructor: Soul Sand Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 20000, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Soul Sand"), + ATOMIC_RECONSTRUCTOR_LEATHER_COST("Atomic Reconstructor: Leather Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 8000, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Leather"), + ATOMIC_RECONSTRUCTOR_NETHER_WART_COST("Atomic Reconstructor: Nether Wart Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 150000, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Nether Wart"), + ATOMIC_RECONSTRUCTOR_PRISMARINE_COST("Atomic Reconstructor: Prismarine Shard Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 30000, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Prismarine Shard"), + ATOMIC_RECONSTRUCTOR_CRYSTALLIZED_CANOLA_COST("Atomic Reconstructor: Crystallized Canola Seed Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 2000, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Crystallized Canola Seed"), + ATOMIC_RECONSTRUCTOR_ETHETIC_QUARTZ_COST("Atomic Reconstructor: Ethetic Quartz Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 10, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Ethetic Quartz"), + ATOMIC_RECONSTRUCTOR_ETHETIC_GREEN_BLOCK_COST("Atomic Reconstructor: Ethetic Green Block Creation Cost", ConfigCategories.MACHINE_RECIPE_COSTS, 10, 1, 1000000, "Amount of energy used by Atomic Reconstructor to create Ethetic Green Block"), + LENS_COLOR_ENERGY_USE("Lens of Color: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 200, 1, 1000000000, "Amount of energy used by Atomic Reconstructor with Lens of Color to perform action"), + LENS_DEATH_ENERGY_USE("Lens of Certain Death: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 350, 1, 1000000000, "Amount of energy used by Atomic Reconstructor with Lens of Certain Death to perform action"), + LENS_DETONATION_ENERGY_USE("Lens of Detonation: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 250000, 1, 1000000000, "Amount of energy used by Atomic Reconstructor with Lens of Detonation to perform action"), + LENS_KILLER_ENERGY_USE("Lens of Killer: Energy Use", ConfigCategories.MACHINE_RECIPE_COSTS, 2500, 1, 1000000000, "Amount of energy used by Atomic Reconstructor with Lens of Killer to perform action"), + 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?"); public final String name; public final String category; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java index 6fde75f42..e4c38a9f1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java @@ -11,10 +11,15 @@ package de.ellpeck.actuallyadditions.mod.items.lens; +import java.util.ArrayList; +import java.util.Map; +import java.util.Random; + import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; @@ -29,10 +34,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.FakePlayerFactory; -import java.util.ArrayList; -import java.util.Map; -import java.util.Random; - public class LensColor extends Lens{ public static final int ENERGY_USE = 200; @@ -56,7 +57,8 @@ public class LensColor extends Lens{ @Override public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ if(hitBlock != null){ - if(tile.getEnergy() >= ENERGY_USE){ + int energyUse = ConfigIntValues.LENS_COLOR_ENERGY_USE.getValue(); + if(tile.getEnergy() >= energyUse){ IBlockState state = tile.getWorldObject().getBlockState(hitBlock); Block block = state.getBlock(); int meta = block.getMetaFromState(state); @@ -65,13 +67,13 @@ public class LensColor extends Lens{ Block toPlace = Block.getBlockFromItem(returnStack.getItem()); IBlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, EnumFacing.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), EnumHand.MAIN_HAND); tile.getWorldObject().setBlockState(hitBlock, state2Place, 2); - tile.extractEnergy(ENERGY_USE); + tile.extractEnergy(energyUse); } } ArrayList items = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1)); for(EntityItem item : items){ - if(!item.isDead && StackUtil.isValid(item.getItem()) && tile.getEnergy() >= ENERGY_USE){ + if(!item.isDead && StackUtil.isValid(item.getItem()) && tile.getEnergy() >= energyUse){ ItemStack newStack = this.tryConvert(item.getItem(), hitState, hitBlock, tile); if(StackUtil.isValid(newStack)){ item.setDead(); @@ -79,7 +81,7 @@ public class LensColor extends Lens{ EntityItem newItem = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, newStack); tile.getWorldObject().spawnEntity(newItem); - tile.extractEnergy(ENERGY_USE); + tile.extractEnergy(energyUse); } } } @@ -90,11 +92,9 @@ public class LensColor extends Lens{ private ItemStack tryConvert(ItemStack stack, IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ if(StackUtil.isValid(stack)){ Item item = stack.getItem(); - if(item != null){ - for(Map.Entry changer : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_COLOR_CHANGERS.entrySet()){ - if(item == changer.getKey()){ - return changer.getValue().modifyItem(stack, hitState, hitBlock, tile); - } + for(Map.Entry changer : ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_COLOR_CHANGERS.entrySet()){ + if(item == changer.getKey()){ + return changer.getValue().modifyItem(stack, hitState, hitBlock, tile); } } } @@ -115,6 +115,6 @@ public class LensColor extends Lens{ @Override public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot){ - return tile.getEnergy()-energyUsePerShot >= ENERGY_USE; + return tile.getEnergy() - energyUsePerShot >= ConfigIntValues.LENS_COLOR_ENERGY_USE.getValue(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java index 2efbe20cf..b250f4d91 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java @@ -10,16 +10,17 @@ package de.ellpeck.actuallyadditions.mod.items.lens; +import java.util.ArrayList; + import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.misc.DamageSources; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import java.util.ArrayList; - public class LensDeath extends Lens{ @Override @@ -42,7 +43,7 @@ public class LensDeath extends Lens{ } protected int getUsePerEntity(){ - return 350; + return ConfigIntValues.LENS_DEATH_ENERGY_USE.getValue(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java index a1990a9bd..76393fc29 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java @@ -12,20 +12,20 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; public class LensDetonation extends Lens{ - private static final int ENERGY_USE = 250000; - @Override public boolean invoke(IBlockState state, BlockPos hitBlock, IAtomicReconstructor tile){ if(hitBlock != null && !state.getBlock().isAir(state, tile.getWorldObject(), hitBlock)){ - if(tile.getEnergy() >= ENERGY_USE){ + int energyUse = ConfigIntValues.LENS_DETONATION_ENERGY_USE.getValue(); + if(tile.getEnergy() >= energyUse){ tile.getWorldObject().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true); - tile.extractEnergy(ENERGY_USE); + tile.extractEnergy(energyUse); } return true; } @@ -44,6 +44,6 @@ public class LensDetonation extends Lens{ @Override public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot){ - return tile.getEnergy()-energyUsePerShot >= ENERGY_USE; + return tile.getEnergy()-energyUsePerShot >= ConfigIntValues.LENS_DETONATION_ENERGY_USE.getValue(); } -} \ No newline at end of file +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java index 294b3fa08..93767bc75 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java @@ -10,8 +10,12 @@ package de.ellpeck.actuallyadditions.mod.items.lens; +import java.util.List; +import java.util.Map; + import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.state.IBlockState; @@ -27,18 +31,14 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import java.util.List; -import java.util.Map; - public class LensDisenchanting extends Lens{ - public static final int ENERGY_USE = 250000; - @Override public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ - if(tile.getEnergy() >= ENERGY_USE){ + int energyUse = ConfigIntValues.LENS_DISENCHANTING_ENERGY_USE.getValue(); + if(tile.getEnergy() >= energyUse){ List items = tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1)); - if(items != null && !items.isEmpty()){ + if(!items.isEmpty()){ EntityItem book = null; EntityItem toDisenchant = null; for(EntityItem item : items){ @@ -97,7 +97,7 @@ public class LensDisenchanting extends Lens{ tile.getWorldObject().spawnEntity(newBook); tile.getWorldObject().spawnEntity(disenchanted); - tile.extractEnergy(ENERGY_USE); + tile.extractEnergy(energyUse); return true; } @@ -119,6 +119,6 @@ public class LensDisenchanting extends Lens{ @Override public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot){ - return tile.getEnergy()-energyUsePerShot >= ENERGY_USE; + return tile.getEnergy()-energyUsePerShot >= ConfigIntValues.LENS_DISENCHANTING_ENERGY_USE.getValue(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java index 4b88415ff..87d91e9ed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java @@ -10,6 +10,8 @@ package de.ellpeck.actuallyadditions.mod.items.lens; +import java.util.ArrayList; + import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; @@ -25,15 +27,12 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import java.util.ArrayList; - public class LensDisruption extends Lens{ - private static final int ENERGY_USE = 150000; - @Override public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ - if(ConfigIntValues.ELEVEN.getValue() == 11 && tile.getEnergy() >= ENERGY_USE && hitBlock != null && !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock)){ + int energyUse = ConfigIntValues.LENS_DISRUPTION_ENERGY_USE.getValue(); + if(ConfigIntValues.ELEVEN.getValue() == 11 && tile.getEnergy() >= energyUse && hitBlock != null && !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock)){ int range = 2; ArrayList items = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX()-range, hitBlock.getY()-range, hitBlock.getZ()-range, hitBlock.getX()+range, hitBlock.getY()+range, hitBlock.getZ()+range)); for(EntityItem item : items){ @@ -64,7 +63,7 @@ public class LensDisruption extends Lens{ EntityItem newItem = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, newStack); tile.getWorldObject().spawnEntity(newItem); - tile.extractEnergy(ENERGY_USE); + tile.extractEnergy(energyUse); } } } @@ -85,6 +84,6 @@ public class LensDisruption extends Lens{ @Override public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot){ - return tile.getEnergy()-energyUsePerShot >= ENERGY_USE; + return tile.getEnergy()-energyUsePerShot >= ConfigIntValues.LENS_DISRUPTION_ENERGY_USE.getValue(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensEvenMoarDeath.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensEvenMoarDeath.java index 455f1fa6f..94d72421a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensEvenMoarDeath.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensEvenMoarDeath.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import net.minecraft.entity.EntityLivingBase; import net.minecraft.world.WorldServer; @@ -39,6 +40,6 @@ public class LensEvenMoarDeath extends LensDeath{ @Override protected int getUsePerEntity(){ - return 2500; + return ConfigIntValues.LENS_KILLER_ENERGY_USE.getValue(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java index 10f7d6551..bbbab1b37 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java @@ -10,10 +10,13 @@ package de.ellpeck.actuallyadditions.mod.items.lens; +import java.util.List; + import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.recipe.WeightedOre; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.util.ModUtil; @@ -29,15 +32,13 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.WeightedRandom; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.oredict.OreDictionary; -import java.util.List; - public class LensMining extends Lens{ - public static final int ENERGY_USE = 60000; public static void init(){ ActuallyAdditionsAPI.addMiningLensStoneOre("oreCoal", 5000); @@ -126,9 +127,8 @@ public class LensMining extends Lens{ @Override public boolean invoke(IBlockState hitState, BlockPos hitPos, IAtomicReconstructor tile){ if(!tile.getWorldObject().isAirBlock(hitPos)){ - if(tile.getEnergy() >= ENERGY_USE){ - int adaptedUse = ENERGY_USE; - + if(tile.getEnergy() >= ConfigIntValues.LENS_MINER_ENERGY_USE.getValue()){ + int adaptedUse = ConfigIntValues.LENS_MINER_ENERGY_USE.getValue(); List ores = null; Block hitBlock = hitState.getBlock(); if(hitBlock instanceof BlockStone){ @@ -136,7 +136,7 @@ public class LensMining extends Lens{ } else if(hitBlock instanceof BlockNetherrack){ ores = ActuallyAdditionsAPI.NETHERRACK_ORES; - adaptedUse += 10000; + adaptedUse = ConfigIntValues.LENS_MINER_NETHER_ORES_ENERGY_USE.getValue(); } if(ores != null){ @@ -151,7 +151,7 @@ public class LensMining extends Lens{ if(stacks != null && !stacks.isEmpty()){ for(ItemStack aStack : stacks){ if(StackUtil.isValid(aStack) && !CrusherRecipeRegistry.hasBlacklistedOutput(aStack, ConfigStringListValues.MINING_LENS_BLACKLIST.getValue()) && aStack.getItem() instanceof ItemBlock){ - adaptedUse += (totalWeight-ore.itemWeight)%40000; + adaptedUse += MathHelper.clamp(totalWeight - ore.itemWeight, 0, ConfigIntValues.LENS_MINER_ENERGY_USE.getValue()); stack = aStack; found = true; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java index 8c4b71eac..e10478afb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java @@ -10,11 +10,14 @@ package de.ellpeck.actuallyadditions.mod.items.lens; +import java.util.ArrayList; + import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.recipe.ColorLensChangerByDyeMeta; import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; 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; @@ -25,8 +28,6 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import java.util.ArrayList; - public final class LensRecipeHandler{ public static final ArrayList MAIN_PAGE_RECIPES = new ArrayList(); @@ -45,65 +46,91 @@ public final class LensRecipeHandler{ public static void init(){ //Crystal Blocks - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.REDSTONE_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.REDSTONE.ordinal()), 400); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.REDSTONE_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.REDSTONE.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_RESTONIA_BLOCK_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.LAPIS_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.LAPIS.ordinal()), 400); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.LAPIS_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.LAPIS.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_PALIS_BLOCK_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.DIAMOND_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), 600); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.DIAMOND_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_DIAMATINE_BLOCK_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.EMERALD_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.EMERALD.ordinal()), 1000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.EMERALD_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.EMERALD.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_EMERADIC_BLOCK_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.COAL_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()), 600); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.COAL_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_VOID_BLOCK_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.IRON_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()), 800); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.IRON_BLOCK), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_ENORI_BLOCK_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); //Crystal Items - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.REDSTONE), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), 40); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.REDSTONE), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_RESTONIA_CRYSTAL_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.DYE, 1, 4), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), 40); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.DYE, 1, 4), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_PALIS_CRYSTAL_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.DIAMOND), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), 60); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.DIAMOND), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_DIAMATINE_CRYSTAL_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.EMERALD), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), 100); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.EMERALD), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_EMERADIC_CRYSTAL_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.COAL), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), 60); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.COAL), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_VOID_CRYSTAL_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.IRON_INGOT), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), 80); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.IRON_INGOT), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_ENORI_CRYSTAL_COST.getValue()); MAIN_PAGE_RECIPES.add(RecipeUtil.lastReconstructorRecipe()); //Lenses - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new ItemStack(InitItems.itemColorLens), 5000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new ItemStack(InitItems.itemColorLens), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_LENS_COST.getValue()); recipeColorLens = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemColorLens), new ItemStack(InitItems.itemExplosionLens), 5000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemColorLens), new ItemStack(InitItems.itemExplosionLens), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_LENS_COST.getValue()); recipeExplosionLens = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemExplosionLens), new ItemStack(InitItems.itemDamageLens), 5000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemExplosionLens), new ItemStack(InitItems.itemDamageLens), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_LENS_COST.getValue()); recipeDamageLens = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemDamageLens), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), 5000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemDamageLens), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_LENS_COST.getValue()); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitBlocks.blockLaserRelay), new ItemStack(InitBlocks.blockLaserRelayFluids), 2000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitBlocks.blockLaserRelay), new ItemStack(InitBlocks.blockLaserRelayFluids), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_LASER_RELAY_COST.getValue()); recipeFluidLaser = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitBlocks.blockLaserRelayFluids), new ItemStack(InitBlocks.blockLaserRelayItem), 2000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitBlocks.blockLaserRelayFluids), new ItemStack(InitBlocks.blockLaserRelayItem), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_LASER_RELAY_COST.getValue()); recipeItemLaser = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitBlocks.blockLaserRelayItem), new ItemStack(InitBlocks.blockLaserRelay), 2000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitBlocks.blockLaserRelayItem), new ItemStack(InitBlocks.blockLaserRelay), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_LASER_RELAY_COST.getValue()); //Misc - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), 20000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_SOUL_SAND_COST.getValue()); recipeSoulSand = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), 8000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_LEATHER_COST.getValue()); recipeLeather = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), 150000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_NETHER_WART_COST.getValue()); recipeNetherWart = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.QUARTZ), new ItemStack(Items.PRISMARINE_SHARD), 30000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Items.QUARTZ), new ItemStack(Items.PRISMARINE_SHARD), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_PRISMARINE_COST.getValue()); recipePrismarine = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemCanolaSeed), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal()), 2000); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(InitItems.itemCanolaSeed), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal()), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_CRYSTALLIZED_CANOLA_COST.getValue()); recipeCrystallizedCanolaSeed = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.QUARTZ_BLOCK), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), 10); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.QUARTZ_BLOCK), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_ETHETIC_QUARTZ_COST.getValue()); recipeWhiteWall = RecipeUtil.lastReconstructorRecipe(); - ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 1), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), 10); + ActuallyAdditionsAPI.addReconstructorLensConversionRecipe(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 1), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), + ConfigIntValues.ATOMIC_RECONSTRUCTOR_ETHETIC_GREEN_BLOCK_COST.getValue()); recipeGreenWall = RecipeUtil.lastReconstructorRecipe(); IColorLensChanger changer = new ColorLensChangerByDyeMeta(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java index cc6179427..107b92689 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java @@ -10,6 +10,9 @@ package de.ellpeck.actuallyadditions.mod.misc.apiimpl; +import java.util.ArrayList; +import java.util.List; + import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; @@ -25,6 +28,7 @@ import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrafting; import de.ellpeck.actuallyadditions.mod.booklet.page.PageFurnace; import de.ellpeck.actuallyadditions.mod.booklet.page.PagePicture; import de.ellpeck.actuallyadditions.mod.booklet.page.PageTextOnly; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; @@ -47,9 +51,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.FakePlayerFactory; -import java.util.ArrayList; -import java.util.List; - public class MethodHandler implements IMethodHandler{ @Override @@ -237,11 +238,12 @@ public class MethodHandler implements IMethodHandler{ @Override public boolean invokeReconstructor(IAtomicReconstructor tile){ - if(tile.getEnergy() >= TileEntityAtomicReconstructor.ENERGY_USE){ + int energyUse = ConfigIntValues.ATOMIC_RECONSTRUCTOR_ENERGY_USE.getValue(); + if(tile.getEnergy() >= energyUse){ EnumFacing sideToManipulate = tile.getOrientation(); Lens currentLens = tile.getLens(); - if(currentLens.canInvoke(tile, sideToManipulate, TileEntityAtomicReconstructor.ENERGY_USE)){ - tile.extractEnergy(TileEntityAtomicReconstructor.ENERGY_USE); + if(currentLens.canInvoke(tile, sideToManipulate, energyUse)){ + tile.extractEnergy(energyUse); int distance = currentLens.getDistance(); for(int i = 0; i < distance; i++){ @@ -290,7 +292,7 @@ public class MethodHandler implements IMethodHandler{ } return hasWorkedOnce; } - + @Override public boolean addCrusherRecipes(List inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance){ boolean hasWorkedOnce = false; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index 0586a77d4..5aaadfbab 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.ILensItem; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil; @@ -30,14 +31,15 @@ import net.minecraftforge.energy.IEnergyStorage; public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyDisplay, IAtomicReconstructor{ - public static final int ENERGY_USE = 1000; - public final CustomEnergyStorage storage = new CustomEnergyStorage(300000, 5000, 0); + public final CustomEnergyStorage storage; public int counter; private int currentTime; private int oldEnergy; public TileEntityAtomicReconstructor(){ super(1, "reconstructor"); + // Storage should be initialized after loading of config + this.storage = new CustomEnergyStorage(ConfigIntValues.ATOMIC_RECONSTRUCTOR_ENERGY_CAPACITY.getValue(), ConfigIntValues.ATOMIC_RECONSTRUCTOR_ENERGY_RECEIVE.getValue(), 0); } public static void shootLaser(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, Lens currentLens){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java index 9b130c52c..23ba82702 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java @@ -36,9 +36,14 @@ public final class StackUtil{ } public static boolean isValid(ItemStack stack){//Stacks are nonnull. If we are making null stacks we're stupid anyway. - if(stack == null) AwfulUtil.callTheFuckinPolice("Oh yeah some idiot somewhere threw a null itemstack at us, might've been us, but whatever"); + if(stack == null){ + AwfulUtil.callTheFuckinPolice("Oh yeah some idiot somewhere threw a null itemstack at us, might've been us, but whatever"); + return false; + } Item i = stack.getItem(); - if(i instanceof IDisableableItem) return !((IDisableableItem) i).isDisabled(); + if(i instanceof IDisableableItem){ + return !((IDisableableItem) i).isDisabled(); + } return !stack.isEmpty(); }