Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-26 00:00:33 +01:00
Use getFullItemMappings
Dieser Commit ist enthalten in:
Ursprung
e52210a674
Commit
3b9b3ab257
@ -18,9 +18,9 @@
|
||||
package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5;
|
||||
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.data.BackwardsMappings;
|
||||
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.data.BackwardsMappings;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.provider.TransferProvider;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter.BlockItemPacketRewriter1_20_5;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.rewriter.EntityPacketRewriter1_20_5;
|
||||
@ -48,6 +48,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.Clientb
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPacket1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.Protocol1_20_5To1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPacket1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
|
||||
@ -62,7 +63,7 @@ import static com.viaversion.viaversion.util.ProtocolUtil.packetTypeMap;
|
||||
|
||||
public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundPacket1_20_5, ClientboundPacket1_20_3, ServerboundPacket1_20_5, ServerboundPacket1_20_3> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.20.5", "1.20.3", Protocol1_20_5To1_20_3.class);
|
||||
private static final ByteArrayType COOKIE_DATA_TYPE = new ByteArrayType(5120);
|
||||
private final EntityPacketRewriter1_20_5 entityRewriter = new EntityPacketRewriter1_20_5(this);
|
||||
private final BlockItemPacketRewriter1_20_5 itemRewriter = new BlockItemPacketRewriter1_20_5(this);
|
||||
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.data;
|
||||
|
||||
import com.viaversion.viabackwards.api.data.BackwardsMappingDataLoader;
|
||||
import com.viaversion.viaversion.libs.gson.JsonArray;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.Protocol1_20_5To1_20_3;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public final class BackwardsMappings extends com.viaversion.viabackwards.api.data.BackwardsMappings {
|
||||
|
||||
private String[] sounds;
|
||||
|
||||
public BackwardsMappings() {
|
||||
super("1.20.5", "1.20.3", Protocol1_20_5To1_20_3.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadExtras(final CompoundTag data) {
|
||||
super.loadExtras(data);
|
||||
|
||||
final JsonArray sounds = BackwardsMappingDataLoader.INSTANCE.loadData("sounds-1.20.3.json").getAsJsonArray("sounds");
|
||||
this.sounds = new String[sounds.size()];
|
||||
int i = 0;
|
||||
for (final JsonElement sound : sounds) {
|
||||
this.sounds[i++] = sound.getAsString();
|
||||
}
|
||||
}
|
||||
|
||||
public @Nullable String mappedSoundName(final int mappedId) {
|
||||
return mappedId >= 0 && mappedId < sounds.length ? sounds[mappedId] : null;
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.Recip
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.Protocol1_20_5To1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPacket1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.rewriter.StructuredDataConverter;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
@ -96,7 +95,7 @@ public final class BlockItemPacketRewriter1_20_5 extends BackwardsStructuredItem
|
||||
}
|
||||
} else if (particle.id() == protocol.getMappingData().getParticleMappings().mappedId("dust_color_transition")) {
|
||||
// fromColor, toColor, scale -> fromColor, scale, toColor
|
||||
particle.add(3, Type.FLOAT, particle.<Float> removeArgument(6).getValue());
|
||||
particle.add(3, Type.FLOAT, particle.<Float>removeArgument(6).getValue());
|
||||
}
|
||||
|
||||
wrapper.set(Type.VAR_INT, 0, particle.id());
|
||||
@ -131,7 +130,7 @@ public final class BlockItemPacketRewriter1_20_5 extends BackwardsStructuredItem
|
||||
}
|
||||
|
||||
soundId = protocol.getMappingData().getSoundMappings().getNewId(soundId);
|
||||
final String soundKey = protocol.getMappingData().mappedSoundName(soundId);
|
||||
final String soundKey = Protocol1_20_5To1_20_3.MAPPINGS.soundName(soundId);
|
||||
wrapper.write(Type.STRING, soundKey != null ? soundKey : "minecraft:entity.generic.explode");
|
||||
wrapper.write(Type.OPTIONAL_FLOAT, null); // Fixed range
|
||||
});
|
||||
|
@ -151,7 +151,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
if (isTrimPattern) {
|
||||
final CompoundTag patternTag = (CompoundTag) entry.tag();
|
||||
final StringTag templateItem = patternTag.getStringTag("template_item");
|
||||
if (Protocol1_20_5To1_20_3.MAPPINGS.itemId(templateItem.getValue()) == -1) {
|
||||
if (Protocol1_20_5To1_20_3.MAPPINGS.getFullItemMappings().id(templateItem.getValue()) == -1) {
|
||||
// Skip new items
|
||||
continue;
|
||||
}
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren