1.16.2-pre3 (almost)

The Nether does not have its custom fog, no idea why yet
This commit is contained in:
KennyTV 2020-08-06 20:21:54 +02:00
parent ea0f91136e
commit f6fec5b93b
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
14 changed files with 52 additions and 12 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>3.1.0-1.16.2-pre2</version> <version>3.1.0-1.16.2-pre3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>3.1.0-1.16.2-pre2</version> <version>3.1.0-1.16.2-pre3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>3.1.0-1.16.2-pre2</version> <version>3.1.0-1.16.2-pre3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>3.1.0-1.16.2-pre2</version> <version>3.1.0-1.16.2-pre3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -84,7 +84,7 @@ public class ProtocolVersion {
register(v1_15_2 = new ProtocolVersion(578, "1.15.2")); register(v1_15_2 = new ProtocolVersion(578, "1.15.2"));
register(v1_16 = new ProtocolVersion(735, "1.16")); register(v1_16 = new ProtocolVersion(735, "1.16"));
register(v1_16_1 = new ProtocolVersion(736, "1.16.1")); register(v1_16_1 = new ProtocolVersion(736, "1.16.1"));
register(v1_16_2 = new ProtocolVersion(746, "1.16.2")); register(v1_16_2 = new ProtocolVersion(748, "1.16.2"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN")); register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
} }

View File

@ -1,6 +1,9 @@
package us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.data; package us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.data;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.ListTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.MappingDataLoader; import us.myles.ViaVersion.api.data.MappingDataLoader;
@ -9,9 +12,12 @@ import us.myles.ViaVersion.api.minecraft.nbt.BinaryTagIO;
import us.myles.ViaVersion.util.Int2IntBiMap; import us.myles.ViaVersion.util.Int2IntBiMap;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class MappingData { public class MappingData {
public static CompoundTag dimensionRegistry; public static CompoundTag dimensionRegistry;
public static Map<String, CompoundTag> dimensionDataMap = new HashMap<>();
public static Int2IntBiMap oldToNewItems = new Int2IntBiMap(); public static Int2IntBiMap oldToNewItems = new Int2IntBiMap();
public static Mappings blockMappings; public static Mappings blockMappings;
public static Mappings blockStateMappings; public static Mappings blockStateMappings;
@ -35,5 +41,14 @@ public class MappingData {
blockMappings = new Mappings(mapping1_16.getAsJsonObject("blocks"), mapping1_16_2.getAsJsonObject("blocks")); blockMappings = new Mappings(mapping1_16.getAsJsonObject("blocks"), mapping1_16_2.getAsJsonObject("blocks"));
MappingDataLoader.mapIdentifiers(oldToNewItems, mapping1_16.getAsJsonObject("items"), mapping1_16_2.getAsJsonObject("items")); MappingDataLoader.mapIdentifiers(oldToNewItems, mapping1_16.getAsJsonObject("items"), mapping1_16_2.getAsJsonObject("items"));
soundMappings = new Mappings(mapping1_16.getAsJsonArray("sounds"), mapping1_16_2.getAsJsonArray("sounds")); soundMappings = new Mappings(mapping1_16.getAsJsonArray("sounds"), mapping1_16_2.getAsJsonArray("sounds"));
// Data of each dimension
ListTag dimensions = ((CompoundTag) dimensionRegistry.get("minecraft:dimension_type")).get("value");
for (Tag dimension : dimensions) {
CompoundTag dimensionCompound = (CompoundTag) dimension;
// Copy with an empty name
CompoundTag dimensionData = new CompoundTag("", ((CompoundTag) dimensionCompound.get("element")).getValue());
dimensionDataMap.put(((StringTag) dimensionCompound.get("name")).getValue(), dimensionData);
}
} }
} }

View File

@ -1,5 +1,7 @@
package us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.packets; package us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.packets;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.entities.Entity1_16_2Types; import us.myles.ViaVersion.api.entities.Entity1_16_2Types;
import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.api.type.Type;
@ -40,8 +42,11 @@ public class EntityPackets {
// Throw away the old dimension registry, extra conversion would be too hard of a hit // Throw away the old dimension registry, extra conversion would be too hard of a hit
wrapper.read(Type.NBT); wrapper.read(Type.NBT);
wrapper.write(Type.NBT, MappingData.dimensionRegistry); wrapper.write(Type.NBT, MappingData.dimensionRegistry);
// Instead of the dimension's resource key, it now just wants the data directly
String dimensionType = wrapper.read(Type.STRING);
wrapper.write(Type.NBT, getDimensionData(dimensionType));
}); });
map(Type.STRING); // Dimension Type
map(Type.STRING); // Dimension map(Type.STRING); // Dimension
map(Type.LONG); // Seed map(Type.LONG); // Seed
map(Type.UNSIGNED_BYTE, Type.VAR_INT); // Max players map(Type.UNSIGNED_BYTE, Type.VAR_INT); // Max players
@ -54,5 +59,24 @@ public class EntityPackets {
}); });
} }
}); });
protocol.registerOutgoing(ClientboundPackets1_16.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
String dimensionType = wrapper.read(Type.STRING);
wrapper.write(Type.NBT, getDimensionData(dimensionType));
});
}
});
}
public static CompoundTag getDimensionData(String dimensionType) {
CompoundTag tag = MappingData.dimensionDataMap.get(dimensionType);
if (tag == null) {
Via.getPlatform().getLogger().severe("Could not get dimension data of " + dimensionType);
throw new NullPointerException("Dimension data for " + dimensionType + " is null!");
}
return tag;
} }
} }

View File

@ -84,6 +84,7 @@ public class WorldPackets {
PacketWrapper newPacket = wrapper.create(ClientboundPackets1_16_2.MULTI_BLOCK_CHANGE.ordinal()); PacketWrapper newPacket = wrapper.create(ClientboundPackets1_16_2.MULTI_BLOCK_CHANGE.ordinal());
newPacket.write(Type.LONG, chunkPosition | (chunkY & 0xFFFFFL)); newPacket.write(Type.LONG, chunkPosition | (chunkY & 0xFFFFFL));
newPacket.write(Type.BOOLEAN, false); // Ignore light updates
newPacket.write(Type.VAR_LONG_BLOCK_CHANGE_RECORD_ARRAY, sectionRecord.toArray(EMPTY_RECORDS)); newPacket.write(Type.VAR_LONG_BLOCK_CHANGE_RECORD_ARRAY, sectionRecord.toArray(EMPTY_RECORDS));
} }
}); });

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>3.1.0-1.16.2-pre2</version> <version>3.1.0-1.16.2-pre3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>3.1.0-1.16.2-pre2</version> <version>3.1.0-1.16.2-pre3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<name>viaversion-jar</name> <name>viaversion-jar</name>

View File

@ -6,7 +6,7 @@
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<version>3.1.0-1.16.2-pre2</version> <version>3.1.0-1.16.2-pre3</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>viaversion-parent</name> <name>viaversion-parent</name>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>3.1.0-1.16.2-pre2</version> <version>3.1.0-1.16.2-pre3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>3.1.0-1.16.2-pre2</version> <version>3.1.0-1.16.2-pre3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>3.1.0-1.16.2-pre2</version> <version>3.1.0-1.16.2-pre3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>