Skip to content

Commit ffa738c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into elytras
2 parents e6267b2 + bfbbf6c commit ffa738c

24 files changed

Lines changed: 22464 additions & 29 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The ultimate goal of this project is to allow Minecraft: Bedrock Edition users t
1515
Special thanks to the DragonProxy project for being a trailblazer in protocol translation and for all the team members who have joined us here!
1616

1717
## Supported Versions
18-
Geyser is currently supporting Minecraft Bedrock 1.21.50 - 1.21.72 and Minecraft Java 1.21.5. For more information, please see [here](https://geysermc.org/wiki/geyser/supported-versions/).
18+
Geyser is currently supporting Minecraft Bedrock 1.21.50 - 1.21.80 and Minecraft Java 1.21.5. For more information, please see [here](https://geysermc.org/wiki/geyser/supported-versions/).
1919

2020
## Setting Up
2121
Take a look [here](https://geysermc.org/wiki/geyser/setup/) for how to set up Geyser.

core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,19 @@ public void tick() {
210210

211211
if (isPaddlingLeft) {
212212
paddleTimeLeft += ROWING_SPEED;
213-
sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_LEFT, paddleTimeLeft);
213+
if (GameProtocol.is1_21_80orHigher(session)) {
214+
dirtyMetadata.put(EntityDataTypes.ROW_TIME_LEFT, paddleTimeLeft);
215+
} else {
216+
sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_LEFT, paddleTimeLeft);
217+
}
214218
}
215219
if (isPaddlingRight) {
216220
paddleTimeRight += ROWING_SPEED;
217-
sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_RIGHT, paddleTimeRight);
221+
if (GameProtocol.is1_21_80orHigher(session)) {
222+
dirtyMetadata.put(EntityDataTypes.ROW_TIME_RIGHT, paddleTimeRight);
223+
} else {
224+
sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_RIGHT, paddleTimeRight);
225+
}
218226
}
219227
}
220228

core/src/main/java/org/geysermc/geyser/network/CodecProcessor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ static BedrockCodec processCodec(BedrockCodec codec) {
282282
.updateSerializer(InventorySlotPacket.class, INVENTORY_SLOT_SERIALIZER_V748)
283283
.updateSerializer(MovePlayerPacket.class, MOVE_PLAYER_SERIALIZER)
284284
.updateSerializer(MoveEntityAbsolutePacket.class, MOVE_ENTITY_SERIALIZER)
285-
.updateSerializer(RiderJumpPacket.class, ILLEGAL_SERIALIZER)
286-
.updateSerializer(PlayerInputPacket.class, ILLEGAL_SERIALIZER)
287285
// Ignored only when serverbound
288286
.updateSerializer(BossEventPacket.class, bossEventSerializer)
289287
.updateSerializer(MobArmorEquipmentPacket.class, MOB_ARMOR_EQUIPMENT_SERIALIZER)
@@ -303,6 +301,13 @@ static BedrockCodec processCodec(BedrockCodec codec) {
303301
.updateSerializer(SimpleEventPacket.class, IGNORED_SERIALIZER)
304302
.updateSerializer(MultiplayerSettingsPacket.class, IGNORED_SERIALIZER);
305303

304+
// These packets have been removed post 1.21.80.
305+
if (codec.getProtocolVersion() < 800) {
306+
codecBuilder
307+
.updateSerializer(RiderJumpPacket.class, ILLEGAL_SERIALIZER)
308+
.updateSerializer(PlayerInputPacket.class, ILLEGAL_SERIALIZER);
309+
}
310+
306311
return codecBuilder.build();
307312
}
308313

core/src/main/java/org/geysermc/geyser/network/GameProtocol.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727

2828
import org.checkerframework.checker.nullness.qual.Nullable;
2929
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
30-
import org.cloudburstmc.protocol.bedrock.codec.v748.Bedrock_v748;
3130
import org.cloudburstmc.protocol.bedrock.codec.v766.Bedrock_v766;
3231
import org.cloudburstmc.protocol.bedrock.codec.v776.Bedrock_v776;
3332
import org.cloudburstmc.protocol.bedrock.codec.v786.Bedrock_v786;
33+
import org.cloudburstmc.protocol.bedrock.codec.v800.Bedrock_v800;
3434
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
3535
import org.geysermc.geyser.session.GeyserSession;
3636
import org.geysermc.mcprotocollib.protocol.codec.MinecraftCodec;
@@ -49,8 +49,8 @@ public final class GameProtocol {
4949
* Default Bedrock codec that should act as a fallback. Should represent the latest available
5050
* release of the game that Geyser supports.
5151
*/
52-
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = CodecProcessor.processCodec(Bedrock_v786.CODEC.toBuilder()
53-
.minecraftVersion("1.21.70")
52+
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = CodecProcessor.processCodec(Bedrock_v800.CODEC.toBuilder()
53+
.minecraftVersion("1.21.80")
5454
.build());
5555

5656
/**
@@ -71,6 +71,9 @@ public final class GameProtocol {
7171
SUPPORTED_BEDROCK_CODECS.add(CodecProcessor.processCodec(Bedrock_v776.CODEC.toBuilder()
7272
.minecraftVersion("1.21.60 - 1.21.62")
7373
.build()));
74+
SUPPORTED_BEDROCK_CODECS.add(CodecProcessor.processCodec(Bedrock_v786.CODEC.toBuilder()
75+
.minecraftVersion("1.21.70 - 1.21.73")
76+
.build()));
7477
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
7578
}
7679

@@ -90,10 +93,6 @@ public final class GameProtocol {
9093

9194
/* Bedrock convenience methods to gatekeep features and easily remove the check on version removal */
9295

93-
public static boolean isPreWinterDrop(GeyserSession session) {
94-
return session.getUpstream().getProtocolVersion() == Bedrock_v748.CODEC.getProtocolVersion();
95-
}
96-
9796
public static boolean isPreCreativeInventoryRewrite(int protocolVersion) {
9897
return protocolVersion < 776;
9998
}
@@ -102,6 +101,14 @@ public static boolean is1_21_70orHigher(GeyserSession session) {
102101
return session.protocolVersion() >= Bedrock_v786.CODEC.getProtocolVersion();
103102
}
104103

104+
public static boolean isTheOneVersionWithBrokenForms(GeyserSession session) {
105+
return session.protocolVersion() == Bedrock_v786.CODEC.getProtocolVersion();
106+
}
107+
108+
public static boolean is1_21_80orHigher(GeyserSession session) {
109+
return session.protocolVersion() >= Bedrock_v800.CODEC.getProtocolVersion();
110+
}
111+
105112
/**
106113
* Gets the {@link PacketCodec} for Minecraft: Java Edition.
107114
*

core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.cloudburstmc.protocol.bedrock.BedrockDisconnectReasons;
3131
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
3232
import org.cloudburstmc.protocol.bedrock.codec.compat.BedrockCompat;
33+
import org.cloudburstmc.protocol.bedrock.data.ExperimentData;
3334
import org.cloudburstmc.protocol.bedrock.data.PacketCompressionAlgorithm;
3435
import org.cloudburstmc.protocol.bedrock.data.ResourcePackType;
3536
import org.cloudburstmc.protocol.bedrock.netty.codec.compression.CompressionStrategy;
@@ -239,6 +240,8 @@ public PacketSignal handle(ResourcePackClientResponsePacket packet) {
239240
stackPacket.setForcedToAccept(false); // Leaving this as false allows the player to choose to download or not
240241
stackPacket.setGameVersion(session.getClientData().getGameVersion());
241242
stackPacket.getResourcePacks().addAll(this.resourcePackLoadEvent.orderedPacks());
243+
// Allows Vibrant Visuals to be toggled in the settings
244+
stackPacket.getExperiments().add(new ExperimentData("experimental_graphics", true));
242245

243246
session.sendUpstreamPacket(stackPacket);
244247
}

core/src/main/java/org/geysermc/geyser/registry/Registries.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
3232
import org.cloudburstmc.nbt.NbtMap;
3333
import org.cloudburstmc.nbt.NbtMapBuilder;
34+
import org.cloudburstmc.protocol.bedrock.data.biome.BiomeDefinitions;
3435
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.PotionMixData;
3536
import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket;
3637
import org.geysermc.geyser.GeyserImpl;
@@ -98,9 +99,15 @@ public final class Registries {
9899

99100
/**
100101
* A registry holding a NbtMap of all the known biomes.
102+
* Remove once 1.21.80 is lowest supported version - replaced by {@link Registries#BIOMES}
101103
*/
102104
public static final SimpleDeferredRegistry<NbtMap> BIOMES_NBT = SimpleDeferredRegistry.create("bedrock/biome_definitions.dat", RegistryLoaders.NBT);
103105

106+
/**
107+
* A registry holding biome data for all known biomes.
108+
*/
109+
public static final SimpleDeferredRegistry<BiomeDefinitions> BIOMES = SimpleDeferredRegistry.create("bedrock/stripped_biome_definitions.json", RegistryLoaders.BIOME_LOADER);
110+
104111
/**
105112
* A mapped registry which stores Java biome identifiers and their Bedrock biome identifier.
106113
*/
@@ -200,6 +207,7 @@ public static void load() {
200207

201208
BEDROCK_ENTITY_IDENTIFIERS.load();
202209
BIOMES_NBT.load();
210+
BIOMES.load();
203211
BIOME_IDENTIFIERS.load();
204212
BLOCK_ENTITIES.load();
205213
PARTICLES.load();
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/*
2+
* Copyright (c) 2025 GeyserMC. http://geysermc.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
* THE SOFTWARE.
21+
*
22+
* @author GeyserMC
23+
* @link https://github.com/GeyserMC/Geyser
24+
*/
25+
26+
package org.geysermc.geyser.registry.loader;
27+
28+
import com.google.gson.Gson;
29+
import com.google.gson.GsonBuilder;
30+
import com.google.gson.TypeAdapter;
31+
import com.google.gson.reflect.TypeToken;
32+
import com.google.gson.stream.JsonReader;
33+
import com.google.gson.stream.JsonToken;
34+
import com.google.gson.stream.JsonWriter;
35+
import org.cloudburstmc.protocol.bedrock.data.biome.BiomeDefinitionData;
36+
import org.cloudburstmc.protocol.bedrock.data.biome.BiomeDefinitions;
37+
import org.geysermc.geyser.GeyserImpl;
38+
39+
import java.awt.*;
40+
import java.io.IOException;
41+
import java.io.InputStream;
42+
import java.io.InputStreamReader;
43+
import java.lang.reflect.Type;
44+
import java.util.Map;
45+
46+
public class BiomeLoader implements RegistryLoader<String, BiomeDefinitions> {
47+
private final Gson GSON = new GsonBuilder()
48+
.registerTypeAdapter(Color.class, new ColorTypeAdapter())
49+
.create(); // temporary
50+
51+
@Override
52+
public BiomeDefinitions load(String input) {
53+
Type type = new TypeToken<Map<String, BiomeDefinitionData>>() {}.getType();
54+
Map<String, BiomeDefinitionData> biomes;
55+
try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResourceOrThrow(input)) {
56+
biomes = GSON.fromJson(new InputStreamReader(stream), type);
57+
} catch (Exception e) {
58+
throw new AssertionError("Unable to load Bedrock biomes!", e);
59+
}
60+
61+
return new BiomeDefinitions(biomes);
62+
}
63+
64+
public static class ColorTypeAdapter extends TypeAdapter<Color> {
65+
66+
@Override
67+
public void write(JsonWriter out, Color color) throws IOException {
68+
if (color == null) {
69+
out.nullValue();
70+
return;
71+
}
72+
73+
out.beginObject();
74+
out.name("r").value(color.getRed());
75+
out.name("g").value(color.getGreen());
76+
out.name("b").value(color.getBlue());
77+
out.name("a").value(color.getAlpha());
78+
out.endObject();
79+
}
80+
81+
@Override
82+
public Color read(JsonReader in) throws IOException {
83+
if (in.peek() == JsonToken.NULL) {
84+
in.nextNull();
85+
return null;
86+
}
87+
88+
int r = 0, g = 0, b = 0, a = 255;
89+
in.beginObject();
90+
while (in.hasNext()) {
91+
switch (in.nextName()) {
92+
case "r": r = in.nextInt(); break;
93+
case "g": g = in.nextInt(); break;
94+
case "b": b = in.nextInt(); break;
95+
case "a": a = in.nextInt(); break;
96+
default: in.skipValue(); break;
97+
}
98+
}
99+
in.endObject();
100+
return new Color(r, g, b, a);
101+
}
102+
}
103+
}

core/src/main/java/org/geysermc/geyser/registry/loader/RegistryLoaders.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public final class RegistryLoaders {
3838
*/
3939
public static final NbtRegistryLoader NBT = new NbtRegistryLoader();
4040

41+
/**
42+
* The {@link RegistryLoader} responsible for loading biome data.
43+
*/
44+
public static final BiomeLoader BIOME_LOADER = new BiomeLoader();
45+
4146
/**
4247
* The {@link RegistryLoader} responsible for loading resource packs.
4348
*/
@@ -69,4 +74,4 @@ public static <I, V> RegistryLoader<I, V> uninitialized() {
6974

7075
private RegistryLoaders() {
7176
}
72-
}
77+
}

core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.cloudburstmc.protocol.bedrock.codec.v766.Bedrock_v766;
4646
import org.cloudburstmc.protocol.bedrock.codec.v776.Bedrock_v776;
4747
import org.cloudburstmc.protocol.bedrock.codec.v786.Bedrock_v786;
48+
import org.cloudburstmc.protocol.bedrock.codec.v800.Bedrock_v800;
4849
import org.cloudburstmc.protocol.bedrock.data.BlockPropertyData;
4950
import org.cloudburstmc.protocol.bedrock.data.definitions.BlockDefinition;
5051
import org.geysermc.geyser.GeyserImpl;
@@ -121,6 +122,7 @@ private static void registerBedrockBlocks() {
121122
.put(ObjectIntPair.of("1_21_50", Bedrock_v766.CODEC.getProtocolVersion()), Conversion776_766::remapBlock)
122123
.put(ObjectIntPair.of("1_21_60", Bedrock_v776.CODEC.getProtocolVersion()), Conversion786_776::remapBlock)
123124
.put(ObjectIntPair.of("1_21_70", Bedrock_v786.CODEC.getProtocolVersion()), tag -> tag)
125+
.put(ObjectIntPair.of("1_21_80", Bedrock_v800.CODEC.getProtocolVersion()), tag -> tag)
124126
.build();
125127

126128
// We can keep this strong as nothing should be garbage collected

core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.cloudburstmc.protocol.bedrock.codec.v766.Bedrock_v766;
4949
import org.cloudburstmc.protocol.bedrock.codec.v776.Bedrock_v776;
5050
import org.cloudburstmc.protocol.bedrock.codec.v786.Bedrock_v786;
51+
import org.cloudburstmc.protocol.bedrock.codec.v800.Bedrock_v800;
5152
import org.cloudburstmc.protocol.bedrock.data.definitions.BlockDefinition;
5253
import org.cloudburstmc.protocol.bedrock.data.definitions.ItemDefinition;
5354
import org.cloudburstmc.protocol.bedrock.data.definitions.SimpleItemDefinition;
@@ -129,6 +130,7 @@ public static void populate() {
129130
paletteVersions.add(new PaletteVersion("1_21_50", Bedrock_v766.CODEC.getProtocolVersion(), itemFallbacks, (item, mapping) -> mapping));
130131
paletteVersions.add(new PaletteVersion("1_21_60", Bedrock_v776.CODEC.getProtocolVersion(), itemFallbacks, (item, mapping) -> mapping));
131132
paletteVersions.add(new PaletteVersion("1_21_70", Bedrock_v786.CODEC.getProtocolVersion()));
133+
paletteVersions.add(new PaletteVersion("1_21_80", Bedrock_v800.CODEC.getProtocolVersion()));
132134

133135
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
134136

0 commit comments

Comments
 (0)