Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 22:40:18 +01:00
Merge branch 'master' into feature/viaproxy-platform
Dieser Commit ist enthalten in:
Commit
ad9d1612bd
@ -14,7 +14,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!
|
||||
|
||||
### Currently supporting Minecraft Bedrock 1.20.0 - 1.20.40 and Minecraft Java 1.20.2
|
||||
### Currently supporting Minecraft Bedrock 1.20.0 - 1.20.50 and Minecraft Java 1.20.2
|
||||
|
||||
## Setting Up
|
||||
Take a look [here](https://wiki.geysermc.org/geyser/setup/) for how to set up Geyser.
|
||||
|
@ -34,6 +34,7 @@ import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
// Note: 1.19.4 requires that the billboard is set to something in order to show, on Java Edition
|
||||
@ -56,6 +57,12 @@ public class TextDisplayEntity extends Entity {
|
||||
// On JE: Hiding the display name still shows the display entity text.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayName(EntityMetadata<Optional<Component>, ?> entityMetadata) {
|
||||
// This would usually set EntityDataTypes.NAME, but we are instead using NAME for the text display.
|
||||
// On JE: custom name does not override text display.
|
||||
}
|
||||
|
||||
public void setText(EntityMetadata<Component, ?> entityMetadata) {
|
||||
this.dirtyMetadata.put(EntityDataTypes.NAME, MessageTranslator.convertMessage(entityMetadata.getValue()));
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import org.cloudburstmc.protocol.bedrock.codec.v589.Bedrock_v589;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v594.Bedrock_v594;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v618.Bedrock_v618;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
|
||||
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
@ -47,7 +48,7 @@ public final class GameProtocol {
|
||||
* Default Bedrock codec that should act as a fallback. Should represent the latest available
|
||||
* release of the game that Geyser supports.
|
||||
*/
|
||||
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = Bedrock_v622.CODEC;
|
||||
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = Bedrock_v630.CODEC;
|
||||
|
||||
/**
|
||||
* A list of all supported Bedrock versions that can join Geyser
|
||||
@ -70,6 +71,9 @@ public final class GameProtocol {
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v618.CODEC.toBuilder()
|
||||
.minecraftVersion("1.20.30/1.20.32")
|
||||
.build());
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v622.CODEC.toBuilder()
|
||||
.minecraftVersion("1.20.40/1.20.41")
|
||||
.build());
|
||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
/**
|
||||
* Bare bones implementation of BedrockPacketHandler suitable for extension.
|
||||
*
|
||||
* <p>
|
||||
* Logs and ignores all packets presented. Allows subclasses to override/implement only
|
||||
* packets of interest and limit boilerplate code.
|
||||
*/
|
||||
@ -60,11 +60,6 @@ public class LoggingPacketHandler implements BedrockPacketHandler {
|
||||
return defaultHandler(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketSignal handle(AdventureSettingsPacket packet) {
|
||||
return defaultHandler(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketSignal handle(AnimatePacket packet) {
|
||||
return defaultHandler(packet);
|
||||
@ -505,11 +500,6 @@ public class LoggingPacketHandler implements BedrockPacketHandler {
|
||||
return defaultHandler(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketSignal handle(ScriptCustomEventPacket packet) {
|
||||
return defaultHandler(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketSignal handle(ServerSettingsResponsePacket packet) {
|
||||
return defaultHandler(packet);
|
||||
@ -560,6 +550,11 @@ public class LoggingPacketHandler implements BedrockPacketHandler {
|
||||
return defaultHandler(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketSignal handle(SetPlayerInventoryOptionsPacket packet) {
|
||||
return defaultHandler(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketSignal handle(SetScoreboardIdentityPacket packet) {
|
||||
return defaultHandler(packet);
|
||||
|
@ -37,12 +37,17 @@ import org.cloudburstmc.blockstateupdater.BlockStateUpdater;
|
||||
import org.cloudburstmc.blockstateupdater.BlockStateUpdater_1_20_10;
|
||||
import org.cloudburstmc.blockstateupdater.BlockStateUpdater_1_20_30;
|
||||
import org.cloudburstmc.blockstateupdater.BlockStateUpdater_1_20_40;
|
||||
import org.cloudburstmc.blockstateupdater.BlockStateUpdater_1_20_50;
|
||||
import org.cloudburstmc.blockstateupdater.util.tagupdater.CompoundTagUpdaterContext;
|
||||
import org.cloudburstmc.nbt.*;
|
||||
import org.cloudburstmc.nbt.NBTInputStream;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v589.Bedrock_v589;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v594.Bedrock_v594;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v618.Bedrock_v618;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
|
||||
import org.cloudburstmc.protocol.bedrock.data.BlockPropertyData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.definitions.BlockDefinition;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
@ -120,12 +125,14 @@ public final class BlockRegistryPopulator {
|
||||
Remapper mapper594 = Remapper.of(BlockStateUpdater_1_20_10.INSTANCE);
|
||||
Remapper mapper618 = Remapper.of(BlockStateUpdater_1_20_10.INSTANCE, BlockStateUpdater_1_20_30.INSTANCE);
|
||||
Remapper mapper622 = Remapper.of(BlockStateUpdater_1_20_10.INSTANCE, BlockStateUpdater_1_20_30.INSTANCE, BlockStateUpdater_1_20_40.INSTANCE);
|
||||
Remapper mapper630 = Remapper.of(BlockStateUpdater_1_20_10.INSTANCE, BlockStateUpdater_1_20_30.INSTANCE, BlockStateUpdater_1_20_40.INSTANCE, BlockStateUpdater_1_20_50.INSTANCE);
|
||||
|
||||
var blockMappers = ImmutableMap.<ObjectIntPair<String>, Remapper>builder()
|
||||
.put(ObjectIntPair.of("1_20_0", Bedrock_v589.CODEC.getProtocolVersion()), tag -> tag)
|
||||
.put(ObjectIntPair.of("1_20_10", Bedrock_v594.CODEC.getProtocolVersion()), mapper594)
|
||||
.put(ObjectIntPair.of("1_20_30", Bedrock_v618.CODEC.getProtocolVersion()), mapper618)
|
||||
.put(ObjectIntPair.of("1_20_40", Bedrock_v622.CODEC.getProtocolVersion()), mapper622)
|
||||
.put(ObjectIntPair.of("1_20_50", Bedrock_v630.CODEC.getProtocolVersion()), mapper630)
|
||||
.build();
|
||||
|
||||
// We can keep this strong as nothing should be garbage collected
|
||||
|
@ -42,6 +42,7 @@ import org.cloudburstmc.protocol.bedrock.codec.v589.Bedrock_v589;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v594.Bedrock_v594;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v618.Bedrock_v618;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
|
||||
import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
|
||||
import org.cloudburstmc.protocol.bedrock.data.definitions.BlockDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.definitions.ItemDefinition;
|
||||
@ -113,11 +114,25 @@ public class ItemRegistryPopulator {
|
||||
return mapping;
|
||||
};
|
||||
|
||||
Remapper remapper630 = (item, mapping) -> {
|
||||
mapping = remapper618.remap(item, mapping); // apply 1.20.30 remapper first
|
||||
|
||||
String id = item.javaIdentifier();
|
||||
// 1.20.50 replaced stone & planks to individual stone types
|
||||
// E.g.: granite, diorite, andesite, polished variants, dark_oak_planks etc
|
||||
if (mapping.getBedrockIdentifier().equals("minecraft:stone") || mapping.getBedrockIdentifier().equals("minecraft:planks")) {
|
||||
return mapping.withBedrockIdentifier(id);
|
||||
}
|
||||
|
||||
return mapping;
|
||||
};
|
||||
|
||||
List<PaletteVersion> paletteVersions = new ArrayList<>(3);
|
||||
paletteVersions.add(new PaletteVersion("1_20_0", Bedrock_v589.CODEC.getProtocolVersion()));
|
||||
paletteVersions.add(new PaletteVersion("1_20_10", Bedrock_v594.CODEC.getProtocolVersion(), Collections.emptyMap(), remapper594));
|
||||
paletteVersions.add(new PaletteVersion("1_20_30", Bedrock_v618.CODEC.getProtocolVersion(), Collections.emptyMap(), remapper618));
|
||||
paletteVersions.add(new PaletteVersion("1_20_40", Bedrock_v622.CODEC.getProtocolVersion(), Collections.emptyMap(), remapper618)); // NO item changes between 1.20.30 and 1.20.40
|
||||
paletteVersions.add(new PaletteVersion("1_20_50", Bedrock_v630.CODEC.getProtocolVersion(), Collections.emptyMap(), remapper630));
|
||||
|
||||
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
|
||||
|
||||
|
@ -1039,7 +1039,11 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect", authData.name(), remoteServer.address(), disconnectMessage));
|
||||
}
|
||||
if (cause != null) {
|
||||
GeyserImpl.getInstance().getLogger().error(cause.getMessage());
|
||||
if (cause.getMessage() != null) {
|
||||
GeyserImpl.getInstance().getLogger().error(cause.getMessage());
|
||||
} else {
|
||||
GeyserImpl.getInstance().getLogger().error("An exception occurred: ", cause);
|
||||
}
|
||||
// GeyserSession is disconnected via session.disconnect() called indirectly be the server
|
||||
// This only needs to be "initiated" here when there is an exception, hence the cause clause
|
||||
GeyserSession.this.disconnect(disconnectMessage);
|
||||
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.translator.protocol.bedrock.entity.player;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.CraftingBookStateType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundRecipeBookChangeSettingsPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryTabLeft;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryTabRight;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.SetPlayerInventoryOptionsPacket;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.Translator;
|
||||
|
||||
@Translator(packet = SetPlayerInventoryOptionsPacket.class)
|
||||
public class BedrockSetPlayerInventoryOptionsTranslator extends PacketTranslator<SetPlayerInventoryOptionsPacket> {
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, SetPlayerInventoryOptionsPacket packet) {
|
||||
// Sent by 1.20.50+ - we can pass it through to the java server
|
||||
|
||||
// This should ensure that we never send these packets when the player inventory is opened while in creative
|
||||
// Java edition can't craft in the 2x2 grid in creative, and subsequently doesn't have a recipe book
|
||||
if (session.getGameMode() == GameMode.CREATIVE && session.getPlayerInventory() == session.getOpenInventory()) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean filtered = packet.isFiltering();
|
||||
boolean bookOpen = isBookOpen(packet.getLeftTab(), packet.getRightTab());
|
||||
|
||||
// Hardcoded to crafting; bedrock does not have any furnace recipe books
|
||||
session.sendDownstreamPacket(new ServerboundRecipeBookChangeSettingsPacket(CraftingBookStateType.CRAFTING, bookOpen, filtered));
|
||||
}
|
||||
|
||||
private boolean isBookOpen(InventoryTabLeft leftTab, InventoryTabRight rightTab) {
|
||||
boolean leftOpen = (leftTab != InventoryTabLeft.NONE && leftTab != InventoryTabLeft.SURVIVAL);
|
||||
boolean rightOpen = rightTab == InventoryTabRight.CRAFTING;
|
||||
return leftOpen || rightOpen;
|
||||
}
|
||||
}
|
BIN
core/src/main/resources/bedrock/block_palette.1_20_50.nbt
Normale Datei
BIN
core/src/main/resources/bedrock/block_palette.1_20_50.nbt
Normale Datei
Binäre Datei nicht angezeigt.
5787
core/src/main/resources/bedrock/creative_items.1_20_50.json
Normale Datei
5787
core/src/main/resources/bedrock/creative_items.1_20_50.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
5846
core/src/main/resources/bedrock/runtime_item_states.1_20_50.json
Normale Datei
5846
core/src/main/resources/bedrock/runtime_item_states.1_20_50.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -9,10 +9,10 @@ netty = "4.1.80.Final"
|
||||
guava = "29.0-jre"
|
||||
gson = "2.3.1" # Provided by Spigot 1.8.8
|
||||
websocket = "1.5.1"
|
||||
protocol = "3.0.0.Beta1-20231016.115644-107"
|
||||
protocol-connection = "3.0.0.Beta1-20231016.115644-106"
|
||||
protocol = "3.0.0.Beta1-20231107.190703-113"
|
||||
protocol-connection = "3.0.0.Beta1-20231107.190703-112"
|
||||
raknet = "1.0.0.CR1-20230703.195238-9"
|
||||
blockstateupdater="1.20.40-20231016.111746-1"
|
||||
blockstateupdater="1.20.50-20231106.161340-1"
|
||||
mcauthlib = "d9d773e"
|
||||
mcprotocollib = "1.20.2-1-20231101.141901-7"
|
||||
adventure = "4.14.0"
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren