3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-17 13:30:14 +01:00

Merge branch 'refs/heads/dev' into preview

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-18 16:26:20 +02:00
Commit 5a49413dbc
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
21 geänderte Dateien mit 128 neuen und 124 gelöschten Zeilen

Datei anzeigen

@ -19,6 +19,7 @@ package com.viaversion.viabackwards;
import com.viaversion.viaversion.util.Config; import com.viaversion.viaversion.util.Config;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -87,6 +88,11 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback
return getClass().getClassLoader().getResource("assets/viabackwards/config.yml"); return getClass().getClassLoader().getResource("assets/viabackwards/config.yml");
} }
@Override
public InputStream getDefaultConfigInputStream() {
return getClass().getClassLoader().getResourceAsStream("assets/viabackwards/config.yml");
}
@Override @Override
protected void handleConfig(Map<String, Object> map) { protected void handleConfig(Map<String, Object> map) {
} }

Datei anzeigen

@ -17,8 +17,8 @@
*/ */
package com.viaversion.viabackwards.api.data; package com.viaversion.viabackwards.api.data;
import com.viaversion.viabackwards.utils.Block;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.util.IdAndData;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
public class MappedLegacyBlockItem { public class MappedLegacyBlockItem {
@ -26,14 +26,14 @@ public class MappedLegacyBlockItem {
private final int id; private final int id;
private final short data; private final short data;
private final String name; private final String name;
private final Block block; private final IdAndData block;
private BlockEntityHandler blockEntityHandler; private BlockEntityHandler blockEntityHandler;
public MappedLegacyBlockItem(int id, short data, @Nullable String name, boolean block) { public MappedLegacyBlockItem(int id, short data, @Nullable String name, boolean block) {
this.id = id; this.id = id;
this.data = data; this.data = data;
this.name = name != null ? "§f" + name : null; this.name = name != null ? "§f" + name : null;
this.block = block ? new Block(id, data) : null; this.block = block ? data != -1 ? new IdAndData(id, data) : new IdAndData(id) : null;
} }
public int getId() { public int getId() {
@ -52,7 +52,7 @@ public class MappedLegacyBlockItem {
return block != null; return block != null;
} }
public Block getBlock() { public IdAndData getBlock() {
return block; return block;
} }

Datei anzeigen

@ -22,7 +22,6 @@ import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.api.data.MappedLegacyBlockItem; import com.viaversion.viabackwards.api.data.MappedLegacyBlockItem;
import com.viaversion.viabackwards.api.data.BackwardsMappingDataLoader; import com.viaversion.viabackwards.api.data.BackwardsMappingDataLoader;
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.BlockColors; import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.BlockColors;
import com.viaversion.viabackwards.utils.Block;
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord; import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
@ -51,6 +50,7 @@ import com.viaversion.viaversion.util.ComponentUtil;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import com.viaversion.viaversion.util.IdAndData;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S extends ServerboundPacketType, public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S extends ServerboundPacketType,
@ -81,9 +81,9 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
// Include data // Include data
short unmappedData = Short.parseShort(key.substring(dataSeparatorIndex + 1)); short unmappedData = Short.parseShort(key.substring(dataSeparatorIndex + 1));
unmappedId = Integer.parseInt(key.substring(0, dataSeparatorIndex)); unmappedId = Integer.parseInt(key.substring(0, dataSeparatorIndex));
unmappedId = Block.toRawId(unmappedId, unmappedData); unmappedId = IdAndData.toRawData(unmappedId, unmappedData);
} else { } else {
unmappedId = Block.rawById(Integer.parseInt(key)); unmappedId = IdAndData.toRawData(Integer.parseInt(key));
} }
mappings.put(unmappedId, new MappedLegacyBlockItem(id, data, name, block)); mappings.put(unmappedId, new MappedLegacyBlockItem(id, data, name, block));
@ -98,12 +98,12 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
// Special block color handling // Special block color handling
if (name.contains("%color%")) { if (name.contains("%color%")) {
for (int i = from; i <= to; i++) { for (int i = from; i <= to; i++) {
mappings.put(Block.rawById(i), new MappedLegacyBlockItem(id, data, name.replace("%color%", BlockColors.get(i - from)), block)); mappings.put(IdAndData.toRawData(i), new MappedLegacyBlockItem(id, data, name.replace("%color%", BlockColors.get(i - from)), block));
} }
} else { } else {
MappedLegacyBlockItem mappedBlockItem = new MappedLegacyBlockItem(id, data, name, block); MappedLegacyBlockItem mappedBlockItem = new MappedLegacyBlockItem(id, data, name, block);
for (int i = from; i <= to; i++) { for (int i = from; i <= to; i++) {
mappings.put(Block.rawById(i), mappedBlockItem); mappings.put(IdAndData.toRawData(i), mappedBlockItem);
} }
} }
} }
@ -208,7 +208,7 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
if (type.isPresent() && type.get() == EntityTypes1_12.ObjectType.FALLING_BLOCK) { if (type.isPresent() && type.get() == EntityTypes1_12.ObjectType.FALLING_BLOCK) {
final int objectData = wrapper.get(Type.INT, 0); final int objectData = wrapper.get(Type.INT, 0);
final Block block = handleBlock(objectData & 4095, objectData >> 12 & 15); final IdAndData block = handleBlock(objectData & 4095, objectData >> 12 & 15);
if (block == null) return; if (block == null) return;
wrapper.set(Type.INT, 0, block.getId() | block.getData() << 12); wrapper.set(Type.INT, 0, block.getId() | block.getData() << 12);
@ -216,11 +216,11 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
}; };
} }
public @Nullable Block handleBlock(int blockId, int data) { public @Nullable IdAndData handleBlock(int blockId, int data) {
MappedLegacyBlockItem settings = getMappedBlockItem(blockId, data); MappedLegacyBlockItem settings = getMappedBlockItem(blockId, data);
if (settings == null || !settings.isBlock()) return null; if (settings == null || !settings.isBlock()) return null;
Block block = settings.getBlock(); IdAndData block = settings.getBlock();
// For some blocks, the data can still be useful (: // For some blocks, the data can still be useful (:
if (block.getData() == -1) { if (block.getData() == -1) {
return block.withData(data); return block.withData(data);
@ -229,13 +229,13 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
} }
public int handleBlockId(final int rawId) { public int handleBlockId(final int rawId) {
final int id = Block.getId(rawId); final int id = IdAndData.getId(rawId);
final int data = Block.getData(rawId); final int data = IdAndData.getData(rawId);
final Block mappedBlock = handleBlock(id, data); final IdAndData mappedBlock = handleBlock(id, data);
if (mappedBlock == null) return rawId; if (mappedBlock == null) return rawId;
return Block.toRawId(mappedBlock.getId(), mappedBlock.getData()); return IdAndData.toRawData(mappedBlock.getId(), mappedBlock.getData());
} }
public void handleChunk(Chunk chunk) { public void handleChunk(Chunk chunk) {
@ -283,9 +283,9 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
int btype = block >> 4; int btype = block >> 4;
int meta = block & 0xF; int meta = block & 0xF;
Block b = handleBlock(btype, meta); IdAndData b = handleBlock(btype, meta);
if (b != null) { if (b != null) {
palette.setIdByIndex(j, Block.toRawId(b.getId(), b.getData())); palette.setIdByIndex(j, IdAndData.toRawData(b.getId(), b.getData()));
} }
// We already know that is has a handler // We already know that is has a handler
@ -336,13 +336,13 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
} }
private @Nullable MappedLegacyBlockItem getMappedBlockItem(int id, int data) { private @Nullable MappedLegacyBlockItem getMappedBlockItem(int id, int data) {
MappedLegacyBlockItem mapping = replacementData.get(Block.toRawId(id, data)); MappedLegacyBlockItem mapping = replacementData.get(IdAndData.toRawData(id, data));
return mapping != null || data == 0 ? mapping : replacementData.get(Block.rawById(id)); return mapping != null || data == 0 ? mapping : replacementData.get(IdAndData.toRawData(id));
} }
private @Nullable MappedLegacyBlockItem getMappedBlockItem(int rawId) { private @Nullable MappedLegacyBlockItem getMappedBlockItem(int rawId) {
MappedLegacyBlockItem mapping = replacementData.get(rawId); MappedLegacyBlockItem mapping = replacementData.get(rawId);
return mapping != null ? mapping : replacementData.get(Block.rawByData(rawId)); return mapping != null ? mapping : replacementData.get(IdAndData.removeData(rawId));
} }
protected JsonObject readMappingsFile(final String name) { protected JsonObject readMappingsFile(final String name) {

Datei anzeigen

@ -24,7 +24,6 @@ import com.viaversion.viabackwards.api.rewriters.LegacyEnchantmentRewriter;
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.Protocol1_10To1_11; import com.viaversion.viabackwards.protocol.protocol1_10to1_11.Protocol1_10To1_11;
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.storage.ChestedHorseStorage; import com.viaversion.viabackwards.protocol.protocol1_10to1_11.storage.ChestedHorseStorage;
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.storage.WindowTracker; import com.viaversion.viabackwards.protocol.protocol1_10to1_11.storage.WindowTracker;
import com.viaversion.viabackwards.utils.Block;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.entity.EntityTracker; import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.data.entity.StoredEntityData; import com.viaversion.viaversion.api.data.entity.StoredEntityData;
@ -41,6 +40,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
import com.viaversion.viaversion.protocols.protocol1_11to1_10.rewriter.EntityIdRewriter; import com.viaversion.viaversion.protocols.protocol1_11to1_10.rewriter.EntityIdRewriter;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
import com.viaversion.viaversion.util.IdAndData;
import java.util.Arrays; import java.util.Arrays;
import java.util.Optional; import java.util.Optional;
@ -274,7 +274,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<ClientboundPac
@Override @Override
protected void registerRewrites() { protected void registerRewrites() {
// Handle spawner block entity (map to itself with custom handler) // Handle spawner block entity (map to itself with custom handler)
MappedLegacyBlockItem data = replacementData.computeIfAbsent(Block.rawById(52), s -> new MappedLegacyBlockItem(52, (short) -1, null, false)); MappedLegacyBlockItem data = replacementData.computeIfAbsent(IdAndData.toRawData(52), s -> new MappedLegacyBlockItem(52, (short) -1, null, false));
data.setBlockEntityHandler((b, tag) -> { data.setBlockEntityHandler((b, tag) -> {
EntityIdRewriter.toClientSpawner(tag, true); EntityIdRewriter.toClientSpawner(tag, true);
return tag; return tag;

Datei anzeigen

@ -27,7 +27,6 @@ import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.block_entity_ha
import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.providers.BackwardsBlockEntityProvider; import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.providers.BackwardsBlockEntityProvider;
import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.storage.BackwardsBlockStorage; import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.storage.BackwardsBlockStorage;
import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.storage.NoteBlockStorage; import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.storage.NoteBlockStorage;
import com.viaversion.viabackwards.utils.Block;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord; import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
@ -57,6 +56,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.BlockIdData; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.BlockIdData;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.SpawnEggRewriter; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.SpawnEggRewriter;
import com.viaversion.viaversion.util.ComponentUtil; import com.viaversion.viaversion.util.ComponentUtil;
import com.viaversion.viaversion.util.IdAndData;
import com.viaversion.viaversion.util.Key; import com.viaversion.viaversion.util.Key;
import com.viaversion.viaversion.util.Pair; import com.viaversion.viaversion.util.Pair;
import java.util.ArrayList; import java.util.ArrayList;
@ -101,11 +101,11 @@ public class BlockItemPackets1_13 extends BackwardsItemRewriter<ClientboundPacke
} }
if (SpawnEggRewriter.getEntityId(oldId).isPresent()) { if (SpawnEggRewriter.getEntityId(oldId).isPresent()) {
wrapper.write(Type.VAR_INT, Block.rawById(383)); wrapper.write(Type.VAR_INT, IdAndData.toRawData(383));
return; return;
} }
wrapper.write(Type.VAR_INT, Block.getId(oldId)); wrapper.write(Type.VAR_INT, IdAndData.getId(oldId));
}); });
protocol.registerClientbound(ClientboundPackets1_13.BLOCK_ACTION, new PacketHandlers() { protocol.registerClientbound(ClientboundPackets1_13.BLOCK_ACTION, new PacketHandlers() {
@ -752,7 +752,7 @@ public class BlockItemPackets1_13 extends BackwardsItemRewriter<ClientboundPacke
// Save original id // Save original id
int originalId = (item.identifier() << 16 | item.data() & 0xFFFF); int originalId = (item.identifier() << 16 | item.data() & 0xFFFF);
int rawId = Block.toRawId(item.identifier(), item.data()); int rawId = IdAndData.toRawData(item.identifier(), item.data());
// NBT Additions // NBT Additions
if (isDamageable(item.identifier())) { if (isDamageable(item.identifier())) {
@ -833,7 +833,7 @@ public class BlockItemPackets1_13 extends BackwardsItemRewriter<ClientboundPacke
if (item.identifier() == 229) { // purple shulker box if (item.identifier() == 229) { // purple shulker box
newId = 362; // directly set the new id -> base/colorless shulker box newId = 362; // directly set the new id -> base/colorless shulker box
} else if (item.identifier() == 31 && item.data() == 0) { // Shrub was removed } else if (item.identifier() == 31 && item.data() == 0) { // Shrub was removed
rawId = Block.rawById(32); // Dead Bush rawId = IdAndData.toRawData(32); // Dead Bush
} else if (protocol.getMappingData().getItemMappings().inverse().getNewId(rawId & ~0xF) != -1) { } else if (protocol.getMappingData().getItemMappings().inverse().getNewId(rawId & ~0xF) != -1) {
rawId &= ~0xF; // Remove data rawId &= ~0xF; // Remove data
} else { } else {

Datei anzeigen

@ -28,7 +28,6 @@ import com.viaversion.viaversion.api.minecraft.Position;
import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.rewriter.RewriterBase; import com.viaversion.viaversion.api.rewriter.RewriterBase;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
@ -39,9 +38,11 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPacke
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.packets.InventoryPackets; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
import com.viaversion.viaversion.rewriter.CommandRewriter; import com.viaversion.viaversion.rewriter.CommandRewriter;
import com.viaversion.viaversion.util.Key;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
@ -100,7 +101,7 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
String oldChannel = InventoryPackets.getOldPluginChannelId(channel); String oldChannel = InventoryPackets.getOldPluginChannelId(channel);
if (oldChannel == null) { if (oldChannel == null) {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("Ignoring outgoing plugin message with channel: " + channel); ViaBackwards.getPlatform().getLogger().warning("Ignoring clientbound plugin message with channel: " + channel);
} }
wrapper.cancel(); wrapper.cancel();
return; return;
@ -115,7 +116,7 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
if (rewritten != null) { if (rewritten != null) {
rewrittenChannels.add(rewritten); rewrittenChannels.add(rewritten);
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { } else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("Ignoring plugin channel in outgoing REGISTER: " + s); ViaBackwards.getPlatform().getLogger().warning("Ignoring plugin channel in clientbound " + oldChannel + ": " + s);
} }
} }
wrapper.write(Type.REMAINING_BYTES, Joiner.on('\0').join(rewrittenChannels).getBytes(StandardCharsets.UTF_8)); wrapper.write(Type.REMAINING_BYTES, Joiner.on('\0').join(rewrittenChannels).getBytes(StandardCharsets.UTF_8));
@ -489,7 +490,7 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
String newChannel = InventoryPackets.getNewPluginChannelId(channel); String newChannel = InventoryPackets.getNewPluginChannelId(channel);
if (newChannel == null) { if (newChannel == null) {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("Ignoring incoming plugin message with channel: " + channel); ViaBackwards.getPlatform().getLogger().warning("Ignoring serverbound plugin message with channel: " + channel);
} }
wrapper.cancel(); wrapper.cancel();
return; return;
@ -504,7 +505,7 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
if (rewritten != null) { if (rewritten != null) {
rewrittenChannels.add(rewritten); rewrittenChannels.add(rewritten);
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { } else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("Ignoring plugin channel in incoming REGISTER: " + s); ViaBackwards.getPlatform().getLogger().warning("Ignoring plugin channel in serverbound " + Key.stripMinecraftNamespace(newChannel).toUpperCase(Locale.ROOT) + ": " + s);
} }
} }
if (!rewrittenChannels.isEmpty()) { if (!rewrittenChannels.isEmpty()) {

Datei anzeigen

@ -51,6 +51,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
private final EntityPackets1_13_1 entityRewriter = new EntityPackets1_13_1(this); private final EntityPackets1_13_1 entityRewriter = new EntityPackets1_13_1(this);
private final InventoryPackets1_13_1 itemRewriter = new InventoryPackets1_13_1(this); private final InventoryPackets1_13_1 itemRewriter = new InventoryPackets1_13_1(this);
private final TranslatableRewriter<ClientboundPackets1_13> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); private final TranslatableRewriter<ClientboundPackets1_13> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_13> tagRewriter = new TagRewriter<>(this);
public Protocol1_13To1_13_1() { public Protocol1_13To1_13_1() {
super(ClientboundPackets1_13.class, ClientboundPackets1_13.class, ServerboundPackets1_13.class, ServerboundPackets1_13.class); super(ClientboundPackets1_13.class, ClientboundPackets1_13.class, ServerboundPackets1_13.class, ServerboundPackets1_13.class);
@ -195,7 +196,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
} }
}); });
new TagRewriter<>(this).register(ClientboundPackets1_13.TAGS, RegistryType.ITEM); tagRewriter.register(ClientboundPackets1_13.TAGS, RegistryType.ITEM);
new StatisticsRewriter<>(this).register(ClientboundPackets1_13.STATISTICS); new StatisticsRewriter<>(this).register(ClientboundPackets1_13.STATISTICS);
} }
@ -226,4 +227,9 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
public TranslatableRewriter<ClientboundPackets1_13> translatableRewriter() { public TranslatableRewriter<ClientboundPackets1_13> translatableRewriter() {
return translatableRewriter; return translatableRewriter;
} }
@Override
public TagRewriter<ClientboundPackets1_13> getTagRewriter() {
return tagRewriter;
}
} }

