mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-22 14:34:59 +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
This commit is contained in:
commit
ed36adec56
15 changed files with 10205 additions and 31 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!
|
||||
|
||||
### 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
|
||||
Take a look [here](https://wiki.geysermc.org/geyser/setup/) for how to set up Geyser.
|
||||
|
|
|
@ -7,8 +7,8 @@ plugins {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
api(projects.api)
|
||||
api(projects.common)
|
||||
api(projects.api)
|
||||
|
||||
// Jackson JSON and YAML serialization
|
||||
api(libs.bundles.jackson)
|
||||
|
|
|
@ -119,6 +119,8 @@ public class PlayerEntity extends LivingEntity {
|
|||
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
|
||||
updateDisplayName(session.getWorldCache().getScoreboard().getTeamFor(username));
|
||||
|
||||
|
|
|
@ -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.v557.Bedrock_v557;
|
||||
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
|
||||
import com.nukkitx.protocol.bedrock.v567.Bedrock_v567;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -73,6 +74,7 @@ public final class GameProtocol {
|
|||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
||||
.minecraftVersion("1.19.50/1.19.51")
|
||||
.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();
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
|
|
|
@ -29,9 +29,9 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
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.v567.Bedrock_v567;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
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()
|
||||
.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_60", Bedrock_v567.V567_CODEC.getProtocolVersion()), emptyMapper)
|
||||
.build();
|
||||
|
||||
for (Map.Entry<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> palette : blockMappers.entrySet()) {
|
||||
|
|
|
@ -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.ItemData;
|
||||
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 it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
|
||||
import com.nukkitx.protocol.bedrock.v567.Bedrock_v567;
|
||||
import it.unimi.dsi.fastutil.ints.*;
|
||||
import it.unimi.dsi.fastutil.objects.*;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.geyser.GeyserBootstrap;
|
||||
|
@ -79,6 +75,7 @@ public class ItemRegistryPopulator {
|
|||
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_60", new PaletteVersion(Bedrock_v567.V567_CODEC.getProtocolVersion(), Collections.emptyMap()));
|
||||
|
||||
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
import static org.geysermc.geyser.scoreboard.UpdateType.*;
|
||||
|
||||
public final class Scoreboard {
|
||||
private static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true"));
|
||||
|
||||
private final GeyserSession session;
|
||||
private final GeyserLogger logger;
|
||||
@Getter
|
||||
|
@ -134,7 +136,9 @@ public final class Scoreboard {
|
|||
public Team registerNewTeam(String teamName, String[] players) {
|
||||
Team team = teams.get(teamName);
|
||||
if (team != null) {
|
||||
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName));
|
||||
if (SHOW_SCOREBOARD_LOGS) {
|
||||
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName));
|
||||
}
|
||||
return team;
|
||||
}
|
||||
|
||||
|
@ -352,7 +356,8 @@ public final class Scoreboard {
|
|||
// With the player's lack of a team in visibility checks
|
||||
updateEntityNames(remove, remove.getEntities(), true);
|
||||
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());
|
||||
|
|
|
@ -65,7 +65,14 @@ public final class Team {
|
|||
if (entities.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()) {
|
||||
|
|
|
@ -46,7 +46,7 @@ import lombok.ToString;
|
|||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
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.inventory.item.Enchantment;
|
||||
import org.geysermc.geyser.registry.BlockRegistries;
|
||||
|
@ -150,12 +150,20 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
|
|||
index -> new HashSet<>()).add(node.getName().toLowerCase());
|
||||
}
|
||||
|
||||
ServerDefineCommandsEvent event = new ServerDefineCommandsEvent(session, commands.keySet());
|
||||
session.getGeyser().eventBus().fire(event);
|
||||
var eventBus = session.getGeyser().eventBus();
|
||||
|
||||
var event = new ServerDefineCommandsEvent(session, commands.keySet());
|
||||
eventBus.fire(event);
|
||||
if (event.isCancelled()) {
|
||||
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
|
||||
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.
|
||||
*/
|
||||
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
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.geysermc.geyser.inventory.recipe.GeyserRecipe;
|
|||
import org.geysermc.geyser.inventory.recipe.GeyserShapedRecipe;
|
||||
import org.geysermc.geyser.inventory.recipe.GeyserShapelessRecipe;
|
||||
import org.geysermc.geyser.inventory.recipe.GeyserStonecutterData;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
@ -144,10 +145,16 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
|
|||
for (ItemStack addition : recipeData.getAddition().getOptions()) {
|
||||
ItemDescriptorWithCount bedrockAddition = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, addition));
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
craftingDataPacket.getCraftingData().add(CraftingData.fromShapeless(uuid.toString(),
|
||||
List.of(bedrockBase, bedrockAddition),
|
||||
Collections.singletonList(output), uuid, "smithing_table", 2, netId++));
|
||||
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();
|
||||
craftingDataPacket.getCraftingData().add(CraftingData.fromShapeless(uuid.toString(),
|
||||
List.of(bedrockBase, bedrockAddition),
|
||||
Collections.singletonList(output), uuid, "smithing_table", 2, netId++));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ import org.geysermc.geyser.translator.protocol.Translator;
|
|||
|
||||
@Translator(packet = ClientboundSetScorePacket.class)
|
||||
public class JavaSetScoreTranslator extends PacketTranslator<ClientboundSetScorePacket> {
|
||||
private static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true"));
|
||||
|
||||
private final GeyserLogger logger;
|
||||
|
||||
public JavaSetScoreTranslator() {
|
||||
|
@ -58,7 +60,9 @@ public class JavaSetScoreTranslator extends PacketTranslator<ClientboundSetScore
|
|||
|
||||
Objective objective = scoreboard.getObjective(packet.getObjective());
|
||||
if (objective == null && packet.getAction() != ScoreboardAction.REMOVE) {
|
||||
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.score.failed_objective", packet.getObjective()));
|
||||
if (SHOW_SCOREBOARD_LOGS) {
|
||||
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.score.failed_objective", packet.getObjective()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
BIN
core/src/main/resources/bedrock/block_palette.1_19_60.nbt
Normal file
BIN
core/src/main/resources/bedrock/block_palette.1_19_60.nbt
Normal file
Binary file not shown.
5452
core/src/main/resources/bedrock/creative_items.1_19_60.json
Normal file
5452
core/src/main/resources/bedrock/creative_items.1_19_60.json
Normal file
File diff suppressed because it is too large
Load diff
4682
core/src/main/resources/bedrock/runtime_item_states.1_19_60.json
Normal file
4682
core/src/main/resources/bedrock/runtime_item_states.1_19_60.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
[versions]
|
||||
base-api = "1.0.0-SNAPSHOT"
|
||||
cumulus = "1.1.1"
|
||||
cumulus = "1.1.1"
|
||||
events = "1.0-SNAPSHOT"
|
||||
jackson = "2.14.0"
|
||||
fastutil = "8.5.2"
|
||||
|
@ -8,7 +8,7 @@ netty = "4.1.80.Final"
|
|||
guava = "29.0-jre"
|
||||
gson = "2.3.1" # Provided by Spigot 1.8.8
|
||||
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"
|
||||
mcauthlib = "d9d773e"
|
||||
mcprotocollib = "1.19.3-20230107.194116-10"
|
||||
|
@ -17,7 +17,7 @@ adventure = "4.12.0-20220629.025215-9"
|
|||
adventure-platform = "4.1.2"
|
||||
junit = "4.13.1"
|
||||
checkerframework = "3.19.0"
|
||||
log4j = "2.17.1"
|
||||
log4j = "2.17.1"
|
||||
jline = "3.21.0"
|
||||
terminalconsoleappender = "1.2.0"
|
||||
paper = "1.19-R0.1-SNAPSHOT"
|
||||
|
@ -85,7 +85,7 @@ junit = { group = "junit", name = "junit", version.ref = "junit" }
|
|||
mcauthlib = { group = "com.github.GeyserMC", name = "MCAuthLib", version.ref = "mcauthlib" }
|
||||
mcprotocollib = { group = "com.github.steveice10", name = "mcprotocollib", version.ref = "mcprotocollib" }
|
||||
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" }
|
||||
sponge-api = { group = "org.spongepowered", name = "spongeapi", version.ref = "sponge" }
|
||||
terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" }
|
||||
|
@ -94,8 +94,8 @@ viaversion = { group = "com.viaversion", name = "viaversion", version.ref = "via
|
|||
websocket = { group = "org.java-websocket", name = "Java-WebSocket", version.ref = "websocket" }
|
||||
|
||||
[bundles]
|
||||
jackson = [ "jackson-annotations", "jackson-core", "jackson-dataformat-yaml" ]
|
||||
fastutil = [ "fastutil-int-int-maps", "fastutil-int-long-maps", "fastutil-int-byte-maps", "fastutil-int-boolean-maps", "fastutil-object-int-maps", "fastutil-object-object-maps" ]
|
||||
adventure = [ "adventure-text-serializer-gson", "adventure-text-serializer-legacy", "adventure-text-serializer-plain" ]
|
||||
log4j = [ "log4j-api", "log4j-core", "log4j-slf4j18-impl" ]
|
||||
jline = [ "jline-terminal", "jline-terminal-jna", "jline-reader" ]
|
||||
jackson = ["jackson-annotations", "jackson-core", "jackson-dataformat-yaml"]
|
||||
fastutil = ["fastutil-int-int-maps", "fastutil-int-long-maps", "fastutil-int-byte-maps", "fastutil-int-boolean-maps", "fastutil-object-int-maps", "fastutil-object-object-maps"]
|
||||
adventure = ["adventure-text-serializer-gson", "adventure-text-serializer-legacy", "adventure-text-serializer-plain"]
|
||||
log4j = ["log4j-api", "log4j-core", "log4j-slf4j18-impl"]
|
||||
jline = ["jline-terminal", "jline-terminal-jna", "jline-reader"]
|
||||
|
|
Loading…
Reference in a new issue