Skip to content

Commit

Permalink
Various optimizations, config settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jul 16, 2022
1 parent 325c353 commit 7f7acbe
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 117 deletions.
21 changes: 2 additions & 19 deletions HotOrNot.iml
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="HotOrNot" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.buuz135" external.system.module.version="1.1.9" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>FORGE</platformType>
<platformType>MCP</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="McpModuleSettings">
<option name="mappingFile" value="D:\Spiele\Minecraft\Meine Mods\HotOrNot\build\createMcpToSrg\output.tsrg" />
<option name="mcpVersion" value="stable_39-1.12" />
<option name="minecraftVersion" value="1.12.2" />
<option name="srgType" value="TSRG" />
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/out" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
15 changes: 10 additions & 5 deletions src/main/java/com/buuz135/hotornot/client/HotTooltip.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,25 @@ public static void onTooltip(ItemTooltipEvent event)
{
if (effect.isValid.test(fluidStack))
{
event.getToolTip().add(effect.color + new TextComponentTranslation(effect.tooltip).getUnformattedText());
if ((effect.equals(FluidEffect.HOT) && HotConfig.HOT_FLUIDS) ||
(effect.equals(FluidEffect.COLD) && HotConfig.COLD_FLUIDS) ||
(effect.equals(FluidEffect.GAS) && HotConfig.GASEOUS_FLUIDS))
{
event.getToolTip().add(effect.color + new TextComponentTranslation(effect.tooltip).getUnformattedText());
}
}
}
}
}
else if (HotLists.isHotItem(stack))
else if (HotConfig.HOT_ITEMS && HotLists.isHotItem(stack))
{
event.getToolTip().add(FluidEffect.HOT.color + new TextComponentTranslation(FluidEffect.HOT.tooltip).getUnformattedText());
}
else if (HotLists.isColdItem(stack))
else if (HotConfig.COLD_ITEMS && HotLists.isColdItem(stack))
{
event.getToolTip().add(FluidEffect.COLD.color + new TextComponentTranslation(FluidEffect.COLD.tooltip).getUnformattedText());
}
else if (HotLists.isGaseousItem(stack))
else if (HotConfig.GASEOUS_ITEMS && HotLists.isGaseousItem(stack))
{
event.getToolTip().add(FluidEffect.GAS.color + new TextComponentTranslation(FluidEffect.GAS.tooltip).getUnformattedText());
}
Expand All @@ -60,7 +65,7 @@ else if (Loader.isModLoaded("tfc") && HotConfig.HOT_ITEMS)
if (stack.hasCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null))
{
IItemHeat heat = stack.getCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null);
if (heat.getTemperature() >= HotConfig.HOT_ITEM_TEMP)
if (heat.getTemperature() >= HotConfig.TEMP_HOT_ITEM)
{
event.getToolTip().add(FluidEffect.HOT.color + new TextComponentTranslation(FluidEffect.HOT.tooltip).getUnformattedText());
}
Expand Down
34 changes: 23 additions & 11 deletions src/main/java/com/buuz135/hotornot/config/HotConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,48 +43,60 @@ public class HotConfig
@Config.Comment("If true, hot items make the player yeet them")
public static boolean YEET = true;

@Config.Name("Throw entire stack")
@Config.Comment("If true, the player yeets the entire stack of items")
public static boolean YEET_STACK = true;

@Config.Name("Hot fluid temperature")
@Config.Comment("How hot a fluid should be to start burning the player (in Celsius)")
public static int HOT_FLUID_TEMP = 480;
public static int TEMP_HOT_FLUID = 480;

@Config.Name("Cold fluid temperature")
@Config.Comment("How cold a fluid should be to start adding effects the player (in Celsius)")
public static int COLD_FLUID_TEMP = 0;
public static int TEMP_COLD_FLUID = 0;

@Config.Name("Hot item temperature")
@Config.Name("Hot item temperature (TFC)")
@Config.Comment("How hot an item should be to start burning the player (in Celsius)")
public static int HOT_ITEM_TEMP = 480;
public static int TEMP_HOT_ITEM = 480;

@Config.RequiresMcRestart()
@Config.Name("Wooden Tongs durability")
@Config.Comment("Max durability of Wooden Tongs, 0 for infinite durability")
public static int WOODEN_TONGS_DURABILITY = 1200;
public static int DURABILITY_WOODEN_TONGS = 1200;

@Config.RequiresMcRestart()
@Config.Name("Mitts durability")
@Config.Comment("Max durability of Mitts, 0 for infinite durability")
public static int MITTS_DURABILITY = 12000;
public static int DURABILITY_MITTS = 12000;