Datei anzeigen

@ -45,6 +45,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
private final EntityPackets1_15 entityRewriter = new EntityPackets1_15(this); private final EntityPackets1_15 entityRewriter = new EntityPackets1_15(this);
private final BlockItemPackets1_15 blockItemPackets = new BlockItemPackets1_15(this); private final BlockItemPackets1_15 blockItemPackets = new BlockItemPackets1_15(this);
private final TranslatableRewriter<ClientboundPackets1_15> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); private final TranslatableRewriter<ClientboundPackets1_15> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_15> tagRewriter = new TagRewriter<>(this);
public Protocol1_14_4To1_15() { public Protocol1_14_4To1_15() {
super(ClientboundPackets1_15.class, ClientboundPackets1_14_4.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class); super(ClientboundPackets1_15.class, ClientboundPackets1_14_4.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
@ -94,7 +95,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
} }
}); });
new TagRewriter<>(this).register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY); tagRewriter.register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY);
new StatisticsRewriter<>(this).register(ClientboundPackets1_15.STATISTICS); new StatisticsRewriter<>(this).register(ClientboundPackets1_15.STATISTICS);
} }
@ -120,6 +121,11 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
return blockItemPackets; return blockItemPackets;
} }
@Override
public TagRewriter<ClientboundPackets1_15> getTagRewriter() {
return tagRewriter;
}
@Override @Override
public TranslatableRewriter<ClientboundPackets1_15> getTranslatableRewriter() { public TranslatableRewriter<ClientboundPackets1_15> getTranslatableRewriter() {
return translatableRewriter; return translatableRewriter;

Datei anzeigen

@ -51,6 +51,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
private final EntityPackets1_16 entityRewriter = new EntityPackets1_16(this); private final EntityPackets1_16 entityRewriter = new EntityPackets1_16(this);
private final BlockItemPackets1_16 blockItemPackets = new BlockItemPackets1_16(this); private final BlockItemPackets1_16 blockItemPackets = new BlockItemPackets1_16(this);
private final TranslatableRewriter1_16 translatableRewriter = new TranslatableRewriter1_16(this); private final TranslatableRewriter1_16 translatableRewriter = new TranslatableRewriter1_16(this);
private final TagRewriter<ClientboundPackets1_16> tagRewriter = new TagRewriter<>(this);
public Protocol1_15_2To1_16() { public Protocol1_15_2To1_16() {
super(ClientboundPackets1_16.class, ClientboundPackets1_15.class, ServerboundPackets1_16.class, ServerboundPackets1_14.class); super(ClientboundPackets1_16.class, ClientboundPackets1_15.class, ServerboundPackets1_16.class, ServerboundPackets1_14.class);
@ -118,7 +119,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
wrapper.write(Type.STRING, uuid.toString()); wrapper.write(Type.STRING, uuid.toString());
}); });
new TagRewriter<>(this).register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY); tagRewriter.register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY);
new StatisticsRewriter<>(this).register(ClientboundPackets1_16.STATISTICS); new StatisticsRewriter<>(this).register(ClientboundPackets1_16.STATISTICS);
@ -192,4 +193,9 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
public BlockItemPackets1_16 getItemRewriter() { public BlockItemPackets1_16 getItemRewriter() {
return blockItemPackets; return blockItemPackets;
} }
@Override
public TagRewriter<ClientboundPackets1_16> getTagRewriter() {
return tagRewriter;
}
} }

Datei anzeigen

@ -47,6 +47,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
private final EntityPackets1_16_2 entityRewriter = new EntityPackets1_16_2(this); private final EntityPackets1_16_2 entityRewriter = new EntityPackets1_16_2(this);
private final BlockItemPackets1_16_2 blockItemPackets = new BlockItemPackets1_16_2(this); private final BlockItemPackets1_16_2 blockItemPackets = new BlockItemPackets1_16_2(this);
private final TranslatableRewriter<ClientboundPackets1_16_2> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); private final TranslatableRewriter<ClientboundPackets1_16_2> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_16_2> tagRewriter = new TagRewriter<>(this);
public Protocol1_16_1To1_16_2() { public Protocol1_16_1To1_16_2() {
super(ClientboundPackets1_16_2.class, ClientboundPackets1_16.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16.class); super(ClientboundPackets1_16_2.class, ClientboundPackets1_16.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16.class);
@ -101,7 +102,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
} }
}); });
new TagRewriter<>(this).register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY); tagRewriter.register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY);
new StatisticsRewriter<>(this).register(ClientboundPackets1_16_2.STATISTICS); new StatisticsRewriter<>(this).register(ClientboundPackets1_16_2.STATISTICS);
} }
@ -142,4 +143,9 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
public BlockItemPackets1_16_2 getItemRewriter() { public BlockItemPackets1_16_2 getItemRewriter() {
return blockItemPackets; return blockItemPackets;
} }
@Override
public TagRewriter<ClientboundPackets1_16_2> getTagRewriter() {
return tagRewriter;
}
} }

Datei anzeigen

@ -59,6 +59,7 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
private final EntityPackets1_17 entityRewriter = new EntityPackets1_17(this); private final EntityPackets1_17 entityRewriter = new EntityPackets1_17(this);
private final BlockItemPackets1_17 blockItemPackets = new BlockItemPackets1_17(this); private final BlockItemPackets1_17 blockItemPackets = new BlockItemPackets1_17(this);
private final TranslatableRewriter<ClientboundPackets1_17> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); private final TranslatableRewriter<ClientboundPackets1_17> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_17> tagRewriter = new TagRewriter<>(this);
public Protocol1_16_4To1_17() { public Protocol1_16_4To1_17() {
super(ClientboundPackets1_17.class, ClientboundPackets1_16_2.class, ServerboundPackets1_17.class, ServerboundPackets1_16_2.class); super(ClientboundPackets1_17.class, ClientboundPackets1_16_2.class, ServerboundPackets1_17.class, ServerboundPackets1_16_2.class);
@ -81,7 +82,6 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
soundRewriter.registerNamedSound(ClientboundPackets1_17.NAMED_SOUND); soundRewriter.registerNamedSound(ClientboundPackets1_17.NAMED_SOUND);
soundRewriter.registerStopSound(ClientboundPackets1_17.STOP_SOUND); soundRewriter.registerStopSound(ClientboundPackets1_17.STOP_SOUND);
TagRewriter<ClientboundPackets1_17> tagRewriter = new TagRewriter<>(this);
registerClientbound(ClientboundPackets1_17.TAGS, wrapper -> { registerClientbound(ClientboundPackets1_17.TAGS, wrapper -> {
Map<String, List<TagData>> tags = new HashMap<>(); Map<String, List<TagData>> tags = new HashMap<>();
@ -249,4 +249,9 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
public BlockItemPackets1_17 getItemRewriter() { public BlockItemPackets1_17 getItemRewriter() {
return blockItemPackets; return blockItemPackets;
} }
@Override
public TagRewriter<ClientboundPackets1_17> getTagRewriter() {
return tagRewriter;
}
} }

Datei anzeigen

@ -42,6 +42,7 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
private final EntityPackets1_18 entityRewriter = new EntityPackets1_18(this); private final EntityPackets1_18 entityRewriter = new EntityPackets1_18(this);
private final BlockItemPackets1_18 itemRewriter = new BlockItemPackets1_18(this); private final BlockItemPackets1_18 itemRewriter = new BlockItemPackets1_18(this);
private final TranslatableRewriter<ClientboundPackets1_18> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); private final TranslatableRewriter<ClientboundPackets1_18> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_18> tagRewriter = new TagRewriter<>(this);
public Protocol1_17_1To1_18() { public Protocol1_17_1To1_18() {
super(ClientboundPackets1_18.class, ClientboundPackets1_17_1.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class); super(ClientboundPackets1_18.class, ClientboundPackets1_17_1.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class);
@ -68,7 +69,6 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
soundRewriter.registerStopSound(ClientboundPackets1_18.STOP_SOUND); soundRewriter.registerStopSound(ClientboundPackets1_18.STOP_SOUND);
soundRewriter.registerNamedSound(ClientboundPackets1_18.NAMED_SOUND); soundRewriter.registerNamedSound(ClientboundPackets1_18.NAMED_SOUND);
final TagRewriter<ClientboundPackets1_18> tagRewriter = new TagRewriter<>(this);
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:lava_pool_stone_replaceables"); tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:lava_pool_stone_replaceables");
tagRewriter.registerGeneric(ClientboundPackets1_18.TAGS); tagRewriter.registerGeneric(ClientboundPackets1_18.TAGS);
@ -154,4 +154,9 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
public TranslatableRewriter<ClientboundPackets1_18> getTranslatableRewriter() { public TranslatableRewriter<ClientboundPackets1_18> getTranslatableRewriter() {
return translatableRewriter; return translatableRewriter;
} }
@Override
public TagRewriter<ClientboundPackets1_18> getTagRewriter() {
return tagRewriter;
}
} }

Datei anzeigen

@ -69,6 +69,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
private final EntityPackets1_19 entityRewriter = new EntityPackets1_19(this); private final EntityPackets1_19 entityRewriter = new EntityPackets1_19(this);
private final BlockItemPackets1_19 blockItemPackets = new BlockItemPackets1_19(this); private final BlockItemPackets1_19 blockItemPackets = new BlockItemPackets1_19(this);
private final TranslatableRewriter<ClientboundPackets1_19> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); private final TranslatableRewriter<ClientboundPackets1_19> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_19> tagRewriter = new TagRewriter<>(this);
public Protocol1_18_2To1_19() { public Protocol1_18_2To1_19() {
super(ClientboundPackets1_19.class, ClientboundPackets1_18.class, ServerboundPackets1_19.class, ServerboundPackets1_17.class); super(ClientboundPackets1_19.class, ClientboundPackets1_18.class, ServerboundPackets1_19.class, ServerboundPackets1_17.class);
@ -131,7 +132,6 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
} }
}); });
final TagRewriter<ClientboundPackets1_19> tagRewriter = new TagRewriter<>(this);
tagRewriter.removeTags("minecraft:banner_pattern"); tagRewriter.removeTags("minecraft:banner_pattern");
tagRewriter.removeTags("minecraft:instrument"); tagRewriter.removeTags("minecraft:instrument");
tagRewriter.removeTags("minecraft:cat_variant"); tagRewriter.removeTags("minecraft:cat_variant");
@ -371,4 +371,9 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
public BlockItemPackets1_19 getItemRewriter() { public BlockItemPackets1_19 getItemRewriter() {
return blockItemPackets; return blockItemPackets;
} }
@Override
public TagRewriter<ClientboundPackets1_19> getTagRewriter() {
return tagRewriter;
}
} }

Datei anzeigen

@ -72,6 +72,7 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
private final EntityPackets1_19_3 entityRewriter = new EntityPackets1_19_3(this); private final EntityPackets1_19_3 entityRewriter = new EntityPackets1_19_3(this);
private final BlockItemPackets1_19_3 itemRewriter = new BlockItemPackets1_19_3(this); private final BlockItemPackets1_19_3 itemRewriter = new BlockItemPackets1_19_3(this);
private final TranslatableRewriter<ClientboundPackets1_19_3> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); private final TranslatableRewriter<ClientboundPackets1_19_3> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_19_3> tagRewriter = new TagRewriter<>(this);
public Protocol1_19_1To1_19_3() { public Protocol1_19_1To1_19_3() {
super(ClientboundPackets1_19_3.class, ClientboundPackets1_19_1.class, ServerboundPackets1_19_3.class, ServerboundPackets1_19_1.class); super(ClientboundPackets1_19_3.class, ClientboundPackets1_19_1.class, ServerboundPackets1_19_3.class, ServerboundPackets1_19_1.class);
@ -116,7 +117,6 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
wrapper.write(Type.VAR_INT, mappedId); wrapper.write(Type.VAR_INT, mappedId);
}); });
final TagRewriter<ClientboundPackets1_19_3> tagRewriter = new TagRewriter<>(this);
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:non_flammable_wood"); tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:non_flammable_wood");
tagRewriter.addEmptyTag(RegistryType.ITEM, "minecraft:overworld_natural_logs"); tagRewriter.addEmptyTag(RegistryType.ITEM, "minecraft:overworld_natural_logs");
tagRewriter.registerGeneric(ClientboundPackets1_19_3.TAGS); tagRewriter.registerGeneric(ClientboundPackets1_19_3.TAGS);
@ -404,4 +404,9 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
public EntityPackets1_19_3 getEntityRewriter() { public EntityPackets1_19_3 getEntityRewriter() {
return entityRewriter; return entityRewriter;
} }
@Override
public TagRewriter<ClientboundPackets1_19_3> getTagRewriter() {
return tagRewriter;
}
} }

