Skip to content

Commit

Permalink
[fix] Small fixes
Browse files Browse the repository at this point in the history
- Adds `#c:armor` to `#playerex:armor`
- Makes ranged weapons actually work
  • Loading branch information
naomieow committed Dec 14, 2024
1 parent 3706c04 commit f25f562
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.llamalad7.mixinextras.sugar.Local;
import net.fabric_extras.ranged_weapon.api.EntityAttributes_RangedWeapon;
import net.minecraft.ChatFormatting;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.TagKey;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
Expand Down Expand Up @@ -111,6 +115,9 @@ public void modifyAttributeModifiers(EquipmentSlot slot, CallbackInfoReturnable<
HashMultimap<Attribute, AttributeModifier> hashmap = HashMultimap.create(cir.getReturnValue());
if (PlayerEX.CONFIG.getWeaponLevelingSettings().getEnabled() && PlayerEXUtil.isWeapon(stack)) {
PlayerEXUtil.addToModifier(hashmap, Attributes.ATTACK_DAMAGE, getLevel() * PlayerEX.CONFIG.getWeaponLevelingSettings().getDamagePerLevel());
if (stack.is(TagKey.create(Registries.ITEM, ResourceLocation.tryBuild("c", "bows")))) {
PlayerEXUtil.addToModifier(hashmap, EntityAttributes_RangedWeapon.DAMAGE.attribute, getLevel() * PlayerEX.CONFIG.getWeaponLevelingSettings().getDamagePerLevel());
}
}
if (PlayerEX.CONFIG.getArmorLevelingSettings().getEnabled() && PlayerEXUtil.isArmor(stack)) {
PlayerEXUtil.addToModifier(hashmap, Attributes.ARMOR, getLevel() * PlayerEX.CONFIG.getArmorLevelingSettings().getArmorPerLevel());
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/data/playerex/tags/items/armor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"replace": false,
"values": [
{
"id": "#c:armor",
"required": false
},
"minecraft:leather_helmet",
"minecraft:leather_chestplate",
"minecraft:leather_leggings",
Expand Down

0 comments on commit f25f562

Please sign in to comment.