Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-25 15:50:10 +01:00
Reuse sound rewriter instance in 1.21->1.21.2 (#4323)
Dieser Commit ist enthalten in:
Ursprung
c17b6c5099
Commit
5aae4ab10a
@ -81,7 +81,6 @@ import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
||||
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ClientboundPacket1_20_3;
|
||||
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.packet.ClientboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.rewriter.RecipeRewriter1_20_3;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.Protocol1_20_3To1_20_5;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.data.Attributes1_20_5;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.data.BannerPatterns1_20_5;
|
||||
@ -603,9 +602,10 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
||||
}
|
||||
}
|
||||
|
||||
// Only for VB, but kept here for simplicity; In VV we backup the original tag and later restore it, in VB
|
||||
// we use the converted data and manually restore what broke during the conversion
|
||||
final CompoundTag backupTag = StructuredDataConverter.removeBackupTag(tag);
|
||||
if (backupTag != null) {
|
||||
// Restore original data components
|
||||
restoreFromBackupTag(backupTag, data);
|
||||
}
|
||||
return item;
|
||||
|
@ -68,6 +68,7 @@ public final class Protocol1_21To1_21_2 extends AbstractProtocol<ClientboundPack
|
||||
private final ParticleRewriter1_21_2 particleRewriter = new ParticleRewriter1_21_2(this);
|
||||
private final TagRewriter<ClientboundPacket1_21> tagRewriter = new TagRewriter<>(this);
|
||||
private final ComponentRewriter1_21_2 componentRewriter = new ComponentRewriter1_21_2(this);
|
||||
private final SoundRewriter<ClientboundPacket1_21> soundRewriter = new SoundRewriter<>(this);
|
||||
|
||||
public Protocol1_21To1_21_2() {
|
||||
super(ClientboundPacket1_21.class, ClientboundPacket1_21_2.class, ServerboundPacket1_20_5.class, ServerboundPacket1_21_2.class);
|
||||
@ -94,7 +95,6 @@ public final class Protocol1_21To1_21_2 extends AbstractProtocol<ClientboundPack
|
||||
|
||||
particleRewriter.registerLevelParticles1_20_5(ClientboundPackets1_21.LEVEL_PARTICLES);
|
||||
|
||||
final SoundRewriter<ClientboundPacket1_21> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.registerSound1_19_3(ClientboundPackets1_21.SOUND);
|
||||
soundRewriter.registerSound1_19_3(ClientboundPackets1_21.SOUND_ENTITY);
|
||||
|
||||
@ -280,6 +280,10 @@ public final class Protocol1_21To1_21_2 extends AbstractProtocol<ClientboundPack
|
||||
return componentRewriter;
|
||||
}
|
||||
|
||||
public SoundRewriter<ClientboundPacket1_21> getSoundRewriter() {
|
||||
return soundRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PacketTypesProvider<ClientboundPacket1_21, ClientboundPacket1_21_2, ServerboundPacket1_20_5, ServerboundPacket1_21_2> createPacketTypesProvider() {
|
||||
return new SimplePacketTypesProvider<>(
|
||||
|
@ -60,7 +60,6 @@ import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ServerboundPacke
|
||||
import com.viaversion.viaversion.protocols.v1_21to1_21_2.storage.BundleStateTracker;
|
||||
import com.viaversion.viaversion.protocols.v1_21to1_21_2.storage.ChunkLoadTracker;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StructuredItemRewriter;
|
||||
import com.viaversion.viaversion.util.ComponentUtil;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
@ -238,7 +237,7 @@ public final class BlockItemPacketRewriter1_21_2 extends StructuredItemRewriter<
|
||||
wrapper.write(Types1_21_2.PARTICLE, smallExplosionParticle);
|
||||
}
|
||||
|
||||
new SoundRewriter<>(protocol).soundHolderHandler().handle(wrapper);
|
||||
protocol.getSoundRewriter().soundHolderHandler().handle(wrapper);
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_21.UPDATE_RECIPES, wrapper -> {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren