3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00
Missing: Diff mappings
Dieser Commit ist enthalten in:
KennyTV 2020-11-04 21:52:38 +01:00
Ursprung 692e53427b
Commit 0d3f729679
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
19 geänderte Dateien mit 21488 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-20w45a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-20w45a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-20w45a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-20w45a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -75,7 +75,7 @@ public class ProtocolPipeline extends SimpleProtocol {
packetWrapper.apply(direction, state, 0, protocolList, direction == Direction.OUTGOING);
super.transform(direction, state, packetWrapper);
if (Via.getManager().isDebug()) {
if (Via.getManager().isDebug()) { // 26 52 76
logPacket(direction, state, packetWrapper, originalID);
}
}

Datei anzeigen

@ -34,6 +34,7 @@ import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16
import us.myles.ViaVersion.protocols.protocol1_16_3to1_16_2.Protocol1_16_3To1_16_2;
import us.myles.ViaVersion.protocols.protocol1_16_4to1_16_3.Protocol1_16_4To1_16_3;
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4;
import us.myles.ViaVersion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3To1_9_1_2;
@ -118,6 +119,8 @@ public class ProtocolRegistry {
registerProtocol(new Protocol1_16_2To1_16_1(), ProtocolVersion.v1_16_2, ProtocolVersion.v1_16_1);
registerProtocol(new Protocol1_16_3To1_16_2(), ProtocolVersion.v1_16_3, ProtocolVersion.v1_16_2);
registerProtocol(new Protocol1_16_4To1_16_3(), ProtocolVersion.v1_16_4, ProtocolVersion.v1_16_3);
registerProtocol(new Protocol1_17To1_16_4(), ProtocolVersion.v1_17, ProtocolVersion.v1_16_4);
}
public static void init() {

Datei anzeigen

@ -54,6 +54,7 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_16_2 = register(751, "1.16.2");
public static final ProtocolVersion v1_16_3 = register(753, "1.16.3");
public static final ProtocolVersion v1_16_4 = register(754, "1.16.4");
public static final ProtocolVersion v1_17 = register(755, 5, "1.17");
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
public static ProtocolVersion register(int version, String name) {

Datei anzeigen

@ -0,0 +1,64 @@
package us.myles.ViaVersion.protocols.protocol1_17to1_16_4;
import org.jetbrains.annotations.Nullable;
import us.myles.ViaVersion.api.data.MappingData;
import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.RegistryType;
import us.myles.ViaVersion.api.rewriters.SoundRewriter;
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
import us.myles.ViaVersion.api.rewriters.TagRewriter;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.packets.InventoryPackets;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.packets.WorldPackets;
public class Protocol1_17To1_16_4 extends Protocol<ClientboundPackets1_16_2, ClientboundPackets1_16_2, ServerboundPackets1_16_2, ServerboundPackets1_16_2> {
public static final MappingData MAPPINGS = new MappingData("1.16.2", "1.17");
private TagRewriter tagRewriter;
public Protocol1_17To1_16_4() {
super(ClientboundPackets1_16_2.class, ClientboundPackets1_16_2.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16_2.class);
}
@Override
protected void registerPackets() {
InventoryPackets.register(this);
WorldPackets.register(this);
tagRewriter = new TagRewriter(this, null);
tagRewriter.register(ClientboundPackets1_16_2.TAGS);
new StatisticsRewriter(this, null).register(ClientboundPackets1_16_2.STATISTICS);
SoundRewriter soundRewriter = new SoundRewriter(this);
soundRewriter.registerSound(ClientboundPackets1_16_2.SOUND);
soundRewriter.registerSound(ClientboundPackets1_16_2.ENTITY_SOUND);
registerOutgoing(ClientboundPackets1_16_2.RESOURCE_PACK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
wrapper.passthrough(Type.STRING);
wrapper.passthrough(Type.STRING);
wrapper.write(Type.BOOLEAN, false); // Required
});
}
});
}
@Override
protected void onMappingDataLoaded() {
tagRewriter.addEmptyTags(RegistryType.ITEM, "minecraft:candles", "minecraft:ignored_by_piglin_babies", "minecraft:piglin_food");
tagRewriter.addEmptyTags(RegistryType.BLOCK, "minecraft:crystal_sound_blocks", "minecraft:candle_cakes", "minecraft:candles");
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:cauldrons", 261);
}
@Override
@Nullable
public MappingData getMappingData() {
return MAPPINGS;
}
}

Datei anzeigen

@ -0,0 +1,50 @@
package us.myles.ViaVersion.protocols.protocol1_17to1_16_4.packets;
import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
public class InventoryPackets {
public static void register(Protocol1_17To1_16_4 protocol) {
ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets::toClient, InventoryPackets::toServer);
itemRewriter.registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN);
itemRewriter.registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
itemRewriter.registerTradeList(ClientboundPackets1_16_2.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerSetSlot(ClientboundPackets1_16_2.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerAdvancements(ClientboundPackets1_16_2.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerEntityEquipmentArray(ClientboundPackets1_16_2.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
new RecipeRewriter1_16(protocol, InventoryPackets::toClient).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES);
itemRewriter.registerClickWindow(ServerboundPackets1_16_2.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerCreativeInvAction(ServerboundPackets1_16_2.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
protocol.registerIncoming(ServerboundPackets1_16_2.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
}
});
itemRewriter.registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
}
public static void toClient(Item item) {
if (item == null) return;
item.setIdentifier(Protocol1_17To1_16_4.MAPPINGS.getNewItemId(item.getIdentifier()));
}
public static void toServer(Item item) {
if (item == null) return;
item.setIdentifier(Protocol1_17To1_16_4.MAPPINGS.getOldItemId(item.getIdentifier()));
}
}

Datei anzeigen

@ -0,0 +1,65 @@
package us.myles.ViaVersion.protocols.protocol1_17to1_16_4.packets;
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.BlockRewriter;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.types.Chunk1_16_2Type;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
public class WorldPackets {
public static void register(Protocol1_17To1_16_4 protocol) {
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
blockRewriter.registerBlockAction(ClientboundPackets1_16_2.BLOCK_ACTION);
blockRewriter.registerBlockChange(ClientboundPackets1_16_2.BLOCK_CHANGE);
blockRewriter.registerMultiBlockChange(ClientboundPackets1_16_2.MULTI_BLOCK_CHANGE);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16_2.ACKNOWLEDGE_PLAYER_DIGGING);
protocol.registerOutgoing(ClientboundPackets1_16_2.UPDATE_LIGHT, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
wrapper.passthrough(Type.VAR_INT);
wrapper.passthrough(Type.VAR_INT);
wrapper.passthrough(Type.BOOLEAN);
wrapper.write(Type.VAR_LONG, wrapper.read(Type.VAR_INT).longValue()); // Sky mask
wrapper.write(Type.VAR_LONG, wrapper.read(Type.VAR_INT).longValue()); // Block mask
wrapper.write(Type.VAR_LONG, wrapper.read(Type.VAR_INT).longValue()); // Empty sky mask
wrapper.write(Type.VAR_LONG, wrapper.read(Type.VAR_INT).longValue()); // Empty block mask
});
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
Chunk chunk = wrapper.read(new Chunk1_16_2Type());
wrapper.write(new Chunk1_17Type(), chunk);
if (!chunk.isFullChunk()) {
chunk.setBiomeData(new int[0]);
//TODO does this have to be converted to a multi block change and/or entity nbt update?
}
for (int s = 0; s < 16; s++) {
ChunkSection section = chunk.getSections()[s];
if (section == null) continue;
for (int i = 0; i < section.getPaletteSize(); i++) {
int old = section.getPaletteEntry(i);
section.setPaletteEntry(i, protocol.getMappingData().getNewBlockStateId(old));
}
}
});
}
});
blockRewriter.registerEffect(ClientboundPackets1_16_2.EFFECT, 1010, 2001);
}
}

Datei anzeigen

