From 15d3f74c534a973eae5d0506327243f51ebd1fcb Mon Sep 17 00:00:00 2001 From: OneEyeMaker Date: Wed, 4 Oct 2017 08:35:24 +0300 Subject: [PATCH] Added configuration for Long-Range Breaker --- .../actuallyadditions/mod/booklet/InitBooklet.java | 2 +- .../mod/config/values/ConfigIntValues.java | 4 ++++ .../mod/tile/TileEntityDirectionalBreaker.java | 13 +++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) 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 20ce8360c..b6c1c869b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -230,7 +230,7 @@ public final class InitBooklet{ new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.LAVA_FACTORY_ENERGY_USE.getValue()), new PagePicture(2, "page_lava_factory", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLavaFactory).setNoText(), new PageCrafting(4, BlockCrafting.recipeCasing).setNoText()); new BookletChapter("energizer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockEnergizer), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator)); new BookletChapter("repairer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("", ConfigIntValues.ITEM_REPAIRER_ENERGY_USE.getValue())); - new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDirectionalBreaker), new PageTextOnly(1).addTextReplacement("", TileEntityDirectionalBreaker.ENERGY_USE).addTextReplacement("", TileEntityDirectionalBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard()); + new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDirectionalBreaker), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.LONG_RANGE_BREAKER_ENERGY_USE.getValue()).addTextReplacement("", ConfigIntValues.LONG_RANGE_BREAKER_WORK_DISTANCE.getValue()), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard()); new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockPlayerInterface), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.PLAYER_INTERFACE_WORK_RANGE.getValue()), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial(); new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDisplayStand), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial(); new BookletChapter("shockSuppressor", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockShockSuppressor), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.SHOCK_ABSORBER_WORK_RANGE.getValue()).addTextReplacement("", ConfigIntValues.SHOCK_ABSORBER_ENERGY_USE.getValue()), new PageCrafting(2, BlockCrafting.recipeShockSuppressor)); 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 dab3e1f5f..96ef68ff2 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 @@ -100,6 +100,10 @@ public enum ConfigIntValues{ LEAF_GENERATOR_ENERGY_SEND("Leaf-Eating Generator: Energy Send Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 450, 1, 1000000000, "Amount of energy Leaf-Eating Generator can send per tick."), LEAF_GENERATOR_ENERGY_PRODUCTION("Leaf-Eating Generator: Energy Production", ConfigCategories.MACHINE_ENERGY_VALUES, 300, 1, 1000000000, "Amount of energy Leaf-Eating Generator produces per leaf block."), LEAF_GENERATOR_WORK_RANGE("Leaf-Eating Generator: Work Range", ConfigCategories.MACHINE_VALUES, 7, 1, 16, "Radius (in blocks) in which Leaf-Eating Generator consumes leaves."), + LONG_RANGE_BREAKER_ENERGY_CAPACITY("Long-Range Breaker: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 10000, 1000, 1000000000, "Amount of energy Long-Range Breaker can store."), + LONG_RANGE_BREAKER_ENERGY_RECEIVE("Long-Range Breaker: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 20, 1, 1000000000, "Amount of energy Long-Range Breaker can receive per tick."), + LONG_RANGE_BREAKER_ENERGY_USE("Long-Range Breaker: Energy Use", ConfigCategories.MACHINE_ENERGY_VALUES, 5, 1, 1000000000, "Amount of energy Long-Range Breaker uses per mined block."), + LONG_RANGE_BREAKER_WORK_DISTANCE("Long-Range Breaker: Work Distance", ConfigCategories.MACHINE_VALUES, 8, 1, 32, "Distance in block in which Long-Range Breaker can mine blocks."), OIL_GENERATOR_ENERGY_CAPACITY("Oil Generator: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 50000, 1000, 1000000000, "Amount of energy Oil Generator can store."), OIL_GENERATOR_ENERGY_SEND("Oil Generator: Energy Send Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 150, 1, 1000000000, "Amount of energy Oil Generator can send per tick."), PHANTOMFACE_WORK_RANGE("Phantomface: Work Range", ConfigCategories.MACHINE_VALUES, 16, 1, 32, "Distance in block in which Phantomface, Phantom Itemface, Phantom Liquidface, Phantom Energyface and Phantom Redstoneface work."), diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java index 0c7db61de..7434eff42 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; @@ -24,9 +25,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityDirectionalBreaker extends TileEntityInventoryBase{ - public static final int RANGE = 8; - public static final int ENERGY_USE = 5; - public final CustomEnergyStorage storage = new CustomEnergyStorage(10000, 20, 0); + public final CustomEnergyStorage storage = new CustomEnergyStorage(ConfigIntValues.LONG_RANGE_BREAKER_ENERGY_CAPACITY.getValue(), ConfigIntValues.LONG_RANGE_BREAKER_ENERGY_RECEIVE.getValue(), 0); private int lastEnergy; private int currentTime; @@ -75,11 +74,13 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase{ } private void doWork(){ - if(this.storage.getEnergyStored() >= ENERGY_USE*RANGE){ + int energyUse = ConfigIntValues.LONG_RANGE_BREAKER_ENERGY_USE.getValue(); + int workDistance = ConfigIntValues.LONG_RANGE_BREAKER_WORK_DISTANCE.getValue(); + if(this.storage.getEnergyStored() >= energyUse*workDistance){ IBlockState state = this.world.getBlockState(this.pos); EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)); - for(int i = 0; i < RANGE; i++){ + for(int i = 0; i < workDistance; i++){ BlockPos coordsBlock = this.pos.offset(sideToManipulate, i+1); Block blockToBreak = this.world.getBlockState(coordsBlock).getBlock(); if(blockToBreak != null && !this.world.isAirBlock(coordsBlock) && this.world.getBlockState(coordsBlock).getBlockHardness(this.world, coordsBlock) > -1.0F){ @@ -92,7 +93,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase{ this.world.playEvent(2001, coordsBlock, Block.getStateId(this.world.getBlockState(coordsBlock))); this.world.setBlockToAir(coordsBlock); WorldUtil.addToInventory(this.slots, drops, true); - this.storage.extractEnergyInternal(ENERGY_USE, false); + this.storage.extractEnergyInternal(energyUse, false); this.markDirty(); } }