Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: windburst stuff #1646

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.windcharge.WindCharge;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.SimpleExplosionDamageCalculator;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.common.ModConfigSpec;
import org.jetbrains.annotations.NotNull;

Expand All @@ -35,22 +37,32 @@ public EffectWindburst() {
public void onResolve(HitResult rayTraceResult, Level world, @NotNull LivingEntity shooter, SpellStats spellStats, SpellContext spellContext, SpellResolver resolver) {
super.onResolve(rayTraceResult, world, shooter, spellStats, spellContext, resolver);

var loc = rayTraceResult.getLocation();
double x = loc.x;
double y = loc.y;
double z = loc.z;

var dummyWindCharge = new WindCharge(world, x, y, z, Vec3.ZERO);
if (spellStats.isSensitive()) {
dummyWindCharge.setOwner(shooter);
}

world.explode(
spellStats.isSensitive() ? shooter : null,
null,
dummyWindCharge,
null,
new SimpleExplosionDamageCalculator(
true, false, Optional.of(1.22f + (float) (spellStats.getAmpMultiplier() * this.AMP_VALUE.getAsDouble())), BuiltInRegistries.BLOCK.getTag(BlockTags.BLOCKS_WIND_CHARGE_EXPLOSIONS).map(Function.identity())
),
rayTraceResult.getLocation().x,
rayTraceResult.getLocation().y,
rayTraceResult.getLocation().z,
1.2f + (float) (spellStats.getAoeMultiplier() * this.GENERIC_DOUBLE.getAsDouble()),
false,
Level.ExplosionInteraction.TRIGGER,
ParticleTypes.GUST_EMITTER_SMALL,
ParticleTypes.GUST_EMITTER_LARGE,
SoundEvents.WIND_CHARGE_BURST
);
x,
y,
z,
1.2f + (float) (spellStats.getAoeMultiplier() * this.GENERIC_DOUBLE.getAsDouble()),
false,
Level.ExplosionInteraction.TRIGGER,
ParticleTypes.GUST_EMITTER_SMALL,
ParticleTypes.GUST_EMITTER_LARGE,
SoundEvents.WIND_CHARGE_BURST
);
}

@Override
Expand Down