From 47729c59f131b654c855cb8631908446c0549e32 Mon Sep 17 00:00:00 2001 From: Dragonoidzero Date: Sat, 9 Oct 2021 01:08:30 -0500 Subject: [PATCH] More changes to PulseIo --- gradle.properties | 2 +- .../id/incubus_core/systems/MaterialProvider.java | 3 ++- .../java/net/id/incubus_core/systems/PulseIo.java | 13 ++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 53910ad..735af9b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.11.6 # Mod Properties - mod_version = 1.6.2 + mod_version = 1.6.3 maven_group = azzy.fabric archives_base_name = incubus-core diff --git a/src/main/java/net/id/incubus_core/systems/MaterialProvider.java b/src/main/java/net/id/incubus_core/systems/MaterialProvider.java index 34a1bd5..19221b8 100644 --- a/src/main/java/net/id/incubus_core/systems/MaterialProvider.java +++ b/src/main/java/net/id/incubus_core/systems/MaterialProvider.java @@ -1,9 +1,10 @@ package net.id.incubus_core.systems; import net.minecraft.util.math.Direction; +import org.jetbrains.annotations.Nullable; @SuppressWarnings("unused") public interface MaterialProvider { - Material getMaterial(Direction direction); + Material getMaterial(@Nullable Direction direction); } diff --git a/src/main/java/net/id/incubus_core/systems/PulseIo.java b/src/main/java/net/id/incubus_core/systems/PulseIo.java index e3a34fc..c142a06 100644 --- a/src/main/java/net/id/incubus_core/systems/PulseIo.java +++ b/src/main/java/net/id/incubus_core/systems/PulseIo.java @@ -17,7 +17,9 @@ public interface PulseIo extends MaterialProvider { /** * Get the total amount of energy stored */ - long getMotive(); + default long getMotive() { + return getFrequency() * getInductance(); + } /** * Get the frequency component of the stored energy @@ -52,14 +54,14 @@ default long getMotiveCapacity() { * Get the minimum level of Inductance needed to cause this object to fail. */ default long getFailureInductance() { - return Long.MAX_VALUE; + return getMaterial(null).maxInductance(); } /** * Get the minimum frequency needed to cause this object to fail. */ default long getFailureFrequency() { - return Long.MAX_VALUE; + return getMaterial(null).maxFrequency(); } /** @@ -135,6 +137,11 @@ default long extractMotive(long maxAmount, Simulation simulation) { return 0; } + /** + * What do you want me to explain here? Half the bloody methods are already just copy pasted! + */ + void setPolarity(Polarity polarity); + /** * Return false if this object does not support insertion at all, meaning that insertion will always return the passed amount, * and insert-only connectors should not connect.