mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-23 15:48:34 +01:00
Added configuration for Long-Range Breaker
This commit is contained in:
parent
5969db45d0
commit
15d3f74c53
3 changed files with 12 additions and 7 deletions
|
@ -230,7 +230,7 @@ public final class InitBooklet{
|
|||
new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("<rf>", 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("<rf>", ConfigIntValues.ITEM_REPAIRER_ENERGY_USE.getValue()));
|
||||
new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDirectionalBreaker), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityDirectionalBreaker.ENERGY_USE).addTextReplacement("<range>", TileEntityDirectionalBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard());
|
||||
new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockDirectionalBreaker), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LONG_RANGE_BREAKER_ENERGY_USE.getValue()).addTextReplacement("<range>", 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("<range>", 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("<range>", ConfigIntValues.SHOCK_ABSORBER_WORK_RANGE.getValue()).addTextReplacement("<rf>", ConfigIntValues.SHOCK_ABSORBER_ENERGY_USE.getValue()), new PageCrafting(2, BlockCrafting.recipeShockSuppressor));
|
||||
|
|
|
@ -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."),
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue