-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+Added Chinese translation. +Armor type Relics can now be repaired with Relic Shards. +Armor type Relics can now be affixed to chestplates and helmets: equip a chestplate/helmet, then shift-right click whilst holding a Relic. Note that this cannot be undone and this can only be done once per armor piece. *Item sounds for the Orbs of Regret and Tomes are now volume controlled by PlayerEx client config. *Updated Fabric Loader/API versions.
- Loading branch information
1 parent
4a4a397
commit 6584561
Showing
12 changed files
with
241 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/java/com/github/clevernucleus/relicex/mixin/ArmorItemMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.github.clevernucleus.relicex.mixin; | ||
|
||
import java.util.List; | ||
|
||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import com.github.clevernucleus.dataattributes.api.item.ItemHelper; | ||
import com.github.clevernucleus.relicex.impl.EntityAttributeCollection; | ||
import com.github.clevernucleus.relicex.impl.Rareness; | ||
import com.google.common.collect.ArrayListMultimap; | ||
import com.google.common.collect.Multimap; | ||
|
||
import net.fabricmc.fabric.api.util.NbtType; | ||
import net.minecraft.client.item.TooltipContext; | ||
import net.minecraft.entity.EquipmentSlot; | ||
import net.minecraft.entity.attribute.EntityAttribute; | ||
import net.minecraft.entity.attribute.EntityAttributeModifier; | ||
import net.minecraft.entity.attribute.EntityAttributes; | ||
import net.minecraft.item.ArmorItem; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NbtCompound; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.world.World; | ||
|
||
@Mixin(ArmorItem.class) | ||
abstract class ArmorItemMixin extends Item implements ItemHelper { | ||
|
||
@Shadow | ||
@Final | ||
protected EquipmentSlot slot; | ||
|
||
@Shadow | ||
@Final | ||
private Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers; | ||
|
||
private ArmorItemMixin(Settings settings) { super(settings); } | ||
|
||
@Override | ||
public void appendTooltip(ItemStack stack, World world, List<Text> tooltip, TooltipContext context) { | ||
NbtCompound tag = stack.getNbt(); | ||
|
||
if(tag == null || !tag.contains(EntityAttributeCollection.KEY_RARENESS, NbtType.STRING)) return; | ||
Rareness rareness = Rareness.fromKey(tag.getString(EntityAttributeCollection.KEY_RARENESS)); | ||
tooltip.add(rareness.formatted()); | ||
} | ||
|
||
@Override | ||
public Multimap<EntityAttribute, EntityAttributeModifier> getAttributeModifiers(ItemStack stack, EquipmentSlot slot) { | ||
NbtCompound tag = stack.getOrCreateNbt(); | ||
Multimap<EntityAttribute, EntityAttributeModifier> modifiers = ArrayListMultimap.create(); | ||
EntityAttributeCollection.readFromNbt(tag, this.slot.getName(), modifiers, this.attributeModifiers); | ||
|
||
return slot == this.slot ? (modifiers.isEmpty() ? this.attributeModifiers : modifiers) : super.getAttributeModifiers(stack, slot); | ||
} | ||
|
||
@Override | ||
public int getProtection(ItemStack itemStack) { | ||
return (int)EntityAttributeCollection.getValueIfArmor(itemStack.getOrCreateNbt(), EntityAttributes.GENERIC_ARMOR, ((ArmorItem)(Object)this).getProtection()); | ||
} | ||
|
||
@Override | ||
public float getToughness(ItemStack itemStack) { | ||
return (int)EntityAttributeCollection.getValueIfArmor(itemStack.getOrCreateNbt(), EntityAttributes.GENERIC_ARMOR_TOUGHNESS, ((ArmorItem)(Object)this).getToughness()); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/github/clevernucleus/relicex/mixin/RepairItemRecipeMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.github.clevernucleus.relicex.mixin; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
import com.github.clevernucleus.relicex.item.ArmorRelicItem; | ||
|
||
import net.minecraft.item.Item; | ||
import net.minecraft.recipe.RepairItemRecipe; | ||
|
||
@Mixin(RepairItemRecipe.class) | ||
abstract class RepairItemRecipeMixin { | ||
|
||
@Redirect(method = "matches", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isDamageable()Z")) | ||
private boolean relicex_matches(Item item) { | ||
return item instanceof ArmorRelicItem ? false : item.isDamageable(); | ||
} | ||
} |
Oops, something went wrong.