mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Merge pull request #3216 from Konicai/ext-1.19.20-fixes
Fix forms and items in extensions
This commit is contained in:
commit
62f9ef7986
12 changed files with 9999 additions and 15 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.1/1.19.2.
|
### Currently supporting Minecraft Bedrock 1.19.0/1.19.1x/1.19.20 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.
|
||||||
|
|
|
@ -28,9 +28,10 @@ object Versions {
|
||||||
const val fastutilVersion = "8.5.2"
|
const val fastutilVersion = "8.5.2"
|
||||||
const val nettyVersion = "4.1.66.Final"
|
const val nettyVersion = "4.1.66.Final"
|
||||||
const val guavaVersion = "29.0-jre"
|
const val guavaVersion = "29.0-jre"
|
||||||
|
const val gsonVersion = "2.3.1" // Provided by Spigot 1.8.8
|
||||||
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 = "92d9854"
|
const val protocolVersion = "0bd459f"
|
||||||
// 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"
|
||||||
|
@ -41,6 +42,6 @@ object Versions {
|
||||||
const val eventVersion = "3.0.0"
|
const val eventVersion = "3.0.0"
|
||||||
const val junitVersion = "4.13.1"
|
const val junitVersion = "4.13.1"
|
||||||
const val checkerQualVersion = "3.19.0"
|
const val checkerQualVersion = "3.19.0"
|
||||||
const val cumulusVersion = "1.1"
|
const val cumulusVersion = "1.1.1"
|
||||||
const val log4jVersion = "2.17.1"
|
const val log4jVersion = "2.17.1"
|
||||||
}
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
dependencies {
|
dependencies {
|
||||||
api("org.geysermc.cumulus", "cumulus", Versions.cumulusVersion)
|
api("org.geysermc.cumulus", "cumulus", Versions.cumulusVersion)
|
||||||
|
api("com.google.code.gson", "gson", Versions.gsonVersion)
|
||||||
}
|
}
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
package org.geysermc.floodgate.pluginmessage;
|
package org.geysermc.floodgate.pluginmessage;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
public final class PluginMessageChannels {
|
public final class PluginMessageChannels {
|
||||||
public static final String SKIN = "floodgate:skin";
|
public static final String SKIN = "floodgate:skin";
|
||||||
|
@ -35,7 +35,7 @@ public final class PluginMessageChannels {
|
||||||
|
|
||||||
private static final byte[] FLOODGATE_REGISTER_DATA =
|
private static final byte[] FLOODGATE_REGISTER_DATA =
|
||||||
String.join("\0", SKIN, FORM, TRANSFER, PACKET)
|
String.join("\0", SKIN, FORM, TRANSFER, PACKET)
|
||||||
.getBytes(Charsets.UTF_8);
|
.getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the prebuilt register data as a byte array
|
* Get the prebuilt register data as a byte array
|
||||||
|
|
|
@ -33,7 +33,7 @@ public enum BedrockMapIcon {
|
||||||
ICON_ITEM_FRAME(MapIconType.GREEN_ARROW, 7),
|
ICON_ITEM_FRAME(MapIconType.GREEN_ARROW, 7),
|
||||||
ICON_RED_ARROW(MapIconType.RED_ARROW, 2),
|
ICON_RED_ARROW(MapIconType.RED_ARROW, 2),
|
||||||
ICON_BLUE_ARROW(MapIconType.BLUE_ARROW, 3),
|
ICON_BLUE_ARROW(MapIconType.BLUE_ARROW, 3),
|
||||||
ICON_TREASURE_MARKER(MapIconType.TREASURE_MARKER, 4),
|
ICON_WHITE_CROSS(MapIconType.WHITE_CROSS, 4, 0, 0, 0), // Doesn't exist on Bedrock, replaced with a black cross
|
||||||
ICON_RED_POINTER(MapIconType.RED_POINTER, 5),
|
ICON_RED_POINTER(MapIconType.RED_POINTER, 5),
|
||||||
ICON_WHITE_CIRCLE(MapIconType.WHITE_CIRCLE, 6),
|
ICON_WHITE_CIRCLE(MapIconType.WHITE_CIRCLE, 6),
|
||||||
ICON_SMALL_WHITE_CIRCLE(MapIconType.SMALL_WHITE_CIRCLE, 13),
|
ICON_SMALL_WHITE_CIRCLE(MapIconType.SMALL_WHITE_CIRCLE, 13),
|
||||||
|
@ -54,7 +54,8 @@ public enum BedrockMapIcon {
|
||||||
ICON_BROWN_BANNER(MapIconType.BROWN_BANNER, 13, 131, 84, 50),
|
ICON_BROWN_BANNER(MapIconType.BROWN_BANNER, 13, 131, 84, 50),
|
||||||
ICON_GREEN_BANNER(MapIconType.GREEN_BANNER, 13, 94, 124, 22),
|
ICON_GREEN_BANNER(MapIconType.GREEN_BANNER, 13, 94, 124, 22),
|
||||||
ICON_RED_BANNER(MapIconType.RED_BANNER, 13, 176, 46, 38),
|
ICON_RED_BANNER(MapIconType.RED_BANNER, 13, 176, 46, 38),
|
||||||
ICON_BLACK_BANNER(MapIconType.BLACK_BANNER, 13, 29, 29, 33);
|
ICON_BLACK_BANNER(MapIconType.BLACK_BANNER, 13, 29, 29, 33),
|
||||||
|
ICON_TREASURE_MARKER(MapIconType.TREASURE_MARKER, 4);
|
||||||
|
|
||||||
private static final BedrockMapIcon[] VALUES = values();
|
private static final BedrockMapIcon[] VALUES = values();
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public final class GameProtocol {
|
||||||
* Default Bedrock codec that should act as a fallback. Should represent the latest available
|
* Default Bedrock codec that should act as a fallback. Should represent the latest available
|
||||||
* release of the game that Geyser supports.
|
* release of the game that Geyser supports.
|
||||||
*/
|
*/
|
||||||
public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v534.V534_CODEC;
|
public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v544.V544_CODEC;
|
||||||
/**
|
/**
|
||||||
* A list of all supported Bedrock versions that can join Geyser
|
* A list of all supported Bedrock versions that can join Geyser
|
||||||
*/
|
*/
|
||||||
|
@ -61,10 +61,10 @@ public final class GameProtocol {
|
||||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v527.V527_CODEC.toBuilder()
|
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v527.V527_CODEC.toBuilder()
|
||||||
.minecraftVersion("1.19.0/1.19.2")
|
.minecraftVersion("1.19.0/1.19.2")
|
||||||
.build());
|
.build());
|
||||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v534.V534_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);
|
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,6 +40,7 @@ import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
|
||||||
import it.unimi.dsi.fastutil.ints.*;
|
import it.unimi.dsi.fastutil.ints.*;
|
||||||
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 it.unimi.dsi.fastutil.ints.Int2IntMap;
|
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
|
@ -78,6 +79,7 @@ public class ItemRegistryPopulator {
|
||||||
paletteVersions.put("1_19_0", new PaletteVersion(Bedrock_v527.V527_CODEC.getProtocolVersion(),
|
paletteVersions.put("1_19_0", new PaletteVersion(Bedrock_v527.V527_CODEC.getProtocolVersion(),
|
||||||
Collections.singletonMap("minecraft:trader_llama_spawn_egg", "minecraft:llama_spawn_egg")));
|
Collections.singletonMap("minecraft:trader_llama_spawn_egg", "minecraft:llama_spawn_egg")));
|
||||||
paletteVersions.put("1_19_10", new PaletteVersion(Bedrock_v534.V534_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
paletteVersions.put("1_19_10", new PaletteVersion(Bedrock_v534.V534_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||||
|
paletteVersions.put("1_19_20", new PaletteVersion(Bedrock_v544.V544_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||||
|
|
||||||
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
|
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
|
||||||
|
|
||||||
|
|
|
@ -72,12 +72,19 @@ public class JavaCustomPayloadTranslator extends PacketTranslator<ClientboundCus
|
||||||
String dataString = new String(data, 3, data.length - 3, Charsets.UTF_8);
|
String dataString = new String(data, 3, data.length - 3, Charsets.UTF_8);
|
||||||
|
|
||||||
Form form = Forms.fromJson(dataString, type, (ignored, response) -> {
|
Form form = Forms.fromJson(dataString, type, (ignored, response) -> {
|
||||||
byte[] raw = response.getBytes(StandardCharsets.UTF_8);
|
byte[] finalData;
|
||||||
byte[] finalData = new byte[raw.length + 2];
|
if (response == null) {
|
||||||
|
// Response data can be null as of 1.19.20 (same behaviour as empty response data)
|
||||||
|
// Only need to send the form id
|
||||||
|
finalData = new byte[]{data[1], data[2]};
|
||||||
|
} else {
|
||||||
|
byte[] raw = response.getBytes(StandardCharsets.UTF_8);
|
||||||
|
finalData = new byte[raw.length + 2];
|
||||||
|
|
||||||
finalData[0] = data[1];
|
finalData[0] = data[1];
|
||||||
finalData[1] = data[2];
|
finalData[1] = data[2];
|
||||||
System.arraycopy(raw, 0, finalData, 2, raw.length);
|
System.arraycopy(raw, 0, finalData, 2, raw.length);
|
||||||
|
}
|
||||||
|
|
||||||
session.sendDownstreamPacket(new ServerboundCustomPayloadPacket(channel, finalData));
|
session.sendDownstreamPacket(new ServerboundCustomPayloadPacket(channel, finalData));
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,6 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.level;
|
||||||
import com.github.steveice10.mc.protocol.data.game.level.map.MapData;
|
import com.github.steveice10.mc.protocol.data.game.level.map.MapData;
|
||||||
import com.github.steveice10.mc.protocol.data.game.level.map.MapIcon;
|
import com.github.steveice10.mc.protocol.data.game.level.map.MapIcon;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket;
|
||||||
|
import com.nukkitx.math.vector.Vector3i;
|
||||||
import com.nukkitx.protocol.bedrock.data.MapDecoration;
|
import com.nukkitx.protocol.bedrock.data.MapDecoration;
|
||||||
import com.nukkitx.protocol.bedrock.data.MapTrackedObject;
|
import com.nukkitx.protocol.bedrock.data.MapTrackedObject;
|
||||||
import org.geysermc.geyser.level.BedrockMapIcon;
|
import org.geysermc.geyser.level.BedrockMapIcon;
|
||||||
|
@ -48,6 +49,7 @@ public class JavaMapItemDataTranslator extends PacketTranslator<ClientboundMapIt
|
||||||
mapItemDataPacket.setUniqueMapId(packet.getMapId());
|
mapItemDataPacket.setUniqueMapId(packet.getMapId());
|
||||||
mapItemDataPacket.setDimensionId(DimensionUtils.javaToBedrock(session.getDimension()));
|
mapItemDataPacket.setDimensionId(DimensionUtils.javaToBedrock(session.getDimension()));
|
||||||
mapItemDataPacket.setLocked(packet.isLocked());
|
mapItemDataPacket.setLocked(packet.isLocked());
|
||||||
|
mapItemDataPacket.setOrigin(Vector3i.ZERO); // Required since 1.19.20
|
||||||
mapItemDataPacket.setScale(packet.getScale());
|
mapItemDataPacket.setScale(packet.getScale());
|
||||||
|
|
||||||
MapData data = packet.getData();
|
MapData data = packet.getData();
|
||||||
|
|
5440
core/src/main/resources/bedrock/creative_items.1_19_20.json
Normal file
5440
core/src/main/resources/bedrock/creative_items.1_19_20.json
Normal file
File diff suppressed because it is too large
Load diff
Binary file not shown.
4530
core/src/main/resources/bedrock/runtime_item_states.1_19_20.json
Normal file
4530
core/src/main/resources/bedrock/runtime_item_states.1_19_20.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue