aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/api/thermal/energy/ThermalStorage.java
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-04-29 12:55:19 +1000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-04-29 12:55:19 +1000
commit4109c9575dd6d8a89f03e1242493dca228255570 (patch)
treecb71094617867ee843efb5ad1c456286f2269f4a /src/Java/gtPlusPlus/api/thermal/energy/ThermalStorage.java
parent47d2b68b66fb9958b57c3ff81f1e73e8f6afd91b (diff)
downloadGT5-Unofficial-4109c9575dd6d8a89f03e1242493dca228255570.tar.gz
GT5-Unofficial-4109c9575dd6d8a89f03e1242493dca228255570.tar.bz2
GT5-Unofficial-4109c9575dd6d8a89f03e1242493dca228255570.zip
+ Added Framework for Thermal power based upon the code used for RF.
> This is more effective than trying to use the GT EU code for the exact same thing.
Diffstat (limited to 'src/Java/gtPlusPlus/api/thermal/energy/ThermalStorage.java')
-rw-r--r--src/Java/gtPlusPlus/api/thermal/energy/ThermalStorage.java116
1 files changed, 116 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/api/thermal/energy/ThermalStorage.java b/src/Java/gtPlusPlus/api/thermal/energy/ThermalStorage.java
new file mode 100644
index 0000000000..22a47b2807
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/thermal/energy/ThermalStorage.java
@@ -0,0 +1,116 @@
+package gtPlusPlus.api.thermal.energy;
+
+import net.minecraft.nbt.NBTTagCompound;
+
+public class ThermalStorage implements IThermalStorage {
+
+ protected int thermal_energy;
+ protected int capacity;
+ protected int maxReceive;
+ protected int maxExtract;
+
+ public ThermalStorage(int arg0) {
+ this(arg0, arg0, arg0);
+ }
+
+ public ThermalStorage(int arg0, int arg1) {
+ this(arg0, arg1, arg1);
+ }
+
+ public ThermalStorage(int arg0, int arg1, int arg2) {
+ this.capacity = arg0;
+ this.maxReceive = arg1;
+ this.maxExtract = arg2;
+ }
+
+ public ThermalStorage readFromNBT(NBTTagCompound arg0) {
+ this.thermal_energy = arg0.getInteger("Energy");
+ if (this.thermal_energy > this.capacity) {
+ this.thermal_energy = this.capacity;
+ }
+ return this;
+ }
+
+ public NBTTagCompound writeToNBT(NBTTagCompound arg0) {
+ if (this.thermal_energy < 0) {
+ this.thermal_energy = 0;
+ }
+ arg0.setInteger("Energy", this.thermal_energy);
+ return arg0;
+ }
+
+ public void setCapacity(int arg0) {
+ this.capacity = arg0;
+ if (this.thermal_energy > arg0) {
+ this.thermal_energy = arg0;
+ }
+
+ }
+
+ public void setMaxTransfer(int arg0) {
+ this.setMaxReceive(arg0);
+ this.setMaxExtract(arg0);
+ }
+
+ public void setMaxReceive(int arg0) {
+ this.maxReceive = arg0;
+ }
+
+ public void setMaxExtract(int arg0) {
+ this.maxExtract = arg0;
+ }
+
+ public int getMaxReceive() {
+ return this.maxReceive;
+ }
+
+ public int getMaxExtract() {
+ return this.maxExtract;
+ }
+
+ public void setEnergyStored(int arg0) {
+ this.thermal_energy = arg0;
+ if (this.thermal_energy > this.capacity) {
+ this.thermal_energy = this.capacity;
+ } else if (this.thermal_energy < 0) {
+ this.thermal_energy = 0;
+ }
+
+ }
+
+ public void modifyEnergyStored(int arg0) {
+ this.thermal_energy += arg0;
+ if (this.thermal_energy > this.capacity) {
+ this.thermal_energy = this.capacity;
+ } else if (this.thermal_energy < 0) {
+ this.thermal_energy = 0;
+ }
+
+ }
+
+ public int receiveThermalEnergy(int arg0, boolean arg1) {
+ int arg2 = Math.min(this.capacity - this.thermal_energy, Math.min(this.maxReceive, arg0));
+ if (!arg1) {
+ this.thermal_energy += arg2;
+ }
+
+ return arg2;
+ }
+
+ public int extractThermalEnergy(int arg0, boolean arg1) {
+ int arg2 = Math.min(this.thermal_energy, Math.min(this.maxExtract, arg0));
+ if (!arg1) {
+ this.thermal_energy -= arg2;
+ }
+
+ return arg2;
+ }
+
+ public int getThermalEnergyStored() {
+ return this.thermal_energy;
+ }
+
+ public int getMaxThermalEnergyStored() {
+ return this.capacity;
+ }
+} \ No newline at end of file