aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/util/minecraft
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-04-08 14:43:42 +1000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-04-08 14:43:42 +1000
commitc0bea0f7df83c34cab115ec8f050f7e4ac8f2404 (patch)
tree61a8c87de00416741871a50d71eb87bb1d7ac9ba /src/Java/gtPlusPlus/core/util/minecraft
parentf2a08747b22b51c6f051ca035abf38a6121ef320 (diff)
downloadGT5-Unofficial-c0bea0f7df83c34cab115ec8f050f7e4ac8f2404.tar.gz
GT5-Unofficial-c0bea0f7df83c34cab115ec8f050f7e4ac8f2404.tar.bz2
GT5-Unofficial-c0bea0f7df83c34cab115ec8f050f7e4ac8f2404.zip
+ Added ways to provide custom Hazmat armour.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util/minecraft')
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java
index 2f160c3cf6..f05b1ef393 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java
@@ -1,5 +1,63 @@
package gtPlusPlus.core.util.minecraft;
+import static gregtech.api.GregTech_API.sBioHazmatList;
+import static gregtech.api.GregTech_API.sElectroHazmatList;
+import static gregtech.api.GregTech_API.sFrostHazmatList;
+import static gregtech.api.GregTech_API.sGasHazmatList;
+import static gregtech.api.GregTech_API.sHeatHazmatList;
+import static gregtech.api.GregTech_API.sRadioHazmatList;
+
+import gregtech.api.objects.GT_HashSet;
+import gtPlusPlus.api.objects.data.AutoMap;
+import net.minecraft.item.ItemStack;
+
public class HazmatUtils {
+ /**
+ * Registers the {@link ItemStack} to all types of protection.
+ * Provides full hazmat protection. Frost, Fire, Bio, Gas, Radioaton & Electricity.
+ * @param aStack - The Armour to provide protection.
+ * @return - Did we register this ItemStack properly?
+ */
+ public boolean addProtection(ItemStack aStack) {
+ AutoMap<Boolean> aAdded = new AutoMap<Boolean>();
+ aAdded.put(addProtection_Frost(aStack));
+ aAdded.put(addProtection_Fire(aStack));
+ aAdded.put(addProtection_Biohazard(aStack));
+ aAdded.put(addProtection_Gas(aStack));
+ aAdded.put(addProtection_Radiation(aStack));
+ aAdded.put(addProtection_Electricty(aStack));
+ for (boolean b : aAdded) {
+ if (!b) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean addProtection_Frost(ItemStack aStack) {
+ return addProtection_Generic(sFrostHazmatList, aStack);
+ }
+ public static boolean addProtection_Fire(ItemStack aStack) {
+ return addProtection_Generic(sHeatHazmatList, aStack);
+ }
+ public static boolean addProtection_Biohazard(ItemStack aStack) {
+ return addProtection_Generic(sBioHazmatList, aStack);
+ }
+ public static boolean addProtection_Gas(ItemStack aStack) {
+ return addProtection_Generic(sGasHazmatList, aStack);
+ }
+ public static boolean addProtection_Radiation(ItemStack aStack) {
+ return addProtection_Generic(sRadioHazmatList, aStack);
+ }
+ public static boolean addProtection_Electricty(ItemStack aStack) {
+ return addProtection_Generic(sElectroHazmatList, aStack);
+ }
+
+ private static boolean addProtection_Generic(GT_HashSet aSet, ItemStack aStack) {
+ int aMapSize = aSet.size();
+ aSet.add(aStack);
+ return aMapSize < aSet.size();
+ }
+
}