@ -0,0 +1,95 @@
package us.myles.ViaVersion.protocols.protocol1_17to1_16_4.types;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import io.netty.buffer.ByteBuf;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.minecraft.chunks.BaseChunk;
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.minecraft.BaseChunkType;
import us.myles.ViaVersion.api.type.types.version.Types1_16;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Chunk1_17Type extends Type<Chunk> {
private static final CompoundTag[] EMPTY_COMPOUNDS = new CompoundTag[0];
public Chunk1_17Type() {
super(Chunk.class);
}
@Override
public Chunk read(ByteBuf input) throws Exception {
int chunkX = input.readInt();
int chunkZ = input.readInt();
int primaryBitmask = Type.VAR_INT.readPrimitive(input);
CompoundTag heightMap = Type.NBT.read(input);
int[] biomeData = Type.VAR_INT_ARRAY_PRIMITIVE.read(input);
Type.VAR_INT.readPrimitive(input); // data size in bytes
// Read sections
ChunkSection[] sections = new ChunkSection[16];
for (int i = 0; i < 16; i++) {
if ((primaryBitmask & (1 << i)) == 0) continue; // Section not set
short nonAirBlocksCount = input.readShort();
ChunkSection section = Types1_16.CHUNK_SECTION.read(input);
section.setNonAirBlocksCount(nonAirBlocksCount);
sections[i] = section;
}
List<CompoundTag> nbtData = new ArrayList<>(Arrays.asList(Type.NBT_ARRAY.read(input)));
// Read all the remaining bytes (workaround for #681)
if (input.readableBytes() > 0) {
byte[] array = Type.REMAINING_BYTES.read(input);
if (Via.getManager().isDebug()) {
Via.getPlatform().getLogger().warning("Found " + array.length + " more bytes than expected while reading the chunk: " + chunkX + "/" + chunkZ);
}
}
return new BaseChunk(chunkX, chunkZ, true, false, primaryBitmask, sections, biomeData, heightMap, nbtData);
}
@Override
public void write(ByteBuf output, Chunk chunk) throws Exception {
output.writeInt(chunk.getX());
output.writeInt(chunk.getZ());
Type.VAR_INT.writePrimitive(output, chunk.getBitmask());
Type.NBT.write(output, chunk.getHeightMap());
// Write biome data
Type.VAR_INT_ARRAY_PRIMITIVE.write(output, chunk.getBiomeData());
ByteBuf buf = output.alloc().buffer();
try {
for (int i = 0; i < 16; i++) {
ChunkSection section = chunk.getSections()[i];
if (section == null) continue; // Section not set
buf.writeShort(section.getNonAirBlocksCount());
Types1_16.CHUNK_SECTION.write(buf, section);
}
buf.readerIndex(0);
Type.VAR_INT.writePrimitive(output, buf.readableBytes());
output.writeBytes(buf);
} finally {
buf.release(); // release buffer
}
// Write Block Entities
Type.NBT_ARRAY.write(output, chunk.getBlockEntities().toArray(EMPTY_COMPOUNDS));
}
@Override
public Class<? extends Type> getBaseClass() {
return BaseChunkType.class;
}
}

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -0,0 +1,10 @@
{
"blockstates": {
"4729": "minecraft:chain[axis=y,waterlogged=true]",
"4730": "minecraft:chain[axis=y,waterlogged=false]",
"14886": "minecraft:lantern[hanging=true,waterlogged=false]",
"14887": "minecraft:lantern[hanging=false,waterlogged=false]",
"14888": "minecraft:soul_lantern[hanging=true,waterlogged=false]",
"14889": "minecraft:soul_lantern[hanging=false,waterlogged=false]"
}
}

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-20w45a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-20w45a</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>viaversion-jar</name>

Datei anzeigen

@ -6,7 +6,7 @@
<groupId>us.myles</groupId>
<artifactId>viaversion-parent</artifactId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-20w45a</version>
<packaging>pom</packaging>
<name>viaversion-parent</name>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-20w45a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-20w45a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.0-20w45a</version>
</parent>
<modelVersion>4.0.0</modelVersion>