Balance and null fix

This commit is contained in:
Dimmerworld 2017-10-06 19:55:23 +11:00 committed by drcrazy
parent 9855cce93d
commit 4205beaead
2 changed files with 48 additions and 98 deletions

View file

@ -4,11 +4,11 @@ import net.minecraft.util.IStringSerializable;
import reborncore.api.power.EnumPowerTier;
public enum EnumPanelType implements IStringSerializable {
Basic("basic", 128, 1000, 256, 50000, EnumPowerTier.LOW, 0),
Hybrid("hybrid", 32, 2000, 2084, 100000, EnumPowerTier.MEDIUM, 1),
Advanced("advanced", 512, 3000, 4092, 200000, EnumPowerTier.MEDIUM, 2),
Ultimate("ultimate", 2048, 4000, 6084, 300000, EnumPowerTier.HIGH, 3),
Quantum("quantum", 4048, 5000, 8042, 400000, EnumPowerTier.EXTREME, 4);
Basic("basic", 128, 64, 50000, EnumPowerTier.LOW, 0),
Hybrid("hybrid", 256, 128, 1000000, EnumPowerTier.MEDIUM, 1),
Advanced("advanced", 512, 256, 5000000, EnumPowerTier.HIGH, 2),
Ultimate("ultimate", 2048, 1042, 10000000, EnumPowerTier.EXTREME, 3),
Quantum("quantum", 16384, 8192, 100000000, EnumPowerTier.INSANE, 4);
private int ID;
private String friendlyName;
@ -19,20 +19,19 @@ public enum EnumPanelType implements IStringSerializable {
public int generationRateN = 64;
// Generation of FE during Night
public int outputRate = 0;
// Output rate of energy
public int internalCapacity = 0;
// Internal FE storage of solar panel
public EnumPowerTier powerTier;
EnumPanelType(String friendlyName, int generationRateD, int generationRateN, int outputRate, int internalCapacity, EnumPowerTier tier, int ID) {
EnumPanelType(String friendlyName, int generationRateD, int generationRateN, int internalCapacity, EnumPowerTier tier, int ID) {
this.friendlyName = friendlyName;
this.ID = ID;
this.generationRateD = generationRateD;
this.generationRateN = generationRateN;
this.internalCapacity = internalCapacity;
this.outputRate = outputRate;
this.powerTier = tier;
}
@ -46,4 +45,4 @@ public enum EnumPanelType implements IStringSerializable {
public int getID(){
return ID;
}
}
}

View file

@ -24,35 +24,31 @@
package techreborn.tiles.generator;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.energy.IEnergyStorage;
import reborncore.api.IToolDrop;
import reborncore.api.power.EnumPowerTier;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
import techreborn.blocks.generator.solarpanel.EnumPanelType;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
import java.util.List;
/**
* Created by modmuss50 on 25/02/2016.
*/
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop, IEnergyStorage {
public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
// @ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxOutput", comment = "Solar Panel Max Output (Value in EU)")
// public static int maxOutput = 32;
// @ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxEnergy", comment = "Solar Panel Max Energy (Value in EU)")
// public static int maxEnergy = 1000;
// @ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelEnergyPerTick", comment = "Solar Panel Energy Per Tick (Value in EU)")
// public static int energyPerTick = 1;
// @ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxOutput", comment = "Solar Panel Max Output (Value in EU)")
// public static int maxOutput = 32;
// @ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxEnergy", comment = "Solar Panel Max Energy (Value in EU)")
// public static int maxEnergy = 1000;
// @ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelEnergyPerTick", comment = "Solar Panel Energy Per Tick (Value in EU)")
// public static int energyPerTick = 1;
boolean shouldMakePower = false;
boolean lastTickSate = false;
@ -60,69 +56,49 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop, IEne
private int generationRateD = 0;
private int generationRateN = 0;
private int internalCapacity = 0;
private int outputRate = 0;
private EnumPowerTier tier = null;
public TileSolarPanel() {
super();
try {
EnumPanelType panel = getPanelType();
generationRateD = panel.generationRateD;
generationRateN = panel.generationRateN;
internalCapacity = panel.internalCapacity;
outputRate = getPanelType().outputRate;
}catch (Exception e){
System.out.println("Error(Dimmerworld): " + e );
}
}
@Override
public void onLoad() {
try {
EnumPanelType panel = getPanelType();
generationRateD = panel.generationRateD;
generationRateN = panel.generationRateN;
internalCapacity = panel.internalCapacity;
outputRate = getPanelType().outputRate;
}catch (Exception e){
System.out.println("Error(Dimmerworld): " + e );
}
EnumPanelType panel = getPanelType();
this.generationRateD = panel.generationRateD;
this.generationRateN = panel.generationRateN;
this.internalCapacity = panel.internalCapacity;
this.tier = panel.powerTier;
}
@Override
public void update() {
super.update();
if (this.world.isRemote) { return; }
// super.update();
// if (!this.world.isRemote) {
// if (this.world.getTotalWorldTime() % 60 == 0) {
// this.shouldMakePower = this.isSunOut();
//
// }
// if (this.shouldMakePower) {
// this.powerToAdd = energyPerTick;
// this.addEnergy(this.powerToAdd);
// } else {
// this.powerToAdd = 0;
// }
//
// }
if (isSunOut()) {
this.powerToAdd = this.generationRateD;
} else if(this.world.canBlockSeeSky(this.pos.up())) {
this.powerToAdd = this.generationRateN;
}
this.addEnergy(this.powerToAdd);
}
// public boolean isSunOut() {
// return this.world.canBlockSeeSky(this.pos.up()) && !this.world.isRaining() && !this.world.isThundering()
// && this.world.isDaytime();
// }
public boolean isSunOut() {
return this.world.canBlockSeeSky(this.pos.up()) && !this.world.isRaining() && !this.world.isThundering()
&& this.world.isDaytime();
}
private EnumPanelType getPanelType() {
return world.getBlockState(pos).getValue(BlockSolarPanel.TYPE);
if (world != null) {
return world.getBlockState(pos).getValue(BlockSolarPanel.TYPE);
}
return null;
}
@Override
public double getBaseMaxPower() {
return (double)generationRateD;
return (double) this.internalCapacity;
}
@Override
@ -135,39 +111,9 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop, IEne
return true;
}
@Override
public boolean canReceive() {
return false;
}
@Override
public int getEnergyStored() {
return 1000;
}
@Override
public int getMaxEnergyStored() {
return internalCapacity;
}
@Override
public boolean canExtract() {
return true;
}
@Override
public int extractEnergy(int maxExtract, boolean simulate) {
return 0;
}
@Override
public int receiveEnergy(int maxReceive, boolean simulate) {
return 0;
}
@Override
public double getBaseMaxOutput() {
return outputRate;
return generationRateD;
}
@Override
@ -175,8 +121,13 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop, IEne
return 0;
}
@Override
public EnumPowerTier getBaseTier() {
return this.tier;
}
@Override
public ItemStack getToolDrop(final EntityPlayer p0) {
return new ItemStack(ModBlocks.SOLAR_PANEL);
}
}
}