generated from MrSphay/codex-agent-repository-kit
Decompile upstream Explosion Overhaul 0.2.3.0
This commit is contained in:
92
com/vinlanx/explosionoverhaul/mixin/ExplosionMixin.java
Normal file
92
com/vinlanx/explosionoverhaul/mixin/ExplosionMixin.java
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.vinlanx.explosionoverhaul.mixin;
|
||||
|
||||
import com.vinlanx.explosionoverhaul.ServerExplosionHandler;
|
||||
import com.vinlanx.explosionoverhaul.api.IExplosionPower;
|
||||
import com.vinlanx.explosionoverhaul.mixinhelper.ExplosionAccessor;
|
||||
import java.util.List;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
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 org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(value={Explosion.class})
|
||||
public abstract class ExplosionMixin
|
||||
implements IExplosionPower,
|
||||
ExplosionAccessor {
|
||||
@Shadow
|
||||
@Final
|
||||
private Level f_46012_;
|
||||
@Shadow
|
||||
@Final
|
||||
@Nullable
|
||||
private Entity f_46016_;
|
||||
@Shadow
|
||||
@Final
|
||||
private double f_46013_;
|
||||
@Shadow
|
||||
@Final
|
||||
private double f_46014_;
|
||||
@Shadow
|
||||
@Final
|
||||
private double f_46015_;
|
||||
@Unique
|
||||
private float explosionPower;
|
||||
|
||||
@Shadow
|
||||
public abstract List<BlockPos> m_46081_();
|
||||
|
||||
@Inject(method={"<init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;)V"}, at={@At(value="RETURN")})
|
||||
private void capturePowerSimple(Level level, Entity source, double x, double y, double z, float power, boolean fire, Explosion.BlockInteraction interaction, CallbackInfo ci) {
|
||||
this.explosionPower = power;
|
||||
}
|
||||
|
||||
@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;)V"}, at={@At(value="RETURN")})
|
||||
private void capturePowerComplex(Level level, @Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator damageCalculator, double x, double y, double z, float power, boolean fire, Explosion.BlockInteraction blockInteraction, CallbackInfo ci) {
|
||||
this.explosionPower = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPower() {
|
||||
return this.explosionPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(float power) {
|
||||
this.explosionPower = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 explosionoverhaul$getCenter() {
|
||||
return new Vec3(this.f_46013_, this.f_46014_, this.f_46015_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity explosionoverhaul$getSource() {
|
||||
return this.f_46016_;
|
||||
}
|
||||
|
||||
@Inject(method={"finalizeExplosion(Z)V"}, at={@At(value="HEAD")})
|
||||
private void onFinalizeExplosion(boolean spawnParticles, CallbackInfo ci) {
|
||||
Level level = this.f_46012_;
|
||||
if (level instanceof ServerLevel) {
|
||||
ServerLevel serverLevel = (ServerLevel)level;
|
||||
ServerExplosionHandler.handleExplosion(serverLevel, (Explosion)this, this.m_46081_());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user