-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14cbb9e
commit a687f7a
Showing
8 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...ammiescorner/arcanuscontinuum/common/spell_components/effects/DangerSenseSpellEffect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package dev.cammiescorner.arcanuscontinuum.common.spell_components.effects; | ||
|
||
import dev.cammiescorner.arcanuscontinuum.api.spells.SpellEffect; | ||
import dev.cammiescorner.arcanuscontinuum.api.spells.SpellType; | ||
import dev.cammiescorner.arcanuscontinuum.api.spells.Weight; | ||
import dev.cammiescorner.arcanuscontinuum.common.effects.ArcanusStatusEffect; | ||
import dev.cammiescorner.arcanuscontinuum.common.registry.ArcanusSpellComponents; | ||
import dev.cammiescorner.arcanuscontinuum.common.registry.ArcanusStatusEffects; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.hit.EntityHitResult; | ||
import net.minecraft.util.hit.HitResult; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
|
||
public class DangerSenseSpellEffect extends SpellEffect { | ||
public DangerSenseSpellEffect(boolean isEnabled, SpellType type, Weight weight, double manaCost, int coolDown, int minLevel) { | ||
super(isEnabled, type, weight, manaCost, coolDown, minLevel); | ||
} | ||
|
||
@Override | ||
public void effect(@Nullable LivingEntity caster, @Nullable Entity sourceEntity, World world, HitResult target, List<SpellEffect> effects, ItemStack stack, double potency) { | ||
if(target.getType() == HitResult.Type.ENTITY) { | ||
EntityHitResult entityHit = (EntityHitResult) target; | ||
|
||
if(entityHit.getEntity() instanceof LivingEntity livingEntity) | ||
livingEntity.addStatusEffect(new StatusEffectInstance(ArcanusStatusEffects.DANGER_SENSE.get(), 200, (int) ((effects.stream().filter(ArcanusSpellComponents.DANGER_SENSE::is).count() - 1) * potency), true, false)); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/dev/cammiescorner/arcanuscontinuum/mixin/common/ExplosionMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package dev.cammiescorner.arcanuscontinuum.mixin.common; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.sugar.Share; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; | ||
import net.minecraft.util.math.Vec3d; | ||
import net.minecraft.world.explosion.Explosion; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Slice; | ||
|
||
@Mixin(Explosion.class) | ||
public class ExplosionMixin { | ||
@ModifyExpressionValue(method = "collectBlocksAndDamageEntities", at = @At(value = "INVOKE", | ||
target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z" | ||
)) | ||
private boolean arcanuscontinuum$captureDamageReturn(boolean original, @Share("tookDamage") LocalBooleanRef ref) { | ||
ref.set(original); | ||
return original; | ||
} | ||
|
||
@ModifyExpressionValue(method = "collectBlocksAndDamageEntities", slice = @Slice(from = @At(value = "INVOKE", | ||
target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z" | ||
)), at = @At(value = "NEW", | ||
target = "(DDD)Lnet/minecraft/util/math/Vec3d;" | ||
)) | ||
private Vec3d arcanuscontinuum$noKnockback(Vec3d original, @Share("tookDamage") LocalBooleanRef ref) { | ||
return !ref.get() ? Vec3d.ZERO : original; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters