More work on tile entity
This commit is contained in:
parent
fed439307e
commit
74b8246b39
2 changed files with 47 additions and 18 deletions
|
@ -4,11 +4,11 @@ import net.minecraft.util.IStringSerializable;
|
|||
import reborncore.api.power.EnumPowerTier;
|
||||
|
||||
public enum EnumPanelType implements IStringSerializable {
|
||||
Basic("basic", 128, 1000, 50000, EnumPowerTier.LOW, 0),
|
||||
Hybrid("hybrid", 32, 2000, 100000, EnumPowerTier.MEDIUM, 1),
|
||||
Advanced("advanced", 512, 3000, 200000, EnumPowerTier.MEDIUM, 2),
|
||||
Ultimate("ultimate", 2048, 4000, 300000, EnumPowerTier.HIGH, 3),
|
||||
Quantum("quantum", 2048, 5000, 400000, EnumPowerTier.EXTREME, 4);
|
||||
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);
|
||||
|
||||
private int ID;
|
||||
private String friendlyName;
|
||||
|
@ -19,16 +19,20 @@ 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
|
||||
|
||||
|
||||
EnumPanelType(String friendlyName, int generationRateD, int generationRateN, int internalCapacity, EnumPowerTier tier, int ID) {
|
||||
EnumPanelType(String friendlyName, int generationRateD, int generationRateN, int outputRate, int internalCapacity, EnumPowerTier tier, int ID) {
|
||||
this.friendlyName = friendlyName;
|
||||
this.ID = ID;
|
||||
this.generationRateD = generationRateD;
|
||||
this.generationRateN = generationRateN;
|
||||
this.internalCapacity = internalCapacity;
|
||||
this.outputRate = outputRate;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,19 +57,43 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop, IEne
|
|||
boolean shouldMakePower = false;
|
||||
boolean lastTickSate = false;
|
||||
int powerToAdd;
|
||||
private int generationRateD;
|
||||
private int generationRateN;
|
||||
private int internalCapacity;
|
||||
private int generationRateD = 0;
|
||||
private int generationRateN = 0;
|
||||
private int internalCapacity = 0;
|
||||
private int outputRate = 0;
|
||||
|
||||
public TileSolarPanel() {
|
||||
|
||||
super();
|
||||
generationRateD = getPanelType().generationRateD;
|
||||
generationRateN = getPanelType().generationRateN;
|
||||
internalCapacity = getPanelType().internalCapacity;
|
||||
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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
|
||||
// super.update();
|
||||
// if (!this.world.isRemote) {
|
||||
// if (this.world.getTotalWorldTime() % 60 == 0) {
|
||||
|
@ -92,6 +116,10 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop, IEne
|
|||
// && this.world.isDaytime();
|
||||
// }
|
||||
|
||||
private EnumPanelType getPanelType() {
|
||||
return world.getBlockState(pos).getValue(BlockSolarPanel.TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return (double)generationRateD;
|
||||
|
@ -114,7 +142,7 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop, IEne
|
|||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
return 100;
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,17 +167,14 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop, IEne
|
|||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return generationRateD;
|
||||
}
|
||||
|
||||
private EnumPanelType getPanelType() {
|
||||
return world.getBlockState(pos).getValue(BlockSolarPanel.TYPE);
|
||||
return outputRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer p0) {
|
||||
return new ItemStack(ModBlocks.SOLAR_PANEL);
|
||||
|
|
Loading…
Reference in a new issue