diff --git a/src/generated/resources/assets/malum/lang/en_us.json b/src/generated/resources/assets/malum/lang/en_us.json index 23cc0b8e9..b049b1212 100644 --- a/src/generated/resources/assets/malum/lang/en_us.json +++ b/src/generated/resources/assets/malum/lang/en_us.json @@ -250,8 +250,10 @@ "enchantment.malum.haunted.desc": "Deals extra magic damage.", "enchantment.malum.rebound": "Rebound", "enchantment.malum.rebound.desc": "Allows the item to be thrown much like a boomerang, cooldown decreases with tier.", + "enchantment.malum.replenishing": "Replenishing", "enchantment.malum.spirit_plunder": "Spirit Plunder", "enchantment.malum.spirit_plunder.desc": "Increases the amount of spirits created when shattering a soul.", + "entity.malum.auric_flame_bolt": "Auric Flame Bolt", "entity.malum.etheric_nitrate": "Etheric Nitrate", "entity.malum.hex_bolt": "Hex Bolt", "entity.malum.natural_spirit": "Natural Spirit", @@ -277,6 +279,7 @@ "item.malum.aro_prideweave": "Aro Prideweave", "item.malum.aroace_prideweave": "Aroace Prideweave", "item.malum.astral_weave": "Astral Weave", + "item.malum.belt_of_the_limitless": "Belt of the Limitless", "item.malum.belt_of_the_magebane": "Belt of the Magebane", "item.malum.belt_of_the_prospector": "Belt of the Prospector", "item.malum.belt_of_the_starved": "Belt of the Starved", @@ -379,6 +382,7 @@ "item.malum.ring_of_esoteric_spoils": "Ring of Esoteric Spoils", "item.malum.ring_of_growing_flesh": "Ring of Growing Flesh", "item.malum.ring_of_gruesome_satiation": "Ring of Gruesome Satiation", + "item.malum.ring_of_reinforcement": "Ring of Reinforcement", "item.malum.ring_of_the_demolitionist": "Ring of the Demolitionist", "item.malum.ring_of_the_hoarder": "Ring of the Hoarder", "item.malum.rotting_essence": "Rotting Essence", @@ -868,6 +872,7 @@ "malum.subtitle.arcane_rock_place": "Block placed", "malum.subtitle.arcane_rock_step": "Footsteps", "malum.subtitle.arcane_whispers": "Arcane whispers", + "malum.subtitle.auric_flame_motif": "Auric flame motif", "malum.subtitle.blazing_quartz_block_break": "Block broken", "malum.subtitle.blazing_quartz_block_hit": "Block breaking", "malum.subtitle.blazing_quartz_block_place": "Block placed", diff --git a/src/generated/resources/assets/malum/models/item/belt_of_the_limitless.json b/src/generated/resources/assets/malum/models/item/belt_of_the_limitless.json new file mode 100644 index 000000000..9f60d6098 --- /dev/null +++ b/src/generated/resources/assets/malum/models/item/belt_of_the_limitless.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "malum:item/belt_of_the_limitless" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/malum/models/item/ring_of_reinforcement.json b/src/generated/resources/assets/malum/models/item/ring_of_reinforcement.json new file mode 100644 index 000000000..2614deba6 --- /dev/null +++ b/src/generated/resources/assets/malum/models/item/ring_of_reinforcement.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "malum:item/ring_of_reinforcement" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/malum/tags/items/soul_hunter_weapon.json b/src/generated/resources/data/malum/tags/items/soul_hunter_weapon.json index 72bce95fb..5ed92eed2 100644 --- a/src/generated/resources/data/malum/tags/items/soul_hunter_weapon.json +++ b/src/generated/resources/data/malum/tags/items/soul_hunter_weapon.json @@ -1,6 +1,7 @@ { "values": [ "malum:soul_stained_steel_staff", + "malum:staff_of_the_auric_flame", "malum:tyrving", "malum:crude_scythe", "malum:soul_stained_steel_scythe", diff --git a/src/generated/resources/data/malum/tags/items/staff.json b/src/generated/resources/data/malum/tags/items/staff.json new file mode 100644 index 000000000..97dad0997 --- /dev/null +++ b/src/generated/resources/data/malum/tags/items/staff.json @@ -0,0 +1,6 @@ +{ + "values": [ + "malum:soul_stained_steel_staff", + "malum:staff_of_the_auric_flame" + ] +} \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/common/enchantment/HauntedEnchantment.java b/src/main/java/com/sammy/malum/common/enchantment/HauntedEnchantment.java index 03a4cdac5..decf9eb4f 100644 --- a/src/main/java/com/sammy/malum/common/enchantment/HauntedEnchantment.java +++ b/src/main/java/com/sammy/malum/common/enchantment/HauntedEnchantment.java @@ -1,16 +1,15 @@ package com.sammy.malum.common.enchantment; -import com.sammy.malum.registry.common.DamageTypeRegistry; -import com.sammy.malum.registry.common.item.EnchantmentRegistry; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.LivingEntity; +import com.sammy.malum.registry.common.item.*; +import net.minecraft.world.entity.*; import net.minecraft.world.entity.ai.attributes.*; import net.minecraft.world.item.*; -import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.*; import net.minecraftforge.event.*; import team.lodestar.lodestone.registry.common.*; +import java.util.*; + public class HauntedEnchantment extends Enchantment { public HauntedEnchantment() { super(Rarity.UNCOMMON, EnchantmentRegistry.SCYTHE_OR_STAFF, new EquipmentSlot[]{EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND}); @@ -21,8 +20,22 @@ public static void addMagicDamage(ItemAttributeModifierEvent event) { ItemStack itemStack = event.getItemStack(); int enchantmentLevel = itemStack.getEnchantmentLevel(EnchantmentRegistry.HAUNTED.get()); if (enchantmentLevel > 0) { - event.addModifier(LodestoneAttributeRegistry.MAGIC_DAMAGE.get(), - new AttributeModifier(LodestoneAttributeRegistry.UUIDS.get(LodestoneAttributeRegistry.MAGIC_DAMAGE), "Weapon magic damage", enchantmentLevel, AttributeModifier.Operation.ADDITION)); + UUID uuid = LodestoneAttributeRegistry.UUIDS.get(LodestoneAttributeRegistry.MAGIC_DAMAGE); + final Attribute magicDamage = LodestoneAttributeRegistry.MAGIC_DAMAGE.get(); + if (event.getOriginalModifiers().containsKey(magicDamage)) { + AttributeModifier attributeModifier = null; + if (event.getOriginalModifiers().get(magicDamage).size() > 0) { + attributeModifier = event.getOriginalModifiers().get(magicDamage).iterator().next(); + } + if (attributeModifier != null) { + final double amount = attributeModifier.getAmount() + enchantmentLevel; + AttributeModifier newMagicDamage = new AttributeModifier(uuid, "Weapon magic damage", amount, AttributeModifier.Operation.ADDITION); + event.removeAttribute(magicDamage); + event.addModifier(magicDamage, newMagicDamage); + } + } else { + event.addModifier(magicDamage, new AttributeModifier(uuid, "Weapon magic damage", enchantmentLevel, AttributeModifier.Operation.ADDITION)); + } } } } diff --git a/src/main/java/com/sammy/malum/common/enchantment/ReplenishingEnchantment.java b/src/main/java/com/sammy/malum/common/enchantment/ReplenishingEnchantment.java index a52e891ca..418613d65 100644 --- a/src/main/java/com/sammy/malum/common/enchantment/ReplenishingEnchantment.java +++ b/src/main/java/com/sammy/malum/common/enchantment/ReplenishingEnchantment.java @@ -1,9 +1,14 @@ package com.sammy.malum.common.enchantment; +import com.sammy.malum.common.item.curiosities.weapons.staff.*; import com.sammy.malum.registry.common.item.*; import net.minecraft.world.entity.*; +import net.minecraft.world.entity.player.*; +import net.minecraft.world.item.*; import net.minecraft.world.item.enchantment.*; +import java.util.*; + public class ReplenishingEnchantment extends Enchantment { public ReplenishingEnchantment() { super(Rarity.UNCOMMON, EnchantmentRegistry.STAFF, new EquipmentSlot[]{EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND}); @@ -14,4 +19,24 @@ public int getMaxLevel() { return 5; } + @Override + public void doPostAttack(LivingEntity pAttacker, Entity pTarget, int pLevel) { + if (pAttacker instanceof Player player) { + ItemStack stack = pAttacker.getMainHandItem(); + if (stack.getItem() instanceof AbstractStaffItem staff) { + ItemCooldowns cooldowns = player.getCooldowns(); + if (cooldowns.isOnCooldown(staff)) { + int ratio = (int) (staff.getCooldownDuration(player.level(), player) * (0.1f * pLevel)); + cooldowns.tickCount+=ratio; + for (Map.Entry itemCooldownInstanceEntry : cooldowns.cooldowns.entrySet()) { + if (itemCooldownInstanceEntry.getKey() == staff) continue; + ItemCooldowns.CooldownInstance value = itemCooldownInstanceEntry.getValue(); + ItemCooldowns.CooldownInstance cooldownInstance = new ItemCooldowns.CooldownInstance(value.startTime+ratio, value.endTime+ratio); + cooldowns.cooldowns.put(itemCooldownInstanceEntry.getKey(), cooldownInstance); + cooldowns.onCooldownStarted(itemCooldownInstanceEntry.getKey(), cooldownInstance); + } + } + } + } + } } \ No newline at end of file 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 0962bdae9..3a59a15dc 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 @@ -16,8 +16,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Tier; -import net.minecraft.world.item.enchantment.EnchantmentHelper; -import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.item.enchantment.*; import net.minecraftforge.event.entity.living.LivingHurtEvent; import team.lodestar.lodestone.helpers.CurioHelper; import team.lodestar.lodestone.registry.common.tag.*; @@ -76,4 +75,12 @@ public static ItemStack getScytheItemStack(DamageSource source, LivingEntity att } return stack.getItem() instanceof MalumScytheItem ? stack : ItemStack.EMPTY; } + + @Override + public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { + if (enchantment.equals(Enchantments.SWEEPING_EDGE)) { + return true; + } + return super.canApplyAtEnchantingTable(stack, enchantment); + } } \ 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 776e606a1..fc3782e85 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 @@ -5,6 +5,7 @@ import com.sammy.malum.core.systems.item.*; import com.sammy.malum.registry.client.*; import com.sammy.malum.registry.common.*; +import com.sammy.malum.registry.common.item.*; import net.minecraft.core.particles.*; import net.minecraft.server.level.*; import net.minecraft.sounds.*; @@ -51,8 +52,9 @@ public ImmutableMultimap.Builder createExtraAttrib @Override public void hurtEvent(LivingHurtEvent event, LivingEntity attacker, LivingEntity target, ItemStack stack) { if (attacker instanceof Player player && !(event.getSource().getDirectEntity() instanceof AbstractBoltProjectileEntity)) { + Level level = player.level(); spawnSweepParticles(player, ParticleRegistry.SCYTHE_CUT_ATTACK_PARTICLE.get()); - attacker.level().playSound(null, target.blockPosition(), SoundRegistry.STAFF_STRIKES.get(), attacker.getSoundSource(), 0.75f, Mth.nextFloat(attacker.level().random, 0.5F, 1F)); + level.playSound(null, target.blockPosition(), SoundRegistry.STAFF_STRIKES.get(), attacker.getSoundSource(), 0.75f, Mth.nextFloat(level.random, 0.5F, 1F)); } } diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/AuricFlameStaffItem.java b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/AuricFlameStaffItem.java index 7ffba7199..1eea06327 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/AuricFlameStaffItem.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/AuricFlameStaffItem.java @@ -58,7 +58,7 @@ public void spawnChargeParticles(Level pLevel, LivingEntity pLivingEntity, Vec3 @Override public int getCooldownDuration(Level level, LivingEntity livingEntity) { - return 80; + return 160; } @Override diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/HexStaffItem.java b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/HexStaffItem.java index 294443ec0..31d6bdfe7 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/HexStaffItem.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/staff/HexStaffItem.java @@ -48,7 +48,7 @@ public void spawnChargeParticles(Level pLevel, LivingEntity pLivingEntity, Vec3 @Override public int getCooldownDuration(Level level, LivingEntity livingEntity) { - return 40; + return 80; } @Override diff --git a/src/main/java/com/sammy/malum/mixin/ItemStackMixin.java b/src/main/java/com/sammy/malum/mixin/ItemStackMixin.java index fe63bb3af..b58339991 100644 --- a/src/main/java/com/sammy/malum/mixin/ItemStackMixin.java +++ b/src/main/java/com/sammy/malum/mixin/ItemStackMixin.java @@ -40,16 +40,7 @@ public abstract class ItemStackMixin { double amount = modifier.getAmount(); if (modifier.getId() != null) { - if (modifier.getId().equals(LodestoneAttributeRegistry.UUIDS.get(LodestoneAttributeRegistry.MAGIC_DAMAGE))) { - int enchantmentLevel = EnchantmentHelper.getItemEnchantmentLevel(EnchantmentRegistry.HAUNTED.get(), (ItemStack) (Object) this); - if (enchantmentLevel > 0) { - amount += enchantmentLevel; - } - - copied.put(key, new AttributeModifier( - modifier.getId(), modifier.getName(), amount, modifier.getOperation() - )); - } else if (modifier.getId().equals(BASE_ATTACK_DAMAGE_UUID) && getItem() instanceof MalumScytheItem) { + if (modifier.getId().equals(BASE_ATTACK_DAMAGE_UUID) && getItem() instanceof MalumScytheItem) { AttributeInstance instance = player.getAttribute(AttributeRegistry.SCYTHE_PROFICIENCY.get()); if (instance != null && instance.getValue() > 0) { amount += instance.getValue() * 0.5f; diff --git a/src/main/java/com/sammy/malum/registry/common/item/EnchantmentRegistry.java b/src/main/java/com/sammy/malum/registry/common/item/EnchantmentRegistry.java index 00658680d..f1d13c8af 100644 --- a/src/main/java/com/sammy/malum/registry/common/item/EnchantmentRegistry.java +++ b/src/main/java/com/sammy/malum/registry/common/item/EnchantmentRegistry.java @@ -1,9 +1,7 @@ package com.sammy.malum.registry.common.item; import com.sammy.malum.MalumMod; -import com.sammy.malum.common.enchantment.HauntedEnchantment; -import com.sammy.malum.common.enchantment.ReboundEnchantment; -import com.sammy.malum.common.enchantment.SpiritPlunderEnchantment; +import com.sammy.malum.common.enchantment.*; import com.sammy.malum.config.CommonConfig; import net.minecraft.world.item.TieredItem; import net.minecraft.world.item.enchantment.Enchantment; @@ -24,5 +22,6 @@ public class EnchantmentRegistry { public static final RegistryObject REBOUND = ENCHANTMENTS.register("rebound", ReboundEnchantment::new); public static final RegistryObject HAUNTED = ENCHANTMENTS.register("haunted", HauntedEnchantment::new); public static final RegistryObject SPIRIT_PLUNDER = ENCHANTMENTS.register("spirit_plunder", SpiritPlunderEnchantment::new); + public static final RegistryObject REPLENISHING = ENCHANTMENTS.register("replenishing", ReplenishingEnchantment::new); } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 9fecf2d20..b0dfe68c8 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -132,4 +132,18 @@ public net.minecraft.world.item.ArmorItem f_265987_ public net.minecraft.world.item.ArmorItem f_265987_ # ARMOR_MODIFIER_UUID_PER_TYPE -public-f net.minecraft.data.recipes.RecipeProvider m_6055_()Ljava/lang/String; # getName \ No newline at end of file +public-f net.minecraft.data.recipes.RecipeProvider m_6055_()Ljava/lang/String; # getName + +public net.minecraft.world.item.ItemCooldowns f_41515_ # cooldowns + +public net.minecraft.world.item.ItemCooldowns$CooldownInstance + +public net.minecraft.world.item.ItemCooldowns$CooldownInstance (II)V # constructor + +public net.minecraft.world.item.ItemCooldowns$CooldownInstance f_41533_ # startTime + +public net.minecraft.world.item.ItemCooldowns$CooldownInstance f_41534_ # endTime + +public net.minecraft.world.item.ItemCooldowns f_41516_ # tickCount + +public net.minecraft.world.item.ItemCooldowns m_6899_(Lnet/minecraft/world/item/Item;I)V # onCooldownStarted \ No newline at end of file diff --git a/src/main/resources/assets/malum/textures/item/belt_of_the_limitless.png b/src/main/resources/assets/malum/textures/item/belt_of_the_limitless.png new file mode 100644 index 000000000..0988b82da Binary files /dev/null and b/src/main/resources/assets/malum/textures/item/belt_of_the_limitless.png differ