Tile entity work
This commit is contained in:
parent
c4711848ae
commit
fed439307e
2 changed files with 61 additions and 14 deletions
|
@ -4,27 +4,38 @@ import net.minecraft.util.IStringSerializable;
|
|||
import reborncore.api.power.EnumPowerTier;
|
||||
|
||||
public enum EnumPanelType implements IStringSerializable {
|
||||
Basic("basic", 128, EnumPowerTier.LOW, 0),
|
||||
Hybrid("hybrid", 32, EnumPowerTier.MEDIUM, 1),
|
||||
Advanced("advanced", 512, EnumPowerTier.MEDIUM, 2),
|
||||
Ultimate("ultimate", 2048, EnumPowerTier.HIGH, 3),
|
||||
Quantum("quantum", 2048, EnumPowerTier.EXTREME, 4);
|
||||
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);
|
||||
|
||||
private int ID;
|
||||
public int generationRate = 128;
|
||||
private String friendlyName;
|
||||
|
||||
EnumPanelType(String friendlyName, int generationRate, EnumPowerTier tier, int ID) {
|
||||
public int generationRateD = 128;
|
||||
// Generation of FE during Day
|
||||
|
||||
public int generationRateN = 64;
|
||||
// Generation of FE during Night
|
||||
|
||||
public int internalCapacity = 0;
|
||||
// Internal FE storage of solar panel
|
||||
|
||||
|
||||
EnumPanelType(String friendlyName, int generationRateD, int generationRateN, int internalCapacity, EnumPowerTier tier, int ID) {
|
||||
this.friendlyName = friendlyName;
|
||||
this.generationRate = generationRate;
|
||||
this.ID = ID;
|
||||
this.generationRateD = generationRateD;
|
||||
this.generationRateN = generationRateN;
|
||||
this.internalCapacity = internalCapacity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return friendlyName.toLowerCase();
|
||||
return friendlyName;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ 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.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
|
@ -44,7 +45,7 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
||||
public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop, IEnergyStorage {
|
||||
|
||||
// @ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxOutput", comment = "Solar Panel Max Output (Value in EU)")
|
||||
// public static int maxOutput = 32;
|
||||
|
@ -56,11 +57,15 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
boolean shouldMakePower = false;
|
||||
boolean lastTickSate = false;
|
||||
int powerToAdd;
|
||||
private int generationRateD;
|
||||
private int generationRateN;
|
||||
private int internalCapacity;
|
||||
|
||||
public TileSolarPanel() {
|
||||
super();
|
||||
IBlockState panelType = world.getBlockState(pos);
|
||||
System.out.println(panelType + " Dimmer");
|
||||
generationRateD = getPanelType().generationRateD;
|
||||
generationRateN = getPanelType().generationRateN;
|
||||
internalCapacity = getPanelType().internalCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,7 +94,7 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return 5;
|
||||
return (double)generationRateD;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,14 +107,45 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceive() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@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 200;
|
||||
return generationRateD;
|
||||
}
|
||||
|
||||
private EnumPanelType getPanelType() {
|
||||
return world.getBlockState(pos).getValue(BlockSolarPanel.TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue