mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Merge remote-tracking branch 'upstream/master' into ext-1.19.20
# Conflicts: # core/pom.xml
This commit is contained in:
commit
ee5e916112
8 changed files with 26 additions and 20 deletions
|
@ -17,7 +17,7 @@ The ultimate goal of this project is to allow Minecraft: Bedrock Edition users t
|
||||||
|
|
||||||
Special thanks to the DragonProxy project for being a trailblazer in protocol translation and for all the team members who have joined us here!
|
Special thanks to the DragonProxy project for being a trailblazer in protocol translation and for all the team members who have joined us here!
|
||||||
|
|
||||||
### Currently supporting Minecraft Bedrock 1.19.0 - 1.19.10/1.19.11 and Minecraft Java 1.19.0.
|
### Currently supporting Minecraft Bedrock 1.19.0 - 1.19.10/1.19.11 and Minecraft Java 1.19.1/1.19.2.
|
||||||
|
|
||||||
## Setting Up
|
## Setting Up
|
||||||
Take a look [here](https://wiki.geysermc.org/geyser/setup/) for how to set up Geyser.
|
Take a look [here](https://wiki.geysermc.org/geyser/setup/) for how to set up Geyser.
|
||||||
|
|
|
@ -30,7 +30,7 @@ object Versions {
|
||||||
const val guavaVersion = "29.0-jre"
|
const val guavaVersion = "29.0-jre"
|
||||||
const val nbtVersion = "2.1.0"
|
const val nbtVersion = "2.1.0"
|
||||||
const val websocketVersion = "1.5.1"
|
const val websocketVersion = "1.5.1"
|
||||||
const val protocolVersion = "a78a64b"
|
const val protocolVersion = "92d9854"
|
||||||
// Not pinned to specific version due to possible gradle bug
|
// Not pinned to specific version due to possible gradle bug
|
||||||
// See comment in settings.gradle.kts
|
// See comment in settings.gradle.kts
|
||||||
const val raknetVersion = "1.6.28-SNAPSHOT"
|
const val raknetVersion = "1.6.28-SNAPSHOT"
|
||||||
|
|
|
@ -31,7 +31,7 @@ dependencies {
|
||||||
// Network libraries
|
// Network libraries
|
||||||
implementation("org.java-websocket", "Java-WebSocket", Versions.websocketVersion)
|
implementation("org.java-websocket", "Java-WebSocket", Versions.websocketVersion)
|
||||||
|
|
||||||
api("com.github.CloudburstMC.Protocol", "bedrock-v534", Versions.protocolVersion) {
|
api("com.github.CloudburstMC.Protocol", "bedrock-v544", Versions.protocolVersion) {
|
||||||
exclude("com.nukkitx.network", "raknet")
|
exclude("com.nukkitx.network", "raknet")
|
||||||
exclude("com.nukkitx", "nbt")
|
exclude("com.nukkitx", "nbt")
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,10 @@ import com.github.steveice10.mc.protocol.codec.PacketCodec;
|
||||||
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
|
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
|
||||||
import com.nukkitx.protocol.bedrock.v527.Bedrock_v527;
|
import com.nukkitx.protocol.bedrock.v527.Bedrock_v527;
|
||||||
import com.nukkitx.protocol.bedrock.v534.Bedrock_v534;
|
import com.nukkitx.protocol.bedrock.v534.Bedrock_v534;
|
||||||
|
import com.nukkitx.protocol.bedrock.v544.Bedrock_v544;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ public final class GameProtocol {
|
||||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
||||||
.minecraftVersion("1.19.10/1.19.11")
|
.minecraftVersion("1.19.10/1.19.11")
|
||||||
.build());
|
.build());
|
||||||
|
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v544.V544_CODEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,7 +102,7 @@ public final class GameProtocol {
|
||||||
* @return the supported Minecraft: Java Edition version names
|
* @return the supported Minecraft: Java Edition version names
|
||||||
*/
|
*/
|
||||||
public static List<String> getJavaVersions() {
|
public static List<String> getJavaVersions() {
|
||||||
return Collections.singletonList(DEFAULT_JAVA_CODEC.getMinecraftVersion());
|
return List.of(DEFAULT_JAVA_CODEC.getMinecraftVersion(), "1.19.2");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,6 +30,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.nukkitx.nbt.*;
|
import com.nukkitx.nbt.*;
|
||||||
import com.nukkitx.protocol.bedrock.v527.Bedrock_v527;
|
import com.nukkitx.protocol.bedrock.v527.Bedrock_v527;
|
||||||
|
import com.nukkitx.protocol.bedrock.v544.Bedrock_v544;
|
||||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
|
@ -56,17 +57,7 @@ import java.util.zip.GZIPInputStream;
|
||||||
/**
|
/**
|
||||||
* Populates the block registries.
|
* Populates the block registries.
|
||||||
*/
|
*/
|
||||||
public class BlockRegistryPopulator {
|
public final class BlockRegistryPopulator {
|
||||||
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<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> stateMapperBuilder = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
|
|
||||||
.put(ObjectIntPair.of("1_19_0", Bedrock_v527.V527_CODEC.getProtocolVersion()), EMPTY_MAPPER);
|
|
||||||
|
|
||||||
BLOCK_MAPPERS = stateMapperBuilder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the raw blocks JSON until it is no longer needed.
|
* Stores the raw blocks JSON until it is no longer needed.
|
||||||
*/
|
*/
|
||||||
|
@ -80,7 +71,17 @@ public class BlockRegistryPopulator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerBedrockBlocks() {
|
private static void registerBedrockBlocks() {
|
||||||
for (Map.Entry<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> palette : BLOCK_MAPPERS.entrySet()) {
|
BiFunction<String, NbtMapBuilder, String> emptyMapper = (bedrockIdentifier, statesBuilder) -> null;
|
||||||
|
ImmutableMap<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> blockMappers = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
|
||||||
|
.put(ObjectIntPair.of("1_19_0", Bedrock_v527.V527_CODEC.getProtocolVersion()), (bedrockIdentifier, statesBuilder) -> {
|
||||||
|
if (bedrockIdentifier.equals("minecraft:muddy_mangrove_roots")) {
|
||||||
|
statesBuilder.remove("pillar_axis");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.put(ObjectIntPair.of("1_19_20", Bedrock_v544.V544_CODEC.getProtocolVersion()), emptyMapper).build();
|
||||||
|
|
||||||
|
for (Map.Entry<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> palette : blockMappers.entrySet()) {
|
||||||
NbtList<NbtMap> blocksTag;
|
NbtList<NbtMap> blocksTag;
|
||||||
try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource(String.format("bedrock/block_palette.%s.nbt", palette.getKey().key()));
|
try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource(String.format("bedrock/block_palette.%s.nbt", palette.getKey().key()));
|
||||||
NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) {
|
NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) {
|
||||||
|
@ -95,7 +96,9 @@ public class BlockRegistryPopulator {
|
||||||
|
|
||||||
int stateVersion = -1;
|
int stateVersion = -1;
|
||||||
for (int i = 0; i < blocksTag.size(); i++) {
|
for (int i = 0; i < blocksTag.size(); i++) {
|
||||||
NbtMap tag = blocksTag.get(i);
|
NbtMapBuilder builder = blocksTag.get(i).toBuilder();
|
||||||
|
builder.remove("name_hash"); // Quick workaround - was added in 1.19.20
|
||||||
|
NbtMap tag = builder.build();
|
||||||
if (blockStateOrderedMap.containsKey(tag)) {
|
if (blockStateOrderedMap.containsKey(tag)) {
|
||||||
throw new AssertionError("Duplicate block states in Bedrock palette: " + tag);
|
throw new AssertionError("Duplicate block states in Bedrock palette: " + tag);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +114,7 @@ public class BlockRegistryPopulator {
|
||||||
int movingBlockRuntimeId = -1;
|
int movingBlockRuntimeId = -1;
|
||||||
Iterator<Map.Entry<String, JsonNode>> blocksIterator = BLOCKS_JSON.fields();
|
Iterator<Map.Entry<String, JsonNode>> blocksIterator = BLOCKS_JSON.fields();
|
||||||
|
|
||||||
BiFunction<String, NbtMapBuilder, String> stateMapper = BLOCK_MAPPERS.getOrDefault(palette.getKey(), EMPTY_MAPPER);
|
BiFunction<String, NbtMapBuilder, String> stateMapper = blockMappers.getOrDefault(palette.getKey(), emptyMapper);
|
||||||
|
|
||||||
int[] javaToBedrockBlocks = new int[BLOCKS_JSON.size()];
|
int[] javaToBedrockBlocks = new int[BLOCKS_JSON.size()];
|
||||||
|
|
||||||
|
|
|
@ -1489,6 +1489,8 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
startGamePacket.setPlayerPropertyData(NbtMap.EMPTY);
|
startGamePacket.setPlayerPropertyData(NbtMap.EMPTY);
|
||||||
startGamePacket.setWorldTemplateId(UUID.randomUUID());
|
startGamePacket.setWorldTemplateId(UUID.randomUUID());
|
||||||
|
|
||||||
|
startGamePacket.setChatRestrictionLevel(ChatRestrictionLevel.NONE);
|
||||||
|
|
||||||
SyncedPlayerMovementSettings settings = new SyncedPlayerMovementSettings();
|
SyncedPlayerMovementSettings settings = new SyncedPlayerMovementSettings();
|
||||||
settings.setMovementMode(AuthoritativeMovementMode.CLIENT);
|
settings.setMovementMode(AuthoritativeMovementMode.CLIENT);
|
||||||
settings.setRewindHistorySize(0);
|
settings.setRewindHistorySize(0);
|
||||||
|
|
BIN
core/src/main/resources/bedrock/block_palette.1_19_20.nbt
Normal file
BIN
core/src/main/resources/bedrock/block_palette.1_19_20.nbt
Normal file
Binary file not shown.
|
@ -1 +1 @@
|
||||||
Subproject commit 0127891232742209b8470298dfd997249c506320
|
Subproject commit 2c68dab9d751f78b2f5b0298da5e338ad6bc07ca
|
Loading…
Reference in a new issue