Skip to content

Commit

Permalink
Implement custom protection items
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jul 16, 2022
1 parent 7f7acbe commit 4278a72
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/main/java/com/buuz135/hotornot/config/HotConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,16 @@ public class HotConfig

@Config.Name("Custom gaseous items")
@Config.Comment("Gaseous items that are included manually")
public static String[] CUSTOM_GASEOUS_ITEMS = new String[] {"mod_id:item"};
public static String[] CUSTOM_GASEOUS_ITEMS = new String[] {};

@Config.Name("Excluded items")
@Config.Comment("Items that are exempt from effects")
public static String[] CUSTOM_REMOVALS = new String[] {"immersiveengineering:drill", "immersiveengineering:chemthrower", "immersivepetroleum:fluid_diesel", "immersivepetroleum:fluid_gasoline"};

@Config.Name("Custom protection items")
@Config.Comment("Additional items that protect the player from effects")
public static String[] CUSTOM_PROTECTION_ITEM = new String[] {};

@SuppressWarnings("unused")
@Mod.EventBusSubscriber(modid = HotOrNot.MOD_ID)
private static class EventHandler
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/com/buuz135/hotornot/server/ServerTick.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,19 @@ else if (offHand.getItem().equals(ModItems.IRON_TONGS))
}
return true;
}
return false;
else
{
String regName = offHand.getItem().getRegistryName().toString();
for (String s : HotConfig.CUSTOM_PROTECTION_ITEM)
{
if (regName.equals(s))
{
offHand.damageItem(HotConfig.ITEM_DAMAGE, player);
return true;
}
}
return false;
}
}

public static void applyHotEffect(EntityPlayer player, int index)
Expand Down

0 comments on commit 4278a72

Please sign in to comment.