Skip to content

Commit

Permalink
Dreaded Magic Damage Type Tag
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Nov 27, 2023
1 parent 08063ad commit e7f5074
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ modAuthors=Sammy Semicolon
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
modDescription=A dark magic mod focused on soul and spirit magic.
# Mod Dependency Versions
lodestoneVersion=1.4.2.36
lodestoneVersion=1.4.2.37
jeiVersion=15.2.0.22
curiosVersion=5.4.0+1.20.1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.world.level.Level;
import net.minecraftforge.event.entity.living.LivingDamageEvent;
import team.lodestar.lodestone.helpers.ColorHelper;
import team.lodestar.lodestone.registry.common.tag.*;

public class WickedIntentEffect extends MobEffect {
public WickedIntentEffect() {
Expand All @@ -24,7 +25,7 @@ public WickedIntentEffect() {

public static void removeWickedIntent(LivingDamageEvent event) {
DamageSource source = event.getSource();
if (source.is(DamageTypes.MAGIC) || (source.is(DamageTypes.THORNS))) {
if (source.is(LodestoneDamageTypeTags.IS_MAGIC) || (source.is(DamageTypes.THORNS))) {
return;
}
if (source.getEntity() instanceof LivingEntity livingEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import team.lodestar.lodestone.registry.common.tag.*;
import top.theillusivec4.curios.api.SlotContext;

public class CurioMagebaneBelt extends MalumCurioItem implements IMalumEventResponderItem {
Expand All @@ -26,7 +27,7 @@ public void onSoulwardAbsorbDamage(LivingHurtEvent event, Player wardedPlayer, I
DamageSource source = event.getSource();
if (source.getEntity() != null) {
if (true) {
if (source.is(DamageTypes.MAGIC) && !source.is(DamageTypes.THORNS)) {
if (source.is(LodestoneDamageTypeTags.IS_MAGIC) && !source.is(DamageTypes.THORNS)) {
SoulWardHandler handler = MalumPlayerDataCapability.getCapability(wardedPlayer).soulWardHandler;
handler.soulWardProgress = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import team.lodestar.lodestone.helpers.CurioHelper;
import team.lodestar.lodestone.registry.common.tag.*;
import team.lodestar.lodestone.systems.item.ModCombatItem;

public class MalumScytheItem extends ModCombatItem implements IMalumEventResponderItem {
Expand All @@ -45,7 +46,7 @@ public void hurtEvent(LivingHurtEvent event, LivingEntity attacker, LivingEntity
attacker.level().playSound(null, target.getX(), target.getY(), target.getZ(), sound, attacker.getSoundSource(), 1, 1);
}

if (!canSweep || event.getSource().is(DamageTypes.MAGIC) || event.getSource().getMsgId().equals(DamageSourceRegistry.SCYTHE_SWEEP_IDENTIFIER)) {
if (!canSweep || event.getSource().is(LodestoneDamageTypeTags.IS_MAGIC) || event.getSource().getMsgId().equals(DamageSourceRegistry.SCYTHE_SWEEP_IDENTIFIER)) {
return;
}
int level = EnchantmentHelper.getEnchantmentLevel(Enchantments.SWEEPING_EDGE, attacker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraftforge.common.ToolActions;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.network.PacketDistributor;
import team.lodestar.lodestone.registry.common.tag.*;
import team.lodestar.lodestone.systems.item.tools.LodestoneSwordItem;

import static com.sammy.malum.registry.common.PacketRegistry.MALUM_CHANNEL;
Expand All @@ -27,7 +28,7 @@ public TyrvingItem(Tier material, int attackDamage, float attackSpeed, Propertie

@Override
public void hurtEvent(LivingHurtEvent event, LivingEntity attacker, LivingEntity target, ItemStack stack) {
if (event.getSource().is(DamageTypes.MAGIC)) {
if (event.getSource().is(LodestoneDamageTypeTags.IS_MAGIC)) {
return;
}
if (attacker.level() instanceof ServerLevel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import team.lodestar.lodestone.registry.common.tag.*;

public class MalumAttributeEventHandler {
public static void processAttributes(LivingHurtEvent event) {
Expand All @@ -21,12 +22,10 @@ public static void processAttributes(LivingHurtEvent event) {
if (stack.isEmpty()) {
return;
}
if (true) {
if (source.is(DamageTypes.THORNS)) {
return;
}
if (source.is(DamageTypes.THORNS)) {
return;
}
if (!event.getSource().is(DamageTypes.MAGIC)) {
if (!event.getSource().is(LodestoneDamageTypeTags.IS_MAGIC)) {
AttributeInstance scytheProficiency = attacker.getAttribute(AttributeRegistry.SCYTHE_PROFICIENCY.get());
if (scytheProficiency != null && scytheProficiency.getValue() > 0) {
event.setAmount((float) (amount + scytheProficiency.getValue() * 0.5f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import team.lodestar.lodestone.helpers.ItemHelper;
import team.lodestar.lodestone.registry.client.*;
import team.lodestar.lodestone.registry.common.particle.*;
import team.lodestar.lodestone.registry.common.tag.*;
import team.lodestar.lodestone.systems.particle.builder.ScreenParticleBuilder;
import team.lodestar.lodestone.systems.particle.data.GenericParticleData;
import team.lodestar.lodestone.systems.particle.data.color.ColorParticleData;
Expand Down Expand Up @@ -92,7 +93,7 @@ public static void shieldPlayer(LivingHurtEvent event) {
DamageSource source = event.getSource();

float amount = event.getAmount();
float multiplier = source.is(DamageTypes.MAGIC) ? CommonConfig.SOUL_WARD_MAGIC.getConfigValue().floatValue() : CommonConfig.SOUL_WARD_PHYSICAL.getConfigValue().floatValue();
float multiplier = source.is(LodestoneDamageTypeTags.IS_MAGIC) ? CommonConfig.SOUL_WARD_MAGIC.getConfigValue().floatValue() : CommonConfig.SOUL_WARD_PHYSICAL.getConfigValue().floatValue();

for (ItemStack s : ItemHelper.getEventResponders(player)) {
if (s.getItem() instanceof IMalumEventResponderItem eventItem) {
Expand Down

0 comments on commit e7f5074

Please sign in to comment.