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 incompatibility with lithium explosion exposure optimization #1937

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
10 changes: 3 additions & 7 deletions src/main/java/carpet/mixins/Explosion_scarpetEventMixin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package carpet.mixins;

import com.llamalad7.mixinextras.sugar.Local;
2No2Name marked this conversation as resolved.
Show resolved Hide resolved
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.core.Holder;
import net.minecraft.core.particles.ParticleOptions;
Expand All @@ -9,7 +10,6 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.ArrayList;
Expand All @@ -22,7 +22,6 @@
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.ExplosionDamageCalculator;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;

import static carpet.script.CarpetEventServer.Event.EXPLOSION_OUTCOME;

Expand All @@ -41,8 +40,6 @@ public abstract class Explosion_scarpetEventMixin

@Shadow /*@Nullable*/ public abstract /*@Nullable*/ LivingEntity getIndirectSourceEntity();

@Shadow public static float getSeenPercent(Vec3 source, Entity entity) {return 0.0f;}

private List<Entity> affectedEntities;

@Inject(method = "<init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;Lnet/minecraft/world/level/ExplosionDamageCalculator;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;Lnet/minecraft/core/particles/ParticleOptions;Lnet/minecraft/core/particles/ParticleOptions;Lnet/minecraft/core/Holder;)V",
Expand All @@ -55,17 +52,16 @@ private void onExplosionCreated(Level world, Entity entity, DamageSource damageS
}
}

@Redirect(method = "explode", at=@At(
@Inject(method = "explode", at=@At(
2No2Name marked this conversation as resolved.
Show resolved Hide resolved
value = "INVOKE",
target = "Lnet/minecraft/world/level/Explosion;getSeenPercent(Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/entity/Entity;)F")
)
private float onExplosion(Vec3 source, Entity entity)
private void onExplosion(CallbackInfo ci, @Local Entity entity)
2No2Name marked this conversation as resolved.
Show resolved Hide resolved
{
if (affectedEntities != null)
{
affectedEntities.add(entity);
}
return getSeenPercent(source, entity);
}
2No2Name marked this conversation as resolved.
Show resolved Hide resolved

@Inject(method = "finalizeExplosion", at = @At("HEAD"))
Expand Down
Loading