mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-21 14:26:22 +01:00
Merge remote-tracking branch 'origin/master' into feature/1.21.2
This commit is contained in:
commit
8827173c5b
8 changed files with 29 additions and 14 deletions
|
@ -15,7 +15,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!
|
||||||
|
|
||||||
## Supported Versions
|
## Supported Versions
|
||||||
Geyser is currently supporting Minecraft Bedrock 1.20.80 - 1.21.43 and Minecraft Java 1.21.2/1.21.3. For more information, please see [here](https://geysermc.org/wiki/geyser/supported-versions/).
|
Geyser is currently supporting Minecraft Bedrock 1.20.80 - 1.21.44 and Minecraft Java 1.21.2/1.21.3. For more information, please see [here](https://geysermc.org/wiki/geyser/supported-versions/).
|
||||||
|
|
||||||
## Setting Up
|
## Setting Up
|
||||||
Take a look [here](https://geysermc.org/wiki/geyser/setup/) for how to set up Geyser.
|
Take a look [here](https://geysermc.org/wiki/geyser/setup/) for how to set up Geyser.
|
||||||
|
|
|
@ -52,7 +52,7 @@ public final class GameProtocol {
|
||||||
* release of the game that Geyser supports.
|
* release of the game that Geyser supports.
|
||||||
*/
|
*/
|
||||||
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = CodecProcessor.processCodec(Bedrock_v748.CODEC.toBuilder()
|
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = CodecProcessor.processCodec(Bedrock_v748.CODEC.toBuilder()
|
||||||
.minecraftVersion("1.21.43")
|
.minecraftVersion("1.21.44")
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +83,7 @@ public final class GameProtocol {
|
||||||
.minecraftVersion("1.21.30/1.21.31")
|
.minecraftVersion("1.21.30/1.21.31")
|
||||||
.build()));
|
.build()));
|
||||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
||||||
.minecraftVersion("1.21.40/1.21.41/1.21.43")
|
.minecraftVersion("1.21.40 - 1.21.44")
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ public final class Scoreboard {
|
||||||
Team team = teams.get(teamName);
|
Team team = teams.get(teamName);
|
||||||
if (team != null) {
|
if (team != null) {
|
||||||
if (SHOW_SCOREBOARD_LOGS) {
|
if (SHOW_SCOREBOARD_LOGS) {
|
||||||
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName));
|
logger.info("Ignoring team %s for %s. It overrides without removing old team.".formatted(teamName, session.javaUsername()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ public final class WorldCache {
|
||||||
resetTitleTimes(false);
|
resetTitleTimes(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeScoreboard() {
|
public void resetScoreboard() {
|
||||||
scoreboard.removeScoreboard();
|
scoreboard.removeScoreboard();
|
||||||
scoreboard = new Scoreboard(session);
|
scoreboard = new Scoreboard(session);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,5 +81,11 @@ public class JavaFinishConfigurationTranslator extends PacketTranslator<Clientbo
|
||||||
} else {
|
} else {
|
||||||
session.getUpstream().queuePostStartGamePacket(craftingDataPacket);
|
session.getUpstream().queuePostStartGamePacket(craftingDataPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// while ClientboundLoginPacket holds the level, it doesn't hold the scoreboard.
|
||||||
|
// The ClientboundStartConfigurationPacket indirectly removes the old scoreboard,
|
||||||
|
// and this packet indirectly creates the new one.
|
||||||
|
// This makes this packet a good place to reset the scoreboard.
|
||||||
|
session.getWorldCache().resetScoreboard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,8 +71,6 @@ public class JavaLoginTranslator extends PacketTranslator<ClientboundLoginPacket
|
||||||
DimensionUtils.fastSwitchDimension(session, fakeDim);
|
DimensionUtils.fastSwitchDimension(session, fakeDim);
|
||||||
}
|
}
|
||||||
|
|
||||||
session.getWorldCache().removeScoreboard();
|
|
||||||
|
|
||||||
// Remove all bossbars
|
// Remove all bossbars
|
||||||
session.getEntityCache().removeAllBossBars();
|
session.getEntityCache().removeAllBossBars();
|
||||||
// Remove extra hearts, hunger, etc.
|
// Remove extra hearts, hunger, etc.
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
package org.geysermc.geyser.translator.protocol.java.scoreboard;
|
package org.geysermc.geyser.translator.protocol.java.scoreboard;
|
||||||
|
|
||||||
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
|
import org.geysermc.geyser.GeyserLogger;
|
||||||
import org.geysermc.geyser.scoreboard.Objective;
|
import org.geysermc.geyser.scoreboard.Objective;
|
||||||
import org.geysermc.geyser.scoreboard.Scoreboard;
|
import org.geysermc.geyser.scoreboard.Scoreboard;
|
||||||
import org.geysermc.geyser.scoreboard.ScoreboardUpdater;
|
import org.geysermc.geyser.scoreboard.ScoreboardUpdater;
|
||||||
|
@ -36,6 +38,10 @@ import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.scoreboard.
|
||||||
|
|
||||||
@Translator(packet = ClientboundResetScorePacket.class)
|
@Translator(packet = ClientboundResetScorePacket.class)
|
||||||
public class JavaResetScorePacket extends PacketTranslator<ClientboundResetScorePacket> {
|
public class JavaResetScorePacket extends PacketTranslator<ClientboundResetScorePacket> {
|
||||||
|
private static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true"));
|
||||||
|
|
||||||
|
private final GeyserLogger logger = GeyserImpl.getInstance().getLogger();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, ClientboundResetScorePacket packet) {
|
public void translate(GeyserSession session, ClientboundResetScorePacket packet) {
|
||||||
WorldCache worldCache = session.getWorldCache();
|
WorldCache worldCache = session.getWorldCache();
|
||||||
|
@ -47,6 +53,14 @@ public class JavaResetScorePacket extends PacketTranslator<ClientboundResetScore
|
||||||
scoreboard.resetPlayerScores(packet.getOwner());
|
scoreboard.resetPlayerScores(packet.getOwner());
|
||||||
} else {
|
} else {
|
||||||
Objective objective = scoreboard.getObjective(packet.getObjective());
|
Objective objective = scoreboard.getObjective(packet.getObjective());
|
||||||
|
if (objective == null) {
|
||||||
|
if (SHOW_SCOREBOARD_LOGS) {
|
||||||
|
logger.info(String.format(
|
||||||
|
"Tried to reset score %s for %s without the existence of its requested objective %s",
|
||||||
|
packet.getOwner(), session.javaUsername(), packet.getObjective()));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
objective.removeScore(packet.getOwner());
|
objective.removeScore(packet.getOwner());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.geysermc.geyser.scoreboard.Scoreboard;
|
||||||
import org.geysermc.geyser.scoreboard.ScoreboardUpdater;
|
import org.geysermc.geyser.scoreboard.ScoreboardUpdater;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.session.cache.WorldCache;
|
import org.geysermc.geyser.session.cache.WorldCache;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetScorePacket;
|
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetScorePacket;
|
||||||
|
@ -41,11 +40,7 @@ import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.scoreboard.
|
||||||
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 static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true"));
|
||||||
|
|
||||||
private final GeyserLogger logger;
|
private final GeyserLogger logger = GeyserImpl.getInstance().getLogger();
|
||||||
|
|
||||||
public JavaSetScoreTranslator() {
|
|
||||||
logger = GeyserImpl.getInstance().getLogger();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, ClientboundSetScorePacket packet) {
|
public void translate(GeyserSession session, ClientboundSetScorePacket packet) {
|
||||||
|
@ -56,7 +51,9 @@ public class JavaSetScoreTranslator extends PacketTranslator<ClientboundSetScore
|
||||||
Objective objective = scoreboard.getObjective(packet.getObjective());
|
Objective objective = scoreboard.getObjective(packet.getObjective());
|
||||||
if (objective == null) {
|
if (objective == null) {
|
||||||
if (SHOW_SCOREBOARD_LOGS) {
|
if (SHOW_SCOREBOARD_LOGS) {
|
||||||
logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.score.failed_objective", packet.getObjective()));
|
logger.info(String.format(
|
||||||
|
"Tried to update score %s for %s without the existence of its requested objective %s",
|
||||||
|
packet.getOwner(), session.javaUsername(), packet.getObjective()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue