3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	api/src/main/java/org/geysermc/geyser/api/GeyserApi.java
#	api/src/main/java/org/geysermc/geyser/api/command/Command.java
#	api/src/main/java/org/geysermc/geyser/api/command/CommandExecutor.java
#	api/src/main/java/org/geysermc/geyser/api/command/CommandSource.java
#	api/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java
#	api/src/main/java/org/geysermc/geyser/api/event/EventBus.java
#	api/src/main/java/org/geysermc/geyser/api/event/EventRegistrar.java
#	api/src/main/java/org/geysermc/geyser/api/event/EventSubscriber.java
#	api/src/main/java/org/geysermc/geyser/api/event/ExtensionEventBus.java
#	api/src/main/java/org/geysermc/geyser/api/event/ExtensionEventSubscriber.java
#	api/src/main/java/org/geysermc/geyser/api/event/connection/ConnectionEvent.java
#	api/src/main/java/org/geysermc/geyser/api/event/downstream/ServerDefineCommandsEvent.java
#	api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCommandsEvent.java
#	api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java
#	api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserLoadResourcePacksEvent.java
#	api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPostInitializeEvent.java
#	api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserPreInitializeEvent.java
#	api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserShutdownEvent.java
#	api/src/main/java/org/geysermc/geyser/api/extension/Extension.java
#	api/src/main/java/org/geysermc/geyser/api/extension/ExtensionDescription.java
#	api/src/main/java/org/geysermc/geyser/api/extension/ExtensionLoader.java
#	api/src/main/java/org/geysermc/geyser/api/extension/ExtensionLogger.java
#	api/src/main/java/org/geysermc/geyser/api/extension/ExtensionManager.java
#	api/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidDescriptionException.java
#	api/src/main/java/org/geysermc/geyser/api/extension/exception/InvalidExtensionException.java
#	api/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemData.java
#	api/src/main/java/org/geysermc/geyser/api/item/custom/CustomItemOptions.java
#	api/src/main/java/org/geysermc/geyser/api/item/custom/CustomRenderOffsets.java
#	api/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java
#	api/src/main/java/org/geysermc/geyser/api/network/AuthType.java
#	api/src/main/java/org/geysermc/geyser/api/network/BedrockListener.java
#	api/src/main/java/org/geysermc/geyser/api/network/RemoteServer.java
#	api/src/main/java/org/geysermc/geyser/api/util/TriState.java
#	core/build.gradle.kts
#	gradle/libs.versions.toml
#	settings.gradle.kts
Dieser Commit ist enthalten in:
Tim203 2023-02-09 17:34:27 +01:00
Commit ed36adec56
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 736F3CD49EF01DBF
15 geänderte Dateien mit 10205 neuen und 31 gelöschten Zeilen

Datei anzeigen

@ -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.20 - 1.19.51 and Minecraft Java 1.19.3. ### Currently supporting Minecraft Bedrock 1.19.20 - 1.19.60 and Minecraft Java 1.19.3.
## 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.

Datei anzeigen

@ -7,8 +7,8 @@ plugins {
} }
dependencies { dependencies {
api(projects.api)
api(projects.common) api(projects.common)
api(projects.api)
// Jackson JSON and YAML serialization // Jackson JSON and YAML serialization
api(libs.bundles.jackson) api(libs.bundles.jackson)

Datei anzeigen

@ -119,6 +119,8 @@ public class PlayerEntity extends LivingEntity {
setBelowNameText(objective); setBelowNameText(objective);
} }
// Update in case this entity has been despawned, then respawned
this.nametag = this.username;
// The name can't be updated later (the entity metadata for it is ignored), so we need to check for this now // The name can't be updated later (the entity metadata for it is ignored), so we need to check for this now
updateDisplayName(session.getWorldCache().getScoreboard().getTeamFor(username)); updateDisplayName(session.getWorldCache().getScoreboard().getTeamFor(username));

Datei anzeigen

@ -33,6 +33,7 @@ import com.nukkitx.protocol.bedrock.v545.Bedrock_v545;
import com.nukkitx.protocol.bedrock.v554.Bedrock_v554; import com.nukkitx.protocol.bedrock.v554.Bedrock_v554;
import com.nukkitx.protocol.bedrock.v557.Bedrock_v557; import com.nukkitx.protocol.bedrock.v557.Bedrock_v557;
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560; import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
import com.nukkitx.protocol.bedrock.v567.Bedrock_v567;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import java.util.ArrayList; import java.util.ArrayList;
@ -73,6 +74,7 @@ public final class GameProtocol {
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder() SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
.minecraftVersion("1.19.50/1.19.51") .minecraftVersion("1.19.50/1.19.51")
.build()); .build());
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v567.V567_CODEC);
} }
/** /**
@ -99,6 +101,10 @@ public final class GameProtocol {
return session.getUpstream().getProtocolVersion() >= Bedrock_v560.V560_CODEC.getProtocolVersion(); return session.getUpstream().getProtocolVersion() >= Bedrock_v560.V560_CODEC.getProtocolVersion();
} }
public static boolean supports1_19_60(GeyserSession session) {
return session.getUpstream().getProtocolVersion() >= Bedrock_v567.V567_CODEC.getProtocolVersion();
}
/** /**
* Gets the {@link PacketCodec} for Minecraft: Java Edition. * Gets the {@link PacketCodec} for Minecraft: Java Edition.
* *

Datei anzeigen

@ -29,9 +29,9 @@ 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.v544.Bedrock_v544;
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560; import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
import com.nukkitx.protocol.bedrock.v567.Bedrock_v567;
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;
@ -76,6 +76,7 @@ public final class BlockRegistryPopulator {
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_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)
.put(ObjectIntPair.of("1_19_60", Bedrock_v567.V567_CODEC.getProtocolVersion()), emptyMapper)
.build(); .build();
for (Map.Entry<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> palette : blockMappers.entrySet()) { for (Map.Entry<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> palette : blockMappers.entrySet()) {

Datei anzeigen

@ -37,14 +37,10 @@ import com.nukkitx.protocol.bedrock.data.SoundEvent;
import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData; import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData;
import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.StartGamePacket; import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
import it.unimi.dsi.fastutil.ints.*;
import com.nukkitx.protocol.bedrock.v527.Bedrock_v527;
import com.nukkitx.protocol.bedrock.v534.Bedrock_v534;
import com.nukkitx.protocol.bedrock.v544.Bedrock_v544; import com.nukkitx.protocol.bedrock.v544.Bedrock_v544;
import it.unimi.dsi.fastutil.ints.Int2IntMap; import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
import it.unimi.dsi.fastutil.ints.IntArrayList; import com.nukkitx.protocol.bedrock.v567.Bedrock_v567;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.*;
import it.unimi.dsi.fastutil.objects.*; import it.unimi.dsi.fastutil.objects.*;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.GeyserBootstrap;
@ -79,6 +75,7 @@ public class ItemRegistryPopulator {
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_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()));
paletteVersions.put("1_19_60", new PaletteVersion(Bedrock_v567.V567_CODEC.getProtocolVersion(), Collections.emptyMap()));
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap(); GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();

Datei anzeigen

@ -48,6 +48,8 @@ import java.util.concurrent.atomic.AtomicLong;
import static org.geysermc.geyser.scoreboard.UpdateType.*; import static org.geysermc.geyser.scoreboard.UpdateType.*;
public final class Scoreboard { public final class Scoreboard {
private static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true"));
private final GeyserSession session; private final GeyserSession session;
private final GeyserLogger logger; private final GeyserLogger logger;
@Getter @Getter
@ -134,7 +136,9 @@ public final class Scoreboard {
public Team registerNewTeam(String teamName, String[] players) { public Team registerNewTeam(String teamName, String[] players) {
Team team = teams.get(teamName); Team team = teams.get(teamName);
if (team != null) { if (team != null) {
if (SHOW_SCOREBOARD_LOGS) {
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName)); logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName));
}
return team; return team;
} }
@ -352,7 +356,8 @@ public final class Scoreboard {
// With the player's lack of a team in visibility checks // With the player's lack of a team in visibility checks
updateEntityNames(remove, remove.getEntities(), true); updateEntityNames(remove, remove.getEntities(), true);
for (String name : remove.getEntities()) { for (String name : remove.getEntities()) {
playerToTeam.remove(name, remove); // 1.19.3 Mojmap Scoreboard#removePlayerTeam(PlayerTeam)
playerToTeam.remove(name);
} }
session.removeCommandEnum("Geyser_Teams", remove.getId()); session.removeCommandEnum("Geyser_Teams", remove.getId());

Datei anzeigen

@ -65,7 +65,14 @@ public final class Team {
if (entities.add(name)) { if (entities.add(name)) {
added.add(name); added.add(name);
} }
scoreboard.getPlayerToTeam().put(name, this); scoreboard.getPlayerToTeam().compute(name, (player, oldTeam) -> {
if (oldTeam != null) {
// Remove old team from this map, and from the set of players of the old team.
// Java 1.19.3 Mojmap: Scoreboard#addPlayerToTeam calls #removePlayerFromTeam
oldTeam.entities.remove(player);
}
return this;
});
} }
if (added.isEmpty()) { if (added.isEmpty()) {

Datei anzeigen

@ -46,7 +46,7 @@ import lombok.ToString;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.event.downstream.ServerDefineCommandsEvent; import org.geysermc.geyser.api.event.java.ServerDefineCommandsEvent;
import org.geysermc.geyser.command.GeyserCommandManager; import org.geysermc.geyser.command.GeyserCommandManager;
import org.geysermc.geyser.inventory.item.Enchantment; import org.geysermc.geyser.inventory.item.Enchantment;
import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.BlockRegistries;
@ -150,12 +150,20 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
index -> new HashSet<>()).add(node.getName().toLowerCase()); index -> new HashSet<>()).add(node.getName().toLowerCase());
} }
ServerDefineCommandsEvent event = new ServerDefineCommandsEvent(session, commands.keySet()); var eventBus = session.getGeyser().eventBus();
session.getGeyser().eventBus().fire(event);
var event = new ServerDefineCommandsEvent(session, commands.keySet());
eventBus.fire(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return; return;
} }
var oldEvent = new org.geysermc.geyser.api.event.downstream.ServerDefineCommandsEvent(session, commands.keySet());
eventBus.fire(oldEvent);
if (oldEvent.isCancelled()) {
return;
}
// The command flags, not sure what these do apart from break things // The command flags, not sure what these do apart from break things
List<CommandData.Flag> flags = Collections.emptyList(); List<CommandData.Flag> flags = Collections.emptyList();
@ -259,7 +267,10 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
/** /**
* Stores the command description and parameter data for best optimizing the Bedrock commands packet. * Stores the command description and parameter data for best optimizing the Bedrock commands packet.
*/ */
private record BedrockCommandInfo(String name, String description, CommandParamData[][] paramData) implements ServerDefineCommandsEvent.CommandInfo { private record BedrockCommandInfo(String name, String description, CommandParamData[][] paramData) implements
org.geysermc.geyser.api.event.downstream.ServerDefineCommandsEvent.CommandInfo,
ServerDefineCommandsEvent.CommandInfo
{
} }
/** /**

Datei anzeigen

@ -46,6 +46,7 @@ import org.geysermc.geyser.inventory.recipe.GeyserRecipe;
import org.geysermc.geyser.inventory.recipe.GeyserShapedRecipe; import org.geysermc.geyser.inventory.recipe.GeyserShapedRecipe;
import org.geysermc.geyser.inventory.recipe.GeyserShapelessRecipe; import org.geysermc.geyser.inventory.recipe.GeyserShapelessRecipe;
import org.geysermc.geyser.inventory.recipe.GeyserStonecutterData; import org.geysermc.geyser.inventory.recipe.GeyserStonecutterData;
import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -144,6 +145,11 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
for (ItemStack addition : recipeData.getAddition().getOptions()) { for (ItemStack addition : recipeData.getAddition().getOptions()) {
ItemDescriptorWithCount bedrockAddition = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, addition)); ItemDescriptorWithCount bedrockAddition = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, addition));
if (GameProtocol.supports1_19_60(session)) {
// Note: vanilla inputs use aux value of Short.MAX_VALUE
craftingDataPacket.getCraftingData().add(CraftingData.fromSmithingTransform(recipe.getIdentifier(),
bedrockBase, bedrockAddition, output, "smithing_table", netId++));
} else {
UUID uuid = UUID.randomUUID(); UUID uuid = UUID.randomUUID();
craftingDataPacket.getCraftingData().add(CraftingData.fromShapeless(uuid.toString(), craftingDataPacket.getCraftingData().add(CraftingData.fromShapeless(uuid.toString(),
List.of(bedrockBase, bedrockAddition), List.of(bedrockBase, bedrockAddition),
@ -151,6 +157,7 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
} }
} }
} }
}
default -> { default -> {
List<CraftingData> craftingData = recipeTypes.get(recipe.getType()); List<CraftingData> craftingData = recipeTypes.get(recipe.getType());
if (craftingData != null) { if (craftingData != null) {

Datei anzeigen

@ -44,6 +44,8 @@ import org.geysermc.geyser.translator.protocol.Translator;
@Translator(packet = ClientboundSetScorePacket.class) @Translator(packet = ClientboundSetScorePacket.class)
public class JavaSetScoreTranslator extends PacketTranslator<ClientboundSetScorePacket> { public class JavaSetScoreTranslator extends PacketTranslator<ClientboundSetScorePacket> {
private static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true"));
private final GeyserLogger logger; private final GeyserLogger logger;
public JavaSetScoreTranslator() { public JavaSetScoreTranslator() {
@ -58,7 +60,9 @@ public class JavaSetScoreTranslator extends PacketTranslator<ClientboundSetScore
Objective objective = scoreboard.getObjective(packet.getObjective()); Objective objective = scoreboard.getObjective(packet.getObjective());
if (objective == null && packet.getAction() != ScoreboardAction.REMOVE) { if (objective == null && packet.getAction() != ScoreboardAction.REMOVE) {
if (SHOW_SCOREBOARD_LOGS) {
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.score.failed_objective", packet.getObjective())); logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.score.failed_objective", packet.getObjective()));
}
return; return;
} }

Binäre Datei nicht angezeigt.

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -8,7 +8,7 @@ netty = "4.1.80.Final"
guava = "29.0-jre" guava = "29.0-jre"
gson = "2.3.1" # Provided by Spigot 1.8.8 gson = "2.3.1" # Provided by Spigot 1.8.8
websocket = "1.5.1" websocket = "1.5.1"
protocol = "2.9.15-20230106.005737-3" protocol = "2.9.16-20230205.181702-1"
raknet = "1.6.28-20220125.214016-6" raknet = "1.6.28-20220125.214016-6"
mcauthlib = "d9d773e" mcauthlib = "d9d773e"
mcprotocollib = "1.19.3-20230107.194116-10" mcprotocollib = "1.19.3-20230107.194116-10"
@ -85,7 +85,7 @@ junit = { group = "junit", name = "junit", version.ref = "junit" }
mcauthlib = { group = "com.github.GeyserMC", name = "MCAuthLib", version.ref = "mcauthlib" } mcauthlib = { group = "com.github.GeyserMC", name = "MCAuthLib", version.ref = "mcauthlib" }
mcprotocollib = { group = "com.github.steveice10", name = "mcprotocollib", version.ref = "mcprotocollib" } mcprotocollib = { group = "com.github.steveice10", name = "mcprotocollib", version.ref = "mcprotocollib" }
packetlib = { group = "com.github.steveice10", name = "packetlib", version.ref = "packetlib" } packetlib = { group = "com.github.steveice10", name = "packetlib", version.ref = "packetlib" }
protocol = { group = "com.nukkitx.protocol", name = "bedrock-v560", version.ref = "protocol" } protocol = { group = "com.nukkitx.protocol", name = "bedrock-v567", version.ref = "protocol" }
raknet = { group = "com.nukkitx.network", name = "raknet", version.ref = "raknet" } raknet = { group = "com.nukkitx.network", name = "raknet", version.ref = "raknet" }
sponge-api = { group = "org.spongepowered", name = "spongeapi", version.ref = "sponge" } sponge-api = { group = "org.spongepowered", name = "spongeapi", version.ref = "sponge" }
terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" } terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" }