diff --git a/gradle.properties b/gradle.properties index 080508924..6ec2d6a95 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,7 @@ mod_authors=Sammy Semicolon mod_description=A dark magic mod focused on soul and spirit magic. # Mandatory -lodestone_version=1.7.0.101 +lodestone_version=1.7.0.103 curios_version=9.0.15+1.21.1 # Iron's Spellbooks diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/armor/MalignantStrongholdArmorItem.java b/src/main/java/com/sammy/malum/common/item/curiosities/armor/MalignantStrongholdArmorItem.java index 9a6599fce..324558feb 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/armor/MalignantStrongholdArmorItem.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/armor/MalignantStrongholdArmorItem.java @@ -32,7 +32,9 @@ public MalignantStrongholdArmorItem(Type slot, Properties builder) { @Override public List createExtraAttributes() { ItemAttributeModifiers.Builder attributes = ItemAttributeModifiers.builder(); - attributes.add(AttributeRegistry.MALIGNANT_CONVERSION, new AttributeModifier(MalumMod.malumPath("malignant_conversion"), 0.25f, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.ARMOR); + attributes.add(AttributeRegistry.MALIGNANT_CONVERSION, + new AttributeModifier(MalumMod.malumPath("malignant_conversion"), 0.25f, AttributeModifier.Operation.ADD_VALUE), + EquipmentSlotGroup.bySlot(getEquipmentSlot())); return attributes.build().modifiers(); } diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/armor/SoulHunterArmorItem.java b/src/main/java/com/sammy/malum/common/item/curiosities/armor/SoulHunterArmorItem.java index d02034f61..b353cb80e 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/armor/SoulHunterArmorItem.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/armor/SoulHunterArmorItem.java @@ -34,11 +34,12 @@ public SoulHunterArmorItem(ArmorItem.Type slot, Properties builder) { @Override public List createExtraAttributes() { + var group = EquipmentSlotGroup.bySlot(getEquipmentSlot()); ItemAttributeModifiers.Builder attributes = ItemAttributeModifiers.builder(); attributes.add(LodestoneAttributes.MAGIC_PROFICIENCY, new AttributeModifier(MalumMod.malumPath("magic_proficiency"), 0.15f, AttributeModifier.Operation.ADD_MULTIPLIED_BASE), - EquipmentSlotGroup.ARMOR); - IronsSpellsCompat.addSoulHunterSpellPower(attributes); + group); + IronsSpellsCompat.addSoulHunterSpellPower(attributes, group); return attributes.build().modifiers(); } diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/armor/SoulStainedSteelArmorItem.java b/src/main/java/com/sammy/malum/common/item/curiosities/armor/SoulStainedSteelArmorItem.java index 0e8c231b6..b454fbf1e 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/armor/SoulStainedSteelArmorItem.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/armor/SoulStainedSteelArmorItem.java @@ -19,16 +19,17 @@ public SoulStainedSteelArmorItem(ArmorItem.Type slot, Properties builder) { @Override public List createExtraAttributes() { + final EquipmentSlotGroup group = EquipmentSlotGroup.bySlot(getEquipmentSlot()); return List.of( new ItemAttributeModifiers.Entry( AttributeRegistry.SOUL_WARD_CAPACITY, new AttributeModifier(MalumMod.malumPath("soul_ward_cap"), 3f, AttributeModifier.Operation.ADD_VALUE), - EquipmentSlotGroup.ARMOR), + group), new ItemAttributeModifiers.Entry( AttributeRegistry.SOUL_WARD_RECOVERY_RATE, new AttributeModifier(MalumMod.malumPath("soul_ward_recovery"), 0.15f, AttributeModifier.Operation.ADD_MULTIPLIED_BASE), - EquipmentSlotGroup.ARMOR) + group) ); } @Override diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/scythe/MagicScytheItem.java b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/scythe/MagicScytheItem.java index 974df7ab7..ffb023d3f 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/scythe/MagicScytheItem.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/scythe/MagicScytheItem.java @@ -1,13 +1,13 @@ package com.sammy.malum.common.item.curiosities.weapons.scythe; -import com.google.common.collect.ImmutableMultimap; import com.sammy.malum.common.item.*; import com.sammy.malum.core.systems.spirit.*; import com.sammy.malum.registry.common.*; -import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.item.Tier; -import team.lodestar.lodestone.registry.common.LodestoneAttributes; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.ai.attributes.*; +import net.minecraft.world.item.*; +import net.minecraft.world.item.component.*; +import team.lodestar.lodestone.registry.common.*; public class MagicScytheItem extends MalumScytheItem implements ISpiritAffiliatedItem { @@ -19,15 +19,9 @@ public MagicScytheItem(Tier tier, float attackDamageIn, float attackSpeedIn, flo } @Override - public ImmutableMultimap.Builder createExtraAttributes() { - ImmutableMultimap.Builder builder = new ImmutableMultimap.Builder<>(); - builder.put( - LodestoneAttributes.MAGIC_DAMAGE.get(), - new AttributeModifier( - LodestoneAttributes.MAGIC_DAMAGE.getId(), - magicDamage, - AttributeModifier.Operation.ADD_VALUE) - ); + public ItemAttributeModifiers.Builder createExtraAttributes() { + var builder = ItemAttributeModifiers.builder(); + builder.add(LodestoneAttributes.MAGIC_DAMAGE, new AttributeModifier(LodestoneAttributes.MAGIC_DAMAGE.getId(), magicDamage, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND); return builder; } diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/scythe/MalumScytheItem.java b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/scythe/MalumScytheItem.java index bccab5218..6685fe308 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/scythe/MalumScytheItem.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/scythe/MalumScytheItem.java @@ -9,6 +9,7 @@ import net.minecraft.sounds.*; import net.minecraft.util.*; import net.minecraft.world.*; +import net.minecraft.world.damagesource.*; import net.minecraft.world.entity.*; import net.minecraft.world.entity.player.*; import net.minecraft.world.item.*; @@ -92,4 +93,10 @@ public static boolean canSweep(LivingEntity attacker) { !CurioHelper.hasCurioEquipped(attacker, ItemRegistry.NECKLACE_OF_THE_HIDDEN_BLADE.get()); } + public static DamageSource replaceDamageSource(Player player, DamageSource source) { + if (player.getMainHandItem().is(ItemTagRegistry.SCYTHE)) { + return DamageTypeHelper.create(player.level(), DamageTypeRegistry.SCYTHE_MELEE, player); + } + return source; + } } \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/AbstractStaffItem.java b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/AbstractStaffItem.java index 15d5b403a..94fce18f8 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/AbstractStaffItem.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/AbstractStaffItem.java @@ -1,6 +1,5 @@ package com.sammy.malum.common.item.curiosities.weapons.staff; -import com.google.common.collect.*; import com.sammy.malum.common.item.*; import com.sammy.malum.core.handlers.enchantment.*; import com.sammy.malum.registry.client.*; @@ -16,13 +15,13 @@ import net.minecraft.world.entity.ai.attributes.*; import net.minecraft.world.entity.player.*; import net.minecraft.world.item.*; +import net.minecraft.world.item.component.*; import net.minecraft.world.level.*; import net.minecraft.world.phys.*; -import net.neoforged.api.distmarker.Dist; -import net.neoforged.api.distmarker.OnlyIn; -import net.neoforged.neoforge.event.entity.living.LivingDamageEvent; +import net.neoforged.api.distmarker.*; +import net.neoforged.neoforge.event.entity.living.*; import team.lodestar.lodestone.helpers.*; -import team.lodestar.lodestone.registry.common.LodestoneAttributes; +import team.lodestar.lodestone.registry.common.*; import team.lodestar.lodestone.registry.common.tag.*; import team.lodestar.lodestone.systems.item.*; @@ -49,9 +48,9 @@ public AbstractStaffItem(Tier tier, int chargeDuration, float magicDamage, Prope public abstract void fireProjectile(LivingEntity player, ItemStack stack, Level level, InteractionHand hand, float chargePercentage, int count); @Override - public ImmutableMultimap.Builder createExtraAttributes() { - ImmutableMultimap.Builder builder = new ImmutableMultimap.Builder<>(); - builder.put(LodestoneAttributes.MAGIC_DAMAGE.get(), new AttributeModifier(LodestoneAttributes.MAGIC_DAMAGE.getId(), magicDamage, AttributeModifier.Operation.ADD_VALUE)); + public ItemAttributeModifiers.Builder createExtraAttributes() { + var builder = ItemAttributeModifiers.builder(); + builder.add(LodestoneAttributes.MAGIC_DAMAGE, new AttributeModifier(LodestoneAttributes.MAGIC_DAMAGE.getId(), magicDamage, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND); return builder; } @@ -75,7 +74,6 @@ public void releaseUsing(ItemStack pStack, Level pLevel, LivingEntity pLivingEnt if (projectileCount > 0) { InteractionHand hand = pLivingEntity.getUsedItemHand(); if (!pLevel.isClientSide) { - float magicDamage = (float) pLivingEntity.getAttributes().getValue(LodestoneAttributes.MAGIC_DAMAGE); if (magicDamage == 0) { float pitch = Mth.nextFloat(pLevel.random, 0.5f, 0.8f); diff --git a/src/main/java/com/sammy/malum/compability/irons_spellbooks/IronsSpellsCompat.java b/src/main/java/com/sammy/malum/compability/irons_spellbooks/IronsSpellsCompat.java index 3faf0faad..3ad5ef9c9 100644 --- a/src/main/java/com/sammy/malum/compability/irons_spellbooks/IronsSpellsCompat.java +++ b/src/main/java/com/sammy/malum/compability/irons_spellbooks/IronsSpellsCompat.java @@ -1,30 +1,27 @@ package com.sammy.malum.compability.irons_spellbooks; -import com.google.common.collect.Multimap; -import com.sammy.malum.MalumMod; +import com.google.common.collect.*; +import com.sammy.malum.*; import com.sammy.malum.common.effect.*; -import com.sammy.malum.common.item.curiosities.curios.MalumCurioItem; +import com.sammy.malum.common.item.curiosities.curios.*; import com.sammy.malum.config.*; -import com.sammy.malum.core.handlers.*; import com.sammy.malum.registry.common.*; -import com.sammy.malum.registry.common.item.EnchantmentRegistry; +import com.sammy.malum.registry.common.item.*; import io.redspace.ironsspellbooks.api.events.*; import io.redspace.ironsspellbooks.api.magic.*; -import io.redspace.ironsspellbooks.item.weapons.*; -import net.minecraft.core.Holder; +import net.minecraft.core.*; import net.minecraft.server.level.*; -import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EquipmentSlotGroup; +import net.minecraft.world.damagesource.*; +import net.minecraft.world.entity.*; import net.minecraft.world.entity.ai.attributes.*; import net.minecraft.world.entity.player.*; import net.minecraft.world.item.*; -import net.minecraft.world.item.component.ItemAttributeModifiers; -import net.neoforged.fml.ModList; -import net.neoforged.neoforge.common.NeoForge; -import net.neoforged.neoforge.event.entity.living.LivingDamageEvent; +import net.minecraft.world.item.component.*; +import net.neoforged.fml.*; +import net.neoforged.neoforge.common.*; +import net.neoforged.neoforge.event.entity.living.*; -import static com.sammy.malum.registry.common.item.EnchantmentRegistry.getEnchantmentLevel; +import static com.sammy.malum.registry.common.item.EnchantmentRegistry.*; public class IronsSpellsCompat { @@ -53,9 +50,9 @@ public static void recoverSpellCooldowns(ServerPlayer serverPlayer, int enchantm LoadedOnly.recoverSpellCooldowns(serverPlayer, enchantmentLevel); } } - public static void addSoulHunterSpellPower(ItemAttributeModifiers.Builder attributes) { + public static void addSoulHunterSpellPower(ItemAttributeModifiers.Builder attributes, EquipmentSlotGroup group) { if (LOADED) { - LoadedOnly.addSoulHunterSpellPower(attributes); + LoadedOnly.addSoulHunterSpellPower(attributes, group); } } public static void addSpellPowerToCurio(MalumCurioItem item, Multimap, AttributeModifier> map, float amount) { @@ -118,10 +115,10 @@ public static void recoverSpellCooldowns(ServerPlayer serverPlayer, float amount cooldowns.syncToPlayer(serverPlayer); } - public static void addSoulHunterSpellPower(ItemAttributeModifiers.Builder attributes) { + public static void addSoulHunterSpellPower(ItemAttributeModifiers.Builder attributes, EquipmentSlotGroup group) { attributes.add(io.redspace.ironsspellbooks.api.registry.AttributeRegistry.SPELL_POWER, new AttributeModifier(MalumMod.malumPath("spell_power"), 0.1f, AttributeModifier.Operation.ADD_MULTIPLIED_BASE), - EquipmentSlotGroup.ARMOR); + group); } public static void addSpellPowerToCurio(MalumCurioItem item, Multimap, AttributeModifier> map, float amount) { diff --git a/src/main/java/com/sammy/malum/mixin/PlayerMixin.java b/src/main/java/com/sammy/malum/mixin/PlayerMixin.java index 008d59073..93d882345 100644 --- a/src/main/java/com/sammy/malum/mixin/PlayerMixin.java +++ b/src/main/java/com/sammy/malum/mixin/PlayerMixin.java @@ -1,19 +1,17 @@ package com.sammy.malum.mixin; import com.sammy.malum.common.effect.aura.*; -import com.sammy.malum.registry.common.*; -import com.sammy.malum.registry.common.item.*; +import com.sammy.malum.common.item.curiosities.weapons.scythe.*; import net.minecraft.world.damagesource.*; import net.minecraft.world.entity.player.*; import net.minecraft.world.phys.*; import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.*; -import team.lodestar.lodestone.helpers.*; @Mixin(Player.class) -public class PlayerMixin { +public abstract class PlayerMixin { - @ModifyArg(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getEntities(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/AABB;)Ljava/util/List;"), index = 1) + @ModifyArg(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getEntities(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/AABB;)Ljava/util/List;")) private AABB malum$aiStep(AABB aabb) { Player player = (Player) (Object) this; return AqueousAura.growBoundingBox(player, aabb); @@ -22,9 +20,6 @@ public class PlayerMixin { @ModifyArg(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;hurt(Lnet/minecraft/world/damagesource/DamageSource;F)Z")) private DamageSource malum$attack(DamageSource pSource) { Player player = (Player) (Object) this; - if (player.getMainHandItem().is(ItemTagRegistry.SCYTHE)) { - return DamageTypeHelper.create(player.level(), DamageTypeRegistry.SCYTHE_MELEE, player); - } - return pSource; + return MalumScytheItem.replaceDamageSource(player, pSource); } }