forked from BynBang/OpenPrestige
Find Fabric through the render thread's class loader and make bytecode transformations safer for launcher-provided class definitions. Improve hook reporting, process-picker refresh behavior, and self-destruct cleanup; document Dawn and Lunar 1.21.11 setup.
46 lines
1.6 KiB
Java
46 lines
1.6 KiB
Java
package dev.zprestige.prestige.mixin;
|
|
|
|
import dev.zprestige.prestige.event.ExplosionEvent;
|
|
import dev.zprestige.prestige.util.HookBridge;
|
|
import net.lenni0451.classtransform.InjectionCallback;
|
|
import net.lenni0451.classtransform.annotations.CTarget;
|
|
import net.lenni0451.classtransform.annotations.CTransformer;
|
|
import net.lenni0451.classtransform.annotations.injection.CInject;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.damage.DamageSource;
|
|
import net.minecraft.particle.BlockParticleEffect;
|
|
import net.minecraft.particle.ParticleEffect;
|
|
import net.minecraft.registry.entry.RegistryEntry;
|
|
import net.minecraft.server.world.ServerWorld;
|
|
import net.minecraft.sound.SoundEvent;
|
|
import net.minecraft.util.collection.Pool;
|
|
import net.minecraft.world.World.ExplosionSourceType;
|
|
import net.minecraft.world.explosion.ExplosionBehavior;
|
|
|
|
@CTransformer({ServerWorld.class})
|
|
public class ServerWorldMixin {
|
|
@CInject(
|
|
method = {"createExplosion"},
|
|
target = {@CTarget("HEAD")}
|
|
)
|
|
public void postExplosionEventAtCreateExplosionHead(
|
|
Entity entity,
|
|
DamageSource damageSource,
|
|
ExplosionBehavior behavior,
|
|
double x,
|
|
double y,
|
|
double z,
|
|
float power,
|
|
boolean createFire,
|
|
ExplosionSourceType explosionSourceType,
|
|
ParticleEffect smallParticle,
|
|
ParticleEffect largeParticle,
|
|
Pool<BlockParticleEffect> blockParticles,
|
|
RegistryEntry<SoundEvent> soundEvent,
|
|
InjectionCallback ci
|
|
) {
|
|
ExplosionEvent event = HookBridge.createExplosionEvent(power, x, y, z);
|
|
HookBridge.postExplosionEvent(event);
|
|
}
|
|
}
|