From a06b9e9ff1d5ac57393de041a6dc43d532432ec9 Mon Sep 17 00:00:00 2001 From: MachineMuse Date: Tue, 2 Apr 2013 16:40:24 -0600 Subject: [PATCH] Powersuit helm can now act as an oxygen mask (Galacticraft) - tanks sold separately --- build.xml | 21 ++++++---- .../textures/items/glasspane.png | Bin 0 -> 262 bytes .../powersuits/common/ModCompatability.java | 21 +++++++--- .../powersuits/item/ItemPowerArmorHelmet.java | 13 +++++- .../powermodule/misc/AirtightSealModule.java | 39 ++++++++++++++++++ 5 files changed, 79 insertions(+), 15 deletions(-) create mode 100644 mods/mmmPowersuits/textures/items/glasspane.png create mode 100644 src/minecraft/net/machinemuse/powersuits/powermodule/misc/AirtightSealModule.java diff --git a/build.xml b/build.xml index 70127b6..aee5c40 100644 --- a/build.xml +++ b/build.xml @@ -14,6 +14,7 @@ + @@ -64,6 +65,7 @@ + @@ -82,13 +84,15 @@ + + + - @@ -100,7 +104,6 @@ - @@ -108,28 +111,28 @@ - - - - - - - + + + + + + + diff --git a/mods/mmmPowersuits/textures/items/glasspane.png b/mods/mmmPowersuits/textures/items/glasspane.png new file mode 100644 index 0000000000000000000000000000000000000000..9b99e0ee5238f23082878eee48e51f7fcfb9c95e GIT binary patch literal 262 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP)3zL|*1;=%b3qT>+%#er@=ltB<)VvZPmw~~#C^fMp zHASI3vm`^o-P1Q9MK6^dD4yl%;uvCaIypgtRpP<@{q_G7CFa&Y(01XGG)OdV>Fn&B z2*iRj&mK8)asList( + module = new ToggleablePowerModule(MuseCommonStrings.MODULE_HAZMAT, Arrays. asList( ModularPowersuits.powerArmorHead, ModularPowersuits.powerArmorTorso, ModularPowersuits.powerArmorLegs, ModularPowersuits.powerArmorFeet), "greenstar", MuseCommonStrings.CATEGORY_ARMOR) @@ -167,19 +173,24 @@ public class ModCompatability { .addInstallCost(Config.copyAndResize(ItemComponent.basicPlating, 3)).addBaseProperty(MuseCommonStrings.WEIGHT, 0.5); ModuleManager.addModule(module); } - + if (ModCompatability.isGalacticraftLoaded()) { + module = new AirtightSealModule(Collections.singletonList((IModularItem) ModularPowersuits.powerArmorHead)); + ModuleManager.addModule(module); + } } public static ItemStack getThermexItem(String string, int quantity) { // try { - // ItemStack item = thermalexpansion.api.core.ItemRegistry.getItem(string, quantity); + // ItemStack item = + // thermalexpansion.api.core.ItemRegistry.getItem(string, quantity); // if (item != null) { // return item; // } // } catch (Exception e) { // } // thermalexpansion.api.core.ItemRegistry.printItemNames(); - // MuseLogger.logError("Failed to get Thermal Expansion item " + string); + // MuseLogger.logError("Failed to get Thermal Expansion item " + + // string); return null; } } diff --git a/src/minecraft/net/machinemuse/powersuits/item/ItemPowerArmorHelmet.java b/src/minecraft/net/machinemuse/powersuits/item/ItemPowerArmorHelmet.java index d280372..1bb9b37 100644 --- a/src/minecraft/net/machinemuse/powersuits/item/ItemPowerArmorHelmet.java +++ b/src/minecraft/net/machinemuse/powersuits/item/ItemPowerArmorHelmet.java @@ -1,12 +1,18 @@ package net.machinemuse.powersuits.item; +import micdoodle8.mods.galacticraft.API.EnumGearType; +import micdoodle8.mods.galacticraft.API.IBreathableArmor; +import net.machinemuse.api.MuseItemUtils; import net.machinemuse.general.gui.MuseIcon; +import net.machinemuse.powersuits.powermodule.misc.AirtightSealModule; import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemPowerArmorHelmet extends ItemPowerArmor { +public class ItemPowerArmorHelmet extends ItemPowerArmor implements IBreathableArmor { public static int assignedItemID; public ItemPowerArmorHelmet() { @@ -22,4 +28,9 @@ public class ItemPowerArmorHelmet extends ItemPowerArmor { MuseIcon.ARMOR_HEAD.register(iconRegister); iconIndex = MuseIcon.ARMOR_HEAD.getIconRegistration(); } + + @Override + public boolean canBreathe(ItemStack helmetInSlot, EntityPlayer playerWearing, EnumGearType type) { + return MuseItemUtils.itemHasActiveModule(helmetInSlot, AirtightSealModule.AIRTIGHT_SEAL_MODULE); + } } diff --git a/src/minecraft/net/machinemuse/powersuits/powermodule/misc/AirtightSealModule.java b/src/minecraft/net/machinemuse/powersuits/powermodule/misc/AirtightSealModule.java new file mode 100644 index 0000000..23e2c8e --- /dev/null +++ b/src/minecraft/net/machinemuse/powersuits/powermodule/misc/AirtightSealModule.java @@ -0,0 +1,39 @@ +package net.machinemuse.powersuits.powermodule.misc; + +import java.util.List; + +import net.machinemuse.api.IModularItem; +import net.machinemuse.api.MuseCommonStrings; +import net.machinemuse.powersuits.powermodule.PowerModuleBase; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +public class AirtightSealModule extends PowerModuleBase { + public static final String AIRTIGHT_SEAL_MODULE = "Airtight Seal"; + + public AirtightSealModule(List validItems) { + super(validItems); + addInstallCost(new ItemStack(Block.glass)); + } + + @Override + public String getCategory() { + return MuseCommonStrings.CATEGORY_ENVIRONMENTAL; + } + + @Override + public String getName() { + return AIRTIGHT_SEAL_MODULE; + } + + @Override + public String getDescription() { + return "Seal the suit against hostile atmospheres for venturing to other planets."; + } + + @Override + public String getTextureFile() { + return "glasspane"; + } + +}