Skip to content

Commit

Permalink
Porting Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Dec 9, 2024
1 parent 6c2bd49 commit 20c039e
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 57 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public MalignantStrongholdArmorItem(Type slot, Properties builder) {
@Override
public List<ItemAttributeModifiers.Entry> 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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ public SoulHunterArmorItem(ArmorItem.Type slot, Properties builder) {

@Override
public List<ItemAttributeModifiers.Entry> 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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ public SoulStainedSteelArmorItem(ArmorItem.Type slot, Properties builder) {

@Override
public List<ItemAttributeModifiers.Entry> 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -19,15 +19,9 @@ public MagicScytheItem(Tier tier, float attackDamageIn, float attackSpeedIn, flo
}

@Override
public ImmutableMultimap.Builder<Attribute, AttributeModifier> createExtraAttributes() {
ImmutableMultimap.Builder<Attribute, AttributeModifier> 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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.*;
Expand All @@ -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.*;

Expand All @@ -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<Attribute, AttributeModifier> createExtraAttributes() {
ImmutableMultimap.Builder<Attribute, AttributeModifier> 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;
}

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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<Holder<Attribute>, AttributeModifier> map, float amount) {
Expand Down Expand Up @@ -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<Holder<Attribute>, AttributeModifier> map, float amount) {
Expand Down
13 changes: 4 additions & 9 deletions src/main/java/com/sammy/malum/mixin/PlayerMixin.java
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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);
}
}

0 comments on commit 20c039e

Please sign in to comment.