Skip to content

Commit

Permalink
Reduce scope of increased default max values. Thanks to Shadows-of-Fire.
Browse files Browse the repository at this point in the history
* Reduce scope of increased default max values

* Reduce scope of increased default max values

---------

Co-authored-by: Brennan Ward <3682588+Shadows-of-Fire@users.noreply.github.com>
  • Loading branch information
Shadows-of-Fire and Shadows-of-Fire committed Jul 10, 2023
1 parent 169dd94 commit 9dd19ab
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package net.darkhax.attributefix.config;

import com.google.common.collect.ImmutableMap;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import net.darkhax.attributefix.Constants;
import net.darkhax.attributefix.mixin.AccessorRangedAttribute;
import net.darkhax.attributefix.temp.RegistryHelper;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.attributes.RangedAttribute;

import java.io.File;
Expand Down Expand Up @@ -140,6 +142,18 @@ else if (!registry.exists(attributeId)) {
return config;
}

/**
* Map of Attributes to new default values.<br>
* Any attribute not in this map will retain the declared default value, but can still be changed via config.
*/
private static final Map<Attribute, Double> NEW_DEFAULT_VALUES = ImmutableMap.of(
Attributes.MAX_HEALTH, 1_000_000D,
Attributes.ARMOR, 1_000_000D,
Attributes.ARMOR_TOUGHNESS, 1_000_000D,
Attributes.ATTACK_DAMAGE, 1_000_000D,
Attributes.ATTACK_KNOCKBACK, 1_000_000D
);

public static class Entry {

@Expose
Expand All @@ -155,7 +169,7 @@ public Entry(ResourceLocation id, RangedAttribute attribute) {

this.enabled = "minecraft".equals(id.getNamespace());
this.min = new DoubleValue(attribute.getMinValue(), attribute.getMinValue());
this.max = new DoubleValue(attribute.getMaxValue(), 10_000_000d);
this.max = new DoubleValue(attribute.getMaxValue(), NEW_DEFAULT_VALUES.getOrDefault(attribute, attribute.getMaxValue()));
}

public boolean isEnabled() {
Expand Down

0 comments on commit 9dd19ab

Please sign in to comment.