Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 09:00:09 +01:00
Finish update
Still unsure whether we also have to store block entity data and if/which respawn conditions have to be checked for biome uncaching
Dieser Commit ist enthalten in:
Ursprung
0d3f729679
Commit
88a1a42625
@ -75,7 +75,7 @@ public class ProtocolPipeline extends SimpleProtocol {
|
|||||||
packetWrapper.apply(direction, state, 0, protocolList, direction == Direction.OUTGOING);
|
packetWrapper.apply(direction, state, 0, protocolList, direction == Direction.OUTGOING);
|
||||||
super.transform(direction, state, packetWrapper);
|
super.transform(direction, state, packetWrapper);
|
||||||
|
|
||||||
if (Via.getManager().isDebug()) { // 26 52 76
|
if (Via.getManager().isDebug()) {
|
||||||
logPacket(direction, state, packetWrapper, originalID);
|
logPacket(direction, state, packetWrapper, originalID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package us.myles.ViaVersion.protocols.protocol1_17to1_16_4;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.api.data.MappingData;
|
import us.myles.ViaVersion.api.data.MappingData;
|
||||||
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.rewriters.RegistryType;
|
import us.myles.ViaVersion.api.rewriters.RegistryType;
|
||||||
@ -13,10 +14,11 @@ import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_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.InventoryPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.packets.WorldPackets;
|
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.packets.WorldPackets;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.storage.BiomeStorage;
|
||||||
|
|
||||||
public class Protocol1_17To1_16_4 extends Protocol<ClientboundPackets1_16_2, ClientboundPackets1_16_2, ServerboundPackets1_16_2, ServerboundPackets1_16_2> {
|
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");
|
public static final MappingData MAPPINGS = new MappingData("1.16.2", "1.17", true);
|
||||||
private TagRewriter tagRewriter;
|
private TagRewriter tagRewriter;
|
||||||
|
|
||||||
public Protocol1_17To1_16_4() {
|
public Protocol1_17To1_16_4() {
|
||||||
@ -56,6 +58,11 @@ public class Protocol1_17To1_16_4 extends Protocol<ClientboundPackets1_16_2, Cli
|
|||||||
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:cauldrons", 261);
|
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:cauldrons", 261);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(UserConnection user) {
|
||||||
|
user.put(new BiomeStorage(user));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public MappingData getMappingData() {
|
public MappingData getMappingData() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_17to1_16_4.packets;
|
package us.myles.ViaVersion.protocols.protocol1_17to1_16_4.packets;
|
||||||
|
|
||||||
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
@ -8,6 +9,7 @@ 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.ClientboundPackets1_16_2;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.types.Chunk1_16_2Type;
|
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.Protocol1_17To1_16_4;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.storage.BiomeStorage;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
|
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
|
||||||
|
|
||||||
public class WorldPackets {
|
public class WorldPackets {
|
||||||
@ -43,9 +45,18 @@ public class WorldPackets {
|
|||||||
Chunk chunk = wrapper.read(new Chunk1_16_2Type());
|
Chunk chunk = wrapper.read(new Chunk1_16_2Type());
|
||||||
wrapper.write(new Chunk1_17Type(), chunk);
|
wrapper.write(new Chunk1_17Type(), chunk);
|
||||||
|
|
||||||
if (!chunk.isFullChunk()) {
|
BiomeStorage biomeStorage = wrapper.user().get(BiomeStorage.class);
|
||||||
chunk.setBiomeData(new int[0]);
|
if (chunk.isFullChunk()) {
|
||||||
//TODO does this have to be converted to a multi block change and/or entity nbt update?
|
biomeStorage.setBiomes(chunk.getX(), chunk.getZ(), chunk.getBiomeData());
|
||||||
|
} else {
|
||||||
|
// Biomes always have to be sent now
|
||||||
|
int[] biomes = biomeStorage.getBiomes(chunk.getX(), chunk.getZ());
|
||||||
|
if (biomes != null) {
|
||||||
|
chunk.setBiomeData(biomes);
|
||||||
|
} else {
|
||||||
|
Via.getPlatform().getLogger().warning("Biome data not found for chunk at " + chunk.getX() + ", " + chunk.getZ());
|
||||||
|
chunk.setBiomeData(new int[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int s = 0; s < 16; s++) {
|
for (int s = 0; s < 16; s++) {
|
||||||
@ -60,6 +71,17 @@ public class WorldPackets {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
protocol.registerOutgoing(ClientboundPackets1_16_2.UNLOAD_CHUNK, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
int x = wrapper.passthrough(Type.INT);
|
||||||
|
int z = wrapper.passthrough(Type.INT);
|
||||||
|
wrapper.user().get(BiomeStorage.class).clearBiomes(x, z);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
blockRewriter.registerEffect(ClientboundPackets1_16_2.EFFECT, 1010, 2001);
|
blockRewriter.registerEffect(ClientboundPackets1_16_2.EFFECT, 1010, 2001);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package us.myles.ViaVersion.protocols.protocol1_17to1_16_4.storage;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import us.myles.ViaVersion.api.data.StoredObject;
|
||||||
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class BiomeStorage extends StoredObject {
|
||||||
|
|
||||||
|
private final Map<Long, int[]> chunkBiomes = new HashMap<>();
|
||||||
|
|
||||||
|
public BiomeStorage(UserConnection user) {
|
||||||
|
super(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public int[] getBiomes(int x, int z) {
|
||||||
|
return chunkBiomes.get(getChunkSectionIndex(x, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBiomes(int x, int z, int[] biomes) {
|
||||||
|
chunkBiomes.put(getChunkSectionIndex(x, z), biomes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearBiomes(int x, int z) {
|
||||||
|
chunkBiomes.remove(getChunkSectionIndex(x, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
private long getChunkSectionIndex(int x, int z) {
|
||||||
|
return ((x & 0x3FFFFFFL) << 38) | (z & 0x3FFFFFFL);
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,61 @@
|
|||||||
{
|
{
|
||||||
|
"blocks": {
|
||||||
|
"498": "dirt_path"
|
||||||
|
},
|
||||||
"blockstates": {
|
"blockstates": {
|
||||||
"4729": "minecraft:chain[axis=y,waterlogged=true]",
|
"1305": "minecraft:powered_rail[powered=true,shape=north_south,waterlogged=false]",
|
||||||
"4730": "minecraft:chain[axis=y,waterlogged=false]",
|
"1306": "minecraft:powered_rail[powered=true,shape=east_west,waterlogged=false]",
|
||||||
"14886": "minecraft:lantern[hanging=true,waterlogged=false]",
|
"1307": "minecraft:powered_rail[powered=true,shape=ascending_east,waterlogged=false]",
|
||||||
"14887": "minecraft:lantern[hanging=false,waterlogged=false]",
|
"1308": "minecraft:powered_rail[powered=true,shape=ascending_west,waterlogged=false]",
|
||||||
"14888": "minecraft:soul_lantern[hanging=true,waterlogged=false]",
|
"1309": "minecraft:powered_rail[powered=true,shape=ascending_north,waterlogged=false]",
|
||||||
"14889": "minecraft:soul_lantern[hanging=false,waterlogged=false]"
|
"1310": "minecraft:powered_rail[powered=true,shape=ascending_south,waterlogged=false]",
|
||||||
|
"1311": "minecraft:powered_rail[powered=false,shape=north_south,waterlogged=false]",
|
||||||
|
"1312": "minecraft:powered_rail[powered=false,shape=east_west,waterlogged=false]",
|
||||||
|
"1313": "minecraft:powered_rail[powered=false,shape=ascending_east,waterlogged=false]",
|
||||||
|
"1314": "minecraft:powered_rail[powered=false,shape=ascending_west,waterlogged=false]",
|
||||||
|
"1315": "minecraft:powered_rail[powered=false,shape=ascending_north,waterlogged=false]",
|
||||||
|
"1316": "minecraft:powered_rail[powered=false,shape=ascending_south,waterlogged=false]",
|
||||||
|
"1317": "minecraft:detector_rail[powered=true,shape=north_south,waterlogged=false]",
|
||||||
|
"1318": "minecraft:detector_rail[powered=true,shape=east_west,waterlogged=false]",
|
||||||
|
"1319": "minecraft:detector_rail[powered=true,shape=ascending_east,waterlogged=false]",
|
||||||
|
"1320": "minecraft:detector_rail[powered=true,shape=ascending_west,waterlogged=false]",
|
||||||
|
"1321": "minecraft:detector_rail[powered=true,shape=ascending_north,waterlogged=false]",
|
||||||
|
"1322": "minecraft:detector_rail[powered=true,shape=ascending_south,waterlogged=false]",
|
||||||
|
"1323": "minecraft:detector_rail[powered=false,shape=north_south,waterlogged=false]",
|
||||||
|
"1324": "minecraft:detector_rail[powered=false,shape=east_west,waterlogged=false]",
|
||||||
|
"1325": "minecraft:detector_rail[powered=false,shape=ascending_east,waterlogged=false]",
|
||||||
|
"1326": "minecraft:detector_rail[powered=false,shape=ascending_west,waterlogged=false]",
|
||||||
|
"1327": "minecraft:detector_rail[powered=false,shape=ascending_north,waterlogged=false]",
|
||||||
|
"1328": "minecraft:detector_rail[powered=false,shape=ascending_south,waterlogged=false]",
|
||||||
|
"3645": "minecraft:rail[shape=north_south,waterlogged=false]",
|
||||||
|
"3646": "minecraft:rail[shape=east_west,waterlogged=false]",
|
||||||
|
"3647": "minecraft:rail[shape=ascending_east,waterlogged=false]",
|
||||||
|
"3648": "minecraft:rail[shape=ascending_west,waterlogged=false]",
|
||||||
|
"3649": "minecraft:rail[shape=ascending_north,waterlogged=false]",
|
||||||
|
"3650": "minecraft:rail[shape=ascending_south,waterlogged=false]",
|
||||||
|
"3651": "minecraft:rail[shape=south_east,waterlogged=false]",
|
||||||
|
"3652": "minecraft:rail[shape=south_west,waterlogged=false]",
|
||||||
|
"3653": "minecraft:rail[shape=north_west,waterlogged=false]",
|
||||||
|
"3654": "minecraft:rail[shape=north_east,waterlogged=false]",
|
||||||
|
"6827": "minecraft:activator_rail[powered=true,shape=north_south,waterlogged=false]",
|
||||||
|
"6828": "minecraft:activator_rail[powered=true,shape=east_west,waterlogged=false]",
|
||||||
|
"6829": "minecraft:activator_rail[powered=true,shape=ascending_east,waterlogged=false]",
|
||||||
|
"6830": "minecraft:activator_rail[powered=true,shape=ascending_west,waterlogged=false]",
|
||||||
|
"6831": "minecraft:activator_rail[powered=true,shape=ascending_north,waterlogged=false]",
|
||||||
|
"6832": "minecraft:activator_rail[powered=true,shape=ascending_south,waterlogged=false]",
|
||||||
|
"6833": "minecraft:activator_rail[powered=false,shape=north_south,waterlogged=false]",
|
||||||
|
"6834": "minecraft:activator_rail[powered=false,shape=east_west,waterlogged=false]",
|
||||||
|
"6835": "minecraft:activator_rail[powered=false,shape=ascending_east,waterlogged=false]",
|
||||||
|
"6836": "minecraft:activator_rail[powered=false,shape=ascending_west,waterlogged=false]",
|
||||||
|
"6837": "minecraft:activator_rail[powered=false,shape=ascending_north,waterlogged=false]",
|
||||||
|
"6838": "minecraft:activator_rail[powered=false,shape=ascending_south,waterlogged=false]",
|
||||||
|
"5145": "minecraft:cauldron",
|
||||||
|
"5146": "minecraft:water_cauldron[level=1]",
|
||||||
|
"5147": "minecraft:water_cauldron[level=2]",
|
||||||
|
"5148": "minecraft:water_cauldron[level=3]",
|
||||||
|
"9227": "minecraft:dirt_path"
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
"372": "minecraft:dirt_path"
|
||||||
}
|
}
|
||||||
}
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren