Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 22:40:18 +01:00
Merge remote-tracking branch 'upstream/master' into feature/blocky
Dieser Commit ist enthalten in:
Commit
5f2c8b0d8b
41
.github/workflows/pullrequest.yml
vendored
41
.github/workflows/pullrequest.yml
vendored
@ -4,21 +4,44 @@ on: [pull_request]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: 17
|
java-version: 17
|
||||||
cache: 'gradle'
|
distribution: temurin
|
||||||
- name: submodules-init
|
cache: gradle
|
||||||
uses: snickerbockers/submodules-init@v4
|
|
||||||
- name: Build with Gradle
|
- name: Check if the author has forked the API repo
|
||||||
run: ./gradlew build
|
uses: Kas-tle/ForkFinder@v1.0.1
|
||||||
|
id: find_forks
|
||||||
|
with:
|
||||||
|
owner: GeyserMC
|
||||||
|
repo: api
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Use author's API repo if it exists
|
||||||
|
if: steps.find_forks.outputs.target_branch_found == 'true'
|
||||||
|
env:
|
||||||
|
API_FORK_URL: ${{ steps.find_forks.outputs.user_fork_url }}
|
||||||
|
API_FORK_BRANCH: ${{ github.event.pull_request.head.ref }}
|
||||||
|
run: |
|
||||||
|
git clone "${API_FORK_URL}" --single-branch --branch "${API_FORK_BRANCH}" api
|
||||||
|
cd api
|
||||||
|
./gradlew publishToMavenLocal
|
||||||
|
|
||||||
|
- name: Checkout repository and submodules
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
path: geyser
|
||||||
|
|
||||||
|
- name: Build Geyser
|
||||||
|
uses: gradle/gradle-build-action@v2
|
||||||
|
with:
|
||||||
|
arguments: build
|
||||||
|
build-root-directory: geyser
|
||||||
|
|
||||||
- name: Archive artifacts (Geyser Fabric)
|
- name: Archive artifacts (Geyser Fabric)
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
@ -48,4 +48,6 @@ Make sure to comment your code where possible.
|
|||||||
|
|
||||||
The nature of our software requires a lot of arrays and maps to be stored - where possible, use Fastutil's specialized maps. For example, if you're storing block state translations, use an `Int2IntMap`.
|
The nature of our software requires a lot of arrays and maps to be stored - where possible, use Fastutil's specialized maps. For example, if you're storing block state translations, use an `Int2IntMap`.
|
||||||
|
|
||||||
We have a rundown of all the tools you need to develop over on our [wiki](https://github.com/GeyserMC/Geyser/wiki/Developer-Guide). If you have any questions, please feel free to reach out to our [Discord](https://discord.gg/geysermc)!
|
We have a rundown of all the tools you need to develop over on our [wiki](https://wiki.geysermc.org/other/developer-guide/). If you have any questions, please feel free to reach out to our [Discord](https://discord.gg/geysermc)!
|
||||||
|
|
||||||
|
If you're making a pull request that also depends on changes to [the base API](https://github.com/GeyserMC/api), simply fork the API repo and create a branch with the same name as your Geyser PR. The pull request [action](https://github.com/GeyserMC/Geyser/blob/master/.github/workflows/pullrequest.yml) will automatically use your API changes while building your changes to Geyser.
|
@ -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.60 and Minecraft Java 1.19.3.
|
### Currently supporting Minecraft Bedrock 1.19.20 - 1.19.62 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.
|
||||||
|
@ -33,11 +33,11 @@ import org.geysermc.geyser.api.event.connection.ConnectionEvent;
|
|||||||
/**
|
/**
|
||||||
* Called whenever a Bedrock player performs an emote on their end, before it is broadcasted to the rest of the server.
|
* Called whenever a Bedrock player performs an emote on their end, before it is broadcasted to the rest of the server.
|
||||||
*/
|
*/
|
||||||
public final class BedrockEmoteEvent extends ConnectionEvent implements Cancellable {
|
public final class ClientEmoteEvent extends ConnectionEvent implements Cancellable {
|
||||||
private final String emoteId;
|
private final String emoteId;
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public BedrockEmoteEvent(@NonNull GeyserConnection connection, @NonNull String emoteId) {
|
public ClientEmoteEvent(@NonNull GeyserConnection connection, @NonNull String emoteId) {
|
||||||
super(connection);
|
super(connection);
|
||||||
this.emoteId = emoteId;
|
this.emoteId = emoteId;
|
||||||
}
|
}
|
@ -25,10 +25,6 @@
|
|||||||
|
|
||||||
package org.geysermc.geyser.command.defaults;
|
package org.geysermc.geyser.command.defaults;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.object.Direction;
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
|
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket;
|
|
||||||
import com.nukkitx.math.vector.Vector3i;
|
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.command.GeyserCommand;
|
import org.geysermc.geyser.command.GeyserCommand;
|
||||||
import org.geysermc.geyser.command.GeyserCommandSource;
|
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||||
@ -46,9 +42,7 @@ public class OffhandCommand extends GeyserCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerboundPlayerActionPacket releaseItemPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, Vector3i.ZERO,
|
session.requestOffhandSwap();
|
||||||
Direction.DOWN, 0);
|
|
||||||
session.sendDownstreamPacket(releaseItemPacket);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,7 +37,7 @@ public enum ToolTier {
|
|||||||
DIAMOND(8),
|
DIAMOND(8),
|
||||||
NETHERITE(9);
|
NETHERITE(9);
|
||||||
|
|
||||||
public static final ToolTier[] VALUES = values();
|
private static final ToolTier[] VALUES = values();
|
||||||
|
|
||||||
private final int speed;
|
private final int speed;
|
||||||
|
|
||||||
|
@ -29,9 +29,7 @@ import com.nukkitx.nbt.NbtMap;
|
|||||||
import com.nukkitx.nbt.NbtMapBuilder;
|
import com.nukkitx.nbt.NbtMapBuilder;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.session.cache.ChunkCache;
|
|
||||||
import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator;
|
import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator;
|
||||||
|
|
||||||
public class GeyserWorldManager extends WorldManager {
|
public class GeyserWorldManager extends WorldManager {
|
||||||
@ -39,11 +37,7 @@ public class GeyserWorldManager extends WorldManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockAt(GeyserSession session, int x, int y, int z) {
|
public int getBlockAt(GeyserSession session, int x, int y, int z) {
|
||||||
ChunkCache chunkCache = session.getChunkCache();
|
return session.getChunkCache().getBlockAt(x, y, z);
|
||||||
if (chunkCache != null) { // Chunk cache can be null if the session is closed asynchronously
|
|
||||||
return chunkCache.getBlockAt(x, y, z);
|
|
||||||
}
|
|
||||||
return BlockStateValues.JAVA_AIR_ID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,7 +33,7 @@ public enum PistonBehavior {
|
|||||||
DESTROY,
|
DESTROY,
|
||||||
PUSH_ONLY;
|
PUSH_ONLY;
|
||||||
|
|
||||||
public static final PistonBehavior[] VALUES = values();
|
private static final PistonBehavior[] VALUES = values();
|
||||||
|
|
||||||
public static PistonBehavior getByName(String name) {
|
public static PistonBehavior getByName(String name) {
|
||||||
String upperCase = name.toUpperCase(Locale.ROOT);
|
String upperCase = name.toUpperCase(Locale.ROOT);
|
||||||
|
@ -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_v560.V560_CODEC;
|
public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v567.V567_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,15 @@ public final class GameProtocol {
|
|||||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v557.V557_CODEC.toBuilder()
|
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v557.V557_CODEC.toBuilder()
|
||||||
.minecraftVersion("1.19.40/1.19.41")
|
.minecraftVersion("1.19.40/1.19.41")
|
||||||
.build());
|
.build());
|
||||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v560.V560_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);
|
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
|
||||||
|
// So the version checker will work
|
||||||
|
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v567.V567_CODEC.toBuilder()
|
||||||
|
.protocolVersion(568)
|
||||||
|
.minecraftVersion("1.19.62")
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,6 +31,9 @@ import com.nukkitx.protocol.bedrock.data.ExperimentData;
|
|||||||
import com.nukkitx.protocol.bedrock.data.PacketCompressionAlgorithm;
|
import com.nukkitx.protocol.bedrock.data.PacketCompressionAlgorithm;
|
||||||
import com.nukkitx.protocol.bedrock.data.ResourcePackType;
|
import com.nukkitx.protocol.bedrock.data.ResourcePackType;
|
||||||
import com.nukkitx.protocol.bedrock.packet.*;
|
import com.nukkitx.protocol.bedrock.packet.*;
|
||||||
|
import com.nukkitx.protocol.bedrock.v567.Bedrock_v567;
|
||||||
|
import com.nukkitx.protocol.bedrock.v567.Bedrock_v567patch;
|
||||||
|
import org.geysermc.geyser.Constants;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.api.network.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||||
@ -43,11 +46,13 @@ import org.geysermc.geyser.session.PendingMicrosoftAuthentication;
|
|||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
import org.geysermc.geyser.util.LoginEncryptionUtils;
|
import org.geysermc.geyser.util.LoginEncryptionUtils;
|
||||||
import org.geysermc.geyser.util.MathUtils;
|
import org.geysermc.geyser.util.MathUtils;
|
||||||
|
import org.geysermc.geyser.util.VersionCheckUtils;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
public class UpstreamPacketHandler extends LoggingPacketHandler {
|
public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||||
|
|
||||||
@ -74,7 +79,14 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
|||||||
String supportedVersions = GameProtocol.getAllSupportedBedrockVersions();
|
String supportedVersions = GameProtocol.getAllSupportedBedrockVersions();
|
||||||
if (protocolVersion > GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
if (protocolVersion > GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||||
// Too early to determine session locale
|
// Too early to determine session locale
|
||||||
session.disconnect(GeyserLocale.getLocaleStringLog("geyser.network.outdated.server", supportedVersions));
|
String disconnectMessage = GeyserLocale.getLocaleStringLog("geyser.network.outdated.server", supportedVersions);
|
||||||
|
// If the latest release matches this version, then let the user know.
|
||||||
|
OptionalInt latestRelease = VersionCheckUtils.getLatestBedrockRelease();
|
||||||
|
if (latestRelease.isPresent() && latestRelease.getAsInt() == protocolVersion) {
|
||||||
|
// Random note: don't make the disconnect message too long or Bedrock will cut it off on smaller screens
|
||||||
|
disconnectMessage += "\n" + GeyserLocale.getLocaleStringLog("geyser.version.new.on_disconnect", Constants.GEYSER_DOWNLOAD_LOCATION);
|
||||||
|
}
|
||||||
|
session.disconnect(disconnectMessage);
|
||||||
return false;
|
return false;
|
||||||
} else if (protocolVersion < GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
} else if (protocolVersion < GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||||
session.disconnect(GeyserLocale.getLocaleStringLog("geyser.network.outdated.client", supportedVersions));
|
session.disconnect(GeyserLocale.getLocaleStringLog("geyser.network.outdated.client", supportedVersions));
|
||||||
@ -131,6 +143,11 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hack for... whatever this is
|
||||||
|
if (loginPacket.getProtocolVersion() == Bedrock_v567.V567_CODEC.getProtocolVersion() && !session.getClientData().getGameVersion().equals("1.19.60")) {
|
||||||
|
session.getUpstream().getSession().setPacketCodec(Bedrock_v567patch.BEDROCK_V567PATCH);
|
||||||
|
}
|
||||||
|
|
||||||
PlayStatusPacket playStatus = new PlayStatusPacket();
|
PlayStatusPacket playStatus = new PlayStatusPacket();
|
||||||
playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS);
|
playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS);
|
||||||
session.sendUpstreamPacket(playStatus);
|
session.sendUpstreamPacket(playStatus);
|
||||||
|
@ -28,12 +28,13 @@ package org.geysermc.geyser.registry.type;
|
|||||||
import com.nukkitx.protocol.bedrock.data.LevelEventType;
|
import com.nukkitx.protocol.bedrock.data.LevelEventType;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.ParametersAreNullableByDefault;
|
import javax.annotation.ParametersAreNullableByDefault;
|
||||||
|
|
||||||
@ParametersAreNullableByDefault
|
@ParametersAreNullableByDefault
|
||||||
public record ParticleMapping(LevelEventType levelEventType, String identifier) {
|
public record ParticleMapping(LevelEventType levelEventType, String identifier) {
|
||||||
|
|
||||||
public int getParticleId(GeyserSession session) {
|
public int getParticleId(@Nonnull GeyserSession session) {
|
||||||
if (this.levelEventType == null) {
|
if (this.levelEventType == null) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
|
|
||||||
private final AdvancementsCache advancementsCache;
|
private final AdvancementsCache advancementsCache;
|
||||||
private final BookEditCache bookEditCache;
|
private final BookEditCache bookEditCache;
|
||||||
private final ChunkCache chunkCache;
|
private @org.checkerframework.checker.nullness.qual.NonNull final ChunkCache chunkCache;
|
||||||
private final EntityCache entityCache;
|
private final EntityCache entityCache;
|
||||||
private final EntityEffectCache effectCache;
|
private final EntityEffectCache effectCache;
|
||||||
private final FormCache formCache;
|
private final FormCache formCache;
|
||||||
@ -1354,6 +1354,12 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void requestOffhandSwap() {
|
||||||
|
ServerboundPlayerActionPacket swapHandsPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, Vector3i.ZERO,
|
||||||
|
Direction.DOWN, 0);
|
||||||
|
sendDownstreamPacket(swapHandsPacket);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will be overwritten for GeyserConnect.
|
* Will be overwritten for GeyserConnect.
|
||||||
*/
|
*/
|
||||||
|
@ -73,8 +73,7 @@ public final class LodestoneCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Int2ObjectMap.Entry<LodestonePos> entry : this.lodestones.int2ObjectEntrySet()) {
|
for (LodestonePos pos : this.lodestones.values()) {
|
||||||
LodestonePos pos = entry.getValue();
|
|
||||||
if (pos.equals(x, y, z, dim)) {
|
if (pos.equals(x, y, z, dim)) {
|
||||||
// Use this existing position instead
|
// Use this existing position instead
|
||||||
this.activeLodestones.put(itemStack, pos);
|
this.activeLodestones.put(itemStack, pos);
|
||||||
|
@ -43,6 +43,7 @@ import org.geysermc.geyser.inventory.updater.UIInventoryUpdater;
|
|||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class EnchantingInventoryTranslator extends AbstractBlockInventoryTranslator {
|
public class EnchantingInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||||
public EnchantingInventoryTranslator() {
|
public EnchantingInventoryTranslator() {
|
||||||
@ -71,7 +72,7 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla
|
|||||||
// The Bedrock index might need changed, so let's look it up and see.
|
// The Bedrock index might need changed, so let's look it up and see.
|
||||||
int bedrockIndex = value;
|
int bedrockIndex = value;
|
||||||
if (bedrockIndex != -1) {
|
if (bedrockIndex != -1) {
|
||||||
Enchantment enchantment = Enchantment.getByJavaIdentifier("minecraft:" + Enchantment.JavaEnchantment.of(bedrockIndex).name().toLowerCase());
|
Enchantment enchantment = Enchantment.getByJavaIdentifier("minecraft:" + Enchantment.JavaEnchantment.of(bedrockIndex).name().toLowerCase(Locale.ROOT));
|
||||||
if (enchantment != null) {
|
if (enchantment != null) {
|
||||||
// Convert the Java enchantment index to Bedrock's
|
// Convert the Java enchantment index to Bedrock's
|
||||||
bedrockIndex = enchantment.ordinal();
|
bedrockIndex = enchantment.ordinal();
|
||||||
|
@ -25,11 +25,8 @@
|
|||||||
|
|
||||||
package org.geysermc.geyser.translator.protocol.bedrock.entity.player;
|
package org.geysermc.geyser.translator.protocol.bedrock.entity.player;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.object.Direction;
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
|
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket;
|
|
||||||
import com.nukkitx.math.vector.Vector3i;
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.EmotePacket;
|
import com.nukkitx.protocol.bedrock.packet.EmotePacket;
|
||||||
|
import org.geysermc.geyser.api.event.bedrock.ClientEmoteEvent;
|
||||||
import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption;
|
import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption;
|
||||||
import org.geysermc.geyser.entity.type.Entity;
|
import org.geysermc.geyser.entity.type.Entity;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
@ -43,15 +40,20 @@ public class BedrockEmoteTranslator extends PacketTranslator<EmotePacket> {
|
|||||||
public void translate(GeyserSession session, EmotePacket packet) {
|
public void translate(GeyserSession session, EmotePacket packet) {
|
||||||
if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) {
|
if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) {
|
||||||
// Activate the workaround - we should trigger the offhand now
|
// Activate the workaround - we should trigger the offhand now
|
||||||
ServerboundPlayerActionPacket swapHandsPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, Vector3i.ZERO,
|
session.requestOffhandSwap();
|
||||||
Direction.DOWN, 0);
|
|
||||||
session.sendDownstreamPacket(swapHandsPacket);
|
|
||||||
|
|
||||||
if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) {
|
if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For the future: could have a method that exposes which players will see the emote
|
||||||
|
ClientEmoteEvent event = new ClientEmoteEvent(session, packet.getEmoteId());
|
||||||
|
session.getGeyser().eventBus().fire(event);
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int javaId = session.getPlayerEntity().getEntityId();
|
int javaId = session.getPlayerEntity().getEntityId();
|
||||||
for (GeyserSession otherSession : session.getGeyser().getSessionManager().getSessions().values()) {
|
for (GeyserSession otherSession : session.getGeyser().getSessionManager().getSessions().values()) {
|
||||||
if (otherSession != session) {
|
if (otherSession != session) {
|
||||||
|
@ -38,10 +38,13 @@ import org.geysermc.geyser.command.GeyserCommandSource;
|
|||||||
import org.geysermc.geyser.network.GameProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.OptionalInt;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public final class VersionCheckUtils {
|
public final class VersionCheckUtils {
|
||||||
|
private static @Nonnull OptionalInt LATEST_BEDROCK_RELEASE = OptionalInt.empty();
|
||||||
|
|
||||||
public static void checkForOutdatedFloodgate(GeyserLogger logger) {
|
public static void checkForOutdatedFloodgate(GeyserLogger logger) {
|
||||||
try {
|
try {
|
||||||
@ -61,10 +64,12 @@ public final class VersionCheckUtils {
|
|||||||
JsonNode bedrock = json.get("bedrock").get("protocol");
|
JsonNode bedrock = json.get("bedrock").get("protocol");
|
||||||
int protocolVersion = bedrock.get("id").asInt();
|
int protocolVersion = bedrock.get("id").asInt();
|
||||||
if (GameProtocol.getBedrockCodec(protocolVersion) != null) {
|
if (GameProtocol.getBedrockCodec(protocolVersion) != null) {
|
||||||
|
LATEST_BEDROCK_RELEASE = OptionalInt.empty();
|
||||||
// We support the latest version! No need to print a message.
|
// We support the latest version! No need to print a message.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LATEST_BEDROCK_RELEASE = OptionalInt.of(protocolVersion);
|
||||||
final String newBedrockVersion = bedrock.get("name").asText();
|
final String newBedrockVersion = bedrock.get("name").asText();
|
||||||
|
|
||||||
// Delayed for two reasons: save unnecessary processing, and wait to load locale if this is on join.
|
// Delayed for two reasons: save unnecessary processing, and wait to load locale if this is on join.
|
||||||
@ -89,6 +94,10 @@ public final class VersionCheckUtils {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static @Nonnull OptionalInt getLatestBedrockRelease() {
|
||||||
|
return LATEST_BEDROCK_RELEASE;
|
||||||
|
}
|
||||||
|
|
||||||
private VersionCheckUtils() {
|
private VersionCheckUtils() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit f6685c4ccc6e77b07402d45cb41213559004b7d6
|
Subproject commit 24be9ef7f850f7d180650a65792c266c709cadf5
|
@ -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.16-20230205.181702-1"
|
protocol = "2.9.17-20230217.002312-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"
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren