1
0
Fork 0

fix explosions for real this time

This commit is contained in:
Sen 2025-08-27 19:43:14 +02:00
parent 11db0e57cb
commit aaad753263
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
36 changed files with 338 additions and 495 deletions

View file

@ -135,7 +135,6 @@ import common.util.ParticleType;
import common.util.BlockPos.MutableBlockPos;
import common.util.Equipment;
import common.village.MerchantRecipeList;
import common.world.Explosion;
import common.world.State;
import common.world.Weather;
import common.world.World;
@ -1046,17 +1045,22 @@ public class ClientPlayer implements IClientPlayer
// this.gameController.controller.setCheat(packetIn.getCheat());
}
/**
* Initiates a new explosion (sound, particles, drop spawn) for the affected blocks indicated by the packet.
*/
public void handleExplosion(SPacketExplosion packetIn)
{
NetHandler.checkThread(packetIn, this, this.gm, this.world);
Explosion explosion = new Explosion(this.gm.world, (Entity)null, packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getStrength(), packetIn.getAffectedBlockPositions());
explosion.doExplosionB(true, packetIn.hasAltSound());
this.gm.player.motionX += (double)packetIn.func_149149_c();
this.gm.player.motionY += (double)packetIn.func_149144_d();
this.gm.player.motionZ += (double)packetIn.func_149147_e();
if(packetIn.isLarge())
this.gm.world.clientParticle(ParticleType.EXPLOSION_HUGE, packetIn.getX(), packetIn.getY(), packetIn.getZ());
else
this.gm.world.clientParticle(ParticleType.EXPLOSION_LARGE, packetIn.getX(), packetIn.getY(), packetIn.getZ(), 100);
if(packetIn.getBlocks() != null) {
for(BlockPos pos : packetIn.getBlocks()) {
double d0 = (double)((float)pos.getX() + this.gm.world.rand.floatv());
double d1 = (double)((float)pos.getY() + this.gm.world.rand.floatv());
double d2 = (double)((float)pos.getZ() + this.gm.world.rand.floatv());
this.gm.world.clientParticle(ParticleType.EXPLOSION_NORMAL, (d0 + packetIn.getX() * 1.0D) / 2.0D, (d1 + packetIn.getY() * 1.0D) / 2.0D, (d2 + packetIn.getZ() * 1.0D) / 2.0D);
this.gm.world.clientParticle(ParticleType.SMOKE, d0, d1, d2);
}
}
}
public void handleOpenWindow(SPacketOpenWindow packet)