Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2025-01-11 15:41:08 +01:00
Add support for 1.17.30 (v465)
Dieser Commit ist enthalten in:
Ursprung
58e00b2645
Commit
fdca9f9be6
@ -114,8 +114,8 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.CloudburstMC.Protocol</groupId>
|
||||
<artifactId>bedrock-v448</artifactId>
|
||||
<version>6b48673</version>
|
||||
<artifactId>bedrock-v465</artifactId>
|
||||
<version>v1.17.30-d29a058370-1</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
@ -27,6 +27,7 @@ package org.geysermc.connector.network;
|
||||
|
||||
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
|
||||
import com.nukkitx.protocol.bedrock.v448.Bedrock_v448;
|
||||
import com.nukkitx.protocol.bedrock.v448.Bedrock_v465;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -50,6 +51,7 @@ public class BedrockProtocol {
|
||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
||||
.minecraftVersion("1.17.10/1.17.11")
|
||||
.build());
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v465.V465_CODEC);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,11 +29,13 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.nukkitx.nbt.*;
|
||||
import com.nukkitx.protocol.bedrock.v448.Bedrock_v448;
|
||||
import com.nukkitx.protocol.bedrock.v448.Bedrock_v465;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectIntPair;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.translators.world.block.BlockStateValues;
|
||||
import org.geysermc.connector.network.translators.world.chunk.BlockStorage;
|
||||
@ -58,17 +60,15 @@ import java.util.zip.GZIPInputStream;
|
||||
* Populates the block registries.
|
||||
*/
|
||||
public class BlockRegistryPopulator {
|
||||
private static final ImmutableMap<String, BiFunction<String, NbtMapBuilder, String>> STATE_MAPPER;
|
||||
|
||||
private static final Object2IntMap<String> PALETTE_VERSIONS;
|
||||
private static final ImmutableMap<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> BLOCK_MAPPERS;
|
||||
private static final BiFunction<String, NbtMapBuilder, String> EMPTY_MAPPER = (bedrockIdentifier, statesBuilder) -> null;
|
||||
|
||||
static {
|
||||
ImmutableMap.Builder<String, BiFunction<String, NbtMapBuilder, String>> stateMapperBuilder = ImmutableMap.<String, BiFunction<String, NbtMapBuilder, String>>builder()
|
||||
.put("1_17_10", (bedrockIdentifier, statesBuilder) -> null);
|
||||
STATE_MAPPER = stateMapperBuilder.build();
|
||||
ImmutableMap.Builder<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> stateMapperBuilder = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
|
||||
.put(ObjectIntPair.of("1_17_10", Bedrock_v448.V448_CODEC.getProtocolVersion()), EMPTY_MAPPER)
|
||||
.put(ObjectIntPair.of("1_17_30", Bedrock_v465.V465_CODEC.getProtocolVersion()), EMPTY_MAPPER);
|
||||
|
||||
PALETTE_VERSIONS = new Object2IntOpenHashMap<>();
|
||||
PALETTE_VERSIONS.put("1_17_10", Bedrock_v448.V448_CODEC.getProtocolVersion());
|
||||
BLOCK_MAPPERS = stateMapperBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,8 +84,8 @@ public class BlockRegistryPopulator {
|
||||
}
|
||||
|
||||
private static void registerBedrockBlocks() {
|
||||
for (Map.Entry<String, BiFunction<String, NbtMapBuilder, String>> palette : STATE_MAPPER.entrySet()) {
|
||||
InputStream stream = FileUtils.getResource(String.format("bedrock/block_palette.%s.nbt", palette.getKey()));
|
||||
for (Map.Entry<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> palette : BLOCK_MAPPERS.entrySet()) {
|
||||
InputStream stream = FileUtils.getResource(String.format("bedrock/block_palette.%s.nbt", palette.getKey().key()));
|
||||
NbtList<NbtMap> blocksTag;
|
||||
try (NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) {
|
||||
NbtMap blockPalette = (NbtMap) nbtInputStream.readTag();
|
||||
@ -116,7 +116,7 @@ public class BlockRegistryPopulator {
|
||||
int movingBlockRuntimeId = -1;
|
||||
Iterator<Map.Entry<String, JsonNode>> blocksIterator = BLOCKS_JSON.fields();
|
||||
|
||||
BiFunction<String, NbtMapBuilder, String> stateMapper = STATE_MAPPER.getOrDefault(palette.getKey(), (i, s) -> null);
|
||||
BiFunction<String, NbtMapBuilder, String> stateMapper = BLOCK_MAPPERS.getOrDefault(palette.getKey(), EMPTY_MAPPER);
|
||||
|
||||
int[] javaToBedrockBlocks = new int[BLOCKS_JSON.size()];
|
||||
|
||||
@ -199,7 +199,7 @@ public class BlockRegistryPopulator {
|
||||
}
|
||||
builder.bedrockBlockStates(blocksTag);
|
||||
|
||||
BlockRegistries.BLOCKS.register(PALETTE_VERSIONS.getInt(palette.getKey()), builder.blockStateVersion(stateVersion)
|
||||
BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion)
|
||||
.emptyChunkSection(new ChunkSection(new BlockStorage[]{new BlockStorage(airRuntimeId)}))
|
||||
.javaToBedrockBlocks(javaToBedrockBlocks)
|
||||
.javaIdentifierToBedrockTag(javaIdentifierToBedrockTag)
|
||||
|
@ -36,6 +36,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||
import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
|
||||
import com.nukkitx.protocol.bedrock.v448.Bedrock_v448;
|
||||
import com.nukkitx.protocol.bedrock.v448.Bedrock_v465;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
@ -68,6 +69,8 @@ public class ItemRegistryPopulator {
|
||||
} else {
|
||||
PALETTE_VERSIONS.put("1_17_10", new PaletteVersion(Bedrock_v448.V448_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||
}
|
||||
|
||||
PALETTE_VERSIONS.put("1_17_30", new PaletteVersion(Bedrock_v465.V465_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||
}
|
||||
|
||||
@Getter
|
||||
@ -84,7 +87,7 @@ public class ItemRegistryPopulator {
|
||||
// Load item mappings from Java Edition to Bedrock Edition
|
||||
InputStream stream = FileUtils.getResource("mappings/items.json");
|
||||
|
||||
TypeReference<Map<String, GeyserMappingItem>> mappingItemsType = new TypeReference<Map<String, GeyserMappingItem>>() { };
|
||||
TypeReference<Map<String, GeyserMappingItem>> mappingItemsType = new TypeReference<>() { };
|
||||
|
||||
Map<String, GeyserMappingItem> items;
|
||||
try {
|
||||
|
BIN
connector/src/main/resources/bedrock/block_palette.1_17_30.nbt
Normale Datei
BIN
connector/src/main/resources/bedrock/block_palette.1_17_30.nbt
Normale Datei
Binäre Datei nicht angezeigt.
5207
connector/src/main/resources/bedrock/creative_items.1_17_30.json
Normale Datei
5207
connector/src/main/resources/bedrock/creative_items.1_17_30.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
4306
connector/src/main/resources/bedrock/runtime_item_states.1_17_30.json
Normale Datei
4306
connector/src/main/resources/bedrock/runtime_item_states.1_17_30.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren