aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java
diff options
context:
space:
mode:
authorKiwi <42833050+Kiwi233@users.noreply.github.com>2020-05-22 20:23:55 +0800
committerGitHub <noreply@github.com>2020-05-22 20:23:55 +0800
commit56689ec7b67c46c882d49da4742770e3397a4e9f (patch)
tree879a3372906ec2c5f2a53a4ac46f7dde860a654f /src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java
parentbc19f3ab32c9bccbf936bbeffcc8ddad967ffffd (diff)
parent306a0822c27c59cdbd0a61698939a2dfc02068d2 (diff)
downloadGT5-Unofficial-56689ec7b67c46c882d49da4742770e3397a4e9f.tar.gz
GT5-Unofficial-56689ec7b67c46c882d49da4742770e3397a4e9f.tar.bz2
GT5-Unofficial-56689ec7b67c46c882d49da4742770e3397a4e9f.zip
Merge pull request #1 from kekzdealer/master
5/22
Diffstat (limited to 'src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java')
-rw-r--r--src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java b/src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java
new file mode 100644
index 0000000000..a8de775f98
--- /dev/null
+++ b/src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java
@@ -0,0 +1,54 @@
+package common.tileentities;
+
+import net.minecraft.tileentity.TileEntity;
+
+public class TE_SpaceElevatorCapacitor extends TileEntity {
+
+ private float chargeLevel = 0.0F;
+ private boolean isDamaged = true;
+
+ /**
+ * Called by {@link GTMTE_SpaceElevator} while charging
+ * @param charge
+ * Current elevator charge
+ * @param maxCharge
+ * Charge level it is trying to reach
+ */
+ public void updateChargeLevel(int charge, int maxCharge) {
+ chargeLevel = ((float) charge) / ((float) maxCharge);
+ }
+
+ /**
+ * Called by {@link client.renderer.TESR_SECapacitor} to calculate the block's colour saturation
+ * @return
+ * Charge level from 0.0F to 1.0F
+ */
+ public float getChargeLevel() {
+ return chargeLevel;
+ }
+
+ /**
+ * Called by {@link GTMTE_SpaceElevator} in case of power loss
+ */
+ public void resetChargeLevel() {
+ chargeLevel = 0.0F;
+ }
+
+ /**
+ * Called by {@link GTMTE_SpaceElevator} in case of maintenance issues
+ * @param isDamaged
+ * has maintenance issue
+ */
+ public void setIsDamaged(boolean isDamaged) {
+ this.isDamaged = isDamaged;
+ }
+
+ /**
+ * Called by {@link client.renderer.TESR_SECapacitor} to check whether the block should be rendered red
+ * @return
+ * should be rendered red
+ */
+ public boolean isDamaged() {
+ return isDamaged;
+ }
+}