3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-10-03 08:41:05 +02:00

Write sound in explosion as proper sound event in 1.20.3->1.20.5

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-06-13 18:30:28 +02:00
Ursprung 877053c471
Commit e977e8db90
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
2 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -294,7 +294,9 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
protocol.getEntityRewriter().rewriteParticle(wrapper, Types1_20_3.PARTICLE, Types1_20_5.PARTICLE); // Small explosion particle
protocol.getEntityRewriter().rewriteParticle(wrapper, Types1_20_3.PARTICLE, Types1_20_5.PARTICLE); // Large explosion particle
wrapper.write(Types.VAR_INT, 0); // "Empty" registry id to instead use the resource location that follows after
final String sound = wrapper.read(Types.STRING);
final Float range = wrapper.read(Types.OPTIONAL_FLOAT);
wrapper.write(Types.SOUND_EVENT, Holder.of(new SoundEvent(sound, range)));
});
protocol.registerClientbound(ClientboundPackets1_20_3.MERCHANT_OFFERS, wrapper -> {

Datei anzeigen

@ -504,7 +504,7 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
}
public void registerExplosion(C packetType, Type<Particle> unmappedParticleType, Type<Particle> mappedParticleType) {
final SoundRewriter<C> cSoundRewriter = new SoundRewriter<>(protocol);
final SoundRewriter<C> soundRewriter = new SoundRewriter<>(protocol);
protocol.registerClientbound(packetType, wrapper -> {
wrapper.passthrough(Types.DOUBLE); // X
wrapper.passthrough(Types.DOUBLE); // Y
@ -528,7 +528,7 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
rewriteParticle(wrapper.user(), smallExplosionParticle);
rewriteParticle(wrapper.user(), largeExplosionParticle);
cSoundRewriter.soundHolderHandler().handle(wrapper);
soundRewriter.soundHolderHandler().handle(wrapper);
});
}