@Config.RequiresMcRestart()
@Config.Name("Iron Tongs durability")
@Config.Comment("Max durability of Iron Tongs, 0 for infinite durability")
public static int IRON_TONGS_DURABILITY = 0;
public static int DURABILITY_IRON_TONGS = 0;

@Config.Name("Effect tick rate")
@Config.Comment("How frequently to check for and apply effects in ticks (performance sensitive)")
public static int TICK_RATE = 20;

@Config.Name("Protection item damage")
@Config.Comment("How much damage gets applied to the protection item per check")
public static int ITEM_DAMAGE = 1;

@Config.Name("Custom hot items")
@Config.Comment("Hot items that are included manually")
public static String[] HOT_ITEM_ADDITIONS = new String[] {"minecraft:blaze_rod"};
public static String[] CUSTOM_HOT_ITEMS = new String[] {"minecraft:blaze_rod"};

@Config.Name("Custom cold items")
@Config.Comment("Cold items that are included manually")
public static String[] COLD_ITEM_ADDITIONS = new String[] {"minecraft:ice", "minecraft:packed_ice"};
public static String[] CUSTOM_COLD_ITEMS = new String[] {"minecraft:ice", "minecraft:packed_ice"};

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

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

@SuppressWarnings("unused")
@Mod.EventBusSubscriber(modid = HotOrNot.MOD_ID)
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/buuz135/hotornot/config/HotLists.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ public class HotLists
{
public static boolean isHotFluid(FluidStack fluidStack)
{
return HotConfig.HOT_FLUIDS && fluidStack.getFluid().getTemperature(fluidStack) >= HotConfig.HOT_FLUID_TEMP + 273;
return HotConfig.HOT_FLUIDS && fluidStack.getFluid().getTemperature(fluidStack) >= HotConfig.TEMP_HOT_FLUID + 273;
}

public static boolean isColdFluid(FluidStack fluidStack)
{
return HotConfig.COLD_FLUIDS && fluidStack.getFluid().getTemperature(fluidStack) <= HotConfig.COLD_FLUID_TEMP + 273;
return HotConfig.COLD_FLUIDS && fluidStack.getFluid().getTemperature(fluidStack) <= HotConfig.TEMP_COLD_FLUID + 273;
}

public static boolean isGaseousFluid(FluidStack fluidStack)
Expand All @@ -23,7 +23,7 @@ public static boolean isGaseousFluid(FluidStack fluidStack)
public static boolean isRemovedItem(ItemStack stack)
{
String regName = stack.getItem().getRegistryName().toString();
for (String s : HotConfig.ITEM_REMOVALS)
for (String s : HotConfig.CUSTOM_REMOVALS)
{
if (regName.equals(s))
{
Expand All @@ -38,7 +38,7 @@ public static boolean isHotItem(ItemStack stack)
if (HotConfig.HOT_ITEMS)
{
String regName = stack.getItem().getRegistryName().toString();
for (String s : HotConfig.HOT_ITEM_ADDITIONS)
for (String s : HotConfig.CUSTOM_HOT_ITEMS)
{
if (regName.equals(s))
{
Expand All @@ -54,7 +54,7 @@ public static boolean isColdItem(ItemStack stack)
if (HotConfig.COLD_ITEMS)
{
String regName = stack.getItem().getRegistryName().toString();
for (String s : HotConfig.COLD_ITEM_ADDITIONS)
for (String s : HotConfig.CUSTOM_COLD_ITEMS)
{
if (regName.equals(s))
{
Expand All @@ -70,7 +70,7 @@ public static boolean isGaseousItem(ItemStack stack)
if (HotConfig.GASEOUS_ITEMS)
{
String regName = stack.getItem().getRegistryName().toString();
for (String s : HotConfig.GASEOUS_ITEM_ADDITIONS)
for (String s : HotConfig.CUSTOM_GASEOUS_ITEMS)
{
if (regName.equals(s))
{
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/buuz135/hotornot/item/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ModItems
{
public static List<Item> ITEMS = new ArrayList<>();

public static Item WOODEN_TONGS = new HotItem("wooden_tongs", HotConfig.WOODEN_TONGS_DURABILITY);
public static Item MITTS = new HotItem("mitts", HotConfig.MITTS_DURABILITY);
public static Item IRON_TONGS = new HotItem("iron_tongs", HotConfig.IRON_TONGS_DURABILITY);
public static Item WOODEN_TONGS = new HotItem("wooden_tongs", HotConfig.DURABILITY_WOODEN_TONGS);
public static Item MITTS = new HotItem("mitts", HotConfig.DURABILITY_MITTS);
public static Item IRON_TONGS = new HotItem("iron_tongs", HotConfig.DURABILITY_IRON_TONGS);
}
Loading

0 comments on commit 7f7acbe

Please sign in to comment.