Skip to content

Commit

Permalink
Optional Enchantments, Thirst Saturation Default
Browse files Browse the repository at this point in the history
Default thirst saturation fixed to match TAN #21
Enchantments can now be unregistered
  • Loading branch information
Charles445 committed Jan 12, 2022
1 parent 54c0090 commit 56354e5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class ThirstCapability implements IThirstCapability
{
private float exhaustion = 0.0f;
private int thirst = 20;
private float saturation = 0.0f;
private float saturation = 5.0f;
private int ticktimer = 0;
private int damagecounter = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ public class ConfigMiscellaneous
@Config.RangeInt(min=1)
public int rainCollectorFillChance = 6;

@Config.Comment("Whether to register the cooling and heating enchantments")
@Config.Name("RegisterEnchantments")
@Config.RequiresMcRestart
public boolean registerEnchantments = true;

@Config.Comment("Duration of short heat/cold resistance potions, in ticks")
@Config.Name("ResistancePotionDurationShort")
@Config.RequiresMcRestart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.charles445.simpledifficulty.api.SDEnchantments.*;

import com.charles445.simpledifficulty.SimpleDifficulty;
import com.charles445.simpledifficulty.config.ModConfig;
import com.charles445.simpledifficulty.enchantment.EnchantmentArmorTemperature;

import net.minecraft.enchantment.Enchantment;
Expand Down Expand Up @@ -30,7 +31,9 @@ private static Enchantment registerAs(String name, final Enchantment newEnchantm
{
newEnchantment.setName(name);
newEnchantment.setRegistryName(SimpleDifficulty.MODID,name);
registry.register(newEnchantment);

if(ModConfig.server.miscellaneous.registerEnchantments)
registry.register(newEnchantment);

//Add to map
enchantments.put(name, newEnchantment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ private float checkArmorSlot(ItemStack stack)
float sum = 0.0f;

//Enchantments
if(EnchantmentHelper.getEnchantmentLevel(SDEnchantments.chilling, stack) > 0)
if(ModConfig.server.miscellaneous.registerEnchantments)
{
sum -= ModConfig.server.temperature.enchantmentTemperature;
}
else if(EnchantmentHelper.getEnchantmentLevel(SDEnchantments.heating, stack) > 0)
{
sum += ModConfig.server.temperature.enchantmentTemperature;
if(EnchantmentHelper.getEnchantmentLevel(SDEnchantments.chilling, stack) > 0)
{
sum -= ModConfig.server.temperature.enchantmentTemperature;
}
else if(EnchantmentHelper.getEnchantmentLevel(SDEnchantments.heating, stack) > 0)
{
sum += ModConfig.server.temperature.enchantmentTemperature;
}
}

//Process JSON
Expand Down

0 comments on commit 56354e5

Please sign in to comment.