Skip to content

Commit

Permalink
The earth has taken on a horrifying new rotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Dec 11, 2023
1 parent 87ccc0a commit 4e9313a
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 27 deletions.
5 changes: 5 additions & 0 deletions src/generated/resources/assets/malum/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "malum:item/belt_of_the_limitless"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "malum:item/ring_of_reinforcement"
}
}
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 6 additions & 0 deletions src/generated/resources/data/malum/tags/items/staff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"malum:soul_stained_steel_staff",
"malum:staff_of_the_auric_flame"
]
}
Original file line number Diff line number Diff line change
@@ -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});
Expand All @@ -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));
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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});
Expand All @@ -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<Item, ItemCooldowns.CooldownInstance> 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);
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -51,8 +52,9 @@ public ImmutableMultimap.Builder<Attribute, AttributeModifier> 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));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 1 addition & 10 deletions src/main/java/com/sammy/malum/mixin/ItemStackMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -24,5 +22,6 @@ public class EnchantmentRegistry {
public static final RegistryObject<Enchantment> REBOUND = ENCHANTMENTS.register("rebound", ReboundEnchantment::new);
public static final RegistryObject<Enchantment> HAUNTED = ENCHANTMENTS.register("haunted", HauntedEnchantment::new);
public static final RegistryObject<Enchantment> SPIRIT_PLUNDER = ENCHANTMENTS.register("spirit_plunder", SpiritPlunderEnchantment::new);
public static final RegistryObject<Enchantment> REPLENISHING = ENCHANTMENTS.register("replenishing", ReplenishingEnchantment::new);

}
16 changes: 15 additions & 1 deletion src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 <init>(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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4e9313a

Please sign in to comment.