Datei anzeigen

@ -47,6 +47,7 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol<ClientboundP
private final EntityPackets1_19_4 entityRewriter = new EntityPackets1_19_4(this); private final EntityPackets1_19_4 entityRewriter = new EntityPackets1_19_4(this);
private final BlockItemPackets1_19_4 itemRewriter = new BlockItemPackets1_19_4(this); private final BlockItemPackets1_19_4 itemRewriter = new BlockItemPackets1_19_4(this);
private final TranslatableRewriter<ClientboundPackets1_19_4> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); private final TranslatableRewriter<ClientboundPackets1_19_4> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_19_4> tagRewriter = new TagRewriter<>(this);
public Protocol1_19_3To1_19_4() { public Protocol1_19_3To1_19_4() {
super(ClientboundPackets1_19_4.class, ClientboundPackets1_19_3.class, ServerboundPackets1_19_4.class, ServerboundPackets1_19_3.class); super(ClientboundPackets1_19_4.class, ClientboundPackets1_19_3.class, ServerboundPackets1_19_4.class, ServerboundPackets1_19_3.class);
@ -96,7 +97,6 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol<ClientboundP
} }
}.registerDeclareCommands1_19(ClientboundPackets1_19_4.DECLARE_COMMANDS); }.registerDeclareCommands1_19(ClientboundPackets1_19_4.DECLARE_COMMANDS);
final TagRewriter<ClientboundPackets1_19_4> tagRewriter = new TagRewriter<>(this);
tagRewriter.removeTags("minecraft:damage_type"); tagRewriter.removeTags("minecraft:damage_type");
tagRewriter.registerGeneric(ClientboundPackets1_19_4.TAGS); tagRewriter.registerGeneric(ClientboundPackets1_19_4.TAGS);
@ -139,4 +139,9 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol<ClientboundP
public TranslatableRewriter<ClientboundPackets1_19_4> getTranslatableRewriter() { public TranslatableRewriter<ClientboundPackets1_19_4> getTranslatableRewriter() {
return translatableRewriter; return translatableRewriter;
} }
@Override
public TagRewriter<ClientboundPackets1_19_4> getTagRewriter() {
return tagRewriter;
}
} }

