Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Ursprung
cc3037d6c5
Commit
7d165e329b
@ -60,6 +60,14 @@ public final class GameProtocol {
|
|||||||
private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC;
|
private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v544.V544_CODEC);
|
||||||
|
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v545.V545_CODEC.toBuilder()
|
||||||
|
.minecraftVersion("1.19.21/1.19.22")
|
||||||
|
.build());
|
||||||
|
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v554.V554_CODEC.toBuilder()
|
||||||
|
.minecraftVersion("1.19.30/1.19.31")
|
||||||
|
.build());
|
||||||
|
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v557.V557_CODEC);
|
||||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
|
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +85,16 @@ public final class GameProtocol {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Bedrock convenience methods to gatekeep features and easily remove the check on version removal */
|
||||||
|
|
||||||
|
public static boolean supports1_19_30(GeyserSession session) {
|
||||||
|
return session.getUpstream().getProtocolVersion() >= Bedrock_v554.V554_CODEC.getProtocolVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean supports1_19_50(GeyserSession session) {
|
||||||
|
return session.getUpstream().getProtocolVersion() >= Bedrock_v560.V560_CODEC.getProtocolVersion();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link PacketCodec} for Minecraft: Java Edition.
|
* Gets the {@link PacketCodec} for Minecraft: Java Edition.
|
||||||
*
|
*
|
||||||
|
@ -29,6 +29,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
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.v544.Bedrock_v544;
|
||||||
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
|
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
|
||||||
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;
|
||||||
@ -72,6 +74,7 @@ public final class BlockRegistryPopulator {
|
|||||||
private static void registerBedrockBlocks() {
|
private static void registerBedrockBlocks() {
|
||||||
BiFunction<String, NbtMapBuilder, String> emptyMapper = (bedrockIdentifier, statesBuilder) -> null;
|
BiFunction<String, NbtMapBuilder, String> emptyMapper = (bedrockIdentifier, statesBuilder) -> null;
|
||||||
ImmutableMap<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> blockMappers = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
|
ImmutableMap<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> blockMappers = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
|
||||||
|
.put(ObjectIntPair.of("1_19_20", Bedrock_v544.V544_CODEC.getProtocolVersion()), emptyMapper)
|
||||||
.put(ObjectIntPair.of("1_19_50", Bedrock_v560.V560_CODEC.getProtocolVersion()), emptyMapper)
|
.put(ObjectIntPair.of("1_19_50", Bedrock_v560.V560_CODEC.getProtocolVersion()), emptyMapper)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@ public class ItemRegistryPopulator {
|
|||||||
|
|
||||||
public static void populate() {
|
public static void populate() {
|
||||||
Map<String, PaletteVersion> paletteVersions = new Object2ObjectOpenHashMap<>();
|
Map<String, PaletteVersion> paletteVersions = new Object2ObjectOpenHashMap<>();
|
||||||
|
paletteVersions.put("1_19_20", new PaletteVersion(Bedrock_v544.V544_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||||
paletteVersions.put("1_19_50", new PaletteVersion(Bedrock_v560.V560_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
paletteVersions.put("1_19_50", new PaletteVersion(Bedrock_v560.V560_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||||
|
|
||||||
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
|
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
|
||||||
|
@ -43,6 +43,11 @@ public class BedrockRequestAbilityTranslator extends PacketTranslator<RequestAbi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, RequestAbilityPacket packet) {
|
public void translate(GeyserSession session, RequestAbilityPacket packet) {
|
||||||
|
// Gatekeep to 1.19.30 so older versions don't fire twice
|
||||||
|
if (!GameProtocol.supports1_19_30(session)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (packet.getAbility() == Ability.FLYING) {
|
if (packet.getAbility() == Ability.FLYING) {
|
||||||
handle(session, packet.isBoolValue());
|
handle(session, packet.isBoolValue());
|
||||||
}
|
}
|
||||||
|
@ -125,14 +125,16 @@ public class DimensionUtils {
|
|||||||
|
|
||||||
// Kind of silly but Bedrock 1.19.50 requires an acknowledgement after the
|
// Kind of silly but Bedrock 1.19.50 requires an acknowledgement after the
|
||||||
// initial chunks are sent, prior to the client acknowledgement
|
// initial chunks are sent, prior to the client acknowledgement
|
||||||
// Note: send this before chunks are sent. Fixed https://github.com/GeyserMC/Geyser/issues/3421
|
if (GameProtocol.supports1_19_50(session)) {
|
||||||
PlayerActionPacket ackPacket = new PlayerActionPacket();
|
// Note: send this before chunks are sent. Fixed https://github.com/GeyserMC/Geyser/issues/3421
|
||||||
ackPacket.setRuntimeEntityId(player.getGeyserId());
|
PlayerActionPacket ackPacket = new PlayerActionPacket();
|
||||||
ackPacket.setAction(PlayerActionType.DIMENSION_CHANGE_SUCCESS);
|
ackPacket.setRuntimeEntityId(player.getGeyserId());
|
||||||
ackPacket.setBlockPosition(Vector3i.ZERO);
|
ackPacket.setAction(PlayerActionType.DIMENSION_CHANGE_SUCCESS);
|
||||||
ackPacket.setResultPosition(Vector3i.ZERO);
|
ackPacket.setBlockPosition(Vector3i.ZERO);
|
||||||
ackPacket.setFace(0);
|
ackPacket.setResultPosition(Vector3i.ZERO);
|
||||||
session.sendUpstreamPacket(ackPacket);
|
ackPacket.setFace(0);
|
||||||
|
session.sendUpstreamPacket(ackPacket);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO - fix this hack of a fix by sending the final dimension switching logic after sections have been sent.
|
// TODO - fix this hack of a fix by sending the final dimension switching logic after sections have been sent.
|
||||||
// The client wants sections sent to it before it can successfully respawn.
|
// The client wants sections sent to it before it can successfully respawn.
|
||||||
|
BIN
core/src/main/resources/bedrock/block_palette.1_19_20.nbt
Normale Datei
BIN
core/src/main/resources/bedrock/block_palette.1_19_20.nbt
Normale Datei
Binäre Datei nicht angezeigt.
5440
core/src/main/resources/bedrock/creative_items.1_19_20.json
Normale Datei
5440
core/src/main/resources/bedrock/creative_items.1_19_20.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
4530
core/src/main/resources/bedrock/runtime_item_states.1_19_20.json
Normale Datei
4530
core/src/main/resources/bedrock/runtime_item_states.1_19_20.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren