Atomic Reconstructor Config

This commit is contained in:
Ellpeck 2015-11-15 14:34:40 +01:00
parent 623a8594e1
commit d31eb68128
2 changed files with 12 additions and 6 deletions

View file

@ -176,7 +176,12 @@ public enum ConfigIntValues{
LASER_RELAY_LOSS("Laser Relay: Loss", ConfigCategories.MACHINE_VALUES, 5, 0, 80, "The Energy Loss of the Laser Relay per Transfer in Percent"), LASER_RELAY_LOSS("Laser Relay: Loss", ConfigCategories.MACHINE_VALUES, 5, 0, 80, "The Energy Loss of the Laser Relay per Transfer in Percent"),
LASER_RELAY_MAX_DISTANCE("Laser Relay: Max Distance", ConfigCategories.MACHINE_VALUES, 15, 3, 80, "The max distance between two connected Laser Relays"), LASER_RELAY_MAX_DISTANCE("Laser Relay: Max Distance", ConfigCategories.MACHINE_VALUES, 15, 3, 80, "The max distance between two connected Laser Relays"),
LASER_RELAY_MAX_TRANSFER("Laser Relay: Max Transfer", ConfigCategories.MACHINE_VALUES, 10000, 100, 1000000, "The max amount of RF a Laser Relay can receive and try to transfer (if it's given 100 RF and can only transfer 50, it will only accept 50, it won't waste any power!)"); LASER_RELAY_MAX_TRANSFER("Laser Relay: Max Transfer", ConfigCategories.MACHINE_VALUES, 10000, 100, 1000000, "The max amount of RF a Laser Relay can receive and try to transfer (if it's given 100 RF and can only transfer 50, it will only accept 50, it won't waste any power!)"),
RECONSTRUCTOR_DISTANCE("Atomic Reconstructor: Distance", ConfigCategories.MACHINE_VALUES, 10, 1, 50, "The max distance the Reconstructor goes forward to find blocks to convert"),
RECONSTRCUTOR_RANGE("Atomic Reconstructor: Range", ConfigCategories.MACHINE_VALUES, 2, 1, 10, "The range of Converting blocks or items into other blocks or items"),
RECONSTRUCTOR_USE_PER_BLOCK("Atomic Reconstructor: Energy Use per Block", ConfigCategories.MACHINE_VALUES, 1200, 0, 100000, "The amount of Energy the Reconstructor uses per Block converted"),
RECONSTRUCTOR_COOLDOWN_TIMER("Atomic Reconstrucor: Cooldown Timer", ConfigCategories.MACHINE_VALUES, 100, 0, 10000, "The amount of time the Reconstructor waits between shooting lasers");
public final String name; public final String name;
public final String category; public final String category;

View file

@ -13,6 +13,7 @@ package ellpeck.actuallyadditions.tile;
import cofh.api.energy.EnergyStorage; import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver; import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.misc.DamageSources; import ellpeck.actuallyadditions.misc.DamageSources;
import ellpeck.actuallyadditions.network.PacketAtomicReconstructor; import ellpeck.actuallyadditions.network.PacketAtomicReconstructor;
import ellpeck.actuallyadditions.network.PacketHandler; import ellpeck.actuallyadditions.network.PacketHandler;
@ -40,16 +41,16 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
if(!this.worldObj.isRemote){ if(!this.worldObj.isRemote){
int usePerBlock = 1200; //TODO Config int usePerBlock = ConfigIntValues.RECONSTRUCTOR_USE_PER_BLOCK.getValue();
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) && this.storage.getEnergyStored() >= usePerBlock){ if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) && this.storage.getEnergyStored() >= usePerBlock){
if(this.currentTime > 0){ if(this.currentTime > 0){
this.currentTime--; this.currentTime--;
if(this.currentTime <= 0){ if(this.currentTime <= 0){
ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
//Extract energy for shooting the laser itself too! //Extract energy for shooting the laser itself too!
this.storage.extractEnergy(usePerBlock*3, false); this.storage.extractEnergy(usePerBlock*2, false);
int distance = 10; //TODO Config int distance = ConfigIntValues.RECONSTRUCTOR_DISTANCE.getValue();
for(int i = 0; i < distance; i++){ for(int i = 0; i < distance; i++){
WorldPos coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, i); WorldPos coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, i);
this.damagePlayer(coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ()); this.damagePlayer(coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ());
@ -58,7 +59,7 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
if(!coordsBlock.getBlock().isAir(coordsBlock.getWorld(), coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ())){ if(!coordsBlock.getBlock().isAir(coordsBlock.getWorld(), coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ())){
PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ()), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64)); PacketHandler.theNetwork.sendToAllAround(new PacketAtomicReconstructor(xCoord, yCoord, zCoord, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ()), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
int range = 2; //TODO Config int range = ConfigIntValues.RECONSTRCUTOR_RANGE.getValue();
//Converting the Blocks //Converting the Blocks
for(int reachX = -range; reachX < range+1; reachX++){ for(int reachX = -range; reachX < range+1; reachX++){
@ -116,7 +117,7 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
} }
} }
else{ else{
this.currentTime = 80; //TODO Config this.currentTime = ConfigIntValues.RECONSTRUCTOR_COOLDOWN_TIMER.getValue();
} }
} }
} }