diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2022-08-29 16:04:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 16:04:28 +0200 |
commit | 7d1f51a8937e0a86486267437d444696e81e8aa0 (patch) | |
tree | a5b145e7271998f7b4b968a2212ed487e54a92b5 /src/main/java/gtPlusPlus/xmod/eio | |
parent | 5267969156d30b4bb5f4cb2279ebb49db6bd40e2 (diff) | |
download | GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.gz GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.bz2 GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.zip |
Buildscript + Spotless (#318)
* Convert AES.java to readable class
* Buildscript
* Spotless
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/eio')
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java | 127 | ||||
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/eio/material/MaterialEIO.java | 216 |
2 files changed, 161 insertions, 182 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java b/src/main/java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java index 5b3210d58a..1e96109660 100644 --- a/src/main/java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java +++ b/src/main/java/gtPlusPlus/xmod/eio/handler/HandlerTooltip_EIO.java @@ -2,86 +2,75 @@ package gtPlusPlus.xmod.eio.handler; import static gtPlusPlus.core.lib.CORE.ConfigSwitches.disableEnderIOIngotTooltips; -import java.lang.reflect.Field; - import cpw.mods.fml.common.eventhandler.SubscribeEvent; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import gregtech.api.enums.Materials; - import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.eio.material.MaterialEIO; +import java.lang.reflect.Field; +import net.minecraft.item.Item; import net.minecraftforge.event.entity.player.ItemTooltipEvent; public class HandlerTooltip_EIO { - private static Item mIngot; - Class oMainClass; - Class oIngotClass; + private static Item mIngot; + Class oMainClass; + Class oIngotClass; - @SubscribeEvent - public void onItemTooltip(ItemTooltipEvent event){ - //Is EIO loaded? - if (!disableEnderIOIngotTooltips && LoadedMods.EnderIO){ + @SubscribeEvent + public void onItemTooltip(ItemTooltipEvent event) { + // Is EIO loaded? + if (!disableEnderIOIngotTooltips && LoadedMods.EnderIO) { - //Is the EIO Ingot Item null? - //If it is, reflect in. - if (mIngot == null){ - try { - oMainClass = ReflectionUtils.getClass("crazypants.enderio.EnderIO"); - oIngotClass = ReflectionUtils.getClass("crazypants.enderio.material.ItemAlloy"); - if (oMainClass != null && oIngotClass != null){ - Field oAlloyField = ReflectionUtils.getField(oMainClass, "itemAlloy"); - Object oAlloy = oAlloyField.get(oMainClass); - if (oAlloy != null){ - if (oIngotClass.isInstance(oAlloy) || Item.class.isInstance(oAlloy)){ - mIngot = (Item) oAlloy; - } - } - } - } - catch (Throwable e) { - } - } + // Is the EIO Ingot Item null? + // If it is, reflect in. + if (mIngot == null) { + try { + oMainClass = ReflectionUtils.getClass("crazypants.enderio.EnderIO"); + oIngotClass = ReflectionUtils.getClass("crazypants.enderio.material.ItemAlloy"); + if (oMainClass != null && oIngotClass != null) { + Field oAlloyField = ReflectionUtils.getField(oMainClass, "itemAlloy"); + Object oAlloy = oAlloyField.get(oMainClass); + if (oAlloy != null) { + if (oIngotClass.isInstance(oAlloy) || Item.class.isInstance(oAlloy)) { + mIngot = (Item) oAlloy; + } + } + } + } catch (Throwable e) { + } + } - if (mIngot != null){ - //If the Item is an instance of ItemAlloy.class then proceed - if (event.itemStack.getItem() == mIngot || oIngotClass.isInstance(event.itemStack.getItem()) || event.itemStack.getUnlocalizedName().toLowerCase().contains("item.itemAlloy")){ + if (mIngot != null) { + // If the Item is an instance of ItemAlloy.class then proceed + if (event.itemStack.getItem() == mIngot + || oIngotClass.isInstance(event.itemStack.getItem()) + || event.itemStack.getUnlocalizedName().toLowerCase().contains("item.itemAlloy")) { - //If stacks match, add a tooltip. - if (mIngot != null){ - if (event.itemStack.getItem() == mIngot){ - if (event.itemStack.getItemDamage() == 0){ - event.toolTip.add(MaterialEIO.ELECTRICAL_STEEL.vChemicalFormula); - } - else if (event.itemStack.getItemDamage() == 1){ - event.toolTip.add(MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula); - } - else if (event.itemStack.getItemDamage() == 2){ - event.toolTip.add(MaterialEIO.VIBRANT_ALLOY.vChemicalFormula); - } - else if (event.itemStack.getItemDamage() == 3){ - event.toolTip.add(MaterialEIO.REDSTONE_ALLOY.vChemicalFormula); - } - else if (event.itemStack.getItemDamage() == 4){ - event.toolTip.add(MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula); - } - else if (event.itemStack.getItemDamage() == 5){ - event.toolTip.add(MaterialEIO.PULSATING_IRON.vChemicalFormula); - } - else if (event.itemStack.getItemDamage() == 6){ - event.toolTip.add(Materials.DarkSteel.mChemicalFormula); - } - else if (event.itemStack.getItemDamage() == 7){ - event.toolTip.add(MaterialEIO.SOULARIUM.vChemicalFormula); - } - } - } - } - } - } - } + // If stacks match, add a tooltip. + if (mIngot != null) { + if (event.itemStack.getItem() == mIngot) { + if (event.itemStack.getItemDamage() == 0) { + event.toolTip.add(MaterialEIO.ELECTRICAL_STEEL.vChemicalFormula); + } else if (event.itemStack.getItemDamage() == 1) { + event.toolTip.add(MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula); + } else if (event.itemStack.getItemDamage() == 2) { + event.toolTip.add(MaterialEIO.VIBRANT_ALLOY.vChemicalFormula); + } else if (event.itemStack.getItemDamage() == 3) { + event.toolTip.add(MaterialEIO.REDSTONE_ALLOY.vChemicalFormula); + } else if (event.itemStack.getItemDamage() == 4) { + event.toolTip.add(MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula); + } else if (event.itemStack.getItemDamage() == 5) { + event.toolTip.add(MaterialEIO.PULSATING_IRON.vChemicalFormula); + } else if (event.itemStack.getItemDamage() == 6) { + event.toolTip.add(Materials.DarkSteel.mChemicalFormula); + } else if (event.itemStack.getItemDamage() == 7) { + event.toolTip.add(MaterialEIO.SOULARIUM.vChemicalFormula); + } + } + } + } + } + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/eio/material/MaterialEIO.java b/src/main/java/gtPlusPlus/xmod/eio/material/MaterialEIO.java index a5c87342e7..ea72b6312a 100644 --- a/src/main/java/gtPlusPlus/xmod/eio/material/MaterialEIO.java +++ b/src/main/java/gtPlusPlus/xmod/eio/material/MaterialEIO.java @@ -5,117 +5,107 @@ import gtPlusPlus.core.material.state.MaterialState; public class MaterialEIO { - public static final Material SOULARIUM = new Material( - "Soularium", //Material Name - MaterialState.SOLID, //State - new short[]{95,90,54, 0}, //Material Colour - 10, //Melting Point in C - 10, - 10, - 10, - false, //Uses Blast furnace? - false, //Generates a cell - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().GOLD, 1), - new MaterialStack(NONMATERIAL.SOULSAND, 1) - }); - - public static final Material CONDUCTIVE_IRON = new Material( - "Conductive Iron", //Material Name - MaterialState.SOLID, //State - new short[]{164,109,100, 0}, //Material Colour - 10, //Melting Point in C - 10, - 10, - 10, - false, //Uses Blast furnace? - false, //Generates a cell - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().IRON, 1), - new MaterialStack(NONMATERIAL.REDSTONE, 1) - }); - - public static final Material PULSATING_IRON = new Material( - "Pulsating Iron", //Material Name - MaterialState.SOLID, //State - new short[]{50,91,21, 0}, //Material Colour - 10, //Melting Point in C - 10, - 10, - 10, - false, //Uses Blast furnace? - false, //Generates a cell - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().IRON, 1), - new MaterialStack(NONMATERIAL.ENDERPEARL, 1) - }); - - public static final Material ELECTRICAL_STEEL = new Material( - "Electrical Steel", //Material Name - MaterialState.SOLID, //State - new short[]{194,194,194, 0}, //Material Colour - 10, //Melting Point in C - 10, - 10, - 10, - true, //Uses Blast furnace? - false, //Generates a cell - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.STEEL, 3), - new MaterialStack(ELEMENT.getInstance().SILICON, 1) - }); - - public static final Material ENERGETIC_ALLOY = new Material( - "Energetic Alloy", //Material Name - MaterialState.SOLID, //State - new short[]{252,151,45, 0}, //Material Colour - 10, //Melting Point in C - 10, - 10, - 10, - true, //Uses Blast furnace? - false, //Generates a cell - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().GOLD, 1), - new MaterialStack(NONMATERIAL.REDSTONE, 1), - new MaterialStack(NONMATERIAL.GLOWSTONE, 1) - }); - - public static final Material VIBRANT_ALLOY = new Material( - "Vibrant Alloy", //Material Name - MaterialState.SOLID, //State - new short[]{204,242,142, 0}, //Material Colour - 10, //Melting Point in C - 10, - 10, - 10, - true, //Uses Blast furnace? - false, //Generates a cell - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ENERGETIC_ALLOY, 1), - new MaterialStack(NONMATERIAL.ENDERPEARL, 1) - }); - - public static final Material REDSTONE_ALLOY = new Material( - "Redstone Alloy", //Material Name - MaterialState.SOLID, //State - new short[]{178,34,34, 0}, //Material Colour - 10, //Melting Point in C - 10, - 10, - 10, - false, //Uses Blast furnace? - false, //Generates a cell - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SILICON, 1), - new MaterialStack(NONMATERIAL.REDSTONE, 1) - }); - + public static final Material SOULARIUM = new Material( + "Soularium", // Material Name + MaterialState.SOLID, // State + new short[] {95, 90, 54, 0}, // Material Colour + 10, // Melting Point in C + 10, + 10, + 10, + false, // Uses Blast furnace? + false, // Generates a cell + // Material Stacks with Percentage of required elements. + new MaterialStack[] { + new MaterialStack(ELEMENT.getInstance().GOLD, 1), new MaterialStack(NONMATERIAL.SOULSAND, 1) + }); + + public static final Material CONDUCTIVE_IRON = new Material( + "Conductive Iron", // Material Name + MaterialState.SOLID, // State + new short[] {164, 109, 100, 0}, // Material Colour + 10, // Melting Point in C + 10, + 10, + 10, + false, // Uses Blast furnace? + false, // Generates a cell + // Material Stacks with Percentage of required elements. + new MaterialStack[] { + new MaterialStack(ELEMENT.getInstance().IRON, 1), new MaterialStack(NONMATERIAL.REDSTONE, 1) + }); + + public static final Material PULSATING_IRON = new Material( + "Pulsating Iron", // Material Name + MaterialState.SOLID, // State + new short[] {50, 91, 21, 0}, // Material Colour + 10, // Melting Point in C + 10, + 10, + 10, + false, // Uses Blast furnace? + false, // Generates a cell + // Material Stacks with Percentage of required elements. + new MaterialStack[] { + new MaterialStack(ELEMENT.getInstance().IRON, 1), new MaterialStack(NONMATERIAL.ENDERPEARL, 1) + }); + + public static final Material ELECTRICAL_STEEL = new Material( + "Electrical Steel", // Material Name + MaterialState.SOLID, // State + new short[] {194, 194, 194, 0}, // Material Colour + 10, // Melting Point in C + 10, + 10, + 10, + true, // Uses Blast furnace? + false, // Generates a cell + // Material Stacks with Percentage of required elements. + new MaterialStack[] {new MaterialStack(ALLOY.STEEL, 3), new MaterialStack(ELEMENT.getInstance().SILICON, 1) + }); + + public static final Material ENERGETIC_ALLOY = new Material( + "Energetic Alloy", // Material Name + MaterialState.SOLID, // State + new short[] {252, 151, 45, 0}, // Material Colour + 10, // Melting Point in C + 10, + 10, + 10, + true, // Uses Blast furnace? + false, // Generates a cell + // Material Stacks with Percentage of required elements. + new MaterialStack[] { + new MaterialStack(ELEMENT.getInstance().GOLD, 1), + new MaterialStack(NONMATERIAL.REDSTONE, 1), + new MaterialStack(NONMATERIAL.GLOWSTONE, 1) + }); + + public static final Material VIBRANT_ALLOY = new Material( + "Vibrant Alloy", // Material Name + MaterialState.SOLID, // State + new short[] {204, 242, 142, 0}, // Material Colour + 10, // Melting Point in C + 10, + 10, + 10, + true, // Uses Blast furnace? + false, // Generates a cell + // Material Stacks with Percentage of required elements. + new MaterialStack[] {new MaterialStack(ENERGETIC_ALLOY, 1), new MaterialStack(NONMATERIAL.ENDERPEARL, 1)}); + + public static final Material REDSTONE_ALLOY = new Material( + "Redstone Alloy", // Material Name + MaterialState.SOLID, // State + new short[] {178, 34, 34, 0}, // Material Colour + 10, // Melting Point in C + 10, + 10, + 10, + false, // Uses Blast furnace? + false, // Generates a cell + // Material Stacks with Percentage of required elements. + new MaterialStack[] { + new MaterialStack(ELEMENT.getInstance().SILICON, 1), new MaterialStack(NONMATERIAL.REDSTONE, 1) + }); } |