Fixed M1TTY Envsuit mod detection

This commit is contained in:
Agarmal 2025-01-02 20:38:22 +01:00
parent 62116cfb32
commit 8391255398
2 changed files with 58 additions and 53 deletions

View File

@ -1,13 +1,12 @@
package com.hbm.handler; package com.hbm.handler;
import java.util.UUID;
import com.hbm.items.armor.ItemArmorMod; import com.hbm.items.armor.ItemArmorMod;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import java.util.UUID;
public class ArmorModHandler { public class ArmorModHandler {
public static final int helmet_only = 0; public static final int helmet_only = 0;
@ -147,6 +146,11 @@ public class ArmorModHandler {
return nbt.hasKey(MOD_COMPOUND_KEY); return nbt.hasKey(MOD_COMPOUND_KEY);
} }
/**
* Gets all the modifications in the provided armor
* @param armor
* @return
*/
public static ItemStack[] pryMods(ItemStack armor) { public static ItemStack[] pryMods(ItemStack armor) {
ItemStack[] slots = new ItemStack[MOD_SLOTS]; ItemStack[] slots = new ItemStack[MOD_SLOTS];

View File

@ -1,11 +1,9 @@
package com.hbm.items.armor; package com.hbm.items.armor;
import java.util.UUID;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.hbm.handler.ArmorModHandler;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.render.model.ModelArmorEnvsuit; import com.hbm.render.model.ModelArmorEnvsuit;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelBiped;
@ -19,6 +17,8 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.UUID;
public class ArmorEnvsuit extends ArmorFSBPowered { public class ArmorEnvsuit extends ArmorFSBPowered {
public ArmorEnvsuit(ArmorMaterial material, int slot, String texture, long maxPower, long chargeRate, long consumption, long drain) { public ArmorEnvsuit(ArmorMaterial material, int slot, String texture, long maxPower, long chargeRate, long consumption, long drain) {
@ -80,7 +80,8 @@ public class ArmorEnvsuit extends ArmorFSBPowered {
} else { } else {
boolean canRemoveNightVision = true; boolean canRemoveNightVision = true;
ItemStack helmet = player.inventory.armorInventory[3]; ItemStack helmet = player.inventory.armorInventory[3];
if (helmet.getItem() == ModItems.night_vision) { ItemStack helmetMod = ArmorModHandler.pryMod(helmet, ArmorModHandler.helmet_only); // Get the modification!
if (helmetMod != null && helmetMod.getItem() instanceof ItemModNightVision) {
canRemoveNightVision = false; canRemoveNightVision = false;
} }