Move Draconic/Wyvern armor to new GT Hazard API (#65)

This commit is contained in:
Niclas Klugmann authored and GitHub committed 2025-04-09 00:24:41 -05:00
1 parent 0f3e15ce25
commit a755869dbd
5 files changed
+58 -4

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ dependencies {
compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.3.0:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.1:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.6-GTNH:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.227:dev") {transitive = false}
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false}
compileOnly("curse.maven:computercraft-67504:2269339") {transitive = false}
@@ -55,6 +55,8 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.IArmorApiarist;
import forestry.api.core.IArmorNaturalist;
import gregtech.api.hazards.Hazard;
import gregtech.api.hazards.IHazardProtector;
import thaumcraft.api.IGoggles;
import thaumcraft.api.IVisDiscountGear;
import thaumcraft.api.aspects.Aspect;
@@ -68,9 +70,10 @@ import thaumcraft.api.nodes.IRevealer;
@Interface(iface = "thaumcraft.api.IVisDiscountGear", modid = "Thaumcraft"),
@Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"),
@Interface(iface = "forestry.api.apiculture.IArmorApiarist", modid = "Forestry"),
@Interface(iface = "forestry.api.core.IArmorNaturalist", modid = "Forestry") })
@Interface(iface = "forestry.api.core.IArmorNaturalist", modid = "Forestry"),
@Interface(iface = "gregtech.api.hazards.IHazardProtector", modid = "gregtech") })
public class DraconicArmor extends ItemArmor implements ISpecialArmor, IConfigurableItem, IInventoryTool, IGoggles,
IVisDiscountGear, IRevealer, IUpgradableItem, ICustomArmor, IArmorNaturalist, IArmorApiarist {
IVisDiscountGear, IRevealer, IUpgradableItem, ICustomArmor, IArmorNaturalist, IArmorApiarist, IHazardProtector {
// TODO Wings
@SideOnly(Side.CLIENT)
@@ -374,6 +377,13 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IConfigur
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ApiaristArmor").readFromItem(stack, true));
}
}
if (Loader.isModLoaded("gregtech")) {
for (Hazard value : Hazard.values()) {
list.add(
new ItemConfigField(References.BOOLEAN_ID, slot, ModHelper.getHazmatArmorConfigKey(value))
.readFromItem(stack, true));
}
}
return list;
}
@@ -645,4 +655,10 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IConfigur
public boolean protectPlayer(EntityPlayer entityPlayer, ItemStack itemStack, String s, boolean b) {
return protectEntity(entityPlayer, itemStack, s, b);
}
@Override
@Method(modid = "gregtech")
public boolean protectsAgainst(ItemStack itemStack, Hazard hazard) {
return IConfigurableItem.ProfileHelper.getBoolean(itemStack, ModHelper.getHazmatArmorConfigKey(hazard), true);
}
}
@@ -40,12 +40,15 @@ import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.brandon3055.draconicevolution.integration.ModHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.hazards.Hazard;
import gregtech.api.hazards.IHazardProtector;
import thaumcraft.api.IVisDiscountGear;
import thaumcraft.api.IWarpingGear;
import thaumcraft.api.aspects.Aspect;
@@ -55,9 +58,10 @@ import thaumcraft.api.aspects.Aspect;
*/
@Optional.InterfaceList(
value = { @Optional.Interface(iface = "thaumcraft.api.IVisDiscountGear", modid = "Thaumcraft"),
@Optional.Interface(iface = "thaumcraft.api.IWarpingGear", modid = "Thaumcraft"), })
@Optional.Interface(iface = "thaumcraft.api.IWarpingGear", modid = "Thaumcraft"),
@Optional.Interface(iface = "gregtech.api.hazards.IHazardProtector", modid = "gregtech") })
public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurableItem, IInventoryTool, IUpgradableItem,
ICustomArmor, IVisDiscountGear, IWarpingGear {
ICustomArmor, IVisDiscountGear, IWarpingGear, IHazardProtector {
@SideOnly(Side.CLIENT)
private IIcon helmIcon;
@@ -269,6 +273,13 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab
.readFromItem(stack, 0f).setModifier("PLUSPERCENT"));
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false));
}
if (Loader.isModLoaded("gregtech")) {
for (Hazard value : Hazard.values()) {
list.add(
new ItemConfigField(References.BOOLEAN_ID, slot, ModHelper.getHazmatArmorConfigKey(value))
.readFromItem(stack, true));
}
}
return list;
}
@@ -500,4 +511,10 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab
public int getWarp(ItemStack itemStack, EntityPlayer entityPlayer) {
return 5;
}
@Override
@Optional.Method(modid = "gregtech")
public boolean protectsAgainst(ItemStack itemStack, Hazard hazard) {
return IConfigurableItem.ProfileHelper.getBoolean(itemStack, ModHelper.getHazmatArmorConfigKey(hazard), true);
}
}
@@ -10,7 +10,9 @@ import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler.A
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.hazards.Hazard;
/**
* Created by brandon3055 on 29/9/2015.
@@ -126,4 +128,16 @@ public class ModHelper {
public static boolean isAE2EntityFloatingItem(EntityItem item) {
return isAE2Installed && AE2FItem.isInstance(item);
}
@Optional.Method(modid = "gregtech")
public static String getHazmatArmorConfigKey(Hazard hazard) {
return switch (hazard) {
case ELECTRICAL -> "HazmatElectrical";
case BIOLOGICAL -> "HazmatBiological";
case FROST -> "HazmatFrost";
case GAS -> "HazmatGas";
case HEAT -> "HazmatHeat";
case RADIOLOGICAL -> "HazmatRadiological";
};
}
}
@@ -502,6 +502,12 @@ button.de.EffectiveOnSprint.name=Effective while sprinting
button.de.GogglesOfRevealing.name=Magical Sense
button.de.ApiaristArmor.name=Apiarist's Protection
button.de.NaturalistArmor.name=Naturalist's Vision
button.de.HazmatElectrical.name=Electrical Hazard Protection
button.de.HazmatBiological.name=Biological Hazard Protection
button.de.HazmatFrost.name=Frost Hazard Protection
button.de.HazmatGas.name=Gas Hazard Protection
button.de.HazmatHeat.name=Heat Hazard Protection
button.de.HazmatRadiological.name=Radiological Hazard Protection
button.de.BowArrowSpeedModifier.name=Arrow Velocity Modifier
button.de.BowAutoFire.name=Auto Fire
button.de.BowArrowDamage.name=Base Damage