diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-04-17 10:35:07 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-04-17 10:35:07 +1000 |
commit | 95747970ad7d142a2a981119bdfafca5ab5b27d2 (patch) | |
tree | 6e9e581cff710593e6d64205e3b76ad9e9fab836 /src/Java/gtPlusPlus/xmod/gregtech | |
parent | f09983f7b7348e89fcc73e865cd11be048e45ba9 (diff) | |
download | GT5-Unofficial-95747970ad7d142a2a981119bdfafca5ab5b27d2.tar.gz GT5-Unofficial-95747970ad7d142a2a981119bdfafca5ab5b27d2.tar.bz2 GT5-Unofficial-95747970ad7d142a2a981119bdfafca5ab5b27d2.zip |
+ Added rmb information to Energy Buffers to show current Amperage.
% Migrated getFieldFromGregtechProxy() from Meta_GT_Proxy.java to StaticFields59.java.
$ Fixed hardness/resistance on a few blocks.
$ Fixed bad handling of Item Entities by Fluid Collectors.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech')
5 files changed, 48 insertions, 45 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java index 5ce74588fa..8c0c47bea2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java @@ -6,7 +6,6 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Config; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; @@ -24,7 +23,7 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch super.onConfigLoad(aConfig); if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) { try { - Integer a1 = (int) Meta_GT_Proxy.getFieldFromGregtechProxy(false, "mPollutionSmogLimit"); + Integer a1 = (int) StaticFields59.getFieldFromGregtechProxy(false, "mPollutionSmogLimit"); if (a1 != null && a1 > 0) { mPollutionSmogLimit = a1; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java index f6056af87a..929dee22e4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java @@ -15,7 +15,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { @@ -23,7 +23,7 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { public static final boolean mGt6Pipe; static { - Boolean aGt6 = (Boolean) Meta_GT_Proxy.getFieldFromGregtechProxy(false, "gt6Pipe"); + Boolean aGt6 = (Boolean) StaticFields59.getFieldFromGregtechProxy(false, "gt6Pipe"); if (aGt6 != null) { mGt6Pipe = aGt6; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 6b4bab9e26..7505c2a808 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -5,7 +5,6 @@ import static gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow.mOverfl import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -16,7 +15,6 @@ import java.util.TimerTask; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -24,11 +22,8 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; -import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; import gregtech.common.GT_Proxy; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; @@ -39,11 +34,8 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.reflect.ProxyFinder; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE; -import gtPlusPlus.xmod.gregtech.loaders.misc.AssLineAchievements; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -98,6 +90,9 @@ public class Meta_GT_Proxy { GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); throw new RuntimeException(""); } + + //Gotta set it here so that we don't try call gregtech too early. + StaticFields59.mGT6StylePipes = (boolean) StaticFields59.getFieldFromGregtechProxy(true, "gt6Pipe"); GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity."); GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP"); @@ -375,37 +370,13 @@ public class Meta_GT_Proxy { } - private static GT_Proxy[] mProxies = new GT_Proxy[2]; + static GT_Proxy[] mProxies = new GT_Proxy[2]; + /** + * @deprecated Use {@link StaticFields59#getFieldFromGregtechProxy(boolean,String)} instead + */ public static Object getFieldFromGregtechProxy(boolean client, String fieldName) { - Object proxyGT; - - if (mProxies[0] != null && client) { - proxyGT = mProxies[0]; - } else if (mProxies[1] != null && !client) { - proxyGT = mProxies[1]; - } else { - try { - proxyGT = (client ? ProxyFinder.getClientProxy(GT_Mod.instance) - : ProxyFinder.getServerProxy(GT_Mod.instance)); - } catch (final ReflectiveOperationException e1) { - proxyGT = null; - Logger.INFO("Failed to obtain instance of GT " + (client ? "Client" : "Server") + " proxy."); - } - if (mProxies[0] == null && client) { - mProxies[0] = (GT_Proxy) proxyGT; - } else if (mProxies[1] == null && !client) { - mProxies[1] = (GT_Proxy) proxyGT; - } - } - - if (proxyGT != null && proxyGT instanceof GT_Proxy) { - try { - return ReflectionUtils.getField(proxyGT.getClass(), fieldName).get(proxyGT); - } catch (IllegalArgumentException | IllegalAccessException e) { - } - } - return null; + return StaticFields59.getFieldFromGregtechProxy(client, fieldName); } public void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java index 2287d7964c..2a3fd5e77c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java @@ -9,6 +9,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -18,8 +19,10 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffl import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.common.GT_Proxy; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.reflect.ProxyFinder; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -27,7 +30,7 @@ import net.minecraft.item.ItemStack; public class StaticFields59 { - public static final boolean mGT6StylePipes; + public static boolean mGT6StylePipes; public static final Field mGtBlockCasings5; public static final Field mPreventableComponents; @@ -49,8 +52,6 @@ public class StaticFields59 { static { Logger.INFO("[SH] Creating Static Helper for various fields which require reflective access."); - mGT6StylePipes = (boolean) Meta_GT_Proxy.getFieldFromGregtechProxy(false, "gt6Pipe"); - mGtBlockCasings5 = getField(GregTech_API.class, "sBlockCasings5"); Logger.INFO("[SH] Got Field: sBlockCasings5"); mPreventableComponents = getField(OrePrefixes.class, "mPreventableComponents"); @@ -182,5 +183,36 @@ public class StaticFields59 { return null; } + public static Object getFieldFromGregtechProxy(boolean client, String fieldName) { + Object proxyGT; + + if (Meta_GT_Proxy.mProxies[0] != null && client) { + proxyGT = Meta_GT_Proxy.mProxies[0]; + } else if (Meta_GT_Proxy.mProxies[1] != null && !client) { + proxyGT = Meta_GT_Proxy.mProxies[1]; + } else { + try { + proxyGT = (client ? ProxyFinder.getClientProxy(GT_Mod.instance) + : ProxyFinder.getServerProxy(GT_Mod.instance)); + } catch (final ReflectiveOperationException e1) { + proxyGT = null; + Logger.INFO("Failed to obtain instance of GT " + (client ? "Client" : "Server") + " proxy."); + } + if (Meta_GT_Proxy.mProxies[0] == null && client) { + Meta_GT_Proxy.mProxies[0] = (GT_Proxy) proxyGT; + } else if (Meta_GT_Proxy.mProxies[1] == null && !client) { + Meta_GT_Proxy.mProxies[1] = (GT_Proxy) proxyGT; + } + } + + if (proxyGT != null && proxyGT instanceof GT_Proxy) { + try { + return ReflectionUtils.getField(proxyGT.getClass(), fieldName).get(proxyGT); + } catch (IllegalArgumentException | IllegalAccessException e) { + } + } + return null; + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java index 9674871477..86d02eae9a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java @@ -38,7 +38,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public String[] getDescription() { - return new String[] {this.mDescription, "Defaults 4A In/Out", "Change output Amperage with a screwdriver", "Now Portable!", CORE.GT_Tooltip}; + return new String[] {this.mDescription, "Defaults 4A In/Out", "Change output Amperage with a screwdriver", "Now Portable!"}; } @Override @@ -253,6 +253,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { final double c = ((double) tempStorage / this.maxEUStore()) * 100; final double roundOff = Math.round(c * 100.00) / 100.00; PlayerUtils.messagePlayer(playerIn, "Energy: " + GT_Utility.formatNumbers(tempStorage) + " EU at "+V[this.mTier]+"v ("+roundOff+"%)"); + PlayerUtils.messagePlayer(playerIn, "Amperage: " + GT_Utility.formatNumbers(maxAmperesIn())+"A"); } //Utils.LOG_WARNING("Begin Show Energy"); |