diff options
author | Glease <4586901+Glease@users.noreply.github.com> | 2023-01-19 16:47:48 +0800 |
---|---|---|
committer | Glease <4586901+Glease@users.noreply.github.com> | 2023-01-19 16:47:48 +0800 |
commit | ebc9b1fcde044cc31cf042d0a007c172585a154e (patch) | |
tree | 210266e4013fd75aff698238cea3eb3927c27286 /src/main/java/net/glease/ggfab/util/LaserHelper.java | |
parent | f6fba5263c5124f3e7aeda35f090cafb4cad4a6a (diff) | |
download | GT5-Unofficial-ebc9b1fcde044cc31cf042d0a007c172585a154e.tar.gz GT5-Unofficial-ebc9b1fcde044cc31cf042d0a007c172585a154e.tar.bz2 GT5-Unofficial-ebc9b1fcde044cc31cf042d0a007c172585a154e.zip |
use new working ampere api instead of reflection
Diffstat (limited to 'src/main/java/net/glease/ggfab/util/LaserHelper.java')
-rw-r--r-- | src/main/java/net/glease/ggfab/util/LaserHelper.java | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/main/java/net/glease/ggfab/util/LaserHelper.java b/src/main/java/net/glease/ggfab/util/LaserHelper.java deleted file mode 100644 index 53bf328eb7..0000000000 --- a/src/main/java/net/glease/ggfab/util/LaserHelper.java +++ /dev/null @@ -1,45 +0,0 @@ -package net.glease.ggfab.util; - -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; - -import java.lang.reflect.Field; - -public class LaserHelper { - private static final Class<?> GT_MetaTileEntity_Hatch_EnergyMulti; - private static final Field fieldAmperes; - - static { - Class<?> tmp1; - Field tmp2; - try { - tmp1 = Class.forName("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti"); - } catch (ClassNotFoundException e) { - tmp1 = null; - } - if (tmp1 != null) { - try { - tmp2 = tmp1.getField("Amperes"); - tmp2.setAccessible(true); - } catch (ReflectiveOperationException e) { - tmp1 = null; - tmp2 = null; - } - } else { - tmp2 = null; - } - GT_MetaTileEntity_Hatch_EnergyMulti = tmp1; - fieldAmperes = tmp2; - } - - public static long getAmperes(GT_MetaTileEntity_Hatch hatch) { - if (GT_MetaTileEntity_Hatch_EnergyMulti.isInstance(hatch)) { - try { - // target field is int, not long - return (int) fieldAmperes.get(hatch); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } - return hatch.maxAmperesIn(); - } -} |