Datei anzeigen

@ -41,6 +41,7 @@ public final class Protocol1_19_4To1_20 extends BackwardsProtocol<ClientboundPac
private final TranslatableRewriter<ClientboundPackets1_19_4> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); private final TranslatableRewriter<ClientboundPackets1_19_4> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final EntityPackets1_20 entityRewriter = new EntityPackets1_20(this); private final EntityPackets1_20 entityRewriter = new EntityPackets1_20(this);
private final BlockItemPackets1_20 itemRewriter = new BlockItemPackets1_20(this); private final BlockItemPackets1_20 itemRewriter = new BlockItemPackets1_20(this);
private final TagRewriter<ClientboundPackets1_19_4> tagRewriter = new TagRewriter<>(this);
public Protocol1_19_4To1_20() { public Protocol1_19_4To1_20() {
super(ClientboundPackets1_19_4.class, ClientboundPackets1_19_4.class, ServerboundPackets1_19_4.class, ServerboundPackets1_19_4.class); super(ClientboundPackets1_19_4.class, ClientboundPackets1_19_4.class, ServerboundPackets1_19_4.class, ServerboundPackets1_19_4.class);
@ -50,7 +51,6 @@ public final class Protocol1_19_4To1_20 extends BackwardsProtocol<ClientboundPac
protected void registerPackets() { protected void registerPackets() {
super.registerPackets(); super.registerPackets();
final TagRewriter<ClientboundPackets1_19_4> tagRewriter = new TagRewriter<>(this);
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:replaceable_plants"); tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:replaceable_plants");
tagRewriter.registerGeneric(ClientboundPackets1_19_4.TAGS); tagRewriter.registerGeneric(ClientboundPackets1_19_4.TAGS);
@ -115,4 +115,9 @@ public final class Protocol1_19_4To1_20 extends BackwardsProtocol<ClientboundPac
public TranslatableRewriter<ClientboundPackets1_19_4> getTranslatableRewriter() { public TranslatableRewriter<ClientboundPackets1_19_4> getTranslatableRewriter() {
return translatableRewriter; return translatableRewriter;
} }
@Override
public TagRewriter<ClientboundPackets1_19_4> getTagRewriter() {
return tagRewriter;
}
} }

Datei anzeigen

@ -65,6 +65,7 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
private final EntityPacketRewriter1_20_3 entityRewriter = new EntityPacketRewriter1_20_3(this); private final EntityPacketRewriter1_20_3 entityRewriter = new EntityPacketRewriter1_20_3(this);
private final BlockItemPacketRewriter1_20_3 itemRewriter = new BlockItemPacketRewriter1_20_3(this); private final BlockItemPacketRewriter1_20_3 itemRewriter = new BlockItemPacketRewriter1_20_3(this);
private final TranslatableRewriter<ClientboundPacket1_20_3> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); private final TranslatableRewriter<ClientboundPacket1_20_3> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
private final TagRewriter<ClientboundPacket1_20_3> tagRewriter = new TagRewriter<>(this);
public Protocol1_20_2To1_20_3() { public Protocol1_20_2To1_20_3() {
super(ClientboundPacket1_20_3.class, ClientboundPacket1_20_2.class, ServerboundPacket1_20_3.class, ServerboundPacket1_20_2.class); super(ClientboundPacket1_20_3.class, ClientboundPacket1_20_2.class, ServerboundPacket1_20_3.class, ServerboundPacket1_20_2.class);
@ -74,7 +75,6 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
protected void registerPackets() { protected void registerPackets() {
super.registerPackets(); super.registerPackets();
final TagRewriter<ClientboundPacket1_20_3> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS); tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS);
final SoundRewriter<ClientboundPacket1_20_3> soundRewriter = new SoundRewriter<>(this); final SoundRewriter<ClientboundPacket1_20_3> soundRewriter = new SoundRewriter<>(this);
@ -402,6 +402,11 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
return translatableRewriter; return translatableRewriter;
} }
@Override
public TagRewriter<ClientboundPacket1_20_3> getTagRewriter() {
return tagRewriter;
}
@Override @Override
protected PacketTypesProvider<ClientboundPacket1_20_3, ClientboundPacket1_20_2, ServerboundPacket1_20_3, ServerboundPacket1_20_2> createPacketTypesProvider() { protected PacketTypesProvider<ClientboundPacket1_20_3, ClientboundPacket1_20_2, ServerboundPacket1_20_3, ServerboundPacket1_20_2> createPacketTypesProvider() {
return new SimplePacketTypesProvider<>( return new SimplePacketTypesProvider<>(

Datei anzeigen

@ -67,6 +67,7 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
private final EntityPacketRewriter1_20_5 entityRewriter = new EntityPacketRewriter1_20_5(this); private final EntityPacketRewriter1_20_5 entityRewriter = new EntityPacketRewriter1_20_5(this);
private final BlockItemPacketRewriter1_20_5 itemRewriter = new BlockItemPacketRewriter1_20_5(this); private final BlockItemPacketRewriter1_20_5 itemRewriter = new BlockItemPacketRewriter1_20_5(this);
private final TranslatableRewriter<ClientboundPacket1_20_5> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); private final TranslatableRewriter<ClientboundPacket1_20_5> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
private final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
public Protocol1_20_3To1_20_5() { public Protocol1_20_3To1_20_5() {
super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_3.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_3.class); super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_3.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_3.class);
@ -76,7 +77,6 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
protected void registerPackets() { protected void registerPackets() {
super.registerPackets(); super.registerPackets();
final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS); tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS);
registerClientbound(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS, wrapper -> { registerClientbound(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS, wrapper -> {
// Send off registry data first // Send off registry data first
@ -232,6 +232,11 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
return translatableRewriter; return translatableRewriter;
} }
@Override
public TagRewriter<ClientboundPacket1_20_5> getTagRewriter() {
return tagRewriter;
}
@Override @Override
protected PacketTypesProvider<ClientboundPacket1_20_5, ClientboundPacket1_20_3, ServerboundPacket1_20_5, ServerboundPacket1_20_3> createPacketTypesProvider() { protected PacketTypesProvider<ClientboundPacket1_20_5, ClientboundPacket1_20_3, ServerboundPacket1_20_5, ServerboundPacket1_20_3> createPacketTypesProvider() {
return new SimplePacketTypesProvider<>( return new SimplePacketTypesProvider<>(

Datei anzeigen

@ -51,6 +51,7 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPac
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.20.2", "1.20", Protocol1_20_2To1_20.class); public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.20.2", "1.20", Protocol1_20_2To1_20.class);
private final EntityPacketRewriter1_20_2 entityPacketRewriter = new EntityPacketRewriter1_20_2(this); private final EntityPacketRewriter1_20_2 entityPacketRewriter = new EntityPacketRewriter1_20_2(this);
private final BlockItemPacketRewriter1_20_2 itemPacketRewriter = new BlockItemPacketRewriter1_20_2(this); private final BlockItemPacketRewriter1_20_2 itemPacketRewriter = new BlockItemPacketRewriter1_20_2(this);
private final TagRewriter<ClientboundPackets1_20_2> tagRewriter = new TagRewriter<>(this);
public Protocol1_20To1_20_2() { public Protocol1_20To1_20_2() {
super(ClientboundPackets1_20_2.class, ClientboundPackets1_19_4.class, ServerboundPackets1_20_2.class, ServerboundPackets1_19_4.class); super(ClientboundPackets1_20_2.class, ClientboundPackets1_19_4.class, ServerboundPackets1_20_2.class, ServerboundPackets1_19_4.class);
@ -60,7 +61,6 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPac
protected void registerPackets() { protected void registerPackets() {
super.registerPackets(); super.registerPackets();
final TagRewriter<ClientboundPackets1_20_2> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS); tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS);
final SoundRewriter<ClientboundPackets1_20_2> soundRewriter = new SoundRewriter<>(this); final SoundRewriter<ClientboundPackets1_20_2> soundRewriter = new SoundRewriter<>(this);
@ -216,4 +216,9 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPac
public ItemRewriter<Protocol1_20To1_20_2> getItemRewriter() { public ItemRewriter<Protocol1_20To1_20_2> getItemRewriter() {
return itemPacketRewriter; return itemPacketRewriter;
} }
@Override
public TagRewriter<ClientboundPackets1_20_2> getTagRewriter() {
return tagRewriter;
}
} }

Datei anzeigen

@ -1,77 +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.utils;
public class Block {
private final int id;
private final short data;
public Block(int id, int data) {
this.id = id;
this.data = (short) data;
}
public int getId() {
return id;
}
public int getData() {
return data;
}
public Block withData(int data) {
return new Block(this.id, data);
}
public static int getId(final int rawId) {
return rawId >> 4;
}
public static int getData(final int rawId) {
return rawId & 15;
}
public static int rawById(final int id) {
return id << 4;
}
public static int rawByData(final int data) {
return data & ~15;
}
public static int toRawId(final int id, final int data) {
return (id << 4) | (data & 15);
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Block block = (Block) o;
if (id != block.id) return false;
return data == block.data;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + data;
return result;
}
}

Datei anzeigen

@ -51,6 +51,7 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol<ClientboundPacke
private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this); private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this);
private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this); private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this);
private final TranslatableRewriter<ClientboundPacket1_20_5> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); private final TranslatableRewriter<ClientboundPacket1_20_5> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
private final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
public Protocol1_98To1_99() { public Protocol1_98To1_99() {
super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_5.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_5.class); super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_5.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_5.class);
@ -60,7 +61,6 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol<ClientboundPacke
protected void registerPackets() { protected void registerPackets() {
super.registerPackets(); super.registerPackets();
final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS); tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS);
tagRewriter.registerGeneric(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS); tagRewriter.registerGeneric(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS);
@ -111,5 +111,10 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol<ClientboundPacke
return translatableRewriter; return translatableRewriter;
} }
@Override
public TagRewriter<ClientboundPacket1_20_5> getTagRewriter() {
return tagRewriter;
}
// createPacketTypesProvider // createPacketTypesProvider
} }